Skip to content

Commit 622d1d5

Browse files
authored
Merge pull request #2409 from iotaledger/develop
2 parents b9806c5 + de8af2a commit 622d1d5

File tree

105 files changed

+4877
-2974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+4877
-2974
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# v0.9.5 - 2022-08-31
2+
3+
> This release introduces a warpsync plugin for fast epochs retrieval, a simplified faucet, local snapshot improvements, and network and general bug fixes.
4+
5+
- WarpSync: simplify & fix send on closed channel (#2407)
6+
- Fix network and warpsync bugs & reset genesis time (#2406)
7+
- Mana vector fixes (#2396)
8+
- Implement simplified faucet (#2391)
9+
- Update to latest hive.go (#2400)
10+
- Warpsync: epoch syncing (#2367)
11+
- Activity committments and activity log based on epochs (#2345)
12+
- Implement solid entry points (#2373)
13+
114
# v0.9.4 - 2022-08-08
215

316
> This release mostly include maintenance changes to the deployment scripts and minor bug fixes.

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ proto: $(PROTO_GO_FILES)
2020
# If $GOPATH/bin/protoc-gen-go does not exist, we'll run this command to install it.
2121
$(PROTOC_GEN_GO):
2222
go install google.golang.org/protobuf/cmd/protoc-gen-go
23-
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
2423

2524
# Implicit compile rule for GRPC/proto files
2625
%.pb.go: %.proto | $(PROTOC_GEN_GO)
27-
protoc $< --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:.
26+
protoc $< --go_out=paths=source_relative:.
2827

2928
.PHONY: clean_proto
3029
clean_proto:

client/wallet/packages/address/address.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func (a Address) Base58() string {
3131

3232
func (a Address) String() string {
3333
return stringify.Struct("Address",
34-
stringify.StructField("Address", a.Address()),
35-
stringify.StructField("Index", a.Index),
34+
stringify.NewStructField("Address", a.Address()),
35+
stringify.NewStructField("Index", a.Index),
3636
)
3737
}
3838

client/wallet/packages/sendoptions/options.go

+22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package sendoptions
22

33
import (
4+
"context"
45
"time"
56

67
"github.com/cockroachdb/errors"
@@ -65,6 +66,25 @@ func Remainder(addr address.Address) SendFundsOption {
6566
}
6667
}
6768

69+
// Sources is an option for the SendFunds call that allows to specify the addresses from which the outputs for the
70+
// transfer should be sourced.
71+
func Sources(addr ...address.Address) SendFundsOption {
72+
return func(options *SendFundsOptions) error {
73+
options.SourceAddresses = addr
74+
75+
return nil
76+
}
77+
}
78+
79+
// Context is an option for SendFunds call that allows to specify a context that is used in case of waiting for
80+
// transaction acceptance.
81+
func Context(ctx context.Context) SendFundsOption {
82+
return func(options *SendFundsOptions) error {
83+
options.Context = ctx
84+
return nil
85+
}
86+
}
87+
6888
// AccessManaPledgeID is an option for SendFunds call that defines the nodeID to pledge access mana to.
6989
func AccessManaPledgeID(nodeID string) SendFundsOption {
7090
return func(options *SendFundsOptions) error {
@@ -143,6 +163,8 @@ type SendFundsOptions struct {
143163
ConsensusManaPledgeID string
144164
WaitForConfirmation bool
145165
UsePendingOutputs bool
166+
SourceAddresses []address.Address
167+
Context context.Context
146168
}
147169

148170
// RequiredFunds derives how much funds are needed based on the Destinations to fund the transfer.

client/wallet/wallet.go

+29-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package wallet
22

33
import (
4+
"context"
45
"reflect"
56
"time"
67
"unsafe"
@@ -115,7 +116,7 @@ func (wallet *Wallet) SendFunds(options ...sendoptions.SendFundsOption) (tx *dev
115116
// how much funds will we need to fund this transfer?
116117
requiredFunds := sendOptions.RequiredFunds()
117118
// collect that many outputs for funding
118-
consumedOutputs, err := wallet.collectOutputsForFunding(requiredFunds, sendOptions.UsePendingOutputs)
119+
consumedOutputs, err := wallet.collectOutputsForFunding(requiredFunds, sendOptions.UsePendingOutputs, sendOptions.SourceAddresses...)
119120
if err != nil {
120121
if errors.Is(err, ErrTooManyOutputs) {
121122
err = errors.Errorf("consolidate funds and try again: %w", err)
@@ -169,7 +170,7 @@ func (wallet *Wallet) SendFunds(options ...sendoptions.SendFundsOption) (tx *dev
169170
return nil, err
170171
}
171172
if sendOptions.WaitForConfirmation {
172-
err = wallet.WaitForTxAcceptance(tx.ID())
173+
err = wallet.WaitForTxAcceptance(tx.ID(), sendOptions.Context)
173174
}
174175

175176
return tx, err
@@ -1815,20 +1816,30 @@ func (wallet *Wallet) ExportState() []byte {
18151816
// region WaitForTxAcceptance //////////////////////////////////////////////////////////////////////////////////////////
18161817

18171818
// WaitForTxAcceptance waits for the given tx to be accepted.
1818-
func (wallet *Wallet) WaitForTxAcceptance(txID utxo.TransactionID) (err error) {
1819+
func (wallet *Wallet) WaitForTxAcceptance(txID utxo.TransactionID, optionalCtx ...context.Context) (err error) {
1820+
ctx := context.Background()
1821+
if len(optionalCtx) == 1 && optionalCtx[0] != nil {
1822+
ctx = optionalCtx[0]
1823+
}
1824+
1825+
ticker := time.NewTicker(wallet.ConfirmationPollInterval)
18191826
timeoutCounter := time.Duration(0)
18201827
for {
1821-
time.Sleep(wallet.ConfirmationPollInterval)
1822-
timeoutCounter += wallet.ConfirmationPollInterval
1823-
confirmationState, fetchErr := wallet.connector.GetTransactionConfirmationState(txID)
1824-
if fetchErr != nil {
1825-
return fetchErr
1826-
}
1827-
if confirmationState.IsAccepted() {
1828-
return
1829-
}
1830-
if timeoutCounter > wallet.ConfirmationTimeout {
1831-
return errors.Errorf("transaction %s did not confirm within %d seconds", txID.Base58(), wallet.ConfirmationTimeout/time.Second)
1828+
select {
1829+
case <-ctx.Done():
1830+
return errors.Errorf("context cancelled")
1831+
case <-ticker.C:
1832+
timeoutCounter += wallet.ConfirmationPollInterval
1833+
confirmationState, fetchErr := wallet.connector.GetTransactionConfirmationState(txID)
1834+
if fetchErr != nil {
1835+
return fetchErr
1836+
}
1837+
if confirmationState.IsAccepted() {
1838+
return
1839+
}
1840+
if timeoutCounter > wallet.ConfirmationTimeout {
1841+
return errors.Errorf("transaction %s did not confirm within %d seconds", txID.Base58(), wallet.ConfirmationTimeout/time.Second)
1842+
}
18321843
}
18331844
}
18341845
}
@@ -1968,13 +1979,15 @@ func (wallet *Wallet) findStateControlledAliasOutputByAliasID(id *devnetvm.Alias
19681979

19691980
// collectOutputsForFunding tries to collect unspent outputs to fund fundingBalance.
19701981
// It may collect pending outputs according to flag.
1971-
func (wallet *Wallet) collectOutputsForFunding(fundingBalance map[devnetvm.Color]uint64, includePending bool) (OutputsByAddressAndOutputID, error) {
1982+
func (wallet *Wallet) collectOutputsForFunding(fundingBalance map[devnetvm.Color]uint64, includePending bool, addresses ...address.Address) (OutputsByAddressAndOutputID, error) {
19721983
if fundingBalance == nil {
19731984
return nil, errors.Errorf("can't collect fund: empty fundingBalance provided")
19741985
}
19751986

19761987
_ = wallet.outputManager.Refresh()
1977-
addresses := wallet.addressManager.Addresses()
1988+
if len(addresses) == 0 {
1989+
addresses = wallet.addressManager.Addresses()
1990+
}
19781991
unspentOutputs := wallet.outputManager.UnspentValueOutputs(includePending, addresses...)
19791992

19801993
collected := make(map[devnetvm.Color]uint64)

deploy/ansible/roles/goshimmer-node/templates/docker-compose-entrynode.yml.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ services:
2626
{% endif %}
2727
--autoPeering.entryNodes=
2828
--analysis.client.serverAddress=
29-
--node.disablePlugins=activity,analysisClient,chat,consensus,dashboard,faucet,gossip,firewall,issuer,mana,manualpeering,blockLayer,metrics,networkdelay,portcheck,pow,syncBeaconFollower,webAPIBroadcastDataEndpoint,WebAPIDataEndpoint,WebAPIHealthzEndpoint,WebAPIFaucetRequestEndpoint,webAPIFindTransactionHashesEndpoint,webAPIGetNeighborsEndpoint,webAPIGetTransactionObjectsByHashEndpoint,webAPIGetTransactionTrytesByHashEndpoint,WebAPIInfoEndpoint,WebAPILedgerstateEndpoint,WebAPIBlockEndpoint,WebAPIToolsBlockEndpoint,WebAPIWeightProviderEndpoint,remotelog,remotelogmetrics,DAGsVisualizer,WebAPIRateSetterEndpoint,WebAPISchedulerEndpoint,ManaInitializer,Notarization,EpochStorage,WebAPIEpochEndpoint,BootstrapManager
29+
--node.disablePlugins=activity,analysisClient,chat,consensus,dashboard,faucet,gossip,firewall,issuer,mana,manualpeering,blockLayer,metrics,networkdelay,portcheck,pow,syncBeaconFollower,webAPIBroadcastDataEndpoint,WebAPIDataEndpoint,WebAPIHealthzEndpoint,WebAPIFaucetRequestEndpoint,webAPIFindTransactionHashesEndpoint,webAPIGetNeighborsEndpoint,webAPIGetTransactionObjectsByHashEndpoint,webAPIGetTransactionTrytesByHashEndpoint,WebAPIInfoEndpoint,WebAPILedgerstateEndpoint,WebAPIBlockEndpoint,WebAPIToolsBlockEndpoint,WebAPIWeightProviderEndpoint,remotelog,remotelogmetrics,DAGsVisualizer,WebAPIRateSetterEndpoint,WebAPISchedulerEndpoint,ManaInitializer,Notarization,EpochStorage,WebAPIEpochEndpoint,BootstrapManager,Warpsync,Snapshot
3030
--logger.level={{ logLevel }}
3131
--logger.outputPaths=stdout

go.mod

+11-9
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ require (
1212
github.com/gin-gonic/gin v1.7.7
1313
github.com/go-resty/resty/v2 v2.6.0
1414
github.com/gorilla/websocket v1.5.0
15-
github.com/iotaledger/hive.go/core v0.0.0-20220804174551-efbca20a83e4
16-
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-20220804174551-efbca20a83e4
15+
github.com/iotaledger/hive.go/core v1.0.0-beta.3.0.20220825155653-0a69188181ca
16+
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-beta.2.0.20220825155653-0a69188181ca
1717
github.com/labstack/echo v3.3.10+incompatible
1818
github.com/labstack/gommon v0.3.0
1919
github.com/libp2p/go-libp2p v0.15.0
2020
github.com/libp2p/go-libp2p-core v0.9.0
21-
github.com/libp2p/go-yamux/v2 v2.2.0
2221
github.com/magiconair/properties v1.8.6
2322
github.com/markbates/pkger v0.17.1
2423
github.com/mr-tron/base58 v1.2.0
2524
github.com/multiformats/go-multiaddr v0.4.1
2625
github.com/multiformats/go-varint v0.0.6
2726
github.com/panjf2000/ants/v2 v2.5.0
2827
github.com/paulbellamy/ratecounter v0.2.0
28+
github.com/pkg/errors v0.9.1
2929
github.com/prometheus/client_golang v1.11.1
3030
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
3131
github.com/spf13/pflag v1.0.5
@@ -52,6 +52,7 @@ require (
5252
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
5353
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
5454
github.com/emirpasic/gods v1.18.1 // indirect
55+
github.com/ethereum/go-ethereum v1.10.21 // indirect
5556
github.com/fatih/structs v1.1.0 // indirect
5657
github.com/flynn/noise v1.0.0 // indirect
5758
github.com/fsnotify/fsnotify v1.5.4 // indirect
@@ -64,13 +65,14 @@ require (
6465
github.com/go-stack/stack v1.8.0 // indirect
6566
github.com/gobuffalo/here v0.6.0 // indirect
6667
github.com/gogo/protobuf v1.3.2 // indirect
67-
github.com/gohornet/grocksdb v1.7.1-0.20220426081058-60f50d7c59e8 // indirect
6868
github.com/golang/protobuf v1.5.2 // indirect
6969
github.com/golang/snappy v0.0.4 // indirect
7070
github.com/google/gopacket v1.1.19 // indirect
7171
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
7272
github.com/hashicorp/hcl v1.0.0 // indirect
73-
github.com/huin/goupnp v1.0.2 // indirect
73+
github.com/huin/goupnp v1.0.3 // indirect
74+
github.com/iancoleman/orderedmap v0.2.0 // indirect
75+
github.com/iotaledger/grocksdb v1.7.5-0.20220808142449-1dc0b8ac4d7d // indirect
7476
github.com/ipfs/go-cid v0.0.7 // indirect
7577
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
7678
github.com/ipfs/go-log v1.0.5 // indirect
@@ -123,6 +125,7 @@ require (
123125
github.com/libp2p/go-stream-muxer-multistream v0.3.0 // indirect
124126
github.com/libp2p/go-tcp-transport v0.2.8 // indirect
125127
github.com/libp2p/go-ws-transport v0.5.0 // indirect
128+
github.com/libp2p/go-yamux/v2 v2.2.0 // indirect
126129
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
127130
github.com/mattn/go-colorable v0.1.12 // indirect
128131
github.com/mattn/go-isatty v0.0.14 // indirect
@@ -151,7 +154,6 @@ require (
151154
github.com/pelletier/go-toml v1.9.5 // indirect
152155
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
153156
github.com/petermattis/goid v0.0.0-20220712135657-ac599d9cba15 // indirect
154-
github.com/pkg/errors v0.9.1 // indirect
155157
github.com/pmezard/go-difflib v1.0.0 // indirect
156158
github.com/prometheus/client_model v0.2.0 // indirect
157159
github.com/prometheus/common v0.30.0 // indirect
@@ -180,10 +182,10 @@ require (
180182
go.dedis.ch/fixbuf v1.0.3 // indirect
181183
go.mongodb.org/mongo-driver v1.5.1 // indirect
182184
go.uber.org/multierr v1.8.0 // indirect
183-
go.uber.org/zap v1.21.0 // indirect
184-
golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b // indirect
185+
go.uber.org/zap v1.22.0 // indirect
186+
golang.org/x/net v0.0.0-20220809012201-f428fae20770 // indirect
185187
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
186-
golang.org/x/sys v0.0.0-20220803195053-6e608f9ce704 // indirect
188+
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
187189
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
188190
golang.org/x/text v0.3.7 // indirect
189191
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect

0 commit comments

Comments
 (0)