From 2f38fef31af973e8d64036ee66f69d9aefa557bb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Jun 2021 18:02:25 +0300 Subject: [PATCH 001/219] [#589] ir/container: Verify session token lifetime Session tokens have limited lifetime in NeoFS. Container processor should verify lifetime of the incoming tokens. Define `NetworkState` interface with `Epoch` method to get number of the current epoch. Use Netmap contract client's wrapper as `NetworkState` of Container `Processor`. Check values of token lifetime, and deny if: * NBF value is gt the current epoch; * IAT is gt the current epoch; * EXP is le the current epoch. Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 6 ++-- pkg/innerring/innerring.go | 1 + pkg/innerring/processors/container/common.go | 30 +++++++++++++++++++ .../processors/container/processor.go | 15 ++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7399f6f9e8..6a0d558738 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.1 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.1 - github.com/nspcc-dev/neofs-api-go v1.27.0 + github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index 2d7b4a8d39..3c19f2f7ea 100644 --- a/go.sum +++ b/go.sum @@ -211,6 +211,7 @@ github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8 github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -286,8 +287,8 @@ github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLH github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= -github.com/nspcc-dev/neofs-api-go v1.27.0 h1:SiqD1wb50l/ahCNV8/D9R3ua/sFS8oRCJ5jV+ux6AzE= -github.com/nspcc-dev/neofs-api-go v1.27.0/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797 h1:pUFVPj21BaKdeSyuqBXJUFTPgx7H0cO167+2SJ472jU= +github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= @@ -318,6 +319,7 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 89e6ff537a..fe2cf89a1b 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -561,6 +561,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error FeeProvider: server.feeConfig, ContainerClient: cnrClient, NeoFSIDClient: neofsIDClient, + NetworkState: nmClient, }) if err != nil { return nil, err diff --git a/pkg/innerring/processors/container/common.go b/pkg/innerring/processors/container/common.go index 98e953aff9..562e780e24 100644 --- a/pkg/innerring/processors/container/common.go +++ b/pkg/innerring/processors/container/common.go @@ -106,6 +106,12 @@ func (cp *Processor) checkSessionToken(token *session.Token) error { return errors.New("invalid signature") } + // check lifetime + err := cp.checkTokenLifetime(token) + if err != nil { + return err + } + // check token owner's key ownership key, err := keys.NewPublicKeyFromBytes(token.Signature().Key(), elliptic.P256()) @@ -149,3 +155,27 @@ func checkTokenContextWithCID(tok *session.Token, id *cid.ID, verbAssert verbAss return nil } + +func (cp *Processor) checkTokenLifetime(token *session.Token) error { + curEpoch, err := cp.netState.Epoch() + if err != nil { + return fmt.Errorf("could not read current epoch: %w", err) + } + + nbf := token.Nbf() + if curEpoch < nbf { + return fmt.Errorf("token is not valid yet: nbf %d, cur %d", nbf, curEpoch) + } + + iat := token.Iat() + if curEpoch < iat { + return fmt.Errorf("token is issued in future: iat %d, cur %d", iat, curEpoch) + } + + exp := token.Exp() + if curEpoch >= exp { + return fmt.Errorf("token is expired: exp %d, cur %d", exp, curEpoch) + } + + return nil +} diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index d68fed2423..dcee3ae2e6 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -31,6 +31,7 @@ type ( feeProvider *config.FeeConfig cnrClient *wrapper.Wrapper // notary must be enabled idClient *neofsid.ClientWrapper + netState NetworkState } // Params of the processor constructor. @@ -43,9 +44,20 @@ type ( FeeProvider *config.FeeConfig ContainerClient *wrapper.Wrapper NeoFSIDClient *neofsid.ClientWrapper + NetworkState NetworkState } ) +// NetworkState is an interface of a component +// that provides access to network state. +type NetworkState interface { + // Epoch must return number of the current epoch. + // + // Must return any error encountered + // which did not allow reading the value. + Epoch() (uint64, error) +} + const ( putNotification = "containerPut" deleteNotification = "containerDelete" @@ -68,6 +80,8 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/container: Container client is not set") case p.NeoFSIDClient == nil: return nil, errors.New("ir/container: NeoFS ID client is not set") + case p.NetworkState == nil: + return nil, errors.New("ir/container: network state is not set") } p.Log.Debug("container worker pool", zap.Int("size", p.PoolSize)) @@ -86,6 +100,7 @@ func New(p *Params) (*Processor, error) { feeProvider: p.FeeProvider, cnrClient: p.ContainerClient, idClient: p.NeoFSIDClient, + netState: p.NetworkState, }, nil } From 096acb2a4422b5a663b90fea12855e03ec274699 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 7 Jun 2021 12:29:38 +0300 Subject: [PATCH 002/219] [#580] v2/object/put: Check payload size of the relayed objects NeoFS network dictates the limitation of the maximum size of the "finished" objects. The payload size of an object is recorded in its header. When writing finished objects, the nodes must check: * satisfying the constraint; * matching the value in the header to the number of payload bytes. Provide value returned by `MaxSizeSource` component to `validatingTarget`. Check max size value during the stream of the "finished" objects. Check header value during the streaming and on-close. Check payload size in v2 relay scenario. Signed-off-by: Leonard Lyubich --- pkg/services/object/put/streamer.go | 23 +++++++--- pkg/services/object/put/v2/streamer.go | 45 +++++++++++++++++++ pkg/services/object/put/validation.go | 60 ++++++++++++++++++++++++-- 3 files changed, 119 insertions(+), 9 deletions(-) diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 3ccb800065..c1461a73c3 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -21,6 +21,8 @@ type Streamer struct { target transformer.ObjectTarget relay func(client.Client) error + + maxPayloadSz uint64 // network config } var errNotInit = errors.New("stream not initialized") @@ -39,6 +41,13 @@ func (p *Streamer) Init(prm *PutInitPrm) error { return nil } +// MaxObjectSize returns maximum payload size for the streaming session. +// +// Must be called after the successful Init. +func (p *Streamer) MaxObjectSize() uint64 { + return p.maxPayloadSz +} + func (p *Streamer) initTarget(prm *PutInitPrm) error { // prevent re-calling if p.target != nil { @@ -50,6 +59,11 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error { return fmt.Errorf("(%T) could not prepare put parameters: %w", p, err) } + p.maxPayloadSz = p.maxSizeSrc.MaxObjectSize() + if p.maxPayloadSz == 0 { + return fmt.Errorf("(%T) could not obtain max object size parameter", p) + } + if prm.hdr.Signature() != nil { p.relay = prm.relay @@ -57,6 +71,8 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error { p.target = &validatingTarget{ nextTarget: p.newCommonTarget(prm), fmt: p.fmtValidator, + + maxPayloadSz: p.maxPayloadSz, } return nil @@ -72,13 +88,8 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error { return fmt.Errorf("(%T) could not receive session key: %w", p, err) } - maxSz := p.maxSizeSrc.MaxObjectSize() - if maxSz == 0 { - return fmt.Errorf("(%T) could not obtain max object size parameter", p) - } - p.target = transformer.NewPayloadSizeLimiter( - maxSz, + p.maxPayloadSz, func() transformer.ObjectTarget { return transformer.NewFormatTarget(&transformer.FormatterParams{ Key: sessionKey, diff --git a/pkg/services/object/put/v2/streamer.go b/pkg/services/object/put/v2/streamer.go index e09122e138..9f07975f94 100644 --- a/pkg/services/object/put/v2/streamer.go +++ b/pkg/services/object/put/v2/streamer.go @@ -1,6 +1,7 @@ package putsvc import ( + "errors" "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -19,8 +20,25 @@ type streamer struct { saveChunks bool init *object.PutRequest chunks []*object.PutRequest + + *sizes // only for relay streams } +type sizes struct { + payloadSz uint64 // value from the header + + writtenPayload uint64 // sum size of already cached chunks +} + +// TODO: errors are copy-pasted from putsvc package +// consider replacing to core library + +// errors related to invalid payload size +var ( + errExceedingMaxSize = errors.New("payload size is greater than the limit") + errWrongPayloadSize = errors.New("wrong payload size") +) + func (s *streamer) Send(req *object.PutRequest) (err error) { switch v := req.GetBody().GetObjectPart().(type) { case *object.PutObjectPartInit: @@ -37,9 +55,29 @@ func (s *streamer) Send(req *object.PutRequest) (err error) { s.saveChunks = v.GetSignature() != nil if s.saveChunks { + maxSz := s.stream.MaxObjectSize() + + s.sizes = &sizes{ + payloadSz: uint64(v.GetHeader().GetPayloadLength()), + } + + // check payload size limit overflow + if s.payloadSz > maxSz { + return errExceedingMaxSize + } + s.init = req } case *object.PutObjectPartChunk: + if s.saveChunks { + s.writtenPayload += uint64(len(v.GetChunk())) + + // check payload size overflow + if s.writtenPayload > s.payloadSz { + return errWrongPayloadSize + } + } + if err = s.stream.SendChunk(toChunkPrm(v)); err != nil { err = fmt.Errorf("(%T) could not send payload chunk: %w", s, err) } @@ -71,6 +109,13 @@ func (s *streamer) Send(req *object.PutRequest) (err error) { } func (s *streamer) CloseAndRecv() (*object.PutResponse, error) { + if s.saveChunks { + // check payload size correctness + if s.writtenPayload != s.payloadSz { + return nil, errWrongPayloadSize + } + } + resp, err := s.stream.Close() if err != nil { return nil, fmt.Errorf("(%T) could not object put stream: %w", s, err) diff --git a/pkg/services/object/put/validation.go b/pkg/services/object/put/validation.go index 6de78f48fb..042c6b8cec 100644 --- a/pkg/services/object/put/validation.go +++ b/pkg/services/object/put/validation.go @@ -3,6 +3,7 @@ package putsvc import ( "bytes" "crypto/sha256" + "errors" "fmt" "hash" @@ -20,9 +21,34 @@ type validatingTarget struct { hash hash.Hash checksum []byte + + maxPayloadSz uint64 // network config + + payloadSz uint64 // payload size of the streaming object from header + + writtenPayload uint64 // number of already written payload bytes } +// errors related to invalid payload size +var ( + errExceedingMaxSize = errors.New("payload size is greater than the limit") + errWrongPayloadSize = errors.New("wrong payload size") +) + func (t *validatingTarget) WriteHeader(obj *object.RawObject) error { + t.payloadSz = obj.PayloadSize() + chunkLn := uint64(len(obj.Payload())) + + // check chunk size + if chunkLn > t.payloadSz { + return errWrongPayloadSize + } + + // check payload size limit + if t.payloadSz > t.maxPayloadSz { + return errExceedingMaxSize + } + cs := obj.PayloadChecksum() switch typ := cs.Type(); typ { default: @@ -39,19 +65,47 @@ func (t *validatingTarget) WriteHeader(obj *object.RawObject) error { return fmt.Errorf("(%T) coult not validate object format: %w", t, err) } - return t.nextTarget.WriteHeader(obj) + err := t.nextTarget.WriteHeader(obj) + if err != nil { + return err + } + + // update written bytes + // + // Note: we MUST NOT add obj.PayloadSize() since obj + // can carry only the chunk of the full payload + t.writtenPayload += chunkLn + + return nil } func (t *validatingTarget) Write(p []byte) (n int, err error) { - n, err = t.hash.Write(p) + chunkLn := uint64(len(p)) + + // check if new chunk will overflow payload size + if t.writtenPayload+chunkLn > t.payloadSz { + return 0, errWrongPayloadSize + } + + _, err = t.hash.Write(p) if err != nil { return } - return t.nextTarget.Write(p) + n, err = t.nextTarget.Write(p) + if err == nil { + t.writtenPayload += uint64(n) + } + + return } func (t *validatingTarget) Close() (*transformer.AccessIdentifiers, error) { + // check payload size correctness + if t.payloadSz != t.writtenPayload { + return nil, errWrongPayloadSize + } + if !bytes.Equal(t.hash.Sum(nil), t.checksum) { return nil, fmt.Errorf("(%T) incorrect payload checksum", t) } From 75d6702d2e7d326939759e8ef8db8b2cf5ea05d9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 13:42:40 +0300 Subject: [PATCH 003/219] [#412] ir/locode: Fix docs of the VerifyAndUpdate method `Validator.VerifyAndUpdate` method does not add location code attribute. Signed-off-by: Leonard Lyubich --- pkg/innerring/processors/netmap/nodevalidation/locode/calls.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go index ade2e80fe5..1cc9b8c55d 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go @@ -21,7 +21,6 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record // If DB entry R was found w/o errors, then new attributes are: // * CountryCode: R.CountryCode().String(); // * Country: R.CountryName(); -// * LocationCode: R.LocationCode().String(); // * Location: Record.LocationName(); // * SubDivCode: R.SubDivCode(); // * SubDiv: R.SubDivName(); From 68e85e4b3380897aad74866e72fdf1e61260665d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 13:47:12 +0300 Subject: [PATCH 004/219] [#412] ir/locode: Disallow explicit setting of LOCODE-derived attributes Make `Validator.VerifyAndUpdate` method to return an error if at least one of LOCODE-derived attributes is set explicitly. Thus, IR will not confirm the candidates for the network map who independently set these attributes. Cover `Validator.VerifyAndUpdate` method with unit tests. Signed-off-by: Leonard Lyubich --- .../netmap/nodevalidation/locode/calls.go | 16 +- .../nodevalidation/locode/calls_test.go | 189 ++++++++++++++++++ 2 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 pkg/innerring/processors/netmap/nodevalidation/locode/calls_test.go diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go index 1cc9b8c55d..d015117098 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go @@ -13,8 +13,10 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record // VerifyAndUpdate validates UN-LOCODE attribute of n // and adds a group of related attributes. // -// If n does not contain UN-LOCODE attribute, nil is returned -// without any actions. Otherwise, if UN-LOCODE value does not +// If n contains at least one of the LOCODE-derived attributes, +// an error returns. +// +// If n contains UN-LOCODE attribute and its value does not // match the UN/LOCODE format, an error returns. // // New attributes are formed from the record of DB instance (Prm). @@ -30,6 +32,16 @@ var errMissingRequiredAttr = errors.New("missing required attribute in DB record func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { mAttr := uniqueAttributes(n.Attributes()) + // check if derived attributes are presented + for attrKey := range v.mAttr { + if _, ok := mAttr[attrKey]; ok { + return fmt.Errorf("attribute derived from %s is presented: %s", + netmap.AttrUNLOCODE, + attrKey, + ) + } + } + attrLocode, ok := mAttr[netmap.AttrUNLOCODE] if !ok { return nil diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/calls_test.go b/pkg/innerring/processors/netmap/nodevalidation/locode/calls_test.go new file mode 100644 index 0000000000..3d0df4a91d --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/calls_test.go @@ -0,0 +1,189 @@ +package locode_test + +import ( + "errors" + "fmt" + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/nodevalidation/locode" + locodestd "github.com/nspcc-dev/neofs-node/pkg/util/locode" + locodedb "github.com/nspcc-dev/neofs-node/pkg/util/locode/db" + "github.com/stretchr/testify/require" +) + +type record struct { + *locodedb.Key + *locodedb.Record +} + +type db struct { + items map[locodestd.LOCODE]locode.Record +} + +func (x db) add(lc locodestd.LOCODE, rec locode.Record) { + x.items[lc] = rec +} + +func (x db) Get(lc *locodestd.LOCODE) (locode.Record, error) { + r, ok := x.items[*lc] + if !ok { + return nil, errors.New("record not found") + } + + return r, nil +} + +func addAttrKV(n *netmap.NodeInfo, key, val string) { + a := netmap.NewNodeAttribute() + + a.SetKey(key) + a.SetValue(val) + + n.SetAttributes(append(n.Attributes(), a)...) +} + +func addLocodeAttrValue(n *netmap.NodeInfo, val string) { + addAttrKV(n, netmap.AttrUNLOCODE, val) +} + +func addLocodeAttr(n *netmap.NodeInfo, lc locodestd.LOCODE) { + addLocodeAttrValue(n, fmt.Sprintf("%s %s", lc[0], lc[1])) +} + +func nodeInfoWithSomeAttrs() *netmap.NodeInfo { + n := netmap.NewNodeInfo() + + addAttrKV(n, "key1", "val1") + addAttrKV(n, "key2", "val2") + + return n +} + +func containsAttr(n *netmap.NodeInfo, key, val string) bool { + for _, a := range n.Attributes() { + if a.Key() == key && a.Value() == val { + return true + } + } + + return false +} + +func TestValidator_VerifyAndUpdate(t *testing.T) { + db := &db{ + items: make(map[locodestd.LOCODE]locode.Record), + } + + // test record with valid but random values + r := locodestd.Record{ + LOCODE: locodestd.LOCODE{"RU", "MOW"}, + NameWoDiacritics: "Moskva", + SubDiv: "MSK", + } + + k, err := locodedb.NewKey(r.LOCODE) + require.NoError(t, err) + + rdb, err := locodedb.NewRecord(r) + require.NoError(t, err) + + rdb.SetCountryName("Russia") + rdb.SetSubDivName("Moskva oblast") + + var cont locodedb.Continent = locodedb.ContinentEurope + + rdb.SetContinent(&cont) + + rec := record{ + Key: k, + Record: rdb, + } + + db.add(r.LOCODE, rec) + + var p locode.Prm + + p.DB = db + + validator := locode.New(p) + + t.Run("w/ derived attributes", func(t *testing.T) { + fn := func(withLocode bool) { + for _, derivedAttr := range []string{ + netmap.AttrCountryCode, + netmap.AttrCountry, + netmap.AttrLocation, + netmap.AttrSubDivCode, + netmap.AttrSubDiv, + netmap.AttrContinent, + } { + n := nodeInfoWithSomeAttrs() + + addAttrKV(n, derivedAttr, "some value") + + if withLocode { + addLocodeAttr(n, r.LOCODE) + } + + err := validator.VerifyAndUpdate(n) + require.Error(t, err) + } + } + + fn(true) + fn(false) + }) + + t.Run("w/o locode", func(t *testing.T) { + n := nodeInfoWithSomeAttrs() + + attrs := n.Attributes() + + err := validator.VerifyAndUpdate(n) + require.NoError(t, err) + require.Equal(t, attrs, n.Attributes()) + }) + + t.Run("w/ locode", func(t *testing.T) { + t.Run("invalid locode", func(t *testing.T) { + n := nodeInfoWithSomeAttrs() + + addLocodeAttrValue(n, "WRONG LOCODE") + + err := validator.VerifyAndUpdate(n) + require.Error(t, err) + }) + + t.Run("missing DB record", func(t *testing.T) { + n := nodeInfoWithSomeAttrs() + + addLocodeAttr(n, locodestd.LOCODE{"RU", "SPB"}) + + err := validator.VerifyAndUpdate(n) + require.Error(t, err) + }) + + n := nodeInfoWithSomeAttrs() + + addLocodeAttr(n, r.LOCODE) + + attrs := n.Attributes() + + err := validator.VerifyAndUpdate(n) + require.NoError(t, err) + + outAttrs := n.Attributes() + + for _, a := range attrs { + require.Contains(t, outAttrs, a) + } + + require.True(t, containsAttr(n, netmap.AttrCountryCode, rec.CountryCode().String())) + require.True(t, containsAttr(n, netmap.AttrCountry, rec.CountryName())) + require.True(t, containsAttr(n, netmap.AttrLocation, rec.LocationName())) + require.True(t, containsAttr(n, netmap.AttrSubDivCode, rec.SubDivCode())) + require.True(t, containsAttr(n, netmap.AttrSubDiv, rec.SubDivName())) + require.True(t, containsAttr(n, netmap.AttrContinent, rec.Continent().String())) + }) +} From c973aac89116cdb64f2392309f845f18a33c04a9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 15:28:23 +0300 Subject: [PATCH 005/219] [#599] Makefile: Remove test_dep target Flag `-i` is deprecated in go1.16 and it has pretty much no effect since go1.10 when build cache was introduced. Read more about this at https://golang.org/doc/go1.16 Signed-off-by: Alex Vanin --- .github/workflows/go.yml | 3 --- Makefile | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 5c2d7d1f69..762a49a315 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -35,9 +35,6 @@ jobs: restore-keys: | ${{ runner.os }}-go-${{ matrix.go }}- - - name: Get test dependencies - run: make test_dep - - name: Run go test run: go test -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/Makefile b/Makefile index 0ec60d83ae..5b2d3a239a 100644 --- a/Makefile +++ b/Makefile @@ -49,12 +49,6 @@ dep: GO111MODULE=on \ go mod tidy -v && echo OK -test_dep: - @printf "⇒ Install test requirements: " - CGO_ENABLED=0 \ - GO111MODULE=on \ - go test -i ./... && echo OK - # Regenerate proto files: protoc: @GOPRIVATE=github.com/nspcc-dev go mod vendor @@ -99,7 +93,7 @@ imports: @GO111MODULE=on goimports -w cmd/ pkg/ misc/ # Run Unit Test with go test -test: test_dep +test: @echo "⇒ Running go test" @GO111MODULE=on go test ./... From b55a2959c59404cfbb3191084429e9c83b247a47 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 15:33:49 +0300 Subject: [PATCH 006/219] [#599] Run go mod tidy Signed-off-by: Alex Vanin --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 3c19f2f7ea..0658389fb4 100644 --- a/go.sum +++ b/go.sum @@ -211,7 +211,6 @@ github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8 github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -319,7 +318,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= From e50abeab0cd266e28cbdbd1c92b1329c8dfb02b9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 14:00:55 +0300 Subject: [PATCH 007/219] [#598] innerring/config: Override global config only in debug build Signed-off-by: Alex Vanin --- pkg/innerring/config/config.go | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 73c0aed1b5..dcfbe65c6b 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -13,6 +13,7 @@ Implemented as a part of https://github.com/nspcc-dev/neofs-node/issues/363 */ import ( + "github.com/nspcc-dev/neofs-node/misc" netmapClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/spf13/viper" ) @@ -30,27 +31,33 @@ func NewGlobalConfigReader(cfg *viper.Viper, nm *netmapClient.Wrapper) *GlobalCo } func (c *GlobalConfig) BasicIncomeRate() (uint64, error) { - value := c.cfg.GetUint64("settlement.basic_income_rate") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint64("settlement.basic_income_rate") + if value != 0 { + return value, nil + } } return c.nm.BasicIncomeRate() } func (c *GlobalConfig) AuditFee() (uint64, error) { - value := c.cfg.GetUint64("settlement.audit_fee") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint64("settlement.audit_fee") + if value != 0 { + return value, nil + } } return c.nm.AuditFee() } func (c *GlobalConfig) EpochDuration() (uint32, error) { - value := c.cfg.GetUint32("timers.epoch") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint32("timers.epoch") + if value != 0 { + return value, nil + } } epochDuration, err := c.nm.EpochDuration() @@ -60,3 +67,7 @@ func (c *GlobalConfig) EpochDuration() (uint32, error) { return uint32(epochDuration), nil } + +func isDebug() bool { + return misc.Debug == "true" +} From caafd973e4ce9faace2c232afb70bfb6c6de349b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 14:03:09 +0300 Subject: [PATCH 008/219] [#598] misc: Remove global prefixes New config package in storage node does not use application prefix from misc package. Therefore inner ring node can define prefix in local scope. Signed-off-by: Alex Vanin --- cmd/neofs-ir/defaults.go | 5 +++-- misc/build.go | 8 -------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 98aef6818f..bd2625933f 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -4,17 +4,18 @@ import ( "strings" "time" - "github.com/nspcc-dev/neofs-node/misc" "github.com/spf13/viper" ) func newConfig(path string) (*viper.Viper, error) { + const innerRingPrefix = "neofs_ir" + var ( err error v = viper.New() ) - v.SetEnvPrefix(misc.InnerRingPrefix) + v.SetEnvPrefix(innerRingPrefix) v.AutomaticEnv() v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) diff --git a/misc/build.go b/misc/build.go index 16a4bc9865..198c4a4330 100644 --- a/misc/build.go +++ b/misc/build.go @@ -1,13 +1,5 @@ package misc -const ( - // Prefix is a neofs node application prefix. - Prefix = "neofs" - - // InnerRingPrefix is an inner ring application prefix. - InnerRingPrefix = "neofs_ir" -) - // These variables are changed in compile time. var ( // Build is an application build time. From 0368d5f2b2d0b1e43e79660345c17ddc917ec1a8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 14:06:02 +0300 Subject: [PATCH 009/219] [#598] cmd/neofs-ir: Print debug message in `--version` Signed-off-by: Alex Vanin --- cmd/neofs-ir/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index edde0a5a8b..bfbb4ccfb2 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -40,7 +40,8 @@ func main() { flag.Parse() if *versionFlag { - fmt.Println("version:", misc.Version) + fmt.Println("neofs-ir", misc.Version) + fmt.Println("debug:", misc.Debug) os.Exit(SuccessReturnCode) } From 5ee7d7efcbedb33bc9fbbe5e730f769847751f8c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 14:13:55 +0300 Subject: [PATCH 010/219] [#598] cmd/neofs-ir: Update default config values In testnet and neofs-dev-env we use timers with these settings and they are looking good. So it makes sense to make them default. Storage node now can't configure bootstrap healthcheck length and can't disable it. Inner ring default values now adopt these changes too. Signed-off-by: Alex Vanin --- cmd/neofs-ir/defaults.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index bd2625933f..a65ffd4d3d 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -70,11 +70,11 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("timers.main_notary", "1000") cfg.SetDefault("timers.side_notary", "1000") cfg.SetDefault("timers.stop_estimation.mul", 1) - cfg.SetDefault("timers.stop_estimation.div", 1) + cfg.SetDefault("timers.stop_estimation.div", 4) cfg.SetDefault("timers.collect_basic_income.mul", 1) - cfg.SetDefault("timers.collect_basic_income.div", 1) - cfg.SetDefault("timers.distribute_basic_income.mul", 1) - cfg.SetDefault("timers.distribute_basic_income.div", 1) + cfg.SetDefault("timers.collect_basic_income.div", 2) + cfg.SetDefault("timers.distribute_basic_income.mul", 3) + cfg.SetDefault("timers.distribute_basic_income.div", 4) cfg.SetDefault("notary.side.deposit_amount", 1_0000_0000) // 1.0 Fixed8 cfg.SetDefault("notary.main.deposit_amount", 2000_0000) // 0.2 Fixed8 @@ -86,7 +86,7 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("workers.alphabet", "10") cfg.SetDefault("workers.reputation", "10") - cfg.SetDefault("netmap_cleaner.enabled", false) + cfg.SetDefault("netmap_cleaner.enabled", true) cfg.SetDefault("netmap_cleaner.threshold", 3) cfg.SetDefault("emit.storage.amount", 0) From 419038334110760ddfb09f34115857cb0d6c9d48 Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Tue, 8 Jun 2021 17:10:03 +0300 Subject: [PATCH 011/219] [#551] Add vmagent in neofs-storage testnet image Signed-off-by: anastasia prasolova --- config/testnet/config.yml | 4 ++++ config/testnet/docker-compose.yml | 11 +++++++++++ config/testnet/prometheus.yml | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 config/testnet/prometheus.yml diff --git a/config/testnet/config.yml b/config/testnet/config.yml index 47975c1de9..4685bd6df3 100644 --- a/config/testnet/config.yml +++ b/config/testnet/config.yml @@ -30,6 +30,10 @@ node: key: /node.key attribute_0: Deployed:SelfHosted +metrics: + address: 127.0.0.1:9090 + shutdown_timeout: 15s + storage: shard_num: 1 shard: diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index beb8e5ed32..26fdf12cac 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -17,5 +17,16 @@ services: - =UN-LOCODE: - NEOFS_NODE_ATTRIBUTE_2=Price:100000 + vmagent: + image: victoriametrics/vmagent:v1.61.0 + container_name: vmagent + command: + - '--promscrape.config=/configs/prometheus.yml' + - '--remoteWrite.url=https://collector.fs.neo.org:8429/api/v1/write' + network_mode: host + restart: always + volumes: + - ./prometheus.yml:/configs/prometheus.yml + volumes: neofs_storage: diff --git a/config/testnet/prometheus.yml b/config/testnet/prometheus.yml new file mode 100644 index 0000000000..a3855ba411 --- /dev/null +++ b/config/testnet/prometheus.yml @@ -0,0 +1,10 @@ +global: + scrape_interval: 15s + external_labels: + monitor: 'user_metrics' + +scrape_configs: + - job_name: 'neofs-node-user' + scrape_interval: 5s + static_configs: + - targets: ['127.0.0.1:9090'] From 9b598355a05273dc324428623dc568d23c028c02 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Jun 2021 20:42:18 +0300 Subject: [PATCH 012/219] Update neofs-api-go to v1.27.1 Signed-off-by: Alex Vanin --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6a0d558738..c01cb2ab26 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.1 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.1 - github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797 + github.com/nspcc-dev/neofs-api-go v1.27.1 github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index 0658389fb4..7975e266b0 100644 --- a/go.sum +++ b/go.sum @@ -286,8 +286,8 @@ github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLH github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= -github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797 h1:pUFVPj21BaKdeSyuqBXJUFTPgx7H0cO167+2SJ472jU= -github.com/nspcc-dev/neofs-api-go v1.27.1-0.20210607102659-cc1163fd5797/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.27.1 h1:ONdKOnm0/hK6m38VTUliCHY6RTxg+IpAzY4G+BeOZG4= +github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From b615943e7f141b5a790425674aadf4e9f8e75060 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Jun 2021 20:43:41 +0300 Subject: [PATCH 013/219] Update N3 RC3 testnet config Signed-off-by: Alex Vanin --- config/testnet/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index 26fdf12cac..dbc5c44264 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -3,7 +3,7 @@ version: "2.4" services: storage01: - image: nspccdev/neofs-storage-testnet:0.21.0 + image: nspccdev/neofs-storage-testnet:0.21.1 container_name: neofs-testnet network_mode: host restart: always From 17ac85e09102838e765c9be50af8d11cc21d95c6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 10 Jun 2021 20:41:26 +0300 Subject: [PATCH 014/219] Release v0.21.1 Signed-off-by: Alex Vanin --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4daa9a3f..d6daabb6f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog Changelog for NeoFS Node +## [0.21.1] - 2021-06-10 + +### Fixed +- Session token lifetime check (#589). +- Payload size check on the relayed objects (#580). + +### Added +- VMagent to collect metrics from testnet storage image + +### Changed +- Updated neofs-api-go to v1.27.1 release. + ## [0.21.0] - 2021-06-03 - Seongmodo (석모도, 席毛島) Session token support in container service, refactored config in storage node, @@ -394,6 +406,7 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. +[0.21.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.0...v0.21.1 [0.21.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.20.0...v0.21.0 [0.20.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.19.0...v0.20.0 [0.19.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.18.0...v0.19.0 From 4859bb2e1c3ff2e4e344c3c6ac98508d21cd6213 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Jun 2021 11:39:49 +0300 Subject: [PATCH 015/219] [#603] cmd/node: Remove unused bootType field of cfgNodeInfo struct Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index d8da58b36c..c53c9b1690 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -167,7 +167,6 @@ type BootstrapType uint32 type cfgNodeInfo struct { // values from config - bootType BootstrapType attributes []*netmap.NodeAttribute // values at runtime @@ -296,7 +295,6 @@ func initCfg(path string) *cfg { reBoostrapTurnedOff: atomic.NewBool(relayOnly), }, cfgNodeInfo: cfgNodeInfo{ - bootType: StorageNode, attributes: parseAttributes(appCfg), }, cfgGRPC: cfgGRPC{ From 5a4c3dfddf655dc82d4ee45a1204895f448d72af Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Jun 2021 11:43:05 +0300 Subject: [PATCH 016/219] [#603] cmd/node: Parse node attributes when node info is constructed Remove no longer needed `cfgNodeInfo.attributes` field. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 4 ---- cmd/neofs-node/netmap.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index c53c9b1690..b105354589 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -167,7 +167,6 @@ type BootstrapType uint32 type cfgNodeInfo struct { // values from config - attributes []*netmap.NodeAttribute // values at runtime infoMtx sync.RWMutex @@ -294,9 +293,6 @@ func initCfg(path string) *cfg { reBootstrapEnabled: !relayOnly, reBoostrapTurnedOff: atomic.NewBool(relayOnly), }, - cfgNodeInfo: cfgNodeInfo{ - attributes: parseAttributes(appCfg), - }, cfgGRPC: cfgGRPC{ maxChunkSize: maxChunkSize, maxAddrAmount: maxAddrAmount, diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 249e6f1811..35da5487fd 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -40,7 +40,7 @@ func initNetmapService(c *cfg) { peerInfo := new(netmapSDK.NodeInfo) peerInfo.SetAddress(c.localAddr.String()) peerInfo.SetPublicKey(crypto.MarshalPublicKey(&c.key.PublicKey)) - peerInfo.SetAttributes(c.cfgNodeInfo.attributes...) + peerInfo.SetAttributes(parseAttributes(c.appCfg)...) peerInfo.SetState(netmapSDK.NodeStateOffline) c.handleLocalNodeInfo(peerInfo) From 6279b6343fbed1a761653a78ffced957d5de46b6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Jun 2021 13:55:11 +0300 Subject: [PATCH 017/219] [#603] cmd/node: Separate configuration and netmap node info Config `NodeInfo` should be used for bootstrap. Separete local node info and netmap one. Return configured `NodeInfo` if structure from netmap is missing. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 67 ++++++------------------------------- cmd/neofs-node/container.go | 14 +++----- cmd/neofs-node/control.go | 6 +--- cmd/neofs-node/netmap.go | 57 ++++++++++++++++++++++++------- 4 files changed, 60 insertions(+), 84 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index b105354589..8f4e81891d 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -103,8 +103,6 @@ type cfg struct { cfgControlService cfgControlService - netStatus *atomic.Int32 - healthStatus *atomic.Int32 closers []func() @@ -167,10 +165,7 @@ type BootstrapType uint32 type cfgNodeInfo struct { // values from config - - // values at runtime - infoMtx sync.RWMutex - info netmap.NodeInfo + localInfo netmap.NodeInfo } type cfgObject struct { @@ -307,7 +302,6 @@ func initCfg(path string) *cfg { cfgObject: cfgObject{ pool: initObjectPool(appCfg), }, - netStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)), healthStatus: atomic.NewInt32(int32(control.HealthStatus_HEALTH_STATUS_UNDEFINED)), cfgReputation: cfgReputation{ scriptHash: contractsconfig.Reputation(appCfg), @@ -454,63 +448,22 @@ func initObjectPool(cfg *config.Config) (pool cfgObjectRoutines) { } func (c *cfg) LocalNodeInfo() (*netmapV2.NodeInfo, error) { - ni := c.localNodeInfo() - return ni.ToV2(), nil -} - -// handleLocalNodeInfo rewrites local node info -func (c *cfg) handleLocalNodeInfo(ni *netmap.NodeInfo) { - c.cfgNodeInfo.infoMtx.Lock() - + ni := c.cfgNetmap.state.getNodeInfo() if ni != nil { - c.cfgNodeInfo.info = *ni + return ni.ToV2(), nil } - c.updateStatusWithoutLock(ni) - - c.cfgNodeInfo.infoMtx.Unlock() -} - -// handleNodeInfoStatus updates node info status without rewriting whole local -// node info status -func (c *cfg) handleNodeInfoStatus(ni *netmap.NodeInfo) { - c.cfgNodeInfo.infoMtx.Lock() - - c.updateStatusWithoutLock(ni) - - c.cfgNodeInfo.infoMtx.Unlock() + return c.cfgNodeInfo.localInfo.ToV2(), nil } -func (c *cfg) localNodeInfo() netmap.NodeInfo { - c.cfgNodeInfo.infoMtx.RLock() - defer c.cfgNodeInfo.infoMtx.RUnlock() - - return c.cfgNodeInfo.info +// handleLocalNodeInfo rewrites local node info from netmap +func (c *cfg) handleLocalNodeInfo(ni *netmap.NodeInfo) { + c.cfgNetmap.state.setNodeInfo(ni) } -func (c *cfg) toOnlineLocalNodeInfo() *netmap.NodeInfo { - ni := c.localNodeInfo() +func (c *cfg) bootstrap() error { + ni := c.cfgNodeInfo.localInfo ni.SetState(netmap.NodeStateOnline) - return &ni -} - -func (c *cfg) updateStatusWithoutLock(ni *netmap.NodeInfo) { - var nmState netmap.NodeState - - if ni != nil { - nmState = ni.State() - } else { - nmState = netmap.NodeStateOffline - c.cfgNodeInfo.info.SetState(nmState) - } - - switch nmState { - default: - c.setNetmapStatus(control.NetmapStatus_STATUS_UNDEFINED) - case netmap.NodeStateOnline: - c.setNetmapStatus(control.NetmapStatus_ONLINE) - case netmap.NodeStateOffline: - c.setNetmapStatus(control.NetmapStatus_OFFLINE) - } + return c.cfgNetmap.wrapper.AddPeer(&ni) } diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index d6fb534ffa..65c3ac5f91 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -365,25 +365,19 @@ type usedSpaceService struct { } func (c *cfg) PublicKey() []byte { - ni := c.localNodeInfo() - return ni.PublicKey() + return nodeKeyFromNetmap(c) } func (c *cfg) Address() string { - ni := c.localNodeInfo() - return ni.Address() + return nodeAddressFromNetmap(c) } func (c *usedSpaceService) PublicKey() []byte { - ni := c.cfg.localNodeInfo() - - return ni.PublicKey() + return nodeKeyFromNetmap(c.cfg) } func (c *usedSpaceService) Address() string { - ni := c.cfg.localNodeInfo() - - return ni.Address() + return nodeAddressFromNetmap(c.cfg) } func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *containerV2.AnnounceUsedSpaceRequest) (*containerV2.AnnounceUsedSpaceResponse, error) { diff --git a/cmd/neofs-node/control.go b/cmd/neofs-node/control.go index 92a778b99f..9234be1fef 100644 --- a/cmd/neofs-node/control.go +++ b/cmd/neofs-node/control.go @@ -75,12 +75,8 @@ func initControlService(c *cfg) { })) } -func (c *cfg) setNetmapStatus(st control.NetmapStatus) { - c.netStatus.Store(int32(st)) -} - func (c *cfg) NetmapStatus() control.NetmapStatus { - return control.NetmapStatus(c.netStatus.Load()) + return c.cfgNetmap.state.controlNetmapStatus() } func (c *cfg) setHealthStatus(st control.HealthStatus) { diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 35da5487fd..bf43330730 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -20,6 +20,10 @@ import ( // primary solution of local network state dump. type networkState struct { epoch *atomic.Uint64 + + controlNetStatus atomic.Value // control.NetmapStatus + + nodeInfo atomic.Value // *netmapSDK.NodeInfo } func newNetworkState() *networkState { @@ -36,14 +40,44 @@ func (s *networkState) setCurrentEpoch(v uint64) { s.epoch.Store(v) } -func initNetmapService(c *cfg) { - peerInfo := new(netmapSDK.NodeInfo) - peerInfo.SetAddress(c.localAddr.String()) - peerInfo.SetPublicKey(crypto.MarshalPublicKey(&c.key.PublicKey)) - peerInfo.SetAttributes(parseAttributes(c.appCfg)...) - peerInfo.SetState(netmapSDK.NodeStateOffline) +func (s *networkState) setNodeInfo(ni *netmapSDK.NodeInfo) { + s.nodeInfo.Store(ni) + + var ctrlNetSt control.NetmapStatus + + switch ni.State() { + default: + ctrlNetSt = control.NetmapStatus_STATUS_UNDEFINED + case netmapSDK.NodeStateOnline: + ctrlNetSt = control.NetmapStatus_ONLINE + case netmapSDK.NodeStateOffline: + ctrlNetSt = control.NetmapStatus_OFFLINE + } + + s.controlNetStatus.Store(ctrlNetSt) +} + +func (s *networkState) controlNetmapStatus() control.NetmapStatus { + return s.controlNetStatus.Load().(control.NetmapStatus) +} - c.handleLocalNodeInfo(peerInfo) +func (s *networkState) getNodeInfo() *netmapSDK.NodeInfo { + return s.nodeInfo.Load().(*netmapSDK.NodeInfo) +} + +func nodeKeyFromNetmap(c *cfg) []byte { + return c.cfgNetmap.state.getNodeInfo().PublicKey() +} + +func nodeAddressFromNetmap(c *cfg) string { + return c.cfgNetmap.state.getNodeInfo().Address() +} + +func initNetmapService(c *cfg) { + c.cfgNodeInfo.localInfo.SetAddress(c.localAddr.String()) + c.cfgNodeInfo.localInfo.SetPublicKey(crypto.MarshalPublicKey(&c.key.PublicKey)) + c.cfgNodeInfo.localInfo.SetAttributes(parseAttributes(c.appCfg)...) + c.cfgNodeInfo.localInfo.SetState(netmapSDK.NodeStateOffline) if c.cfgMorph.client == nil { initMorphComponents(c) @@ -82,7 +116,7 @@ func initNetmapService(c *cfg) { const reBootstrapInterval = 2 if (n-c.cfgNetmap.startEpoch)%reBootstrapInterval == 0 { - err := c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo()) + err := c.bootstrap() if err != nil { c.log.Warn("can't send re-bootstrap tx", zap.Error(err)) } @@ -109,7 +143,7 @@ func initNetmapService(c *cfg) { func bootstrapNode(c *cfg) { initState(c) - err := c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo()) + err := c.bootstrap() fatalOnErrDetails("bootstrap error", err) } @@ -140,8 +174,6 @@ func initState(c *cfg) { ni, err := c.netmapLocalNodeState(epoch) fatalOnErrDetails("could not init network state", err) - c.handleNodeInfoStatus(ni) - c.log.Info("initial network state", zap.Uint64("epoch", epoch), zap.Stringer("state", ni.State()), @@ -149,6 +181,7 @@ func initState(c *cfg) { c.cfgNetmap.state.setCurrentEpoch(epoch) c.cfgNetmap.startEpoch = epoch + c.cfgNetmap.state.setNodeInfo(ni) } func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) { @@ -192,7 +225,7 @@ func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) { func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error { if st == control.NetmapStatus_ONLINE { c.cfgNetmap.reBoostrapTurnedOff.Store(false) - return c.cfgNetmap.wrapper.AddPeer(c.toOnlineLocalNodeInfo()) + return c.bootstrap() } var apiState netmapSDK.NodeState From 946d4c4253e3d7c320b1892bdbad7018efacc635 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 11 Jun 2021 13:55:54 +0300 Subject: [PATCH 018/219] [#603] cmd/node: Remove no longer used BootstrapType enum Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 8f4e81891d..c584bd6e57 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -161,8 +161,6 @@ type cfgNetmap struct { startEpoch uint64 // epoch number when application is started } -type BootstrapType uint32 - type cfgNodeInfo struct { // values from config localInfo netmap.NodeInfo @@ -204,12 +202,6 @@ type cfgReputation struct { scriptHash util.Uint160 } -const ( - _ BootstrapType = iota - StorageNode - RelayNode -) - func initCfg(path string) *cfg { var p config.Prm From 6297bc896526adc744bb1d1d146f2fada3718f0e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Jun 2021 11:51:02 +0300 Subject: [PATCH 019/219] [#605] config/testnet: Update readme file Replacing RC2 with RC3 and some rewording. Signed-off-by: Alex Vanin --- config/testnet/README.md | 46 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/config/testnet/README.md b/config/testnet/README.md index 99c5a93046..4981ff15cc 100644 --- a/config/testnet/README.md +++ b/config/testnet/README.md @@ -1,43 +1,43 @@ -# N3 testnet RC2 storage node configuration +# N3 testnet RC3 storage node configuration -There is a prepared configuration for NeoFS storage node deployment in -N3 testnet RC2. The easiest way to deploy storage node is to use prepared -docker image of storage node and run it with docker-compose. +There is a prepared configuration for NeoFS Storage Node deployment in +N3 testnet RC3. The easiest way to deploy Storage Node is to use prepared +docker image and run it with docker-compose. ## Build image -Prepared neofs-storage-testnet image is available at docker hub. +Prepared neofs-storage-testnet image is available at Docker Hub. However, if you need to rebuild it for some reason, run -`make image-storage-testnet` command: +`make image-storage-testnet` command. ``` $ make image-storage-testnet ... -Successfully built 80ef4e3c488d -Successfully tagged nspccdev/neofs-storage-testnet:0.20.0-dirty +Successfully built ab0557117b02 +Successfully tagged nspccdev/neofs-storage-testnet:0.21.1 ``` ## Deploy node -To run storage node in N3 testnet RC2 environment you should deposit GAS assets, +To run storage node in N3 testnet RC3 environment you should deposit GAS assets, update docker-compose file and start the node. ### Deposit -Storage node holder should deposit assets because it generates a bit of -side chain GAS in node's wallet. Side chain GAS used to send bootstrap tx. +Storage Node owner should deposit GAS to NeoFS smart contract. It generates a +bit of side chain GAS in node's wallet. Side chain GAS used to send bootstrap tx. -First obtain GAS in N3 testnet RC2 chain. You can do that with +First obtain GAS in N3 testnet RC3 chain. You can do that with [faucet](https://neowish.ngd.network) service. -Then make a deposit by transferring GAS to NeoFS contract in N3 testnet RC2. +Then make a deposit by transferring GAS to NeoFS contract in N3 testnet RC3. You can provide scripthash in the `data` argument of transfer tx to make a -deposit to specified account. Otherwise deposit is made to tx sender. +deposit to specified account. Otherwise, deposit is made to tx sender. -NeoFS contract scripthash in NEO testnet RC2 is `088c76a08c7b4546582fe95df1ba58f61f165645`, +NeoFS contract scripthash in NEO testnet RC3 is `088c76a08c7b4546582fe95df1ba58f61f165645`, so the address is `NSEawP75SPnnH9sRtk18xJbjYGHu2q5m1W` -See a deposit example with `neo-go`: +See a deposit example with `neo-go`. ``` neo-go wallet nep17 transfer -w wallet.json -r https://rpc1.n3.nspcc.ru:20331 \ @@ -49,7 +49,7 @@ neo-go wallet nep17 transfer -w wallet.json -r https://rpc1.n3.nspcc.ru:20331 \ ### Configure -Then configure docker-compose.yml file. Change endpoints values. Both of them +Then configure docker-compose.yml file. Change endpoints values. Both should contain your **public** IP. ```yaml @@ -105,9 +105,15 @@ Then specify path to this file in docker-compose - ./my_wallet.key:/node.key ``` -Another way is to provide WIF directly with env in docker-compose. -``` -NEOFS_NODE_KEY=Kwp4Q933QujZLUCcn39tzY94itNQJS4EjTp28oAMzuxMwabm3p1s + +NeoFS objects will be stored on your machine. By default, docker-compose +configured to store objects in named docker volume `neofs_storage`. You can +specify directory on the filesystem to store objects there. + +```yaml + volumes: + - /home/username/neofs/rc3/storage:/storage + - ./my_wallet.key:/node.key ``` ### Start From 88b4fe009ac10a29592f5990aeed79f83073e622 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 11 Jun 2021 11:58:46 +0300 Subject: [PATCH 020/219] [#605] config/testnet: Depend vmagent on storage node Otherwise the race is possible and vmagent won't start. Signed-off-by: Alex Vanin --- config/testnet/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index dbc5c44264..eb247c5063 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -20,6 +20,8 @@ services: vmagent: image: victoriametrics/vmagent:v1.61.0 container_name: vmagent + depends_on: + - storage01 command: - '--promscrape.config=/configs/prometheus.yml' - '--remoteWrite.url=https://collector.fs.neo.org:8429/api/v1/write' From 155396732829e3b9cb168e548583c4b94019c6ce Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 11:55:38 +0300 Subject: [PATCH 021/219] [#562] cmd/neofs-ir: use NEP-6 wallet for keys Also remove neofs-crypto uses from `pkg/innerring`. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-ir/defaults.go | 4 ++- pkg/innerring/indexer.go | 10 +++--- pkg/innerring/innerring.go | 26 ++++++++------ .../processors/netmap/cleanup_table_test.go | 20 ++++++----- .../processors/settlement/audit/calculate.go | 11 ++++-- pkg/innerring/settlement.go | 11 ++++-- pkg/util/config/crypto.go | 34 +++++++++++++++++++ 7 files changed, 85 insertions(+), 31 deletions(-) create mode 100644 pkg/util/config/crypto.go diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index a65ffd4d3d..dd4040d780 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -52,7 +52,9 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("mainnet.endpoint.notification", "") cfg.SetDefault("mainnet.dial_timeout", "10s") - cfg.SetDefault("key", "") // inner ring node key + cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet + cfg.SetDefault("wallet.address", "") // account address + cfg.SetDefault("wallet.password", "") // password cfg.SetDefault("contracts.netmap", "") cfg.SetDefault("contracts.neofs", "") diff --git a/pkg/innerring/indexer.go b/pkg/innerring/indexer.go index b05c8b8dd8..ae644d0b1a 100644 --- a/pkg/innerring/indexer.go +++ b/pkg/innerring/indexer.go @@ -2,13 +2,11 @@ package innerring import ( "bytes" - "crypto/ecdsa" "fmt" "sync" "time" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) @@ -17,7 +15,7 @@ type ( sync.RWMutex cli *client.Client - key *ecdsa.PublicKey + key *keys.PublicKey timeout time.Duration ind indexes @@ -31,7 +29,7 @@ type ( } ) -func newInnerRingIndexer(cli *client.Client, key *ecdsa.PublicKey, to time.Duration) *innerRingIndexer { +func newInnerRingIndexer(cli *client.Client, key *keys.PublicKey, to time.Duration) *innerRingIndexer { return &innerRingIndexer{ cli: cli, key: key, @@ -104,9 +102,9 @@ func (s *innerRingIndexer) AlphabetIndex() (int32, error) { // keyPosition returns "-1" if key is not found in the list, otherwise returns // index of the key. -func keyPosition(key *ecdsa.PublicKey, list keys.PublicKeys) (result int32) { +func keyPosition(key *keys.PublicKey, list keys.PublicKeys) (result int32) { result = -1 - rawBytes := crypto.MarshalPublicKey(key) + rawBytes := key.Bytes() for i := range list { if bytes.Equal(list[i].Bytes(), rawBytes) { diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index fe2cf89a1b..aba5035898 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -2,7 +2,6 @@ package innerring import ( "context" - "crypto/ecdsa" "errors" "fmt" "io" @@ -11,7 +10,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/util" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/alphabet" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit" @@ -35,6 +33,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/timer" audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager" util2 "github.com/nspcc-dev/neofs-node/pkg/util" + utilConfig "github.com/nspcc-dev/neofs-node/pkg/util/config" "github.com/nspcc-dev/neofs-node/pkg/util/precision" "github.com/panjf2000/ants/v2" "github.com/spf13/viper" @@ -68,7 +67,7 @@ type ( sideNotaryConfig *notaryConfig // internal variables - key *ecdsa.PrivateKey + key *keys.PrivateKey pubKey []byte contracts *contracts predefinedValidators keys.PublicKeys @@ -110,7 +109,7 @@ type ( chainParams struct { log *zap.Logger cfg *viper.Viper - key *ecdsa.PrivateKey + key *keys.PrivateKey name string gas util.Uint160 } @@ -264,11 +263,16 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error server.mainNotaryConfig, server.sideNotaryConfig = parseNotaryConfigs(cfg) // prepare inner ring node private key - server.key, err = crypto.LoadPrivateKey(cfg.GetString("key")) + acc, err := utilConfig.LoadAccount( + cfg.GetString("wallet.path"), + cfg.GetString("wallet.address"), + cfg.GetString("wallet.password")) if err != nil { - return nil, fmt.Errorf("ir: can't create private key: %w", err) + return nil, fmt.Errorf("ir: %w", err) } + server.key = acc.PrivateKey() + // get all script hashes of contracts server.contracts, err = parseContracts(cfg) if err != nil { @@ -344,11 +348,11 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error } } - server.pubKey = crypto.MarshalPublicKey(&server.key.PublicKey) + server.pubKey = server.key.PublicKey().Bytes() server.statusIndex = newInnerRingIndexer( server.morphClient, - &server.key.PublicKey, + server.key.PublicKey(), cfg.GetDuration("indexer.cache_timeout"), ) @@ -394,7 +398,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error clientCache := newClientCache(&clientCacheParams{ Log: log, - Key: server.key, + Key: &server.key.PrivateKey, SGTimeout: cfg.GetDuration("audit.timeout.get"), HeadTimeout: cfg.GetDuration("audit.timeout.head"), RangeTimeout: cfg.GetDuration("audit.timeout.rangehash"), @@ -432,7 +436,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error IRList: server, FeeProvider: server.feeConfig, ClientCache: clientCache, - Key: server.key, + Key: &server.key.PrivateKey, RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), TaskManager: auditTaskManager, Reporter: server, @@ -738,7 +742,7 @@ func createListener(ctx context.Context, p *chainParams) (event.Listener, error) func createClient(ctx context.Context, p *chainParams) (*client.Client, error) { return client.New( - p.key, + &p.key.PrivateKey, p.cfg.GetString(p.name+".endpoint.client"), client.WithContext(ctx), client.WithLogger(p.log), diff --git a/pkg/innerring/processors/netmap/cleanup_table_test.go b/pkg/innerring/processors/netmap/cleanup_table_test.go index c6362ea2ef..6ed91a51ee 100644 --- a/pkg/innerring/processors/netmap/cleanup_table_test.go +++ b/pkg/innerring/processors/netmap/cleanup_table_test.go @@ -1,21 +1,25 @@ package netmap import ( - "crypto/ecdsa" "encoding/hex" "testing" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-node/pkg/util/test" "github.com/stretchr/testify/require" ) +func genKey(t *testing.T) *keys.PrivateKey { + priv, err := keys.NewPrivateKey() + require.NoError(t, err) + return priv +} + func TestCleanupTable(t *testing.T) { infos := []netmap.NodeInfo{ - newNodeInfo(&test.DecodeKey(1).PublicKey), - newNodeInfo(&test.DecodeKey(2).PublicKey), - newNodeInfo(&test.DecodeKey(3).PublicKey), + newNodeInfo(genKey(t).PublicKey()), + newNodeInfo(genKey(t).PublicKey()), + newNodeInfo(genKey(t).PublicKey()), } networkMap, err := netmap.NewNetmap(netmap.NodesFromInfo(infos)) @@ -117,7 +121,7 @@ func TestCleanupTable(t *testing.T) { }) } -func newNodeInfo(key *ecdsa.PublicKey) (n netmap.NodeInfo) { - n.SetPublicKey(crypto.MarshalPublicKey(key)) +func newNodeInfo(key *keys.PublicKey) (n netmap.NodeInfo) { + n.SetPublicKey(key.Bytes()) return n } diff --git a/pkg/innerring/processors/settlement/audit/calculate.go b/pkg/innerring/processors/settlement/audit/calculate.go index 4dcc88b217..84a4cea838 100644 --- a/pkg/innerring/processors/settlement/audit/calculate.go +++ b/pkg/innerring/processors/settlement/audit/calculate.go @@ -2,14 +2,16 @@ package audit import ( "bytes" + "crypto/ecdsa" + "crypto/elliptic" "encoding/hex" "math/big" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg/audit" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" @@ -312,9 +314,12 @@ func (c *singleResultCtx) auditEpoch() uint64 { } func ownerFromKey(key []byte) (*owner.ID, error) { - pubKey := crypto.UnmarshalPublicKey(key) + pubKey, err := keys.NewPublicKeyFromBytes(key, elliptic.P256()) + if err != nil { + return nil, err + } - n3wallet, err := owner.NEO3WalletFromPublicKey(pubKey) + n3wallet, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(pubKey)) if err != nil { return nil, err } diff --git a/pkg/innerring/settlement.go b/pkg/innerring/settlement.go index 31070795f6..f3203e58c0 100644 --- a/pkg/innerring/settlement.go +++ b/pkg/innerring/settlement.go @@ -2,10 +2,13 @@ package innerring import ( "context" + "crypto/ecdsa" + "crypto/elliptic" "encoding/hex" "fmt" "math/big" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" auditAPI "github.com/nspcc-dev/neofs-api-go/pkg/audit" containerAPI "github.com/nspcc-dev/neofs-api-go/pkg/container" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" @@ -13,7 +16,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/audit" @@ -181,7 +183,12 @@ func (s settlementDeps) SGInfo(addr *object.Address) (audit.SGInfo, error) { } func (s settlementDeps) ResolveKey(ni common.NodeInfo) (*owner.ID, error) { - w, err := owner.NEO3WalletFromPublicKey(crypto.UnmarshalPublicKey(ni.PublicKey())) + pub, err := keys.NewPublicKeyFromBytes(ni.PublicKey(), elliptic.P256()) + if err != nil { + return nil, err + } + + w, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(pub)) if err != nil { return nil, err } diff --git a/pkg/util/config/crypto.go b/pkg/util/config/crypto.go new file mode 100644 index 0000000000..2564b21c07 --- /dev/null +++ b/pkg/util/config/crypto.go @@ -0,0 +1,34 @@ +package config + +import ( + "errors" + + "github.com/nspcc-dev/neo-go/pkg/encoding/address" + "github.com/nspcc-dev/neo-go/pkg/wallet" +) + +// LoadAccount loads NEP-6 load, unlocks and returns provided account. +func LoadAccount(path, addr, password string) (*wallet.Account, error) { + w, err := wallet.NewWalletFromFile(path) + if err != nil { + return nil, err + } + + defer w.Close() + + h, err := address.StringToUint160(addr) + if err != nil { + return nil, err + } + + acc := w.GetAccount(h) + if acc == nil { + return nil, errors.New("account is missing") + } + + if err := acc.Decrypt(password); err != nil { + return nil, err + } + + return acc, nil +} From 3f07313604febe08a063067e262b654d4f68cb7f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 11:55:38 +0300 Subject: [PATCH 022/219] [#562] cmd/neofs-node: use NEP-6 wallet for keys Also use neo-go private key wrapper where possible, as it already has methods for (un)marshaling. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/accounting.go | 2 +- cmd/neofs-node/config.go | 10 +++---- cmd/neofs-node/config/control/config.go | 21 ++++++++++++-- cmd/neofs-node/config/control/config_test.go | 12 ++++---- cmd/neofs-node/config/node/config.go | 16 +++++++++++ cmd/neofs-node/config/node/config_test.go | 7 +++++ cmd/neofs-node/config/node/wallet.json | 30 ++++++++++++++++++++ cmd/neofs-node/container.go | 7 ++--- cmd/neofs-node/control.go | 24 +++++----------- cmd/neofs-node/morph.go | 2 +- cmd/neofs-node/netmap.go | 9 +++--- cmd/neofs-node/object.go | 7 +++-- cmd/neofs-node/reputation.go | 11 ++++--- cmd/neofs-node/session.go | 2 +- config/example/node.env | 3 ++ config/example/node.json | 5 ++++ config/example/node.yaml | 4 +++ 17 files changed, 119 insertions(+), 53 deletions(-) create mode 100644 cmd/neofs-node/config/node/wallet.json diff --git a/cmd/neofs-node/accounting.go b/cmd/neofs-node/accounting.go index e58426fcc1..e0491709b3 100644 --- a/cmd/neofs-node/accounting.go +++ b/cmd/neofs-node/accounting.go @@ -19,7 +19,7 @@ func initAccountingService(c *cfg) { accountingGRPC.RegisterAccountingServiceServer(c.cfgGRPC.server, accountingTransportGRPC.New( accountingService.NewSignService( - c.key, + &c.key.PrivateKey, accountingService.NewResponseService( accountingService.NewExecutionService( accounting.NewExecutor(balanceMorphWrapper), diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index c584bd6e57..b721ddbcf9 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -2,18 +2,17 @@ package main import ( "context" - "crypto/ecdsa" "net" "os" "path" "sync" "time" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" netmapV2 "github.com/nspcc-dev/neofs-api-go/v2/netmap" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" contractsconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/contracts" engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine" @@ -73,7 +72,7 @@ type cfg struct { wg *sync.WaitGroup - key *ecdsa.PrivateKey + key *keys.PrivateKey apiVersion *pkg.Version @@ -209,12 +208,11 @@ func initCfg(path string) *cfg { config.WithConfigFile(path), ) - key, err := crypto.LoadPrivateKey(nodeconfig.Key(appCfg)) - fatalOnErr(err) + key := nodeconfig.Wallet(appCfg) var logPrm logger.Prm - err = logPrm.SetLevelString( + err := logPrm.SetLevelString( loggerconfig.Level(appCfg), ) fatalOnErr(err) diff --git a/cmd/neofs-node/config/control/config.go b/cmd/neofs-node/config/control/config.go index e1b8766812..ec43f99110 100644 --- a/cmd/neofs-node/config/control/config.go +++ b/cmd/neofs-node/config/control/config.go @@ -1,6 +1,9 @@ package controlconfig import ( + "fmt" + + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) @@ -18,12 +21,24 @@ const ( GRPCEndpointDefault = "" ) -// AuthorizedKeysString returns string array of "authorized_keys" config +// AuthorizedKeys parses and returns array of "authorized_keys" config // parameter from "control" section. // // Returns empty list if not set. -func AuthorizedKeysString(c *config.Config) []string { - return config.StringSliceSafe(c.Sub(subsection), "authorized_keys") +func AuthorizedKeys(c *config.Config) keys.PublicKeys { + strKeys := config.StringSliceSafe(c.Sub(subsection), "authorized_keys") + pubs := make(keys.PublicKeys, 0, len(strKeys)) + + for i := range strKeys { + pub, err := keys.NewPublicKeyFromString(strKeys[i]) + if err != nil { + panic(fmt.Errorf("invalid permitted key for Control service %s: %w", strKeys[i], err)) + } + + pubs = append(pubs, pub) + } + + return pubs } // GRPC returns structure that provides access to "grpc" subsection of diff --git a/cmd/neofs-node/config/control/config_test.go b/cmd/neofs-node/config/control/config_test.go index 7659580bab..654c0f8b01 100644 --- a/cmd/neofs-node/config/control/config_test.go +++ b/cmd/neofs-node/config/control/config_test.go @@ -3,6 +3,7 @@ package controlconfig_test import ( "testing" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" controlconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/control" configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" @@ -13,19 +14,18 @@ func TestControlSection(t *testing.T) { t.Run("defaults", func(t *testing.T) { empty := configtest.EmptyConfig() - require.Empty(t, controlconfig.AuthorizedKeysString(empty)) + require.Empty(t, controlconfig.AuthorizedKeys(empty)) require.Equal(t, controlconfig.GRPCEndpointDefault, controlconfig.GRPC(empty).Endpoint()) }) const path = "../../../../config/example/node" - var keys = []string{ - "035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11", - "028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6", - } + pubs := make(keys.PublicKeys, 2) + pubs[0], _ = keys.NewPublicKeyFromString("035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11") + pubs[1], _ = keys.NewPublicKeyFromString("028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6") var fileConfigTest = func(c *config.Config) { - require.Equal(t, keys, controlconfig.AuthorizedKeysString(c)) + require.Equal(t, pubs, controlconfig.AuthorizedKeys(c)) require.Equal(t, "127.0.0.1:8090", controlconfig.GRPC(c).Endpoint()) } diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index b78223ed18..3c72509238 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -5,8 +5,10 @@ import ( "fmt" "strconv" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" "github.com/nspcc-dev/neofs-node/pkg/network" + utilConfig "github.com/nspcc-dev/neofs-node/pkg/util/config" ) const ( @@ -36,6 +38,20 @@ func Key(c *config.Config) string { return v } +// Wallet returns value of node private key from "node" section. +func Wallet(c *config.Config) *keys.PrivateKey { + v := c.Sub(subsection).Sub("wallet") + acc, err := utilConfig.LoadAccount( + config.String(v, "path"), + config.String(v, "address"), + config.String(v, "password")) + if err != nil { + panic(fmt.Errorf("invalid wallet config: %w", err)) + } + + return acc.PrivateKey() +} + // BootstrapAddress returns value of "address" config parameter // from "node" section as network.Address. // diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index a869a97e69..041c6ef4fe 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -3,6 +3,7 @@ package nodeconfig import ( "testing" + "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" "github.com/nspcc-dev/neofs-node/pkg/network" @@ -43,6 +44,7 @@ func TestNodeSection(t *testing.T) { addr := BootstrapAddress(c) attributes := Attributes(c) relay := Relay(c) + wKey := Wallet(c) expectedAddr, err := network.AddressFromString("s01.neofs.devenv:8080") require.NoError(t, err) @@ -54,6 +56,11 @@ func TestNodeSection(t *testing.T) { require.Len(t, attributes, 2) require.Equal(t, "Price:11", attributes[0]) require.Equal(t, "UN-LOCODE:RU MSK", attributes[1]) + + require.NotNil(t, wKey) + require.Equal(t, + config.StringSafe(c.Sub("node").Sub("wallet"), "address"), + address.Uint160ToString(wKey.GetScriptHash())) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/cmd/neofs-node/config/node/wallet.json b/cmd/neofs-node/config/node/wallet.json new file mode 100644 index 0000000000..006d960233 --- /dev/null +++ b/cmd/neofs-node/config/node/wallet.json @@ -0,0 +1,30 @@ +{ + "version": "3.0", + "accounts": [ + { + "address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz", + "key": "6PYXFRFUfoMNjWd2UmaaEjwHSWpifcLLTbEfhkwXdiSZ2n2WLfr75JpxmJ", + "label": "testacc", + "contract": { + "script": "DCECaeaVhKFa+ENNUpRJLz6BRmRbkIaoN+xZt3VHzlzkHJZBVuezJw==", + "parameters": [ + { + "name": "parameter0", + "type": "Signature" + } + ], + "deployed": false + }, + "lock": false, + "isDefault": false + } + ], + "scrypt": { + "n": 16384, + "r": 8, + "p": 8 + }, + "extra": { + "Tokens": null + } +} diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 65c3ac5f91..adabdc769a 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -14,7 +14,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/netmap" containerV2 "github.com/nspcc-dev/neofs-api-go/v2/container" containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - crypto "github.com/nspcc-dev/neofs-crypto" containerCore "github.com/nspcc-dev/neofs-node/pkg/core/container" netmapCore "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -53,7 +52,7 @@ func initContainerService(c *cfg) { engine: c.cfgObject.cfgLocalStorage.localStorage, } - pubKey := crypto.MarshalPublicKey(&c.key.PublicKey) + pubKey := c.key.PublicKey().Bytes() resultWriter := &morphLoadWriter{ log: c.log, @@ -79,7 +78,7 @@ func initContainerService(c *cfg) { loadroute.Prm{ LocalServerInfo: c, RemoteWriterProvider: &remoteLoadAnnounceProvider{ - key: c.key, + key: &c.key.PrivateKey, loadAddrSrc: c, clientCache: clientCache, deadEndProvider: loadcontroller.SimpleWriterProvider(loadAccumulator), @@ -118,7 +117,7 @@ func initContainerService(c *cfg) { containerGRPC.RegisterContainerServiceServer(c.cfgGRPC.server, containerTransportGRPC.New( containerService.NewSignService( - c.key, + &c.key.PrivateKey, containerService.NewResponseService( &usedSpaceService{ Server: containerService.NewExecutionService(containerMorph.NewExecutor(wrap)), diff --git a/cmd/neofs-node/control.go b/cmd/neofs-node/control.go index 9234be1fef..3b35ef01b4 100644 --- a/cmd/neofs-node/control.go +++ b/cmd/neofs-node/control.go @@ -2,12 +2,9 @@ package main import ( "context" - "encoding/hex" - "fmt" "net" "github.com/nspcc-dev/neofs-api-go/pkg/object" - crypto "github.com/nspcc-dev/neofs-crypto" controlconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/control" grpcconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/grpc" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -17,25 +14,18 @@ import ( ) func initControlService(c *cfg) { - strKeys := controlconfig.AuthorizedKeysString(c.appCfg) - keys := make([][]byte, 0, len(strKeys)+1) // +1 for node key + pubs := controlconfig.AuthorizedKeys(c.appCfg) + rawPubs := make([][]byte, 0, len(pubs)+1) // +1 for node key - keys = append(keys, crypto.MarshalPublicKey(&c.key.PublicKey)) + rawPubs = append(rawPubs, c.key.PublicKey().Bytes()) - for i := range strKeys { - key, err := hex.DecodeString(strKeys[i]) - fatalOnErr(err) - - if crypto.UnmarshalPublicKey(key) == nil { - fatalOnErr(fmt.Errorf("invalid permitted key for Control service %s", strKeys[i])) - } - - keys = append(keys, key) + for i := range pubs { + rawPubs = append(rawPubs, pubs[i].Bytes()) } ctlSvc := controlSvc.New( - controlSvc.WithKey(c.key), - controlSvc.WithAuthorizedKeys(keys), + controlSvc.WithKey(&c.key.PrivateKey), + controlSvc.WithAuthorizedKeys(rawPubs), controlSvc.WithHealthChecker(c), controlSvc.WithNetMapSource(c.cfgNetmap.wrapper), controlSvc.WithNodeState(c), diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index 07adc34b90..59e5b15a41 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -30,7 +30,7 @@ func initMorphComponents(c *cfg) { }) for i := range addresses { - cli, err := client.New(c.key, addresses[i], client.WithDialTimeout(dialTimeout)) + cli, err := client.New(&c.key.PrivateKey, addresses[i], client.WithDialTimeout(dialTimeout)) if err == nil { c.log.Info("neo RPC connection established", zap.String("endpoint", addresses[i])) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index bf43330730..6d06ecc6d6 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -6,7 +6,6 @@ import ( netmapSDK "github.com/nspcc-dev/neofs-api-go/pkg/netmap" netmapV2 "github.com/nspcc-dev/neofs-api-go/v2/netmap" netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/morph/event" netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" @@ -75,7 +74,7 @@ func nodeAddressFromNetmap(c *cfg) string { func initNetmapService(c *cfg) { c.cfgNodeInfo.localInfo.SetAddress(c.localAddr.String()) - c.cfgNodeInfo.localInfo.SetPublicKey(crypto.MarshalPublicKey(&c.key.PublicKey)) + c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes()) c.cfgNodeInfo.localInfo.SetAttributes(parseAttributes(c.appCfg)...) c.cfgNodeInfo.localInfo.SetState(netmapSDK.NodeStateOffline) @@ -86,7 +85,7 @@ func initNetmapService(c *cfg) { netmapGRPC.RegisterNetmapServiceServer(c.cfgGRPC.server, netmapTransportGRPC.New( netmapService.NewSignService( - c.key, + &c.key.PrivateKey, netmapService.NewResponseService( netmapService.NewExecutionService( c, @@ -196,7 +195,7 @@ func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) { func (c *cfg) localNodeInfoFromNetmap(nm *netmapSDK.Netmap) *netmapSDK.NodeInfo { for _, n := range nm.Nodes { - if bytes.Equal(n.PublicKey(), crypto.MarshalPublicKey(&c.key.PublicKey)) { + if bytes.Equal(n.PublicKey(), c.key.PublicKey().Bytes()) { return n.NodeInfo } } @@ -237,7 +236,7 @@ func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error { c.cfgNetmap.reBoostrapTurnedOff.Store(true) return c.cfgNetmap.wrapper.UpdatePeerState( - crypto.MarshalPublicKey(&c.key.PublicKey), + c.key.PublicKey().Bytes(), apiState, ) } diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index a85aa20e67..65efb40db2 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -2,6 +2,7 @@ package main import ( "context" + "crypto/ecdsa" "crypto/sha256" "fmt" @@ -147,10 +148,10 @@ func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { func initObjectService(c *cfg) { ls := c.cfgObject.cfgLocalStorage.localStorage - keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore) + keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore) nodeOwner := owner.NewID() - neo3Wallet, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey) + neo3Wallet, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(c.key.PublicKey())) fatalOnErr(err) nodeOwner.SetNeo3Wallet(neo3Wallet) @@ -325,7 +326,7 @@ func initObjectService(c *cfg) { ) signSvc := objectService.NewSignService( - c.key, + &c.key.PrivateKey, respSvc, ) diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index 6084383a4e..7a4dc7c058 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -7,7 +7,6 @@ import ( v2reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation" v2reputationgrpc "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc" "github.com/nspcc-dev/neofs-api-go/v2/session" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/common" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/intermediate" intermediatereputation "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/intermediate" @@ -38,7 +37,7 @@ func initReputationService(c *cfg) { wrap, err := rtpwrapper.NewFromMorph(c.cfgMorph.client, c.cfgReputation.scriptHash, 0) fatalOnErr(err) - localKey := crypto.MarshalPublicKey(&c.key.PublicKey) + localKey := c.key.PublicKey().Bytes() // consider sharing this between application components nmSrc := newCachedNetmapStorage(c.cfgNetmap.state, c.cfgNetmap.wrapper) @@ -99,7 +98,7 @@ func initReputationService(c *cfg) { ClientCache: apiClientCache, WriterProvider: localreputation.NewRemoteProvider( localreputation.RemoteProviderPrm{ - Key: c.key, + Key: &c.key.PrivateKey, }, ), }, @@ -112,7 +111,7 @@ func initReputationService(c *cfg) { ClientCache: apiClientCache, WriterProvider: intermediatereputation.NewRemoteProvider( intermediatereputation.RemoteProviderPrm{ - Key: c.key, + Key: &c.key.PrivateKey, }, ), }, @@ -144,7 +143,7 @@ func initReputationService(c *cfg) { WorkerPool: c.cfgReputation.workerPool, FinalResultTarget: intermediate.NewFinalWriterProvider( intermediate.FinalWriterProviderPrm{ - PrivatKey: c.key, + PrivatKey: &c.key.PrivateKey, PubKey: localKey, Client: wrap, }, @@ -190,7 +189,7 @@ func initReputationService(c *cfg) { v2reputationgrpc.RegisterReputationServiceServer(c.cfgGRPC.server, grpcreputation.New( reputationrpc.NewSignService( - c.key, + &c.key.PrivateKey, reputationrpc.NewResponseService( &reputationServer{ cfg: c, diff --git a/cmd/neofs-node/session.go b/cmd/neofs-node/session.go index a7bb994721..654236af67 100644 --- a/cmd/neofs-node/session.go +++ b/cmd/neofs-node/session.go @@ -13,7 +13,7 @@ func initSessionService(c *cfg) { sessionGRPC.RegisterSessionServiceServer(c.cfgGRPC.server, sessionTransportGRPC.New( sessionSvc.NewSignService( - c.key, + &c.key.PrivateKey, sessionSvc.NewResponseService( sessionSvc.NewExecutionService( c.privateTokenStore, diff --git a/config/example/node.env b/config/example/node.env index 4d56ad3658..4243283761 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -8,6 +8,9 @@ NEOFS_METRICS_SHUTDOWN_TIMEOUT=15s # Node section NEOFS_NODE_KEY=path/hex/WIF +NEOFS_NODE_WALLET_PATH=./wallet.json +NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz +NEOFS_NODE_WALLET_PASSWORD=password NEOFS_NODE_ADDRESS=s01.neofs.devenv:8080 NEOFS_NODE_ATTRIBUTE_0=Price:11 NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK diff --git a/config/example/node.json b/config/example/node.json index 6125446114..646ccea5e3 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -12,6 +12,11 @@ }, "node": { "key": "path/hex/WIF", + "wallet": { + "path": "./wallet.json", + "address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz", + "password": "password" + }, "address": "s01.neofs.devenv:8080", "attribute_0": "Price:11", "attribute_1": "UN-LOCODE:RU MSK", diff --git a/config/example/node.yaml b/config/example/node.yaml index ba0028e03c..59b01a9fd7 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -11,6 +11,10 @@ metrics: node: key: path/hex/WIF + wallet: + path: "./wallet.json" + address: "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz" + password: "password" address: s01.neofs.devenv:8080 attribute_0: "Price:11" attribute_1: UN-LOCODE:RU MSK From fcdef227e4b5bb66e98005643f7d62459cc3f4fa Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 11:55:38 +0300 Subject: [PATCH 023/219] [#562] cmd/neofs-cli: use NEP-6 wallet for keys Encrypted NEP-2 is still supported. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/modules/root.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 08be163c31..446828824a 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -2,9 +2,7 @@ package cmd import ( "crypto/ecdsa" - "crypto/rand" "crypto/tls" - "encoding/hex" "errors" "fmt" "os" @@ -18,7 +16,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -138,21 +135,11 @@ const nep2Base58Length = 58 func getKey() (*ecdsa.PrivateKey, error) { privateKey := viper.GetString("key") if privateKey == generateKeyConst { - buf := make([]byte, crypto.PrivateKeyCompressedSize) - - _, err := rand.Read(buf) + priv, err := keys.NewPrivateKey() if err != nil { return nil, errCantGenerateKey } - - printVerbose("Generating private key:", hex.EncodeToString(buf)) - - return crypto.UnmarshalPrivateKey(buf) - } - - key, err := crypto.LoadPrivateKey(privateKey) - if err == nil { - return key, nil + return &priv.PrivateKey, nil } w, err := wallet.NewWalletFromFile(privateKey) From 5cab0026c3c4edc3ec7c0fb03cd8f3d2a41e987d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 11:55:40 +0300 Subject: [PATCH 024/219] [#562] pkg/morph: remove neofs-crypto uses Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/morph.go | 2 +- pkg/innerring/innerring.go | 2 +- pkg/morph/client/audit/wrapper/result_test.go | 8 ++--- pkg/morph/client/constructor.go | 20 +++-------- pkg/morph/event/neofs/ir_update_test.go | 33 ++++++++----------- pkg/morph/event/netmap/update_peer_test.go | 17 ++++------ 6 files changed, 30 insertions(+), 52 deletions(-) diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index 59e5b15a41..07adc34b90 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -30,7 +30,7 @@ func initMorphComponents(c *cfg) { }) for i := range addresses { - cli, err := client.New(&c.key.PrivateKey, addresses[i], client.WithDialTimeout(dialTimeout)) + cli, err := client.New(c.key, addresses[i], client.WithDialTimeout(dialTimeout)) if err == nil { c.log.Info("neo RPC connection established", zap.String("endpoint", addresses[i])) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index aba5035898..d26a8e6e26 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -742,7 +742,7 @@ func createListener(ctx context.Context, p *chainParams) (event.Listener, error) func createClient(ctx context.Context, p *chainParams) (*client.Client, error) { return client.New( - &p.key.PrivateKey, + p.key, p.cfg.GetString(p.name+".endpoint.client"), client.WithContext(ctx), client.WithLogger(p.log), diff --git a/pkg/morph/client/audit/wrapper/result_test.go b/pkg/morph/client/audit/wrapper/result_test.go index 343752863d..2e54c270b1 100644 --- a/pkg/morph/client/audit/wrapper/result_test.go +++ b/pkg/morph/client/audit/wrapper/result_test.go @@ -4,10 +4,10 @@ import ( "testing" "time" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" auditAPI "github.com/nspcc-dev/neofs-api-go/pkg/audit" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/morph/client" auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" "github.com/stretchr/testify/require" @@ -21,11 +21,9 @@ func TestAuditResults(t *testing.T) { sAuditHash := "cdfb3dab86e6d60e8a143d9e2ecb0b188f3dc2eb" irKeyWIF := "L3o221BojgcCPYgdbXsm6jn7ayTZ72xwREvBHXKknR8VJ3G4WmjB" - key, err := crypto.WIFDecode(irKeyWIF) + key, err := keys.NewPrivateKeyFromWIF(irKeyWIF) require.NoError(t, err) - pubKey := crypto.MarshalPublicKey(&key.PublicKey) - auditHash, err := util.Uint160DecodeStringLE(sAuditHash) require.NoError(t, err) @@ -39,7 +37,7 @@ func TestAuditResults(t *testing.T) { auditRes := auditAPI.NewResult() auditRes.SetAuditEpoch(epoch) - auditRes.SetPublicKey(pubKey) + auditRes.SetPublicKey(key.PublicKey().Bytes()) auditRes.SetContainerID(id) require.NoError(t, auditClientWrapper.PutAuditResult(auditRes)) diff --git a/pkg/morph/client/constructor.go b/pkg/morph/client/constructor.go index 10915a219a..e2d89f4baa 100644 --- a/pkg/morph/client/constructor.go +++ b/pkg/morph/client/constructor.go @@ -2,7 +2,6 @@ package client import ( "context" - "crypto/ecdsa" "time" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" @@ -10,7 +9,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/wallet" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" ) @@ -47,7 +45,7 @@ func defaultConfig() *cfg { // New creates, initializes and returns the Client instance. // -// If private key is nil, crypto.ErrEmptyPrivateKey is returned. +// If private key is nil, it panics. // // Other values are set according to provided options, or by default: // * client context: Background; @@ -58,22 +56,12 @@ func defaultConfig() *cfg { // If desired option satisfies the default value, it can be omitted. // If multiple options of the same config value are supplied, // the option with the highest index in the arguments will be used. -func New(key *ecdsa.PrivateKey, endpoint string, opts ...Option) (*Client, error) { +func New(key *keys.PrivateKey, endpoint string, opts ...Option) (*Client, error) { if key == nil { - return nil, crypto.ErrEmptyPrivateKey + panic("empty private key") } - privKeyBytes := crypto.MarshalPrivateKey(key) - - wif, err := keys.WIFEncode(privKeyBytes, keys.WIFVersion, true) - if err != nil { - return nil, err - } - - account, err := wallet.NewAccountFromWIF(wif) - if err != nil { - return nil, err - } + account := wallet.NewAccountFromPrivateKey(key) // build default configuration cfg := defaultConfig() diff --git a/pkg/morph/event/neofs/ir_update_test.go b/pkg/morph/event/neofs/ir_update_test.go index 8782b361f3..d9e484f762 100644 --- a/pkg/morph/event/neofs/ir_update_test.go +++ b/pkg/morph/event/neofs/ir_update_test.go @@ -1,24 +1,26 @@ package neofs import ( - "crypto/ecdsa" - "crypto/elliptic" "testing" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/stretchr/testify/require" ) +func genKey(t *testing.T) *keys.PrivateKey { + priv, err := keys.NewPrivateKey() + require.NoError(t, err) + return priv +} + func TestParseUpdateInnerRing(t *testing.T) { var ( - publicKeys = []*ecdsa.PublicKey{ - &test.DecodeKey(1).PublicKey, - &test.DecodeKey(2).PublicKey, - &test.DecodeKey(3).PublicKey, + publicKeys = []*keys.PublicKey{ + genKey(t).PublicKey(), + genKey(t).PublicKey(), + genKey(t).PublicKey(), } ) @@ -43,22 +45,15 @@ func TestParseUpdateInnerRing(t *testing.T) { t.Run("correct", func(t *testing.T) { ev, err := ParseUpdateInnerRing([]stackitem.Item{ stackitem.NewArray([]stackitem.Item{ - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKeys[0])), - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKeys[1])), - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKeys[2])), + stackitem.NewByteArray(publicKeys[0].Bytes()), + stackitem.NewByteArray(publicKeys[1].Bytes()), + stackitem.NewByteArray(publicKeys[2].Bytes()), }), }) require.NoError(t, err) - expKeys := make([]*keys.PublicKey, len(publicKeys)) - for i := range publicKeys { - expKeys[i], err = keys.NewPublicKeyFromBytes( - crypto.MarshalPublicKey(publicKeys[i]), elliptic.P256()) - require.NoError(t, err) - } - require.Equal(t, UpdateInnerRing{ - keys: expKeys, + keys: publicKeys, }, ev) }) } diff --git a/pkg/morph/event/netmap/update_peer_test.go b/pkg/morph/event/netmap/update_peer_test.go index f4622c644e..1da93ea8a3 100644 --- a/pkg/morph/event/netmap/update_peer_test.go +++ b/pkg/morph/event/netmap/update_peer_test.go @@ -1,22 +1,22 @@ package netmap import ( - "crypto/elliptic" "math/big" "testing" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - crypto "github.com/nspcc-dev/neofs-crypto" - "github.com/nspcc-dev/neofs-crypto/test" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/stretchr/testify/require" ) func TestParseUpdatePeer(t *testing.T) { + priv, err := keys.NewPrivateKey() + require.NoError(t, err) + var ( - publicKey = &test.DecodeKey(-1).PublicKey + publicKey = priv.PublicKey() state = netmap.NodeStateOffline ) @@ -39,7 +39,7 @@ func TestParseUpdatePeer(t *testing.T) { t.Run("wrong second parameter type", func(t *testing.T) { _, err := ParseUpdatePeer([]stackitem.Item{ - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKey)), + stackitem.NewByteArray(publicKey.Bytes()), stackitem.NewMap(), }) @@ -49,15 +49,12 @@ func TestParseUpdatePeer(t *testing.T) { t.Run("correct behavior", func(t *testing.T) { ev, err := ParseUpdatePeer([]stackitem.Item{ stackitem.NewBigInteger(new(big.Int).SetInt64(int64(state.ToV2()))), - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKey)), + stackitem.NewByteArray(publicKey.Bytes()), }) require.NoError(t, err) - expectedKey, err := keys.NewPublicKeyFromBytes(crypto.MarshalPublicKey(publicKey), elliptic.P256()) - require.NoError(t, err) - require.Equal(t, UpdatePeer{ - publicKey: expectedKey, + publicKey: publicKey, status: state, }, ev) }) From 9142c778c7d8dbce5c9d46465b481e007f223829 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 11:55:40 +0300 Subject: [PATCH 025/219] [#562] pkg: remove `nspcc-dev/neofs-crypto` dependency Signed-off-by: Evgenii Stratonikov --- go.mod | 1 - pkg/core/object/fmt.go | 11 ++++++++-- pkg/core/object/fmt_test.go | 17 ++++++++------- pkg/services/object/acl/acl.go | 12 +++++----- pkg/services/object/acl/classifier.go | 23 ++++++++++++++------ pkg/services/object/acl/eacl/v2/eacl_test.go | 12 +++++----- pkg/services/session/storage/executor.go | 13 ++++------- 7 files changed, 51 insertions(+), 38 deletions(-) diff --git a/go.mod b/go.mod index c01cb2ab26..391d3b204c 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.1 github.com/nspcc-dev/neofs-api-go v1.27.1 - github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index 81a9e26508..e12aaed56f 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -2,15 +2,17 @@ package object import ( "bytes" + "crypto/ecdsa" + "crypto/elliptic" "errors" "fmt" "strconv" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" ) @@ -106,7 +108,12 @@ func (v *FormatValidator) validateSignatureKey(obj *Object) error { } func (v *FormatValidator) checkOwnerKey(id *owner.ID, key []byte) error { - wallet, err := owner.NEO3WalletFromPublicKey(crypto.UnmarshalPublicKey(key)) + pub, err := keys.NewPublicKeyFromBytes(key, elliptic.P256()) + if err != nil { + return err + } + + wallet, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(pub)) if err != nil { // TODO: check via NeoFSID return err diff --git a/pkg/core/object/fmt_test.go b/pkg/core/object/fmt_test.go index 2d41b1ed99..0fbb4ce5b7 100644 --- a/pkg/core/object/fmt_test.go +++ b/pkg/core/object/fmt_test.go @@ -8,13 +8,13 @@ import ( "strconv" "testing" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test" "github.com/nspcc-dev/neofs-api-go/pkg/storagegroup" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" - "github.com/nspcc-dev/neofs-node/pkg/util/test" "github.com/stretchr/testify/require" ) @@ -65,7 +65,8 @@ func TestFormatValidator_Validate(t *testing.T) { }), ) - ownerKey := test.DecodeKey(-1) + ownerKey, err := keys.NewPrivateKey() + require.NoError(t, err) t.Run("nil input", func(t *testing.T) { require.Error(t, v.Validate(nil)) @@ -93,7 +94,7 @@ func TestFormatValidator_Validate(t *testing.T) { }) t.Run("correct w/ session token", func(t *testing.T) { - w, err := owner.NEO3WalletFromPublicKey(&ownerKey.PublicKey) + w, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(ownerKey.PublicKey())) require.NoError(t, err) tok := sessiontest.Generate() @@ -104,15 +105,15 @@ func TestFormatValidator_Validate(t *testing.T) { obj.SetSessionToken(sessiontest.Generate()) obj.SetOwnerID(tok.OwnerID()) - require.NoError(t, object.SetIDWithSignature(ownerKey, obj.SDK())) + require.NoError(t, object.SetIDWithSignature(&ownerKey.PrivateKey, obj.SDK())) require.NoError(t, v.Validate(obj.Object())) }) t.Run("correct w/o session token", func(t *testing.T) { - obj := blankValidObject(t, ownerKey) + obj := blankValidObject(t, &ownerKey.PrivateKey) - require.NoError(t, object.SetIDWithSignature(ownerKey, obj.SDK())) + require.NoError(t, object.SetIDWithSignature(&ownerKey.PrivateKey, obj.SDK())) require.NoError(t, v.Validate(obj.Object())) }) @@ -187,7 +188,7 @@ func TestFormatValidator_Validate(t *testing.T) { t.Run("expiration", func(t *testing.T) { fn := func(val string) *Object { - obj := blankValidObject(t, ownerKey) + obj := blankValidObject(t, &ownerKey.PrivateKey) a := object.NewAttribute() a.SetKey(objectV2.SysAttributeExpEpoch) @@ -195,7 +196,7 @@ func TestFormatValidator_Validate(t *testing.T) { obj.SetAttributes(a) - require.NoError(t, object.SetIDWithSignature(ownerKey, obj.SDK())) + require.NoError(t, object.SetIDWithSignature(&ownerKey.PrivateKey, obj.SDK())) return obj.Object() } diff --git a/pkg/services/object/acl/acl.go b/pkg/services/object/acl/acl.go index 5765079ceb..da2da5a4d9 100644 --- a/pkg/services/object/acl/acl.go +++ b/pkg/services/object/acl/acl.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" acl "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" @@ -16,7 +17,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/refs" "github.com/nspcc-dev/neofs-api-go/v2/session" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - crypto "github.com/nspcc-dev/neofs-crypto" core "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -589,7 +589,7 @@ func stickyBitCheck(info requestInfo, owner *owner.ID) bool { return true } - requestSenderKey := crypto.UnmarshalPublicKey(info.senderKey) + requestSenderKey := unmarshalPublicKey(info.senderKey) return isOwnerFromKey(owner, requestSenderKey) } @@ -726,7 +726,7 @@ func isValidBearer(reqInfo requestInfo, st netmap.State) bool { } // 3. Then check if container owner signed this token. - tokenIssuerKey := crypto.UnmarshalPublicKey(token.GetSignature().GetKey()) + tokenIssuerKey := unmarshalPublicKey(token.GetSignature().GetKey()) if !isOwnerFromKey(reqInfo.cnrOwner, tokenIssuerKey) { // todo: in this case we can issue all owner keys from neofs.id and check once again return false @@ -735,7 +735,7 @@ func isValidBearer(reqInfo requestInfo, st netmap.State) bool { // 4. Then check if request sender has rights to use this token. tokenOwnerField := owner.NewIDFromV2(token.GetBody().GetOwnerID()) if tokenOwnerField != nil { // see bearer token owner field description - requestSenderKey := crypto.UnmarshalPublicKey(reqInfo.senderKey) + requestSenderKey := unmarshalPublicKey(reqInfo.senderKey) if !isOwnerFromKey(tokenOwnerField, requestSenderKey) { // todo: in this case we can issue all owner keys from neofs.id and check once again return false @@ -754,12 +754,12 @@ func isValidLifetime(lifetime *bearer.TokenLifetime, epoch uint64) bool { return epoch >= lifetime.GetNbf() && epoch <= lifetime.GetExp() } -func isOwnerFromKey(id *owner.ID, key *ecdsa.PublicKey) bool { +func isOwnerFromKey(id *owner.ID, key *keys.PublicKey) bool { if id == nil || key == nil { return false } - wallet, err := owner.NEO3WalletFromPublicKey(key) + wallet, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(key)) if err != nil { return false } diff --git a/pkg/services/object/acl/classifier.go b/pkg/services/object/acl/classifier.go index 574c6a9606..881ad06f85 100644 --- a/pkg/services/object/acl/classifier.go +++ b/pkg/services/object/acl/classifier.go @@ -3,8 +3,10 @@ package acl import ( "bytes" "crypto/ecdsa" + "crypto/elliptic" "fmt" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg" acl "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" "github.com/nspcc-dev/neofs-api-go/pkg/container" @@ -15,7 +17,6 @@ import ( bearer "github.com/nspcc-dev/neofs-api-go/v2/acl" "github.com/nspcc-dev/neofs-api-go/v2/session" v2signature "github.com/nspcc-dev/neofs-api-go/v2/signature" - crypto "github.com/nspcc-dev/neofs-crypto" core "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "go.uber.org/zap" ) @@ -61,7 +62,7 @@ func (c SenderClassifier) Classify( return 0, false, nil, err } - ownerKeyInBytes := crypto.MarshalPublicKey(ownerKey) + ownerKeyInBytes := ownerKey.Bytes() // todo: get owner from neofs.id if present @@ -94,7 +95,7 @@ func (c SenderClassifier) Classify( return acl.RoleOthers, false, ownerKeyInBytes, nil } -func requestOwner(req metaWithToken) (*owner.ID, *ecdsa.PublicKey, error) { +func requestOwner(req metaWithToken) (*owner.ID, *keys.PublicKey, error) { if req.vheader == nil { return nil, nil, fmt.Errorf("%w: nil verification header", ErrMalformedRequest) } @@ -111,8 +112,8 @@ func requestOwner(req metaWithToken) (*owner.ID, *ecdsa.PublicKey, error) { return nil, nil, fmt.Errorf("%w: nil at body signature", ErrMalformedRequest) } - key := crypto.UnmarshalPublicKey(bodySignature.Key()) - neo3wallet, err := owner.NEO3WalletFromPublicKey(key) + key := unmarshalPublicKey(bodySignature.Key()) + neo3wallet, err := owner.NEO3WalletFromPublicKey((*ecdsa.PublicKey)(key)) if err != nil { return nil, nil, fmt.Errorf("can't create neo3 wallet: %w", err) } @@ -196,7 +197,7 @@ func lookupKeyInContainer( return false, nil } -func ownerFromToken(token *session.SessionToken) (*owner.ID, *ecdsa.PublicKey, error) { +func ownerFromToken(token *session.SessionToken) (*owner.ID, *keys.PublicKey, error) { // 1. First check signature of session token. signWrapper := v2signature.StableMarshalerWrapper{SM: token.GetBody()} if err := signature.VerifyDataWithSource(signWrapper, func() (key, sig []byte) { @@ -207,7 +208,7 @@ func ownerFromToken(token *session.SessionToken) (*owner.ID, *ecdsa.PublicKey, e } // 2. Then check if session token owner issued the session token - tokenIssuerKey := crypto.UnmarshalPublicKey(token.GetSignature().GetKey()) + tokenIssuerKey := unmarshalPublicKey(token.GetSignature().GetKey()) tokenOwner := owner.NewIDFromV2(token.GetBody().GetOwnerID()) if !isOwnerFromKey(tokenOwner, tokenIssuerKey) { @@ -217,3 +218,11 @@ func ownerFromToken(token *session.SessionToken) (*owner.ID, *ecdsa.PublicKey, e return tokenOwner, tokenIssuerKey, nil } + +func unmarshalPublicKey(bs []byte) *keys.PublicKey { + pub, err := keys.NewPublicKeyFromBytes(bs, elliptic.P256()) + if err != nil { + return nil + } + return pub +} diff --git a/pkg/services/object/acl/eacl/v2/eacl_test.go b/pkg/services/object/acl/eacl/v2/eacl_test.go index 75827a5fa9..6c16e784ab 100644 --- a/pkg/services/object/acl/eacl/v2/eacl_test.go +++ b/pkg/services/object/acl/eacl/v2/eacl_test.go @@ -1,20 +1,20 @@ package v2 import ( + "crypto/ecdsa" "crypto/rand" "crypto/sha256" "testing" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/session" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/core/object" eacl2 "github.com/nspcc-dev/neofs-node/pkg/services/object/acl/eacl" - "github.com/nspcc-dev/neofs-node/pkg/util/test" "github.com/stretchr/testify/require" ) @@ -111,14 +111,16 @@ func TestHeadRequest(t *testing.T) { table := new(eacl.Table) - senderKey := test.DecodeKey(-1).PublicKey + priv, err := keys.NewPrivateKey() + require.NoError(t, err) + senderKey := priv.PublicKey() r := eacl.NewRecord() r.SetOperation(eacl.OperationHead) r.SetAction(eacl.ActionDeny) r.AddFilter(eacl.HeaderFromObject, eacl.MatchStringEqual, attrKey, attrVal) r.AddFilter(eacl.HeaderFromRequest, eacl.MatchStringEqual, xKey, xVal) - eacl.AddFormedTarget(r, eacl.RoleUnknown, senderKey) + eacl.AddFormedTarget(r, eacl.RoleUnknown, (ecdsa.PublicKey)(*senderKey)) table.AddRecord(r) @@ -132,7 +134,7 @@ func TestHeadRequest(t *testing.T) { unit := new(eacl2.ValidationUnit). WithContainerID(cid). WithOperation(eacl.OperationHead). - WithSenderKey(crypto.MarshalPublicKey(&senderKey)). + WithSenderKey(senderKey.Bytes()). WithHeaderSource( NewMessageHeaderSource( WithObjectStorage(lStorage), diff --git a/pkg/services/session/storage/executor.go b/pkg/services/session/storage/executor.go index fc152f2886..ebb7af7c08 100644 --- a/pkg/services/session/storage/executor.go +++ b/pkg/services/session/storage/executor.go @@ -2,16 +2,13 @@ package storage import ( "context" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" "fmt" "github.com/google/uuid" "github.com/mr-tron/base58" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/v2/session" - crypto "github.com/nspcc-dev/neofs-crypto" ) func (s *TokenStore) Create(ctx context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error) { @@ -30,7 +27,7 @@ func (s *TokenStore) Create(ctx context.Context, body *session.CreateRequestBody return nil, fmt.Errorf("could not marshal token ID: %w", err) } - sk, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + sk, err := keys.NewPrivateKey() if err != nil { return nil, err } @@ -40,16 +37,14 @@ func (s *TokenStore) Create(ctx context.Context, body *session.CreateRequestBody tokenID: base58.Encode(uidBytes), ownerID: base58.Encode(ownerBytes), }] = &PrivateToken{ - sessionKey: sk, + sessionKey: &sk.PrivateKey, exp: body.GetExpiration(), } s.mtx.Unlock() res := new(session.CreateResponseBody) res.SetID(uidBytes) - res.SetSessionKey( - crypto.MarshalPublicKey(&sk.PublicKey), - ) + res.SetSessionKey(sk.PublicKey().Bytes()) return res, nil } From 2f020a500d213724ddc066e8954fe7709f56651a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 3 Jun 2021 18:24:09 +0300 Subject: [PATCH 026/219] [#562] config: parse key on config load Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/config/node/config.go | 19 +++++++++++++++---- cmd/neofs-node/config/node/config_test.go | 2 +- cmd/neofs-node/config/node/wallet.key | 1 + config/example/node.env | 2 +- config/example/node.json | 2 +- config/example/node.yaml | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 cmd/neofs-node/config/node/wallet.key diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index 3c72509238..1883ce1c8f 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -3,6 +3,7 @@ package nodeconfig import ( "errors" "fmt" + "io/ioutil" "strconv" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -26,16 +27,26 @@ var ( // from "node" section. // // Panics if value is not a non-empty string. -func Key(c *config.Config) string { +func Key(c *config.Config) *keys.PrivateKey { v := config.StringSafe(c.Sub(subsection), "key") if v == "" { panic(errKeyNotSet) } - // TODO: add string -> `ecdsa.PrivateKey` parsing logic - // after https://github.com/nspcc-dev/neofs-node/pull/569. + var ( + key *keys.PrivateKey + err error + data []byte + ) + if data, err = ioutil.ReadFile(v); err == nil { + key, err = keys.NewPrivateKeyFromBytes(data) + } + + if err != nil { + panic(fmt.Errorf("can't read key: %w", err)) + } - return v + return key } // Wallet returns value of node private key from "node" section. diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index 041c6ef4fe..d5335bbdec 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -49,7 +49,7 @@ func TestNodeSection(t *testing.T) { expectedAddr, err := network.AddressFromString("s01.neofs.devenv:8080") require.NoError(t, err) - require.Equal(t, "path/hex/WIF", key) + require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address()) require.Equal(t, true, addr.Equal(expectedAddr)) require.Equal(t, true, relay) diff --git a/cmd/neofs-node/config/node/wallet.key b/cmd/neofs-node/config/node/wallet.key new file mode 100644 index 0000000000..ba2021bd52 --- /dev/null +++ b/cmd/neofs-node/config/node/wallet.key @@ -0,0 +1 @@ +?ܳv/l \ No newline at end of file diff --git a/config/example/node.env b/config/example/node.env index 4243283761..9e492ffd82 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -7,7 +7,7 @@ NEOFS_METRICS_ADDRESS=127.0.0.1:9090 NEOFS_METRICS_SHUTDOWN_TIMEOUT=15s # Node section -NEOFS_NODE_KEY=path/hex/WIF +NEOFS_NODE_KEY=./wallet.key NEOFS_NODE_WALLET_PATH=./wallet.json NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz NEOFS_NODE_WALLET_PASSWORD=password diff --git a/config/example/node.json b/config/example/node.json index 646ccea5e3..c5fa0ee771 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -11,7 +11,7 @@ "shutdown_timeout": "15s" }, "node": { - "key": "path/hex/WIF", + "key": "./wallet.key", "wallet": { "path": "./wallet.json", "address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz", diff --git a/config/example/node.yaml b/config/example/node.yaml index 59b01a9fd7..65e0a3d9f9 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -10,7 +10,7 @@ metrics: shutdown_timeout: 15s node: - key: path/hex/WIF + key: ./wallet.key wallet: path: "./wallet.json" address: "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz" From 41a30d6ec298d8f2dc5dc53a487d872b55282ba7 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 4 Jun 2021 14:02:22 +0300 Subject: [PATCH 027/219] [#562] config/node: fallback to wallet if raw key is invalid Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/config.go | 2 +- cmd/neofs-node/config/node/config.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index b721ddbcf9..179a11048a 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -208,7 +208,7 @@ func initCfg(path string) *cfg { config.WithConfigFile(path), ) - key := nodeconfig.Wallet(appCfg) + key := nodeconfig.Key(appCfg) var logPrm logger.Prm diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index 1883ce1c8f..d794ba02b4 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -43,7 +43,7 @@ func Key(c *config.Config) *keys.PrivateKey { } if err != nil { - panic(fmt.Errorf("can't read key: %w", err)) + return Wallet(c) } return key From 93803b1a90309c9619edef71598407be56812487 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:37:03 +0300 Subject: [PATCH 028/219] [#414] ir: Define Control service Define `ControlService` for IR similar to the one from storage node. Add `HealthStatus` RPC which returns health status of the IR application. Implement getters, setters and methods to sign/verify the messages. Signed-off-by: Leonard Lyubich --- pkg/services/control/ir/convert.go | 34 ++ pkg/services/control/ir/rpc.go | 34 ++ pkg/services/control/ir/service.go | 148 ++++++++ pkg/services/control/ir/service.pb.go | 472 ++++++++++++++++++++++++ pkg/services/control/ir/service.proto | 43 +++ pkg/services/control/ir/service_test.go | 47 +++ pkg/services/control/ir/types.go | 15 + pkg/services/control/ir/types.pb.go | 229 ++++++++++++ pkg/services/control/ir/types.proto | 29 ++ 9 files changed, 1051 insertions(+) create mode 100644 pkg/services/control/ir/convert.go create mode 100644 pkg/services/control/ir/rpc.go create mode 100644 pkg/services/control/ir/service.go create mode 100644 pkg/services/control/ir/service.pb.go create mode 100644 pkg/services/control/ir/service.proto create mode 100644 pkg/services/control/ir/service_test.go create mode 100644 pkg/services/control/ir/types.go create mode 100644 pkg/services/control/ir/types.pb.go create mode 100644 pkg/services/control/ir/types.proto diff --git a/pkg/services/control/ir/convert.go b/pkg/services/control/ir/convert.go new file mode 100644 index 0000000000..3536951f42 --- /dev/null +++ b/pkg/services/control/ir/convert.go @@ -0,0 +1,34 @@ +package control + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/grpc" + "github.com/nspcc-dev/neofs-api-go/rpc/message" +) + +type requestWrapper struct { + message.Message + m grpc.Message +} + +func (w *requestWrapper) ToGRPCMessage() grpc.Message { + return w.m +} + +type healthCheckResponseWrapper struct { + m *HealthCheckResponse +} + +func (w *healthCheckResponseWrapper) ToGRPCMessage() grpc.Message { + return w.m +} + +func (w *healthCheckResponseWrapper) FromGRPCMessage(m grpc.Message) error { + var ok bool + + w.m, ok = m.(*HealthCheckResponse) + if !ok { + return message.NewUnexpectedMessageType(m, w.m) + } + + return nil +} diff --git a/pkg/services/control/ir/rpc.go b/pkg/services/control/ir/rpc.go new file mode 100644 index 0000000000..8ed7cf44e4 --- /dev/null +++ b/pkg/services/control/ir/rpc.go @@ -0,0 +1,34 @@ +package control + +import ( + "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-api-go/rpc/common" +) + +const serviceName = "ircontrol.ControlService" + +const ( + rpcHealthCheck = "HealthCheck" +) + +// HealthCheck executes ControlService.HealthCheck RPC. +func HealthCheck( + cli *client.Client, + req *HealthCheckRequest, + opts ...client.CallOption, +) (*HealthCheckResponse, error) { + wResp := &healthCheckResponseWrapper{ + m: new(HealthCheckResponse), + } + + wReq := &requestWrapper{ + m: req, + } + + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcHealthCheck), wReq, wResp, opts...) + if err != nil { + return nil, err + } + + return wResp.m, nil +} diff --git a/pkg/services/control/ir/service.go b/pkg/services/control/ir/service.go new file mode 100644 index 0000000000..8f7705c986 --- /dev/null +++ b/pkg/services/control/ir/service.go @@ -0,0 +1,148 @@ +package control + +import ( + "github.com/nspcc-dev/neofs-api-go/util/proto" +) + +// StableMarshal reads binary representation of health check request body +// in protobuf binary format. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthCheckRequest_Body) StableMarshal(buf []byte) ([]byte, error) { + return buf, nil +} + +// StableSize returns binary size of health check request body +// in protobuf binary format. +// +// Structures with the same field values have the same binary size. +func (x *HealthCheckRequest_Body) StableSize() int { + return 0 +} + +// SetBody sets health check request body. +func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) { + if x != nil { + x.Body = v + } +} + +// SetSignature sets signature of the health check request body. +func (x *HealthCheckRequest) SetSignature(body *Signature) { + if x != nil { + x.Signature = body + } +} + +// ReadSignedData reads signed data of health check request to buf. +// +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf) +} + +// SignedDataSize returns binary size of the signed data +// of health check request. +// +// Structures with the same field values have the same signed data size. +func (x *HealthCheckRequest) SignedDataSize() int { + return x.GetBody().StableSize() +} + +// SetHealthStatus sets health status of the IR application. +func (x *HealthCheckResponse_Body) SetHealthStatus(v HealthStatus) { + if x != nil { + x.HealthStatus = v + } +} + +const ( + _ = iota + healthRespBodyHealthStatusFNum +) + +// StableMarshal reads binary representation of health check response body +// in protobuf binary format. +// +// If buffer length is less than x.StableSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same binary format. +func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) ([]byte, error) { + if x == nil { + return []byte{}, nil + } + + if sz := x.StableSize(); len(buf) < sz { + buf = make([]byte, sz) + } + + _, err := proto.EnumMarshal(healthRespBodyHealthStatusFNum, buf, int32(x.HealthStatus)) + if err != nil { + return nil, err + } + + return buf, nil +} + +// StableSize returns binary size of health check response body +// in protobuf binary format. +// +// Structures with the same field values have the same binary size. +func (x *HealthCheckResponse_Body) StableSize() int { + if x == nil { + return 0 + } + + size := 0 + + size += proto.EnumSize(healthRespBodyHealthStatusFNum, int32(x.HealthStatus)) + + return size +} + +// SetBody sets health check response body. +func (x *HealthCheckResponse) SetBody(v *HealthCheckResponse_Body) { + if x != nil { + x.Body = v + } +} + +// SetSignature sets signature of the health check response body. +func (x *HealthCheckResponse) SetSignature(v *Signature) { + if x != nil { + x.Signature = v + } +} + +// ReadSignedData reads signed data of health check response to buf. +// +// If buffer length is less than x.SignedDataSize(), new buffer is allocated. +// +// Returns any error encountered which did not allow writing the data completely. +// Otherwise, returns the buffer in which the data is written. +// +// Structures with the same field values have the same signed data. +func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) { + return x.GetBody().StableMarshal(buf) +} + +// SignedDataSize returns binary size of the signed data +// of health check response. +// +// Structures with the same field values have the same signed data size. +func (x *HealthCheckResponse) SignedDataSize() int { + return x.GetBody().StableSize() +} diff --git a/pkg/services/control/ir/service.pb.go b/pkg/services/control/ir/service.pb.go new file mode 100644 index 0000000000..0b60effb89 --- /dev/null +++ b/pkg/services/control/ir/service.pb.go @@ -0,0 +1,472 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: pkg/services/control/ir/service.proto + +package control + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Health check request. +type HealthCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of health check request message. + Body *HealthCheckRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Body signature. + // Should be signed by node key or one of + // the keys configured by the node. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *HealthCheckRequest) Reset() { + *x = HealthCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckRequest) ProtoMessage() {} + +func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return file_pkg_services_control_ir_service_proto_rawDescGZIP(), []int{0} +} + +func (x *HealthCheckRequest) GetBody() *HealthCheckRequest_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HealthCheckRequest) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +// Health check response. +type HealthCheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Body of health check response message. + Body *HealthCheckResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Body signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *HealthCheckResponse) Reset() { + *x = HealthCheckResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse) ProtoMessage() {} + +func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return file_pkg_services_control_ir_service_proto_rawDescGZIP(), []int{1} +} + +func (x *HealthCheckResponse) GetBody() *HealthCheckResponse_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *HealthCheckResponse) GetSignature() *Signature { + if x != nil { + return x.Signature + } + return nil +} + +// Health check request body. +type HealthCheckRequest_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HealthCheckRequest_Body) Reset() { + *x = HealthCheckRequest_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckRequest_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckRequest_Body) ProtoMessage() {} + +func (x *HealthCheckRequest_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckRequest_Body.ProtoReflect.Descriptor instead. +func (*HealthCheckRequest_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_control_ir_service_proto_rawDescGZIP(), []int{0, 0} +} + +// Health check response body +type HealthCheckResponse_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Health status of IR node application. + HealthStatus HealthStatus `protobuf:"varint,1,opt,name=health_status,json=healthStatus,proto3,enum=ircontrol.HealthStatus" json:"health_status,omitempty"` +} + +func (x *HealthCheckResponse_Body) Reset() { + *x = HealthCheckResponse_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckResponse_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse_Body) ProtoMessage() {} + +func (x *HealthCheckResponse_Body) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_control_ir_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse_Body.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse_Body) Descriptor() ([]byte, []int) { + return file_pkg_services_control_ir_service_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *HealthCheckResponse_Body) GetHealthStatus() HealthStatus { + if x != nil { + return x.HealthStatus + } + return HealthStatus_HEALTH_STATUS_UNDEFINED +} + +var File_pkg_services_control_ir_service_proto protoreflect.FileDescriptor + +var file_pkg_services_control_ir_service_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x69, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x1a, 0x23, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x69, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x69, + 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, + 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x72, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, + 0x64, 0x79, 0x22, 0xc8, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x69, 0x72, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, + 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x44, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, + 0x3c, 0x0a, 0x0d, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x5e, 0x0a, + 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x4c, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1d, + 0x2e, 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x39, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x69, 0x72, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_services_control_ir_service_proto_rawDescOnce sync.Once + file_pkg_services_control_ir_service_proto_rawDescData = file_pkg_services_control_ir_service_proto_rawDesc +) + +func file_pkg_services_control_ir_service_proto_rawDescGZIP() []byte { + file_pkg_services_control_ir_service_proto_rawDescOnce.Do(func() { + file_pkg_services_control_ir_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_services_control_ir_service_proto_rawDescData) + }) + return file_pkg_services_control_ir_service_proto_rawDescData +} + +var file_pkg_services_control_ir_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_pkg_services_control_ir_service_proto_goTypes = []interface{}{ + (*HealthCheckRequest)(nil), // 0: ircontrol.HealthCheckRequest + (*HealthCheckResponse)(nil), // 1: ircontrol.HealthCheckResponse + (*HealthCheckRequest_Body)(nil), // 2: ircontrol.HealthCheckRequest.Body + (*HealthCheckResponse_Body)(nil), // 3: ircontrol.HealthCheckResponse.Body + (*Signature)(nil), // 4: ircontrol.Signature + (HealthStatus)(0), // 5: ircontrol.HealthStatus +} +var file_pkg_services_control_ir_service_proto_depIdxs = []int32{ + 2, // 0: ircontrol.HealthCheckRequest.body:type_name -> ircontrol.HealthCheckRequest.Body + 4, // 1: ircontrol.HealthCheckRequest.signature:type_name -> ircontrol.Signature + 3, // 2: ircontrol.HealthCheckResponse.body:type_name -> ircontrol.HealthCheckResponse.Body + 4, // 3: ircontrol.HealthCheckResponse.signature:type_name -> ircontrol.Signature + 5, // 4: ircontrol.HealthCheckResponse.Body.health_status:type_name -> ircontrol.HealthStatus + 0, // 5: ircontrol.ControlService.HealthCheck:input_type -> ircontrol.HealthCheckRequest + 1, // 6: ircontrol.ControlService.HealthCheck:output_type -> ircontrol.HealthCheckResponse + 6, // [6:7] is the sub-list for method output_type + 5, // [5:6] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_pkg_services_control_ir_service_proto_init() } +func file_pkg_services_control_ir_service_proto_init() { + if File_pkg_services_control_ir_service_proto != nil { + return + } + file_pkg_services_control_ir_types_proto_init() + if !protoimpl.UnsafeEnabled { + file_pkg_services_control_ir_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_control_ir_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_control_ir_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckRequest_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_services_control_ir_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckResponse_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_services_control_ir_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_services_control_ir_service_proto_goTypes, + DependencyIndexes: file_pkg_services_control_ir_service_proto_depIdxs, + MessageInfos: file_pkg_services_control_ir_service_proto_msgTypes, + }.Build() + File_pkg_services_control_ir_service_proto = out.File + file_pkg_services_control_ir_service_proto_rawDesc = nil + file_pkg_services_control_ir_service_proto_goTypes = nil + file_pkg_services_control_ir_service_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ControlServiceClient is the client API for ControlService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ControlServiceClient interface { + // Performs health check of the IR node. + HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) +} + +type controlServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewControlServiceClient(cc grpc.ClientConnInterface) ControlServiceClient { + return &controlServiceClient{cc} +} + +func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + out := new(HealthCheckResponse) + err := c.cc.Invoke(ctx, "/ircontrol.ControlService/HealthCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ControlServiceServer is the server API for ControlService service. +type ControlServiceServer interface { + // Performs health check of the IR node. + HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) +} + +// UnimplementedControlServiceServer can be embedded to have forward compatible implementations. +type UnimplementedControlServiceServer struct { +} + +func (*UnimplementedControlServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") +} + +func RegisterControlServiceServer(s *grpc.Server, srv ControlServiceServer) { + s.RegisterService(&_ControlService_serviceDesc, srv) +} + +func _ControlService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServiceServer).HealthCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ircontrol.ControlService/HealthCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ControlService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "ircontrol.ControlService", + HandlerType: (*ControlServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "HealthCheck", + Handler: _ControlService_HealthCheck_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "pkg/services/control/ir/service.proto", +} diff --git a/pkg/services/control/ir/service.proto b/pkg/services/control/ir/service.proto new file mode 100644 index 0000000000..e330d0fcfa --- /dev/null +++ b/pkg/services/control/ir/service.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package ircontrol; + +import "pkg/services/control/ir/types.proto"; + +option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/ir/control"; + +// `ControlService` provides an interface for internal work with the Inner Ring node. +service ControlService { + // Performs health check of the IR node. + rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse); +} + +// Health check request. +message HealthCheckRequest { + // Health check request body. + message Body { + } + + // Body of health check request message. + Body body = 1; + + // Body signature. + // Should be signed by node key or one of + // the keys configured by the node. + Signature signature = 2; +} + +// Health check response. +message HealthCheckResponse { + // Health check response body + message Body { + // Health status of IR node application. + HealthStatus health_status = 1; + } + + // Body of health check response message. + Body body = 1; + + // Body signature. + Signature signature = 2; +} diff --git a/pkg/services/control/ir/service_test.go b/pkg/services/control/ir/service_test.go new file mode 100644 index 0000000000..9958e0a561 --- /dev/null +++ b/pkg/services/control/ir/service_test.go @@ -0,0 +1,47 @@ +package control_test + +import ( + "testing" + + control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" +) + +type protoMessage interface { + StableMarshal([]byte) ([]byte, error) + proto.Message +} + +func testStableMarshal(t *testing.T, m1, m2 protoMessage, cmp func(m1, m2 protoMessage) bool) { + data, err := m1.StableMarshal(nil) + require.NoError(t, err) + + require.NoError(t, proto.Unmarshal(data, m2)) + + require.True(t, cmp(m1, m2)) +} + +func TestHealthCheckResponse_Body_StableMarshal(t *testing.T) { + testStableMarshal(t, + generateHealthCheckResponseBody(), + new(control.HealthCheckResponse_Body), + func(m1, m2 protoMessage) bool { + return equalHealthCheckResponseBodies( + m1.(*control.HealthCheckResponse_Body), + m2.(*control.HealthCheckResponse_Body), + ) + }, + ) +} + +func generateHealthCheckResponseBody() *control.HealthCheckResponse_Body { + body := new(control.HealthCheckResponse_Body) + body.SetHealthStatus(control.HealthStatus_SHUTTING_DOWN) + + return body +} + +func equalHealthCheckResponseBodies(b1, b2 *control.HealthCheckResponse_Body) bool { + return b1.GetHealthStatus() == b2.GetHealthStatus() +} diff --git a/pkg/services/control/ir/types.go b/pkg/services/control/ir/types.go new file mode 100644 index 0000000000..97ffd3ce33 --- /dev/null +++ b/pkg/services/control/ir/types.go @@ -0,0 +1,15 @@ +package control + +// SetKey sets public key used for signing. +func (x *Signature) SetKey(v []byte) { + if x != nil { + x.Key = v + } +} + +// SetSign sets binary signature. +func (x *Signature) SetSign(v []byte) { + if x != nil { + x.Sign = v + } +} diff --git a/pkg/services/control/ir/types.pb.go b/pkg/services/control/ir/types.pb.go new file mode 100644 index 0000000000..07daaef73c --- /dev/null +++ b/pkg/services/control/ir/types.pb.go @@ -0,0 +1,229 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: pkg/services/control/ir/types.proto + +package control + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Health status of the IR application. +type HealthStatus int32 + +const ( + // Undefined status, default value. + HealthStatus_HEALTH_STATUS_UNDEFINED HealthStatus = 0 + // IR application is starting. + HealthStatus_STARTING HealthStatus = 1 + // IR application is started and serves all services. + HealthStatus_READY HealthStatus = 2 + // IR application is shutting down. + HealthStatus_SHUTTING_DOWN HealthStatus = 3 +) + +// Enum value maps for HealthStatus. +var ( + HealthStatus_name = map[int32]string{ + 0: "HEALTH_STATUS_UNDEFINED", + 1: "STARTING", + 2: "READY", + 3: "SHUTTING_DOWN", + } + HealthStatus_value = map[string]int32{ + "HEALTH_STATUS_UNDEFINED": 0, + "STARTING": 1, + "READY": 2, + "SHUTTING_DOWN": 3, + } +) + +func (x HealthStatus) Enum() *HealthStatus { + p := new(HealthStatus) + *p = x + return p +} + +func (x HealthStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HealthStatus) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_services_control_ir_types_proto_enumTypes[0].Descriptor() +} + +func (HealthStatus) Type() protoreflect.EnumType { + return &file_pkg_services_control_ir_types_proto_enumTypes[0] +} + +func (x HealthStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HealthStatus.Descriptor instead. +func (HealthStatus) EnumDescriptor() ([]byte, []int) { + return file_pkg_services_control_ir_types_proto_rawDescGZIP(), []int{0} +} + +// Signature of some message. +type Signature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Public key used for signing. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Binary signature. + Sign []byte `protobuf:"bytes,2,opt,name=sign,json=signature,proto3" json:"sign,omitempty"` +} + +func (x *Signature) Reset() { + *x = Signature{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_services_control_ir_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Signature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Signature) ProtoMessage() {} + +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_pkg_services_control_ir_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Signature.ProtoReflect.Descriptor instead. +func (*Signature) Descriptor() ([]byte, []int) { + return file_pkg_services_control_ir_types_proto_rawDescGZIP(), []int{0} +} + +func (x *Signature) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *Signature) GetSign() []byte { + if x != nil { + return x.Sign + } + return nil +} + +var File_pkg_services_control_ir_types_proto protoreflect.FileDescriptor + +var file_pkg_services_control_ir_types_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x69, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x69, 0x72, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x22, 0x36, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2a, 0x57, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x45, 0x41, 0x4c, + 0x54, 0x48, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, + 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, + 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, 0x12, 0x11, + 0x0a, 0x0d, 0x53, 0x48, 0x55, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, + 0x03, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, + 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x69, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_services_control_ir_types_proto_rawDescOnce sync.Once + file_pkg_services_control_ir_types_proto_rawDescData = file_pkg_services_control_ir_types_proto_rawDesc +) + +func file_pkg_services_control_ir_types_proto_rawDescGZIP() []byte { + file_pkg_services_control_ir_types_proto_rawDescOnce.Do(func() { + file_pkg_services_control_ir_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_services_control_ir_types_proto_rawDescData) + }) + return file_pkg_services_control_ir_types_proto_rawDescData +} + +var file_pkg_services_control_ir_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_pkg_services_control_ir_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pkg_services_control_ir_types_proto_goTypes = []interface{}{ + (HealthStatus)(0), // 0: ircontrol.HealthStatus + (*Signature)(nil), // 1: ircontrol.Signature +} +var file_pkg_services_control_ir_types_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_pkg_services_control_ir_types_proto_init() } +func file_pkg_services_control_ir_types_proto_init() { + if File_pkg_services_control_ir_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_services_control_ir_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Signature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_services_control_ir_types_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pkg_services_control_ir_types_proto_goTypes, + DependencyIndexes: file_pkg_services_control_ir_types_proto_depIdxs, + EnumInfos: file_pkg_services_control_ir_types_proto_enumTypes, + MessageInfos: file_pkg_services_control_ir_types_proto_msgTypes, + }.Build() + File_pkg_services_control_ir_types_proto = out.File + file_pkg_services_control_ir_types_proto_rawDesc = nil + file_pkg_services_control_ir_types_proto_goTypes = nil + file_pkg_services_control_ir_types_proto_depIdxs = nil +} diff --git a/pkg/services/control/ir/types.proto b/pkg/services/control/ir/types.proto new file mode 100644 index 0000000000..3a77918741 --- /dev/null +++ b/pkg/services/control/ir/types.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package ircontrol; + +option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/ir/control"; + +// Signature of some message. +message Signature { + // Public key used for signing. + bytes key = 1 [json_name = "key"]; + + // Binary signature. + bytes sign = 2 [json_name = "signature"]; +} + +// Health status of the IR application. +enum HealthStatus { + // Undefined status, default value. + HEALTH_STATUS_UNDEFINED = 0; + + // IR application is starting. + STARTING = 1; + + // IR application is started and serves all services. + READY = 2; + + // IR application is shutting down. + SHUTTING_DOWN = 3; +} From dcfe9a6504a40a718e490a7f4ed5dca8a077041e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:40:02 +0300 Subject: [PATCH 029/219] [#414] ir/control: Implement service server Implement `ControlServiceServer` on `Server` type. The `Server` requires all requests to be signed with keys from the so-called whitelist. To obtain health status, it uses the abstraction in the form of `HealthChecker` interface. Signed-off-by: Leonard Lyubich --- pkg/services/control/ir/server/calls.go | 34 +++++++++++++++ pkg/services/control/ir/server/deps.go | 13 ++++++ pkg/services/control/ir/server/opts.go | 20 +++++++++ pkg/services/control/ir/server/prm.go | 24 +++++++++++ pkg/services/control/ir/server/server.go | 55 ++++++++++++++++++++++++ pkg/services/control/ir/server/sign.go | 54 +++++++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 pkg/services/control/ir/server/calls.go create mode 100644 pkg/services/control/ir/server/deps.go create mode 100644 pkg/services/control/ir/server/opts.go create mode 100644 pkg/services/control/ir/server/prm.go create mode 100644 pkg/services/control/ir/server/server.go create mode 100644 pkg/services/control/ir/server/sign.go diff --git a/pkg/services/control/ir/server/calls.go b/pkg/services/control/ir/server/calls.go new file mode 100644 index 0000000000..11dbe851b6 --- /dev/null +++ b/pkg/services/control/ir/server/calls.go @@ -0,0 +1,34 @@ +package control + +import ( + "context" + + control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// HealthCheck returns health status of the local IR node. +// +// If request is not signed with a key from white list, permission error returns. +func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error) { + // verify request + if err := s.isValidRequest(req); err != nil { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + + // create and fill response + resp := new(control.HealthCheckResponse) + + body := new(control.HealthCheckResponse_Body) + resp.SetBody(body) + + body.SetHealthStatus(s.prm.healthChecker.HealthStatus()) + + // sign the response + if err := SignMessage(s.prm.key, resp); err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return resp, nil +} diff --git a/pkg/services/control/ir/server/deps.go b/pkg/services/control/ir/server/deps.go new file mode 100644 index 0000000000..2fdc6751f1 --- /dev/null +++ b/pkg/services/control/ir/server/deps.go @@ -0,0 +1,13 @@ +package control + +import control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" + +// HealthChecker is component interface for calculating +// the current health status of a node. +type HealthChecker interface { + // Must calculate and return current health status of the IR application. + // + // If status can not be calculated for any reason, + // control.HealthStatus_HEALTH_STATUS_UNDEFINED should be returned. + HealthStatus() control.HealthStatus +} diff --git a/pkg/services/control/ir/server/opts.go b/pkg/services/control/ir/server/opts.go new file mode 100644 index 0000000000..40bdccb67e --- /dev/null +++ b/pkg/services/control/ir/server/opts.go @@ -0,0 +1,20 @@ +package control + +// Option specifies Server's optional parameter. +type Option func(*options) + +type options struct { + allowedKeys [][]byte +} + +func defaultOptions() *options { + return new(options) +} + +// WithAllowedKeys returns option to add public keys +// to white list of the Control service. +func WithAllowedKeys(keys [][]byte) Option { + return func(o *options) { + o.allowedKeys = append(o.allowedKeys, keys...) + } +} diff --git a/pkg/services/control/ir/server/prm.go b/pkg/services/control/ir/server/prm.go new file mode 100644 index 0000000000..a73a00c766 --- /dev/null +++ b/pkg/services/control/ir/server/prm.go @@ -0,0 +1,24 @@ +package control + +import ( + "crypto/ecdsa" +) + +// Prm groups required parameters of +// Server's constructor. +type Prm struct { + key *ecdsa.PrivateKey + + healthChecker HealthChecker +} + +// SetPrivateKey sets private key to sign responses. +func (x *Prm) SetPrivateKey(key *ecdsa.PrivateKey) { + x.key = key +} + +// SetHealthChecker sets HealthChecker to calculate +// health status. +func (x *Prm) SetHealthChecker(hc HealthChecker) { + x.healthChecker = hc +} diff --git a/pkg/services/control/ir/server/server.go b/pkg/services/control/ir/server/server.go new file mode 100644 index 0000000000..b22982b5b9 --- /dev/null +++ b/pkg/services/control/ir/server/server.go @@ -0,0 +1,55 @@ +package control + +import ( + "fmt" + + crypto "github.com/nspcc-dev/neofs-crypto" +) + +// Server is an entity that serves +// Control service on IR node. +// +// To gain access to the service, any request must be +// signed with a key from the white list. +type Server struct { + prm Prm + + allowedKeys [][]byte +} + +func panicOnPrmValue(n string, v interface{}) { + const invalidPrmValFmt = "invalid %s parameter (%T): %v" + panic(fmt.Sprintf(invalidPrmValFmt, n, v, v)) +} + +// New creates a new instance of the Server. +// +// Panics if: +// - parameterized private key is nil; +// - parameterized HealthChecker is nil. +// +// Forms white list from all keys specified via +// WithAllowedKeys option and a public key of +// the parameterized private key. +func New(prm Prm, opts ...Option) *Server { + // verify required parameters + switch { + case prm.key == nil: + panicOnPrmValue("key", prm.key) + case prm.healthChecker == nil: + panicOnPrmValue("health checker", prm.healthChecker) + } + + // compute optional parameters + o := defaultOptions() + + for _, opt := range opts { + opt(o) + } + + return &Server{ + prm: prm, + + allowedKeys: append(o.allowedKeys, crypto.MarshalPublicKey(&prm.key.PublicKey)), + } +} diff --git a/pkg/services/control/ir/server/sign.go b/pkg/services/control/ir/server/sign.go new file mode 100644 index 0000000000..4b94b7eed4 --- /dev/null +++ b/pkg/services/control/ir/server/sign.go @@ -0,0 +1,54 @@ +package control + +import ( + "bytes" + "crypto/ecdsa" + "errors" + + "github.com/nspcc-dev/neofs-api-go/util/signature" + control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" +) + +// SignedMessage is an interface of Control service message. +type SignedMessage interface { + signature.DataSource + GetSignature() *control.Signature + SetSignature(*control.Signature) +} + +var errDisallowedKey = errors.New("key is not in the allowed list") + +func (s *Server) isValidRequest(req SignedMessage) error { + var ( + sign = req.GetSignature() + key = sign.GetKey() + allowed = false + ) + + // check if key is allowed + for i := range s.allowedKeys { + if allowed = bytes.Equal(s.allowedKeys[i], key); allowed { + break + } + } + + if !allowed { + return errDisallowedKey + } + + // verify signature + return signature.VerifyDataWithSource(req, func() ([]byte, []byte) { + return key, sign.GetSign() + }) +} + +// SignMessage signs Control service message with private key. +func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error { + return signature.SignDataWithHandler(key, msg, func(key []byte, sig []byte) { + s := new(control.Signature) + s.SetKey(key) + s.SetSign(sig) + + msg.SetSignature(s) + }) +} From 567421a9b5874d2709c559c20edab87e300d05f6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:41:58 +0300 Subject: [PATCH 030/219] [#414] ir: Implement HealthChecker on Server `HealthChecker` interface is required to construct `ControlServiceServer`. Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 1 + pkg/innerring/state.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index d26a8e6e26..a1ad43764d 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -60,6 +60,7 @@ type ( statusIndex *innerRingIndexer precision precision.Fixed8Converter auditClient *auditWrapper.ClientWrapper + healthStatus atomic.Value // notary configuration feeConfig *config.FeeConfig diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index 310f5e01d6..abe90cb5b4 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/services/audit" + control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" "go.uber.org/zap" ) @@ -130,3 +131,12 @@ func (s *Server) WriteReport(r *audit.Report) error { func (s *Server) ResetEpochTimer() error { return s.epochTimer.Reset() } + +func (s *Server) setHealthStatus(hs control.HealthStatus) { + s.healthStatus.Store(hs) +} + +// HealthStatus returns current health status of IR application. +func (s *Server) HealthStatus() control.HealthStatus { + return s.healthStatus.Load().(control.HealthStatus) +} From 4001ba2967e0c55cb023a50167e9230cb346b1f5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:45:59 +0300 Subject: [PATCH 031/219] [#414] ir: Switch health status on application state transitions Set health status to * `UNDEFINED` during Server construction; * `STARTING` on `Server.Start` call; * `READY` after successful `Server.Start` call; * `SHUTTING_DOWN` on `Server.Stop` call. Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index a1ad43764d..1d26e2532e 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -138,7 +138,14 @@ var ( ) // Start runs all event providers. -func (s *Server) Start(ctx context.Context, intError chan<- error) error { +func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { + s.setHealthStatus(control.HealthStatus_STARTING) + defer func() { + if err == nil { + s.setHealthStatus(control.HealthStatus_READY) + } + }() + for _, starter := range s.starters { if err := starter(); err != nil { return err @@ -223,6 +230,8 @@ func (s *Server) startWorkers(ctx context.Context) { // Stop closes all subscription channels. func (s *Server) Stop() { + s.setHealthStatus(control.HealthStatus_SHUTTING_DOWN) + go s.morphListener.Stop() go s.mainnetListener.Stop() @@ -259,6 +268,8 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error var err error server := &Server{log: log} + server.setHealthStatus(control.HealthStatus_HEALTH_STATUS_UNDEFINED) + // parse notary support server.feeConfig = config.NewFeeConfig(cfg) server.mainNotaryConfig, server.sideNotaryConfig = parseNotaryConfigs(cfg) From 455fd952dd3174e0698eb390c3ea39f04df41ee5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:49:10 +0300 Subject: [PATCH 032/219] [#414] ir: Serve ControlService Serve `ControlService` instance on configured endpoint (do not serve if not specified). Read allowed keys from config. Signed-off-by: Leonard Lyubich --- cmd/neofs-ir/defaults.go | 3 ++ pkg/innerring/innerring.go | 66 +++++++++++++++++++++++- pkg/services/control/ir/server/calls.go | 2 +- pkg/services/control/ir/server/prm.go | 6 +-- pkg/services/control/ir/server/server.go | 6 +-- 5 files changed, 73 insertions(+), 10 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index dd4040d780..2913bde3c3 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -117,4 +117,7 @@ func defaultConfiguration(cfg *viper.Viper) { // extra fee values for working mode without notary contract cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8 cfg.SetDefault("fee.side_chain", 2_0000_0000) // 2.0 Fixed8 + + cfg.SetDefault("control.authorized_keys", []string{}) + cfg.SetDefault("control.grpc.endpoint", "") } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 1d26e2532e..2e12e49024 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -2,9 +2,11 @@ package innerring import ( "context" + "encoding/hex" "errors" "fmt" "io" + "net" "github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -32,6 +34,8 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/subscriber" "github.com/nspcc-dev/neofs-node/pkg/morph/timer" audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager" + control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" + controlsrv "github.com/nspcc-dev/neofs-node/pkg/services/control/ir/server" util2 "github.com/nspcc-dev/neofs-node/pkg/util" utilConfig "github.com/nspcc-dev/neofs-node/pkg/util/config" "github.com/nspcc-dev/neofs-node/pkg/util/precision" @@ -39,6 +43,7 @@ import ( "github.com/spf13/viper" "go.uber.org/atomic" "go.uber.org/zap" + "google.golang.org/grpc" ) type ( @@ -91,6 +96,13 @@ type ( // // Errors are logged. closers []func() error + + // Set of component runners which + // should report start errors + // to the application. + // + // TODO: unify with workers. + runners []func(chan<- error) } contracts struct { @@ -152,7 +164,7 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { } } - err := s.initConfigFromBlockchain() + err = s.initConfigFromBlockchain() if err != nil { return err } @@ -210,6 +222,10 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { s.tickTimers() }) + for _, runner := range s.runners { + runner(intError) + } + go s.morphListener.ListenWithError(ctx, morphErr) // listen for neo:morph events go s.mainnetListener.ListenWithError(ctx, mainnnetErr) // listen for neo:mainnet events @@ -285,6 +301,8 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error server.key = acc.PrivateKey() + fmt.Println(hex.EncodeToString(server.key.PublicKey().Bytes())) + // get all script hashes of contracts server.contracts, err = parseContracts(cfg) if err != nil { @@ -728,6 +746,52 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error server.addBlockTimer(sideNotaryTimer) } + controlSvcEndpoint := cfg.GetString("control.grpc.endpoint") + if controlSvcEndpoint != "" { + authKeysStr := cfg.GetStringSlice("control.authorized_keys") + authKeys := make([][]byte, 0, len(authKeysStr)) + + for i := range authKeysStr { + key, err := hex.DecodeString(authKeysStr[i]) + if err != nil { + return nil, fmt.Errorf("could not parse Control authorized key %s: %w", + authKeysStr[i], + err, + ) + } + + authKeys = append(authKeys, key) + } + + var p controlsrv.Prm + + p.SetPrivateKey(*server.key) + p.SetHealthChecker(server) + + controlSvc := controlsrv.New(p, + controlsrv.WithAllowedKeys(authKeys), + ) + + grpcControlSrv := grpc.NewServer() + control.RegisterControlServiceServer(grpcControlSrv, controlSvc) + + server.runners = append(server.runners, func(ch chan<- error) { + lis, err := net.Listen("tcp", controlSvcEndpoint) + if err != nil { + ch <- err + return + } + + go func() { + ch <- grpcControlSrv.Serve(lis) + }() + }) + + server.registerNoErrCloser(grpcControlSrv.GracefulStop) + } else { + log.Info("no Control server endpoint specified, service is disabled") + } + return server, nil } diff --git a/pkg/services/control/ir/server/calls.go b/pkg/services/control/ir/server/calls.go index 11dbe851b6..c567eed7b9 100644 --- a/pkg/services/control/ir/server/calls.go +++ b/pkg/services/control/ir/server/calls.go @@ -26,7 +26,7 @@ func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) body.SetHealthStatus(s.prm.healthChecker.HealthStatus()) // sign the response - if err := SignMessage(s.prm.key, resp); err != nil { + if err := SignMessage(&s.prm.key.PrivateKey, resp); err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/pkg/services/control/ir/server/prm.go b/pkg/services/control/ir/server/prm.go index a73a00c766..b4f1f25179 100644 --- a/pkg/services/control/ir/server/prm.go +++ b/pkg/services/control/ir/server/prm.go @@ -1,19 +1,19 @@ package control import ( - "crypto/ecdsa" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" ) // Prm groups required parameters of // Server's constructor. type Prm struct { - key *ecdsa.PrivateKey + key keys.PrivateKey healthChecker HealthChecker } // SetPrivateKey sets private key to sign responses. -func (x *Prm) SetPrivateKey(key *ecdsa.PrivateKey) { +func (x *Prm) SetPrivateKey(key keys.PrivateKey) { x.key = key } diff --git a/pkg/services/control/ir/server/server.go b/pkg/services/control/ir/server/server.go index b22982b5b9..f0bfddf867 100644 --- a/pkg/services/control/ir/server/server.go +++ b/pkg/services/control/ir/server/server.go @@ -2,8 +2,6 @@ package control import ( "fmt" - - crypto "github.com/nspcc-dev/neofs-crypto" ) // Server is an entity that serves @@ -34,8 +32,6 @@ func panicOnPrmValue(n string, v interface{}) { func New(prm Prm, opts ...Option) *Server { // verify required parameters switch { - case prm.key == nil: - panicOnPrmValue("key", prm.key) case prm.healthChecker == nil: panicOnPrmValue("health checker", prm.healthChecker) } @@ -50,6 +46,6 @@ func New(prm Prm, opts ...Option) *Server { return &Server{ prm: prm, - allowedKeys: append(o.allowedKeys, crypto.MarshalPublicKey(&prm.key.PublicKey)), + allowedKeys: append(o.allowedKeys, prm.key.PublicKey().Bytes()), } } From 7cead1bc3aedbf3d4732417a53429e0146da6162 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 15 Jun 2021 10:54:09 +0300 Subject: [PATCH 033/219] [#414] cmd/cli: Support IR health-check Add `--ir` flag to `control healthcheck` to communicate with IR node. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/control.go | 59 +++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/cmd/neofs-cli/modules/control.go b/cmd/neofs-cli/modules/control.go index 53907c547b..a8ab229b5c 100644 --- a/cmd/neofs-cli/modules/control.go +++ b/cmd/neofs-cli/modules/control.go @@ -1,11 +1,15 @@ package cmd import ( + "crypto/ecdsa" "fmt" + "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-node/pkg/services/control" + ircontrol "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" + ircontrolsrv "github.com/nspcc-dev/neofs-node/pkg/services/control/ir/server" controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server" "github.com/spf13/cobra" ) @@ -37,6 +41,16 @@ const ( netmapStatusOffline = "offline" ) +// control healthcheck flags +const ( + healthcheckIRFlag = "ir" +) + +// control healthcheck vars +var ( + healthCheckIRVar bool +) + var netmapStatus string func init() { @@ -61,6 +75,8 @@ func init() { "List of object addresses to be removed in string format") _ = dropObjectsCmd.MarkFlagRequired(dropObjectsFlag) + + healthCheckCmd.Flags().BoolVar(&healthCheckIRVar, healthcheckIRFlag, false, "Communicate with IR node") } func healthCheck(cmd *cobra.Command, _ []string) error { @@ -69,6 +85,16 @@ func healthCheck(cmd *cobra.Command, _ []string) error { return err } + cli, err := getSDKClient(key) + if err != nil { + return err + } + + if healthCheckIRVar { + healthCheckIR(cmd, key, cli) + return nil + } + req := new(control.HealthCheckRequest) req.SetBody(new(control.HealthCheckRequest_Body)) @@ -77,11 +103,6 @@ func healthCheck(cmd *cobra.Command, _ []string) error { return err } - cli, err := getSDKClient(key) - if err != nil { - return err - } - resp, err := control.HealthCheck(cli.Raw(), req) if err != nil { return err @@ -101,6 +122,34 @@ func healthCheck(cmd *cobra.Command, _ []string) error { return nil } +func healthCheckIR(cmd *cobra.Command, key *ecdsa.PrivateKey, c client.Client) { + req := new(ircontrol.HealthCheckRequest) + + req.SetBody(new(ircontrol.HealthCheckRequest_Body)) + + if err := ircontrolsrv.SignMessage(key, req); err != nil { + cmd.PrintErrln(fmt.Errorf("could not sign request: %w", err)) + return + } + + resp, err := ircontrol.HealthCheck(c.Raw(), req) + if err != nil { + cmd.PrintErrln(fmt.Errorf("rpc failure: %w", err)) + return + } + + sign := resp.GetSignature() + + if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }); err != nil { + cmd.PrintErrln(fmt.Errorf("invalid response signature: %w", err)) + return + } + + cmd.Printf("Health status: %s\n", resp.GetBody().GetHealthStatus()) +} + func setNetmapStatus(cmd *cobra.Command, _ []string) error { key, err := getKey() if err != nil { From 0ec3faefc9e001e7540a090678dcfb1e49dd6e26 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Jun 2021 16:26:33 +0300 Subject: [PATCH 034/219] [#609] morph/client: Check return state in invoke Test invocations are used in `Invoke` method to calculate consumed gas. We can check return code and return error if panic happened in contract. This is already done the same way in `TestInvoke` method. Signed-off-by: Alex Vanin --- pkg/morph/client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index c8a13a0c22..fcc6aebd6e 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -100,6 +100,10 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, return err } + if resp.State != HaltState { + return &NotHaltStateError{state: resp.State, exception: resp.FaultException} + } + if len(resp.Script) == 0 { return errEmptyInvocationScript } From 08b5f29e1640bc8a7203068d1d82c4a2e03d4d86 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 15 Jun 2021 16:47:57 +0300 Subject: [PATCH 035/219] [#609] morph/client: Make halt state error private Signed-off-by: Alex Vanin --- pkg/morph/client/client.go | 8 ++++---- pkg/morph/client/notary.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index fcc6aebd6e..6c686b4c28 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -51,11 +51,11 @@ var ErrNilClient = errors.New("client is nil") // HaltState returned if TestInvoke function processed without panic. const HaltState = "HALT" -type NotHaltStateError struct { +type notHaltStateError struct { state, exception string } -func (e *NotHaltStateError) Error() string { +func (e *notHaltStateError) Error() string { return fmt.Sprintf( "chain/client: contract execution finished with state %s; exception: %s", e.state, @@ -101,7 +101,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, } if resp.State != HaltState { - return &NotHaltStateError{state: resp.State, exception: resp.FaultException} + return ¬HaltStateError{state: resp.State, exception: resp.FaultException} } if len(resp.Script) == 0 { @@ -151,7 +151,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf } if val.State != HaltState { - return nil, &NotHaltStateError{state: val.State, exception: val.FaultException} + return nil, ¬HaltStateError{state: val.State, exception: val.FaultException} } return val.Stack, nil diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index f523b057c0..ea5dfe8311 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -244,7 +244,7 @@ func (c *Client) notaryInvoke(committee bool, contract util.Uint160, method stri // check invocation state if test.State != HaltState { - return &NotHaltStateError{state: test.State, exception: test.FaultException} + return ¬HaltStateError{state: test.State, exception: test.FaultException} } // if test invocation failed, then return error From cc81723b01983504694135ae33c0cefe5fcfea21 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 11:58:38 +0300 Subject: [PATCH 036/219] [#615] blobovnicza: Simplify byte size stringer Make `stringifyByteSize` to return number of bytes as string. Signed-off-by: Leonard Lyubich --- go.mod | 1 - go.sum | 2 -- pkg/local_object_storage/blobovnicza/sizes.go | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 391d3b204c..34aa88678c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/nspcc-dev/neofs-node go 1.14 require ( - code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48 github.com/golang/protobuf v1.4.3 github.com/google/uuid v1.1.1 github.com/hashicorp/golang-lru v0.5.4 diff --git a/go.sum b/go.sum index 7975e266b0..61af2abcbf 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,6 @@ cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7 cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48 h1:/EMHruHCFXR9xClkGV/t0rmHrdhX4+trQUcBqjwc9xE= -code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/pkg/local_object_storage/blobovnicza/sizes.go b/pkg/local_object_storage/blobovnicza/sizes.go index cecdb3f0eb..027018a506 100644 --- a/pkg/local_object_storage/blobovnicza/sizes.go +++ b/pkg/local_object_storage/blobovnicza/sizes.go @@ -3,8 +3,8 @@ package blobovnicza import ( "encoding/binary" "fmt" + "strconv" - "code.cloudfoundry.org/bytefmt" "go.etcd.io/bbolt" ) @@ -18,7 +18,7 @@ func stringifyBounds(lower, upper uint64) string { } func stringifyByteSize(sz uint64) string { - return bytefmt.ByteSize(sz) + return strconv.FormatUint(sz, 10) } func bucketKeyFromBounds(upperBound uint64) []byte { From b7dfbf4c23793e27b5d0ddf82b2d422be415773d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Jun 2021 14:46:32 +0300 Subject: [PATCH 037/219] Update neo-go to v0.95.2 Signed-off-by: Evgenii Stratonikov --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 34aa88678c..de4ce46c24 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.1.3 github.com/multiformats/go-multiaddr v0.3.1 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.1 + github.com/nspcc-dev/neo-go v0.95.2 github.com/nspcc-dev/neofs-api-go v1.27.1 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index 61af2abcbf..7fe381e644 100644 --- a/go.sum +++ b/go.sum @@ -280,8 +280,9 @@ github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkP github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= -github.com/nspcc-dev/neo-go v0.95.1 h1:5fgLFOul1Ax/maFkgLkD5rDUwY/nB/xX/Jpcd8hLHaI= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neo-go v0.95.2 h1:WaFdqzdqDK2xjXuCUZENTL55fW7RodU23uGdTqx45RY= +github.com/nspcc-dev/neo-go v0.95.2/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1 h1:ONdKOnm0/hK6m38VTUliCHY6RTxg+IpAzY4G+BeOZG4= From 2b5998b8202548c5152d0cb971a4d26c0da212e8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Jun 2021 18:43:09 +0300 Subject: [PATCH 038/219] [#610] neofs-cli: add `--generate-key` flag Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/modules/root.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 446828824a..b4f28a058d 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -24,8 +24,6 @@ import ( const ( envPrefix = "NEOFS_CLI" - generateKeyConst = "new" - ttlDefaultValue = 2 ) @@ -79,7 +77,11 @@ func init() { rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.config/neofs-cli/config.yaml)") - rootCmd.PersistentFlags().StringP("key", "k", "", "private key in hex, WIF, NEP-2 or filepath (use `--key new` to generate key for request)") + // Key options. + rootCmd.PersistentFlags().BoolP("generate-key", "", false, "generate new private key") + _ = viper.BindPFlag("generate-key", rootCmd.PersistentFlags().Lookup("generate-key")) + + rootCmd.PersistentFlags().StringP("key", "k", "", "private key in hex, WIF, NEP-2 or filepath") _ = viper.BindPFlag("key", rootCmd.PersistentFlags().Lookup("key")) rootCmd.PersistentFlags().StringP("address", "", "", "address of wallet account") @@ -133,8 +135,7 @@ const nep2Base58Length = 58 // getKey returns private key that was provided in global arguments. func getKey() (*ecdsa.PrivateKey, error) { - privateKey := viper.GetString("key") - if privateKey == generateKeyConst { + if viper.GetBool("generate-key") { priv, err := keys.NewPrivateKey() if err != nil { return nil, errCantGenerateKey @@ -142,6 +143,7 @@ func getKey() (*ecdsa.PrivateKey, error) { return &priv.PrivateKey, nil } + privateKey := viper.GetString("key") w, err := wallet.NewWalletFromFile(privateKey) if err == nil { return getKeyFromWallet(w, viper.GetString("address")) From 1b14b25e6cbb6495b26308b48eac964b4ccb4797 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Jun 2021 18:45:45 +0300 Subject: [PATCH 039/219] [#610] neofs-cli: add `--wallet` flag Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/modules/root.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index b4f28a058d..7e4267abb2 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -84,6 +84,8 @@ func init() { rootCmd.PersistentFlags().StringP("key", "k", "", "private key in hex, WIF, NEP-2 or filepath") _ = viper.BindPFlag("key", rootCmd.PersistentFlags().Lookup("key")) + rootCmd.PersistentFlags().StringP("wallet", "w", "", "path to the wallet") + _ = viper.BindPFlag("wallet", rootCmd.PersistentFlags().Lookup("wallet")) rootCmd.PersistentFlags().StringP("address", "", "", "address of wallet account") _ = viper.BindPFlag("address", rootCmd.PersistentFlags().Lookup("address")) @@ -143,12 +145,15 @@ func getKey() (*ecdsa.PrivateKey, error) { return &priv.PrivateKey, nil } - privateKey := viper.GetString("key") - w, err := wallet.NewWalletFromFile(privateKey) - if err == nil { + if walletPath := viper.GetString("wallet"); walletPath != "" { + w, err := wallet.NewWalletFromFile(walletPath) + if err != nil { + return nil, fmt.Errorf("%w: %v", errInvalidKey, err) + } return getKeyFromWallet(w, viper.GetString("address")) } + privateKey := viper.GetString("key") if len(privateKey) == nep2Base58Length { return getKeyFromNEP2(privateKey) } From ad90b07ed539a1499d67fa1fc8c927badb94c487 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Jun 2021 18:51:33 +0300 Subject: [PATCH 040/219] [#610] neofs-cli: add `--binary-key` flag Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/modules/root.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 7e4267abb2..b148c9206e 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "errors" "fmt" + "io/ioutil" "os" "strings" @@ -81,6 +82,9 @@ func init() { rootCmd.PersistentFlags().BoolP("generate-key", "", false, "generate new private key") _ = viper.BindPFlag("generate-key", rootCmd.PersistentFlags().Lookup("generate-key")) + rootCmd.PersistentFlags().StringP("binary-key", "", "", "path to the raw private key file") + _ = viper.BindPFlag("binary-key", rootCmd.PersistentFlags().Lookup("binary-key")) + rootCmd.PersistentFlags().StringP("key", "k", "", "private key in hex, WIF, NEP-2 or filepath") _ = viper.BindPFlag("key", rootCmd.PersistentFlags().Lookup("key")) @@ -145,6 +149,10 @@ func getKey() (*ecdsa.PrivateKey, error) { return &priv.PrivateKey, nil } + if keyPath := viper.GetString("binary-key"); keyPath != "" { + return getKeyFromFile(keyPath) + } + if walletPath := viper.GetString("wallet"); walletPath != "" { w, err := wallet.NewWalletFromFile(walletPath) if err != nil { @@ -161,6 +169,20 @@ func getKey() (*ecdsa.PrivateKey, error) { return nil, errInvalidKey } +func getKeyFromFile(keyPath string) (*ecdsa.PrivateKey, error) { + data, err := ioutil.ReadFile(keyPath) + if err != nil { + return nil, fmt.Errorf("%w: %v", errInvalidKey, err) + } + + priv, err := keys.NewPrivateKeyFromBytes(data) + if err != nil { + return nil, fmt.Errorf("%w: %v", errInvalidKey, err) + } + + return &priv.PrivateKey, nil +} + func getKeyFromNEP2(encryptedWif string) (*ecdsa.PrivateKey, error) { pass, err := input.ReadPassword("Enter password > ") if err != nil { From c172fcc11f96e97e00a402a942f378ddeddac7a6 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Jun 2021 18:56:05 +0300 Subject: [PATCH 041/219] [#610] neofs-cli: replace `--key` flag with `--wif` Signed-off-by: Evgenii Stratonikov --- cmd/neofs-cli/modules/root.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index b148c9206e..19db6432fb 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -85,8 +85,8 @@ func init() { rootCmd.PersistentFlags().StringP("binary-key", "", "", "path to the raw private key file") _ = viper.BindPFlag("binary-key", rootCmd.PersistentFlags().Lookup("binary-key")) - rootCmd.PersistentFlags().StringP("key", "k", "", "private key in hex, WIF, NEP-2 or filepath") - _ = viper.BindPFlag("key", rootCmd.PersistentFlags().Lookup("key")) + rootCmd.PersistentFlags().StringP("wif", "", "", "WIF or NEP-2") + _ = viper.BindPFlag("wif", rootCmd.PersistentFlags().Lookup("wif")) rootCmd.PersistentFlags().StringP("wallet", "w", "", "path to the wallet") _ = viper.BindPFlag("wallet", rootCmd.PersistentFlags().Lookup("wallet")) @@ -161,12 +161,17 @@ func getKey() (*ecdsa.PrivateKey, error) { return getKeyFromWallet(w, viper.GetString("address")) } - privateKey := viper.GetString("key") - if len(privateKey) == nep2Base58Length { - return getKeyFromNEP2(privateKey) + wif := viper.GetString("wif") + if len(wif) == nep2Base58Length { + return getKeyFromNEP2(wif) } - return nil, errInvalidKey + priv, err := keys.NewPrivateKeyFromWIF(wif) + if err != nil { + return nil, fmt.Errorf("%w: %v", errInvalidKey, err) + } + + return &priv.PrivateKey, nil } func getKeyFromFile(keyPath string) (*ecdsa.PrivateKey, error) { From a4587dbcd467c46216fe10eb683ac44aad07f639 Mon Sep 17 00:00:00 2001 From: Sergio Nemirowski Date: Wed, 16 Jun 2021 21:37:07 +0300 Subject: [PATCH 042/219] [#88] Add relabel for instance Signed-off-by: Sergio Nemirowski --- config/testnet/README.md | 24 +++++++++++------------- config/testnet/docker-compose.yml | 11 ++++------- config/testnet/node_config.env | 28 ++++++++++++++++++++++++++++ config/testnet/prometheus.yml | 3 +++ 4 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 config/testnet/node_config.env diff --git a/config/testnet/README.md b/config/testnet/README.md index 4981ff15cc..16892cdc94 100644 --- a/config/testnet/README.md +++ b/config/testnet/README.md @@ -6,7 +6,7 @@ docker image and run it with docker-compose. ## Build image -Prepared neofs-storage-testnet image is available at Docker Hub. +Prepared **neofs-storage-testnet** image is available at Docker Hub. However, if you need to rebuild it for some reason, run `make image-storage-testnet` command. @@ -49,23 +49,21 @@ neo-go wallet nep17 transfer -w wallet.json -r https://rpc1.n3.nspcc.ru:20331 \ ### Configure -Then configure docker-compose.yml file. Change endpoints values. Both +Then configure `node_config.env` file. Change endpoints values. Both should contain your **public** IP. -```yaml - environment: - - NEOFS_NODE_ADDRESS=65.52.183.157:36512 - - NEOFS_GRPC_ENDPOINT=65.52.183.157:36512 +``` +NEOFS_NODE_ADDRESS=65.52.183.157:36512 +NEOFS_GRPC_ENDPOINT=65.52.183.157:36512 ``` Set up your [UN/LOCODE](https://unece.org/trade/cefact/unlocode-code-list-country-and-territory) attribute. -```yaml - environment: - - NEOFS_NODE_ADDRESS=65.52.183.157:36512 - - NEOFS_GRPC_ENDPOINT=65.52.183.157:36512 - - NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU LED +``` +NEOFS_NODE_ADDRESS=65.52.183.157:36512 +NEOFS_GRPC_ENDPOINT=65.52.183.157:36512 +NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU LED ``` You can validate UN/LOCODE attribute in @@ -98,7 +96,7 @@ ScriptHash3.0BE dc4b0b44d01c16667880062e2fd4508f9939fedf $ echo '11ab917cd99170cb8d0d48e78fca317564e6b3aaff7f7058952d6175cdca0f56' | xxd -r -p > my_wallet.key ``` -Then specify path to this file in docker-compose +Then specify path to this file in `docker-compose.yml` ```yaml volumes: - neofs_storage:/storage @@ -128,4 +126,4 @@ log, setup log level to debug with this env: ```yaml environment: - NEOFS_LOGGER_LEVEL=debug -``` \ No newline at end of file +``` diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index eb247c5063..b3af5f6f19 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -5,26 +5,23 @@ services: storage01: image: nspccdev/neofs-storage-testnet:0.21.1 container_name: neofs-testnet + env_file: node_config.env network_mode: host restart: always volumes: - neofs_storage:/storage - :/node.key stop_signal: SIGINT - environment: - - NEOFS_NODE_ADDRESS= - - NEOFS_GRPC_ENDPOINT= - - =UN-LOCODE: - - NEOFS_NODE_ATTRIBUTE_2=Price:100000 vmagent: image: victoriametrics/vmagent:v1.61.0 container_name: vmagent depends_on: - storage01 + env_file: node_config.env command: - - '--promscrape.config=/configs/prometheus.yml' - - '--remoteWrite.url=https://collector.fs.neo.org:8429/api/v1/write' + - '-promscrape.config=/configs/prometheus.yml' + - '-remoteWrite.url=https://collector.fs.neo.org:8429/api/v1/write' network_mode: host restart: always volumes: diff --git a/config/testnet/node_config.env b/config/testnet/node_config.env new file mode 100644 index 0000000000..904a8d7302 --- /dev/null +++ b/config/testnet/node_config.env @@ -0,0 +1,28 @@ +# + +# Specify your public IP address or domain name with the open port +# in NODE_ADDRESS and BIND_ADDRESS +# By default keep these addresses the same. + +# This is used for the public announcement in the network map +# +#NEOFS_NODE_ADDRESS= +#NEOFS_NODE_ADDRESS=1.1.1.1:36512 +NEOFS_NODE_ADDRESS= + +# This is used to open the connection listening socket on your machine +# +#NEOFS_GRPC_ENDPOINT= +#NEOFS_GRPC_ENDPOINT=1.1.1.1:36512 +NEOFS_GRPC_ENDPOINT= + + +#https://unece.org/trade/cefact/unlocode-code-list-country-and-territory +# Find suitable LOCODE (from the link above) for your storage node. +# +#NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE: +#NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU LED +NEOFS_NODE_ATTRIBUTE_1= + + +NEOFS_NODE_ATTRIBUTE_2=Price:100000 diff --git a/config/testnet/prometheus.yml b/config/testnet/prometheus.yml index a3855ba411..ced799bd60 100644 --- a/config/testnet/prometheus.yml +++ b/config/testnet/prometheus.yml @@ -8,3 +8,6 @@ scrape_configs: scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9090'] + relabel_configs: + - target_label: 'instance' + replacement: "%{NEOFS_NODE_ADDRESS}" From 6b176e8769d82fd4ad4eda8c97aea643be1f26fa Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 18:29:49 +0300 Subject: [PATCH 043/219] [#613] pkg/reputation: Move manager building to `pkg` Move `managers` package to `pkg` since it can be reused in other packages. Signed-off-by: Pavel Karpy --- cmd/neofs-node/reputation.go | 6 +++--- .../services}/reputation/common/managers.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) rename {cmd/neofs-node => pkg/services}/reputation/common/managers.go (88%) diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index 7a4dc7c058..b4e02ebe90 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -68,11 +68,11 @@ func initReputationService(c *cfg) { LocalKey: localKey, } - managerBuilder := common.NewManagerBuilder( - common.ManagersPrm{ + managerBuilder := reputationcommon.NewManagerBuilder( + reputationcommon.ManagersPrm{ NetMapSource: nmSrc, }, - common.WithLogger(c.log), + reputationcommon.WithLogger(c.log), ) localRouteBuilder := localroutes.New( diff --git a/cmd/neofs-node/reputation/common/managers.go b/pkg/services/reputation/common/managers.go similarity index 88% rename from cmd/neofs-node/reputation/common/managers.go rename to pkg/services/reputation/common/managers.go index e9260a4108..9cddc8094d 100644 --- a/cmd/neofs-node/reputation/common/managers.go +++ b/pkg/services/reputation/common/managers.go @@ -2,12 +2,12 @@ package common import ( "bytes" + "fmt" "github.com/nspcc-dev/hrw" apiNetmap "github.com/nspcc-dev/neofs-api-go/pkg/netmap" netmapcore "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/services/reputation" - "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" ) @@ -36,10 +36,10 @@ type ManagersPrm struct { // // The created managerBuilder does not require additional // initialization and is completely ready for work. -func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) common.ManagerBuilder { +func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) ManagerBuilder { switch { case prm.NetMapSource == nil: - PanicOnPrmValue("NetMapSource", prm.NetMapSource) + panic(fmt.Sprintf("invalid NetMapSource (%T):%v", prm.NetMapSource, prm.NetMapSource)) } o := defaultMngOpts() @@ -57,7 +57,7 @@ func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) common.ManagerBuilder // BuildManagers sorts nodes in NetMap with HRW algorithms and // takes the next node after the current one as the only manager. -func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]common.ServerInfo, error) { +func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]ServerInfo, error) { nm, err := mb.nmSrc.GetNetMapByEpoch(epoch) if err != nil { return nil, err @@ -78,7 +78,7 @@ func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]co managerIndex = 0 } - return []common.ServerInfo{nodes[managerIndex]}, nil + return []ServerInfo{nodes[managerIndex]}, nil } } From ed9a5e44b695a58b0b63a3c58dbf33bb71e97dfb Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 11 Jun 2021 20:13:24 +0300 Subject: [PATCH 044/219] [#613] pkg/innerring: Add sanity check of GlobalTrust Add sanity checks of GlobalTrust value: check if "got manager" is real manager for peer with building managers for peer. Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 8 +++-- .../processors/reputation/process_put.go | 34 +++++++++++++++++-- .../processors/reputation/processor.go | 7 ++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 2e12e49024..2305063fc2 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -36,6 +36,7 @@ import ( audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager" control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir" controlsrv "github.com/nspcc-dev/neofs-node/pkg/services/control/ir/server" + reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common" util2 "github.com/nspcc-dev/neofs-node/pkg/util" utilConfig "github.com/nspcc-dev/neofs-node/pkg/util/config" "github.com/nspcc-dev/neofs-node/pkg/util/precision" @@ -626,8 +627,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - // todo: create reputation processor - // create mainnnet neofs processor neofsProcessor, err := neofs.New(&neofs.Params{ Log: log, @@ -682,6 +681,11 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error EpochState: server, AlphabetState: server, ReputationWrapper: repClient, + ManagerBuilder: reputationcommon.NewManagerBuilder( + reputationcommon.ManagersPrm{ + NetMapSource: nmClient, + }, + ), }) if err != nil { return nil, err diff --git a/pkg/innerring/processors/reputation/process_put.go b/pkg/innerring/processors/reputation/process_put.go index 9d76b91063..f71d1f8055 100644 --- a/pkg/innerring/processors/reputation/process_put.go +++ b/pkg/innerring/processors/reputation/process_put.go @@ -1,14 +1,20 @@ package reputation import ( + "bytes" "encoding/hex" + "errors" + "fmt" - "github.com/nspcc-dev/neofs-api-go/pkg/reputation" + apireputation "github.com/nspcc-dev/neofs-api-go/pkg/reputation" "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" + "github.com/nspcc-dev/neofs-node/pkg/services/reputation" "go.uber.org/zap" ) -func (rp *Processor) processPut(epoch uint64, id reputation.PeerID, value reputation.GlobalTrust) { +var errWrongManager = errors.New("got manager that is incorrect for peer") + +func (rp *Processor) processPut(epoch uint64, id apireputation.PeerID, value apireputation.GlobalTrust) { if !rp.alphabetState.IsAlphabet() { rp.log.Info("non alphabet mode, ignore reputation put notification") return @@ -34,7 +40,14 @@ func (rp *Processor) processPut(epoch uint64, id reputation.PeerID, value reputa return } - // todo: do sanity checks of value + // check if manager is correct + if err := rp.checkManagers(epoch, *value.Manager(), id); err != nil { + rp.log.Info("ignore reputation value", + zap.String("reason", "wrong manager"), + zap.String("error", err.Error())) + + return + } args := wrapper.PutArgs{} args.SetEpoch(epoch) @@ -48,3 +61,18 @@ func (rp *Processor) processPut(epoch uint64, id reputation.PeerID, value reputa zap.String("error", err.Error())) } } + +func (rp *Processor) checkManagers(e uint64, mng apireputation.PeerID, peer apireputation.PeerID) error { + mm, err := rp.mngBuilder.BuildManagers(e, reputation.PeerIDFromBytes(peer.ToV2().GetPublicKey())) + if err != nil { + return fmt.Errorf("could not build managers: %w", err) + } + + for _, m := range mm { + if bytes.Equal(mng.ToV2().GetPublicKey(), m.PublicKey()) { + return nil + } + } + + return errWrongManager +} diff --git a/pkg/innerring/processors/reputation/processor.go b/pkg/innerring/processors/reputation/processor.go index ab30bc3b64..94a7dff371 100644 --- a/pkg/innerring/processors/reputation/processor.go +++ b/pkg/innerring/processors/reputation/processor.go @@ -8,6 +8,7 @@ import ( reputationWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" reputationEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/reputation" + "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common" "github.com/panjf2000/ants/v2" "go.uber.org/zap" ) @@ -34,6 +35,8 @@ type ( alphabetState AlphabetState reputationWrp *reputationWrapper.ClientWrapper + + mngBuilder common.ManagerBuilder } // Params of the processor constructor. @@ -44,6 +47,7 @@ type ( EpochState EpochState AlphabetState AlphabetState ReputationWrapper *reputationWrapper.ClientWrapper + ManagerBuilder common.ManagerBuilder } ) @@ -62,6 +66,8 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/reputation: global state is not set") case p.ReputationWrapper == nil: return nil, errors.New("ir/reputation: reputation contract wrapper is not set") + case p.ManagerBuilder == nil: + return nil, errors.New("ir/reputation: manager builder is not set") } p.Log.Debug("reputation worker pool", zap.Int("size", p.PoolSize)) @@ -78,6 +84,7 @@ func New(p *Params) (*Processor, error) { epochState: p.EpochState, alphabetState: p.AlphabetState, reputationWrp: p.ReputationWrapper, + mngBuilder: p.ManagerBuilder, }, nil } From 68c7f6ce8a71d57b2171a0495cfb209c0e5e754a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 17 Jun 2021 18:08:08 +0300 Subject: [PATCH 045/219] [#613] pkg/innerring/reputation: Add `FIXME` to `ToV2` usage Signed-off-by: Pavel Karpy --- pkg/innerring/processors/reputation/handlers.go | 1 + pkg/innerring/processors/reputation/process_put.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pkg/innerring/processors/reputation/handlers.go b/pkg/innerring/processors/reputation/handlers.go index 4d3c8ab811..26cfa4712e 100644 --- a/pkg/innerring/processors/reputation/handlers.go +++ b/pkg/innerring/processors/reputation/handlers.go @@ -12,6 +12,7 @@ func (rp *Processor) handlePutReputation(ev event.Event) { put := ev.(reputationEvent.Put) peerID := put.PeerID() + // FIXME: do not use `ToV2` method outside neofs-api-go library rp.log.Info("notification", zap.String("type", "reputation put"), zap.String("peer_id", hex.EncodeToString(peerID.ToV2().GetPublicKey()))) diff --git a/pkg/innerring/processors/reputation/process_put.go b/pkg/innerring/processors/reputation/process_put.go index f71d1f8055..6a0fd28e7f 100644 --- a/pkg/innerring/processors/reputation/process_put.go +++ b/pkg/innerring/processors/reputation/process_put.go @@ -56,6 +56,7 @@ func (rp *Processor) processPut(epoch uint64, id apireputation.PeerID, value api err := rp.reputationWrp.Put(args) if err != nil { + // FIXME: do not use `ToV2` method outside neofs-api-go library rp.log.Warn("can't send approval tx for reputation value", zap.String("peer_id", hex.EncodeToString(id.ToV2().GetPublicKey())), zap.String("error", err.Error())) @@ -69,6 +70,7 @@ func (rp *Processor) checkManagers(e uint64, mng apireputation.PeerID, peer apir } for _, m := range mm { + // FIXME: do not use `ToV2` method outside neofs-api-go library if bytes.Equal(mng.ToV2().GetPublicKey(), m.PublicKey()) { return nil } From b2b33aeac9c25888f8022f85716efc95a3e8ab1e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 13:21:24 +0300 Subject: [PATCH 046/219] [#607] network: Don't export L4 protocol constant Const is used for internal package needs only. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index d37e08b443..af4a11b0bb 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -15,10 +15,6 @@ import ( IPAddr strings: "192.168.0.1:8080" */ -const ( - L4Protocol = "tcp" -) - // Address represents the NeoFS node // network address. type Address struct { @@ -125,7 +121,9 @@ func multiaddrStringFromHostAddr(host string) (string, error) { } } - return strings.Join([]string{prefix, addr, L4Protocol, port}, "/"), nil + const l4Protocol = "tcp" + + return strings.Join([]string{prefix, addr, l4Protocol, port}, "/"), nil } // IsLocalAddress returns true if network endpoint from local address From 6de0af0650b51db21ae5ba2a6acff54563582ae3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 13:28:20 +0300 Subject: [PATCH 047/219] [#607] network: Use Equal method in IsLocalAddress function Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index af4a11b0bb..214e1cd1a8 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -129,7 +129,7 @@ func multiaddrStringFromHostAddr(host string) (string, error) { // IsLocalAddress returns true if network endpoint from local address // source is equal to network endpoint of passed address. func IsLocalAddress(src LocalAddressSource, addr *Address) bool { - return src.LocalAddress().ma.Equal(addr.ma) + return src.LocalAddress().Equal(addr) } // HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080". From fdd123ad9818d9af47f371ffe6dd7cc312c57f16 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 13:31:03 +0300 Subject: [PATCH 048/219] [#607] network: Prevent potential panic in `Address.Equal` method Make `Address.Equal` method to accept value instead of pointer in order to prevent NPE. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config/node/config_test.go | 2 +- cmd/neofs-node/object.go | 2 +- pkg/network/address.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index d5335bbdec..9c89df7bd1 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -50,7 +50,7 @@ func TestNodeSection(t *testing.T) { require.NoError(t, err) require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address()) - require.Equal(t, true, addr.Equal(expectedAddr)) + require.Equal(t, true, addr.Equal(*expectedAddr)) require.Equal(t, true, relay) require.Len(t, attributes, 2) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 65efb40db2..0dbd4647c9 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -503,7 +503,7 @@ func (c *reputationClientConstructor) Get(addr *network.Address) (client.Client, for i := range nm.Nodes { netAddr, err := network.AddressFromString(nm.Nodes[i].Address()) if err == nil { - if netAddr.Equal(addr) { + if netAddr.Equal(*addr) { prm := truststorage.UpdatePrm{} prm.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) diff --git a/pkg/network/address.go b/pkg/network/address.go index 214e1cd1a8..d2905fd66c 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -49,7 +49,7 @@ func (a Address) String() string { } // Equal compares Address's. -func (a Address) Equal(addr *Address) bool { +func (a Address) Equal(addr Address) bool { return a.ma.Equal(addr.ma) } @@ -129,7 +129,7 @@ func multiaddrStringFromHostAddr(host string) (string, error) { // IsLocalAddress returns true if network endpoint from local address // source is equal to network endpoint of passed address. func IsLocalAddress(src LocalAddressSource, addr *Address) bool { - return src.LocalAddress().Equal(addr) + return src.LocalAddress().Equal(*addr) } // HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080". From 95ccbbc2f9e3e983bc56f04d345ccbe2e6c755c3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 13:49:00 +0300 Subject: [PATCH 049/219] [#607] network: Accept value instead of pointer in IsLocalAddress Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 4 ++-- pkg/services/object/put/streamer.go | 4 ++-- pkg/services/object/util/placement.go | 4 ++-- pkg/services/policer/check.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index d2905fd66c..df5669e186 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -128,8 +128,8 @@ func multiaddrStringFromHostAddr(host string) (string, error) { // IsLocalAddress returns true if network endpoint from local address // source is equal to network endpoint of passed address. -func IsLocalAddress(src LocalAddressSource, addr *Address) bool { - return src.LocalAddress().Equal(*addr) +func IsLocalAddress(src LocalAddressSource, addr Address) bool { + return src.LocalAddress().Equal(addr) } // HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080". diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index c1461a73c3..afdbe9467d 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -150,7 +150,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { var relay func(*network.Address) error if p.relay != nil { relay = func(addr *network.Address) error { - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, *addr) { return errLocalAddress } @@ -167,7 +167,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { traverseOpts: prm.traverseOpts, workerPool: p.workerPool, nodeTargetInitializer: func(addr *network.Address) transformer.ObjectTarget { - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, *addr) { return &localTarget{ storage: p.localStore, } diff --git a/pkg/services/object/util/placement.go b/pkg/services/object/util/placement.go index d9ad62f138..787e7cf29d 100644 --- a/pkg/services/object/util/placement.go +++ b/pkg/services/object/util/placement.go @@ -56,7 +56,7 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK. continue } - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, *addr) { return []netmapSDK.Nodes{{vs[i][j]}}, nil } } @@ -88,7 +88,7 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK continue } - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, *addr) { vs[i] = append(vs[i][:j], vs[i][j+1:]...) j-- } diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index 4f03e0fd4b..6ba2f9cf21 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -68,7 +68,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes continue } - if network.IsLocalAddress(p.localAddrSrc, node) { + if network.IsLocalAddress(p.localAddrSrc, *node) { if shortage == 0 { // we can call the redundant copy callback // here to slightly improve the performance From 9e241ab91e833a513b9aa0d12913c009b2c2765a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 13:49:40 +0300 Subject: [PATCH 050/219] [#607] network: Remove unused HostAddrFromMultiaddr function. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index df5669e186..77c5a2f24b 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -131,13 +131,3 @@ func multiaddrStringFromHostAddr(host string) (string, error) { func IsLocalAddress(src LocalAddressSource, addr Address) bool { return src.LocalAddress().Equal(addr) } - -// HostAddrFromMultiaddr converts "/dns4/localhost/tcp/8080" to "localhost:8080". -func HostAddrFromMultiaddr(multiaddr string) (string, error) { - address, err := AddressFromString(multiaddr) - if err != nil { - return "", err - } - - return address.HostAddrString() -} From 4c2d8d5ac9532f043c04bb143b795db4b62ad2e3 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 14:00:49 +0300 Subject: [PATCH 051/219] [#607] network: Reflect all supported formats in AddressFromString docs Comment that `AddressFromString` function supports host addresses. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index 77c5a2f24b..b39ed02a61 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -73,7 +73,9 @@ func (a Address) HostAddrString() (string, error) { return host, nil } -// AddressFromString restores address from a multiaddr string representation. +// AddressFromString restores address from a string representation. +// +// Supports MultiAddr and HostAddr strings. func AddressFromString(s string) (*Address, error) { ma, err := multiaddr.NewMultiaddr(s) if err != nil { From 35f81729e4749a2de2beaefc676315b563f507f4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 14:08:07 +0300 Subject: [PATCH 052/219] [#607] network: Do not return error from `Address.HostAddrString` method Panic if internal `manet.DialArgs` call returns error since this is unexpected according to `AddressFromString` implementation. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/root.go | 7 +------ pkg/network/address.go | 10 +++++++--- pkg/network/address_test.go | 6 ++---- pkg/network/cache/client.go | 8 +------- pkg/services/object/get/get_test.go | 10 ++-------- pkg/services/object/search/search_test.go | 10 ++-------- 6 files changed, 15 insertions(+), 36 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 19db6432fb..dca7186411 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -257,13 +257,8 @@ func getSDKClient(key *ecdsa.PrivateKey) (client.Client, error) { return nil, err } - hostAddr, err := netAddr.HostAddrString() - if err != nil { - return nil, errInvalidEndpoint - } - options := []client.Option{ - client.WithAddress(hostAddr), + client.WithAddress(netAddr.HostAddrString()), client.WithDefaultPrivateKey(key), } diff --git a/pkg/network/address.go b/pkg/network/address.go index b39ed02a61..1bba70f693 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -64,13 +64,17 @@ func (a Address) IPAddrString() (string, error) { } // HostAddrString returns host address in string format. -func (a Address) HostAddrString() (string, error) { +// +// Panics if host address cannot be fetched from Address. +func (a Address) HostAddrString() string { _, host, err := manet.DialArgs(a.ma) if err != nil { - return "", fmt.Errorf("could not get host addr: %w", err) + // the only correct way to construct Address is AddressFromString + // which makes this error appear unexpected + panic(fmt.Errorf("could not get host addr: %w", err)) } - return host, nil + return host } // AddressFromString restores address from a string representation. diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index aa6f155eca..6ffeaacb9a 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -62,8 +62,7 @@ func TestAddress_HostAddrString(t *testing.T) { for _, testcase := range testcases { addr := Address{testcase.ma} - got, err := addr.HostAddrString() - require.NoError(t, err) + got := addr.HostAddrString() require.Equal(t, testcase.exp, got) } @@ -76,8 +75,7 @@ func TestAddress_HostAddrString(t *testing.T) { for _, testcase := range testcases { addr := Address{testcase} - _, err := addr.HostAddrString() - require.Error(t, err) + require.Panics(t, func() { addr.HostAddrString() }) } }) } diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index 2e77ada0b4..e62f37334c 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -2,7 +2,6 @@ package cache import ( "crypto/tls" - "fmt" "sync" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -55,12 +54,7 @@ func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) { return cli, nil } - hostAddr, err := netAddr.HostAddrString() - if err != nil { - return nil, fmt.Errorf("could not parse address as a string: %w", err) - } - - opts := append(c.opts, client.WithAddress(hostAddr)) + opts := append(c.opts, client.WithAddress(netAddr.HostAddrString())) if netAddr.TLSEnabled() { opts = append(opts, client.WithTLSConfig(&tls.Config{})) diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index b0232d686f..70841a05af 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -83,12 +83,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap } func (c *testClientCache) get(mAddr *network.Address) (getClient, error) { - hostAddr, err := mAddr.HostAddrString() - if err != nil { - return nil, err - } - - v, ok := c.clients[hostAddr] + v, ok := c.clients[mAddr.HostAddrString()] if !ok { return nil, errors.New("could not construct client") } @@ -415,8 +410,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { na, err := network.AddressFromString(a) require.NoError(t, err) - as[j], err = na.HostAddrString() - require.NoError(t, err) + as[j] = na.HostAddrString() ni := netmap.NewNodeInfo() ni.SetAddress(a) diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 394b6ef8fe..ab7c8250a1 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -85,12 +85,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap } func (c *testClientCache) get(mAddr *network.Address) (searchClient, error) { - hostAddr, err := mAddr.HostAddrString() - if err != nil { - return nil, err - } - - v, ok := c.clients[hostAddr] + v, ok := c.clients[mAddr.HostAddrString()] if !ok { return nil, errors.New("could not construct client") } @@ -209,8 +204,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { na, err := network.AddressFromString(a) require.NoError(t, err) - as[j], err = na.HostAddrString() - require.NoError(t, err) + as[j] = na.HostAddrString() ni := netmap.NewNodeInfo() ni.SetAddress(a) From 47fe8911a3c19760fe0c24898124b1826dd8c480 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 14:12:03 +0300 Subject: [PATCH 053/219] [#607] network: Rename Address.HostAddrString method to HostAddr Return tyype is clear from the method's signature and docs, there is no point in reflecting it in the name. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/root.go | 2 +- pkg/network/address.go | 4 ++-- pkg/network/address_test.go | 4 ++-- pkg/network/cache/client.go | 2 +- pkg/services/object/get/get_test.go | 4 ++-- pkg/services/object/search/search_test.go | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index dca7186411..e52ba4e7b8 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -258,7 +258,7 @@ func getSDKClient(key *ecdsa.PrivateKey) (client.Client, error) { } options := []client.Option{ - client.WithAddress(netAddr.HostAddrString()), + client.WithAddress(netAddr.HostAddr()), client.WithDefaultPrivateKey(key), } diff --git a/pkg/network/address.go b/pkg/network/address.go index 1bba70f693..5535975eee 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -63,10 +63,10 @@ func (a Address) IPAddrString() (string, error) { return ip.String(), nil } -// HostAddrString returns host address in string format. +// HostAddr returns host address in string format. // // Panics if host address cannot be fetched from Address. -func (a Address) HostAddrString() string { +func (a Address) HostAddr() string { _, host, err := manet.DialArgs(a.ma) if err != nil { // the only correct way to construct Address is AddressFromString diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index 6ffeaacb9a..c218b0cd4a 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -62,7 +62,7 @@ func TestAddress_HostAddrString(t *testing.T) { for _, testcase := range testcases { addr := Address{testcase.ma} - got := addr.HostAddrString() + got := addr.HostAddr() require.Equal(t, testcase.exp, got) } @@ -75,7 +75,7 @@ func TestAddress_HostAddrString(t *testing.T) { for _, testcase := range testcases { addr := Address{testcase} - require.Panics(t, func() { addr.HostAddrString() }) + require.Panics(t, func() { addr.HostAddr() }) } }) } diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index e62f37334c..bc8152894b 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -54,7 +54,7 @@ func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) { return cli, nil } - opts := append(c.opts, client.WithAddress(netAddr.HostAddrString())) + opts := append(c.opts, client.WithAddress(netAddr.HostAddr())) if netAddr.TLSEnabled() { opts = append(opts, client.WithTLSConfig(&tls.Config{})) diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index 70841a05af..5a0c3d902c 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -83,7 +83,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap } func (c *testClientCache) get(mAddr *network.Address) (getClient, error) { - v, ok := c.clients[mAddr.HostAddrString()] + v, ok := c.clients[mAddr.HostAddr()] if !ok { return nil, errors.New("could not construct client") } @@ -410,7 +410,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { na, err := network.AddressFromString(a) require.NoError(t, err) - as[j] = na.HostAddrString() + as[j] = na.HostAddr() ni := netmap.NewNodeInfo() ni.SetAddress(a) diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index ab7c8250a1..1b2aa94ded 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -85,7 +85,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap } func (c *testClientCache) get(mAddr *network.Address) (searchClient, error) { - v, ok := c.clients[mAddr.HostAddrString()] + v, ok := c.clients[mAddr.HostAddr()] if !ok { return nil, errors.New("could not construct client") } @@ -204,7 +204,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { na, err := network.AddressFromString(a) require.NoError(t, err) - as[j] = na.HostAddrString() + as[j] = na.HostAddr() ni := netmap.NewNodeInfo() ni.SetAddress(a) From dd67e2b69002de8c0bc1a8ac9c2ebe38156c107e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 14:14:23 +0300 Subject: [PATCH 054/219] [#607] network: Remove Address methods used only for testing Remove `Encapsulate`, `Decapsulate` and `IPAddrString` methods of `Address` since they are used in unit tests only. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 26 ------------ pkg/network/address_test.go | 82 ------------------------------------- 2 files changed, 108 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index 5535975eee..a40fef43b1 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -27,22 +27,6 @@ type LocalAddressSource interface { LocalAddress() *Address } -// Encapsulate wraps this Address around another. For example: -// -// /ip4/1.2.3.4 encapsulate /tcp/80 = /ip4/1.2.3.4/tcp/80 -// -func (a *Address) Encapsulate(addr *Address) { - a.ma = a.ma.Encapsulate(addr.ma) -} - -// Decapsulate removes an Address wrapping. For example: -// -// /ip4/1.2.3.4/tcp/80 decapsulate /ip4/1.2.3.4 = /tcp/80 -// -func (a *Address) Decapsulate(addr *Address) { - a.ma = a.ma.Decapsulate(addr.ma) -} - // String returns multiaddr string func (a Address) String() string { return a.ma.String() @@ -53,16 +37,6 @@ func (a Address) Equal(addr Address) bool { return a.ma.Equal(addr.ma) } -// IPAddrString returns network endpoint address in string format. -func (a Address) IPAddrString() (string, error) { - ip, err := manet.ToNetAddr(a.ma) - if err != nil { - return "", fmt.Errorf("could not get net addr: %w", err) - } - - return ip.String(), nil -} - // HostAddr returns host address in string format. // // Panics if host address cannot be fetched from Address. diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index c218b0cd4a..84e384c364 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -1,34 +1,12 @@ package network import ( - "strings" "testing" "github.com/multiformats/go-multiaddr" "github.com/stretchr/testify/require" ) -func TestAddress_NetAddr(t *testing.T) { - ip := "127.0.0.1" - port := "8080" - - ma, err := multiaddr.NewMultiaddr(strings.Join([]string{ - "/ip4", - ip, - "tcp", - port, - }, "/")) - - require.NoError(t, err) - - addr, err := AddressFromString(ma.String()) - require.NoError(t, err) - - netAddr, err := addr.IPAddrString() - require.NoError(t, err) - require.Equal(t, ip+":"+port, netAddr) -} - func TestAddressFromString(t *testing.T) { t.Run("valid addresses", func(t *testing.T) { testcases := []struct { @@ -80,66 +58,6 @@ func TestAddress_HostAddrString(t *testing.T) { }) } -func TestAddress_Encapsulate(t *testing.T) { - ma1, ma2 := "/dns4/neofs.bigcorp.com/tcp/8080", "/tls" - - testcases := []struct { - ma1 multiaddr.Multiaddr - ma2 multiaddr.Multiaddr - want string - }{ - { - buildMultiaddr(ma1, t), - buildMultiaddr(ma2, t), - ma1 + ma2, - }, - { - buildMultiaddr(ma2, t), - buildMultiaddr(ma1, t), - ma2 + ma1, - }, - } - - for _, testcase := range testcases { - addr1 := &Address{testcase.ma1} - addr2 := &Address{testcase.ma2} - - addr1.Encapsulate(addr2) - - require.Equal(t, addr1.String(), testcase.want) - } -} - -func TestAddress_Decapsulate(t *testing.T) { - ma1, ma2 := "/dns4/neofs.bigcorp.com/tcp/8080", "/tls" - - testcases := []struct { - ma1 multiaddr.Multiaddr - ma2 multiaddr.Multiaddr - want string - }{ - { - buildMultiaddr(ma1+ma2, t), - buildMultiaddr(ma2, t), - ma1, - }, - { - buildMultiaddr(ma2+ma1, t), - buildMultiaddr(ma1, t), - ma2, - }, - } - - for _, testcase := range testcases { - addr1 := &Address{testcase.ma1} - addr2 := &Address{testcase.ma2} - - addr1.Decapsulate(addr2) - - require.Equal(t, addr1.String(), testcase.want) - } -} - func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr { ma, err := multiaddr.NewMultiaddr(s) require.NoError(t, err) From e5504c713003a3640605700214b2dd3a2e6ece11 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 15:03:11 +0300 Subject: [PATCH 055/219] [#607] network: Do not use Address.String for address comparison Signed-off-by: Leonard Lyubich --- cmd/neofs-node/container.go | 10 +++++----- cmd/neofs-node/reputation/common/remote.go | 10 +++++----- pkg/innerring/rpc.go | 2 +- pkg/network/address.go | 2 +- pkg/network/tls_test.go | 5 ++++- .../object_manager/placement/traverser_test.go | 10 ++++++++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index adabdc769a..8dd79c58df 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -218,16 +218,16 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc addr := srv.Address() - if r.loadAddrSrc.LocalAddress().String() == srv.Address() { - // if local => return no-op writer - return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil - } - netAddr, err := network.AddressFromString(addr) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } + if network.IsLocalAddress(r.loadAddrSrc, *netAddr) { + // if local => return no-op writer + return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil + } + c, err := r.clientCache.Get(netAddr) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index bb4d88e63f..7c11da308e 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -72,16 +72,16 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep addr := srv.Address() - if rtp.localAddrSrc.LocalAddress().String() == srv.Address() { - // if local => return no-op writer - return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil - } - netAddr, err := network.AddressFromString(addr) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } + if network.IsLocalAddress(rtp.localAddrSrc, *netAddr) { + // if local => return no-op writer + return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil + } + c, err := rtp.clientCache.Get(netAddr) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index 3d812d2de9..c1dbe82f63 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -87,7 +87,7 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma cli, err := c.Get(netAddr) if err != nil { c.log.Warn("can't setup remote connection", - zap.String("address", netAddr.String()), + zap.Stringer("address", netAddr), zap.String("error", err.Error())) continue diff --git a/pkg/network/address.go b/pkg/network/address.go index a40fef43b1..d73aa1ed80 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -27,7 +27,7 @@ type LocalAddressSource interface { LocalAddress() *Address } -// String returns multiaddr string +// String returns multiaddr string. func (a Address) String() string { return a.ma.String() } diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go index 1d7f106dd3..2f00dad63b 100644 --- a/pkg/network/tls_test.go +++ b/pkg/network/tls_test.go @@ -43,6 +43,9 @@ func TestAddress_AddTLS(t *testing.T) { addr.AddTLS() - require.Equal(t, test.want, addr.String(), test.input) + netAddr, err := AddressFromString(test.want) + require.NoError(t, err) + + require.True(t, netAddr.Equal(addr), test.input) } } diff --git a/pkg/services/object_manager/placement/traverser_test.go b/pkg/services/object_manager/placement/traverser_test.go index 0cba8c3fc5..a3bb48a806 100644 --- a/pkg/services/object_manager/placement/traverser_test.go +++ b/pkg/services/object_manager/placement/traverser_test.go @@ -65,6 +65,12 @@ func testPlacement(t *testing.T, ss, rs []int) ([]netmap.Nodes, *container.Conta return nodes, container.New(container.WithPolicy(policy)) } +func assertSameAddress(t *testing.T, ni *netmap.NodeInfo, addr *network.Address) { + netAddr, err := network.AddressFromString(ni.Address()) + require.NoError(t, err) + require.True(t, netAddr.Equal(*addr)) +} + func TestTraverserObjectScenarios(t *testing.T) { t.Run("search scenario", func(t *testing.T) { selectors := []int{2, 3} @@ -87,7 +93,7 @@ func TestTraverserObjectScenarios(t *testing.T) { require.Len(t, addrs, len(nodes[i])) for j, n := range nodes[i] { - require.Equal(t, n.Address(), addrs[j].String()) + assertSameAddress(t, n.NodeInfo, addrs[j]) } } @@ -142,7 +148,7 @@ func TestTraverserObjectScenarios(t *testing.T) { require.Len(t, addrs, replicas[curVector]) for j := range addrs { - require.Equal(t, nodes[curVector][i+j].Address(), addrs[j].String()) + assertSameAddress(t, nodes[curVector][i+j].NodeInfo, addrs[j]) } } From 5de074f24c8b46e3115c2492b4491e8a52965271 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 16 Jun 2021 15:10:38 +0300 Subject: [PATCH 056/219] [#607] network: Implement WriteToNodeInfo method on Address Implement `Address.WriteToNodeInfo` method which sets address of `NodeInfo` structure. Use it in storage node application. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/netmap.go | 2 +- pkg/network/address.go | 6 ++++++ pkg/network/address_test.go | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 6d06ecc6d6..7305304479 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -73,7 +73,7 @@ func nodeAddressFromNetmap(c *cfg) string { } func initNetmapService(c *cfg) { - c.cfgNodeInfo.localInfo.SetAddress(c.localAddr.String()) + c.localAddr.WriteToNodeInfo(&c.cfgNodeInfo.localInfo) c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes()) c.cfgNodeInfo.localInfo.SetAttributes(parseAttributes(c.appCfg)...) c.cfgNodeInfo.localInfo.SetState(netmapSDK.NodeStateOffline) diff --git a/pkg/network/address.go b/pkg/network/address.go index d73aa1ed80..8eb8a0ce71 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -7,6 +7,7 @@ import ( "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr/net" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" ) /* @@ -37,6 +38,11 @@ func (a Address) Equal(addr Address) bool { return a.ma.Equal(addr.ma) } +// WriteToNodeInfo writes Address to netmap.NodeInfo structure. +func (a Address) WriteToNodeInfo(ni *netmap.NodeInfo) { + ni.SetAddress(a.ma.String()) +} + // HostAddr returns host address in string format. // // Panics if host address cannot be fetched from Address. diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index 84e384c364..ee7167f070 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/multiformats/go-multiaddr" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/stretchr/testify/require" ) @@ -63,3 +64,18 @@ func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr { require.NoError(t, err) return ma } + +func TestAddress_WriteToNodeInfo(t *testing.T) { + a := "127.0.0.1:8080" + + addr, err := AddressFromString(a) + require.NoError(t, err) + + var ni netmap.NodeInfo + + addr.WriteToNodeInfo(&ni) + + restored, err := AddressFromString(ni.Address()) + require.NoError(t, err) + require.True(t, restored.Equal(*addr)) +} From adbbad0beb906424008c188f5f42d66953a3fce5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Jun 2021 09:00:21 +0300 Subject: [PATCH 057/219] [#607] network: Do not work with Address pointers `network.Address` structure in most cases created once and used read-only. Replace `AddressFromString` function with `Address.FromString` method with the same purpose and implementation. Make all libraries to work with value. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/root.go | 8 +++---- cmd/neofs-node/config.go | 4 ++-- cmd/neofs-node/config/node/config.go | 4 ++-- cmd/neofs-node/config/node/config_test.go | 6 +++-- cmd/neofs-node/container.go | 8 ++++--- cmd/neofs-node/object.go | 10 ++++---- cmd/neofs-node/reputation/common/remote.go | 8 ++++--- pkg/innerring/processors/audit/process.go | 4 +++- pkg/innerring/processors/audit/processor.go | 2 +- pkg/innerring/rpc.go | 16 +++++++++---- pkg/network/address.go | 23 ++++++++----------- pkg/network/address_test.go | 14 +++++++---- pkg/network/cache/client.go | 2 +- pkg/network/tls_test.go | 4 +++- pkg/services/object/get/exec.go | 2 +- pkg/services/object/get/get_test.go | 7 +++--- pkg/services/object/get/remote.go | 2 +- pkg/services/object/get/service.go | 4 ++-- pkg/services/object/get/util.go | 2 +- pkg/services/object/head/remote.go | 6 ++--- pkg/services/object/put/distributed.go | 8 +++---- pkg/services/object/put/remote.go | 6 ++--- pkg/services/object/put/service.go | 2 +- pkg/services/object/put/streamer.go | 10 ++++---- pkg/services/object/search/exec.go | 2 +- pkg/services/object/search/remote.go | 2 +- pkg/services/object/search/search_test.go | 7 +++--- pkg/services/object/search/service.go | 4 ++-- pkg/services/object/search/util.go | 2 +- pkg/services/object/util/log.go | 2 +- pkg/services/object/util/placement.go | 12 ++++++---- .../object_manager/placement/traverser.go | 8 +++---- .../placement/traverser_test.go | 14 +++++++---- pkg/services/policer/check.go | 6 +++-- pkg/services/replicator/process.go | 4 +++- 35 files changed, 128 insertions(+), 97 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index e52ba4e7b8..4ebcc55c55 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -238,15 +238,15 @@ func getKeyFromWallet(w *wallet.Wallet, addrStr string) (*ecdsa.PrivateKey, erro // getEndpointAddress returns network address structure that stores multiaddr // inside, parsed from global arguments. -func getEndpointAddress() (*network.Address, error) { +func getEndpointAddress() (addr network.Address, err error) { endpoint := viper.GetString("rpc") - addr, err := network.AddressFromString(endpoint) + err = addr.FromString(endpoint) if err != nil { - return nil, errInvalidEndpoint + err = errInvalidEndpoint } - return addr, nil + return } // getSDKClient returns default neofs-api-go sdk client. Consider using diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 179a11048a..ddd3f1cb8f 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -90,7 +90,7 @@ type cfg struct { cfgNodeInfo cfgNodeInfo - localAddr *network.Address + localAddr network.Address cfgObject cfgObject @@ -308,7 +308,7 @@ func initCfg(path string) *cfg { return c } -func (c *cfg) LocalAddress() *network.Address { +func (c *cfg) LocalAddress() network.Address { return c.localAddr } diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index d794ba02b4..1e1f0bf85c 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -67,13 +67,13 @@ func Wallet(c *config.Config) *keys.PrivateKey { // from "node" section as network.Address. // // Panics if value is not a valid NeoFS network address -func BootstrapAddress(c *config.Config) *network.Address { +func BootstrapAddress(c *config.Config) (addr network.Address) { v := config.StringSafe(c.Sub(subsection), "address") if v == "" { panic(errAddressNotSet) } - addr, err := network.AddressFromString(v) + err := addr.FromString(v) if err != nil { panic(fmt.Errorf("could not convert bootstrap address %s to %T: %w", v, addr, err)) } diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index 9c89df7bd1..d20c1b09f6 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -46,11 +46,13 @@ func TestNodeSection(t *testing.T) { relay := Relay(c) wKey := Wallet(c) - expectedAddr, err := network.AddressFromString("s01.neofs.devenv:8080") + var expectedAddr network.Address + + err := expectedAddr.FromString("s01.neofs.devenv:8080") require.NoError(t, err) require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address()) - require.Equal(t, true, addr.Equal(*expectedAddr)) + require.Equal(t, true, addr.Equal(expectedAddr)) require.Equal(t, true, relay) require.Len(t, attributes, 2) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 8dd79c58df..c44da3dcdc 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -205,7 +205,7 @@ type remoteLoadAnnounceProvider struct { loadAddrSrc network.LocalAddressSource clientCache interface { - Get(*network.Address) (apiClient.Client, error) + Get(network.Address) (apiClient.Client, error) } deadEndProvider loadcontroller.WriterProvider @@ -218,12 +218,14 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc addr := srv.Address() - netAddr, err := network.AddressFromString(addr) + var netAddr network.Address + + err := netAddr.FromString(addr) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(r.loadAddrSrc, *netAddr) { + if network.IsLocalAddress(r.loadAddrSrc, netAddr) { // if local => return no-op writer return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil } diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 0dbd4647c9..bd5805d929 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -408,7 +408,7 @@ type reputationClientConstructor struct { trustStorage *truststorage.Storage basicConstructor interface { - Get(*network.Address) (client.Client, error) + Get(network.Address) (client.Client, error) } } @@ -492,7 +492,7 @@ func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchO return ids, err } -func (c *reputationClientConstructor) Get(addr *network.Address) (client.Client, error) { +func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, error) { cl, err := c.basicConstructor.Get(addr) if err != nil { return nil, err @@ -501,9 +501,11 @@ func (c *reputationClientConstructor) Get(addr *network.Address) (client.Client, nm, err := netmap.GetLatestNetworkMap(c.nmSrc) if err == nil { for i := range nm.Nodes { - netAddr, err := network.AddressFromString(nm.Nodes[i].Address()) + var netAddr network.Address + + err := netAddr.FromString(nm.Nodes[i].Address()) if err == nil { - if netAddr.Equal(*addr) { + if netAddr.Equal(addr) { prm := truststorage.UpdatePrm{} prm.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index 7c11da308e..5c4c88d51e 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -11,7 +11,7 @@ import ( ) type clientCache interface { - Get(*network.Address) (apiClient.Client, error) + Get(network.Address) (apiClient.Client, error) } // clientKeyRemoteProvider must provide remote writer and take into account @@ -72,12 +72,14 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep addr := srv.Address() - netAddr, err := network.AddressFromString(addr) + var netAddr network.Address + + err := netAddr.FromString(addr) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(rtp.localAddrSrc, *netAddr) { + if network.IsLocalAddress(rtp.localAddrSrc, netAddr) { // if local => return no-op writer return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil } diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index 44169dfaf4..c3a78fa772 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -118,7 +118,9 @@ func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*ob zap.Int("total_tries", ln), ) - netAddr, err := network.AddressFromString(shuffled[i].Address()) + var netAddr network.Address + + err := netAddr.FromString(shuffled[i].Address()) if err != nil { log.Warn("can't parse remote address", zap.String("error", err.Error())) diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index a5d41b86e3..23ef5259d9 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -29,7 +29,7 @@ type ( // NeoFSClientCache is an interface for cache of neofs RPC clients NeoFSClientCache interface { - Get(address *network.Address) (SDKClient.Client, error) + Get(address network.Address) (SDKClient.Client, error) } TaskManager interface { diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index c1dbe82f63..ade22dbd01 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -22,7 +22,7 @@ type ( ClientCache struct { log *zap.Logger cache interface { - Get(address *network.Address) (client.Client, error) + Get(address network.Address) (client.Client, error) CloseAll() } key *ecdsa.PrivateKey @@ -49,7 +49,7 @@ func newClientCache(p *clientCacheParams) *ClientCache { } } -func (c *ClientCache) Get(address *network.Address) (client.Client, error) { +func (c *ClientCache) Get(address network.Address) (client.Client, error) { // Because cache is used by `ClientCache` exclusively, // client will always have valid key. return c.cache.Get(address) @@ -75,7 +75,9 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma getParams.WithAddress(addr) for _, node := range placement.FlattenNodes(nodes) { - netAddr, err := network.AddressFromString(node.Address()) + var netAddr network.Address + + err := netAddr.FromString(node.Address()) if err != nil { c.log.Warn("can't parse remote address", zap.String("address", node.Address()), @@ -137,7 +139,9 @@ func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object. headParams.WithMainFields() headParams.WithAddress(objAddress) - netAddr, err := network.AddressFromString(node.Address()) + var netAddr network.Address + + err := netAddr.FromString(node.Address()) if err != nil { return nil, fmt.Errorf("can't parse remote address %s: %w", node.Address(), err) } @@ -173,7 +177,9 @@ func (c *ClientCache) GetRangeHash(task *audit.Task, node *netmap.Node, id *obje rangeParams.WithRangeList(rng) rangeParams.WithSalt(nil) // it MUST be nil for correct hash concatenation in PDP game - netAddr, err := network.AddressFromString(node.Address()) + var netAddr network.Address + + err := netAddr.FromString(node.Address()) if err != nil { return nil, fmt.Errorf("can't parse remote address %s: %w", node.Address(), err) } diff --git a/pkg/network/address.go b/pkg/network/address.go index 8eb8a0ce71..b18987ffb6 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -25,7 +25,7 @@ type Address struct { // LocalAddressSource is an interface of local // network address container with read access. type LocalAddressSource interface { - LocalAddress() *Address + LocalAddress() Address } // String returns multiaddr string. @@ -57,26 +57,21 @@ func (a Address) HostAddr() string { return host } -// AddressFromString restores address from a string representation. +// FromString restores Address from a string representation. // // Supports MultiAddr and HostAddr strings. -func AddressFromString(s string) (*Address, error) { - ma, err := multiaddr.NewMultiaddr(s) +func (a *Address) FromString(s string) error { + var err error + + a.ma, err = multiaddr.NewMultiaddr(s) if err != nil { s, err = multiaddrStringFromHostAddr(s) - if err != nil { - return nil, err - } - - ma, err = multiaddr.NewMultiaddr(s) // don't want recursion there - if err != nil { - return nil, err + if err == nil { + a.ma, err = multiaddr.NewMultiaddr(s) } } - return &Address{ - ma: ma, - }, nil + return err } // multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080" diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index ee7167f070..91f606a858 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -20,8 +20,10 @@ func TestAddressFromString(t *testing.T) { {"[2004:eb1::1]:8080", buildMultiaddr("/ip6/2004:eb1::1/tcp/8080", t)}, } + var addr Address + for _, testcase := range testcases { - addr, err := AddressFromString(testcase.inp) + err := addr.FromString(testcase.inp) require.NoError(t, err) require.Equal(t, testcase.exp, addr.ma, testcase.inp) } @@ -68,14 +70,18 @@ func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr { func TestAddress_WriteToNodeInfo(t *testing.T) { a := "127.0.0.1:8080" - addr, err := AddressFromString(a) + var addr Address + + err := addr.FromString(a) require.NoError(t, err) var ni netmap.NodeInfo addr.WriteToNodeInfo(&ni) - restored, err := AddressFromString(ni.Address()) + var restored Address + + err = restored.FromString(ni.Address()) require.NoError(t, err) - require.True(t, restored.Equal(*addr)) + require.True(t, restored.Equal(addr)) } diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index bc8152894b..225f83bb60 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -29,7 +29,7 @@ func NewSDKClientCache(opts ...client.Option) *ClientCache { } // Get function returns existing client or creates a new one. -func (c *ClientCache) Get(netAddr *network.Address) (client.Client, error) { +func (c *ClientCache) Get(netAddr network.Address) (client.Client, error) { // multiaddr is used as a key in client cache since // same host may have different connections(with tls or not), // therefore, host+port pair is not unique diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go index 2f00dad63b..122568b33b 100644 --- a/pkg/network/tls_test.go +++ b/pkg/network/tls_test.go @@ -43,7 +43,9 @@ func TestAddress_AddTLS(t *testing.T) { addr.AddTLS() - netAddr, err := AddressFromString(test.want) + var netAddr Address + + err := netAddr.FromString(test.want) require.NoError(t, err) require.True(t, netAddr.Equal(addr), test.input) diff --git a/pkg/services/object/get/exec.go b/pkg/services/object/get/exec.go index bfe1ebb44f..6848aa42f7 100644 --- a/pkg/services/object/get/exec.go +++ b/pkg/services/object/get/exec.go @@ -270,7 +270,7 @@ func (exec *execCtx) headChild(id *objectSDK.ID) (*object.Object, bool) { } } -func (exec execCtx) remoteClient(node *network.Address) (getClient, bool) { +func (exec execCtx) remoteClient(node network.Address) (getClient, bool) { log := exec.log.With(zap.Stringer("node", node)) c, err := exec.svc.clientCache.get(node) diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index 5a0c3d902c..549afd6183 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -82,7 +82,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap return vs, nil } -func (c *testClientCache) get(mAddr *network.Address) (getClient, error) { +func (c *testClientCache) get(mAddr network.Address) (getClient, error) { v, ok := c.clients[mAddr.HostAddr()] if !ok { return nil, errors.New("could not construct client") @@ -406,8 +406,9 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { strconv.Itoa(60000+j), ) - var err error - na, err := network.AddressFromString(a) + var na network.Address + + err := na.FromString(a) require.NoError(t, err) as[j] = na.HostAddr() diff --git a/pkg/services/object/get/remote.go b/pkg/services/object/get/remote.go index 9de21b6457..acea51f64a 100644 --- a/pkg/services/object/get/remote.go +++ b/pkg/services/object/get/remote.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" ) -func (exec *execCtx) processNode(ctx context.Context, addr *network.Address) bool { +func (exec *execCtx) processNode(ctx context.Context, addr network.Address) bool { log := exec.log.With(zap.Stringer("remote node", addr)) log.Debug("processing node...") diff --git a/pkg/services/object/get/service.go b/pkg/services/object/get/service.go index 1244c00631..ab8d51e83c 100644 --- a/pkg/services/object/get/service.go +++ b/pkg/services/object/get/service.go @@ -35,7 +35,7 @@ type cfg struct { } clientCache interface { - get(*network.Address) (getClient, error) + get(network.Address) (getClient, error) } traverserGenerator interface { @@ -93,7 +93,7 @@ func WithLocalStorageEngine(e *engine.StorageEngine) Option { } type ClientConstructor interface { - Get(*network.Address) (client.Client, error) + Get(network.Address) (client.Client, error) } // WithClientConstructor returns option to set constructor of remote node clients. diff --git a/pkg/services/object/get/util.go b/pkg/services/object/get/util.go index a8dee7f788..72578458ee 100644 --- a/pkg/services/object/get/util.go +++ b/pkg/services/object/get/util.go @@ -72,7 +72,7 @@ func (s *SimpleObjectWriter) Object() *object.Object { return s.obj.Object() } -func (c *clientCacheWrapper) get(addr *network.Address) (getClient, error) { +func (c *clientCacheWrapper) get(addr network.Address) (getClient, error) { clt, err := c.cache.Get(addr) return &clientWrapper{ diff --git a/pkg/services/object/head/remote.go b/pkg/services/object/head/remote.go index 088e4f1111..921a35a488 100644 --- a/pkg/services/object/head/remote.go +++ b/pkg/services/object/head/remote.go @@ -13,7 +13,7 @@ import ( ) type ClientConstructor interface { - Get(*network.Address) (client.Client, error) + Get(network.Address) (client.Client, error) } // RemoteHeader represents utility for getting @@ -28,7 +28,7 @@ type RemoteHeader struct { type RemoteHeadPrm struct { commonHeadPrm *Prm - node *network.Address + node network.Address } var ErrNotFound = errors.New("object header not found") @@ -42,7 +42,7 @@ func NewRemoteHeader(keyStorage *util.KeyStorage, cache ClientConstructor) *Remo } // WithNodeAddress sets network address of the remote node. -func (p *RemoteHeadPrm) WithNodeAddress(v *network.Address) *RemoteHeadPrm { +func (p *RemoteHeadPrm) WithNodeAddress(v network.Address) *RemoteHeadPrm { if p != nil { p.node = v } diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index e302cf1a55..eed9c9bdbf 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -23,9 +23,9 @@ type distributedTarget struct { chunks [][]byte - nodeTargetInitializer func(*network.Address) transformer.ObjectTarget + nodeTargetInitializer func(network.Address) transformer.ObjectTarget - relay func(*network.Address) error + relay func(network.Address) error fmt *object.FormatValidator @@ -68,7 +68,7 @@ func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) { return t.iteratePlacement(t.sendObject) } -func (t *distributedTarget) sendObject(addr *network.Address) error { +func (t *distributedTarget) sendObject(addr network.Address) error { if t.relay != nil { err := t.relay(addr) if err == nil || !errors.Is(err, errLocalAddress) { @@ -86,7 +86,7 @@ func (t *distributedTarget) sendObject(addr *network.Address) error { return nil } -func (t *distributedTarget) iteratePlacement(f func(*network.Address) error) (*transformer.AccessIdentifiers, error) { +func (t *distributedTarget) iteratePlacement(f func(network.Address) error) (*transformer.AccessIdentifiers, error) { traverser, err := placement.NewTraverser( append(t.traverseOpts, placement.ForObject(t.obj.ID()))..., ) diff --git a/pkg/services/object/put/remote.go b/pkg/services/object/put/remote.go index 2d1a710f20..33e790b19c 100644 --- a/pkg/services/object/put/remote.go +++ b/pkg/services/object/put/remote.go @@ -20,7 +20,7 @@ type remoteTarget struct { commonPrm *util.CommonPrm - addr *network.Address + addr network.Address obj *object.Object @@ -37,7 +37,7 @@ type RemoteSender struct { // RemotePutPrm groups remote put operation parameters. type RemotePutPrm struct { - node *network.Address + node network.Address obj *object.Object } @@ -86,7 +86,7 @@ func NewRemoteSender(keyStorage *util.KeyStorage, cons ClientConstructor) *Remot } // WithNodeAddress sets network address of the remote node. -func (p *RemotePutPrm) WithNodeAddress(v *network.Address) *RemotePutPrm { +func (p *RemotePutPrm) WithNodeAddress(v network.Address) *RemotePutPrm { if p != nil { p.node = v } diff --git a/pkg/services/object/put/service.go b/pkg/services/object/put/service.go index a34d10d0ca..d010226d75 100644 --- a/pkg/services/object/put/service.go +++ b/pkg/services/object/put/service.go @@ -30,7 +30,7 @@ type Service struct { type Option func(*cfg) type ClientConstructor interface { - Get(*network.Address) (client.Client, error) + Get(network.Address) (client.Client, error) } type cfg struct { diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index afdbe9467d..459fdfca4d 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -147,10 +147,10 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error { var errLocalAddress = errors.New("can't relay to local address") func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { - var relay func(*network.Address) error + var relay func(network.Address) error if p.relay != nil { - relay = func(addr *network.Address) error { - if network.IsLocalAddress(p.localAddrSrc, *addr) { + relay = func(addr network.Address) error { + if network.IsLocalAddress(p.localAddrSrc, addr) { return errLocalAddress } @@ -166,8 +166,8 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { return &distributedTarget{ traverseOpts: prm.traverseOpts, workerPool: p.workerPool, - nodeTargetInitializer: func(addr *network.Address) transformer.ObjectTarget { - if network.IsLocalAddress(p.localAddrSrc, *addr) { + nodeTargetInitializer: func(addr network.Address) transformer.ObjectTarget { + if network.IsLocalAddress(p.localAddrSrc, addr) { return &localTarget{ storage: p.localStore, } diff --git a/pkg/services/object/search/exec.go b/pkg/services/object/search/exec.go index 4de46dc899..75fababac6 100644 --- a/pkg/services/object/search/exec.go +++ b/pkg/services/object/search/exec.go @@ -117,7 +117,7 @@ func (exec *execCtx) generateTraverser(cid *cid.ID) (*placement.Traverser, bool) } } -func (exec execCtx) remoteClient(node *network.Address) (searchClient, bool) { +func (exec execCtx) remoteClient(node network.Address) (searchClient, bool) { log := exec.log.With(zap.Stringer("node", node)) c, err := exec.svc.clientConstructor.get(node) diff --git a/pkg/services/object/search/remote.go b/pkg/services/object/search/remote.go index c5db7bdbd7..cdf8ed706a 100644 --- a/pkg/services/object/search/remote.go +++ b/pkg/services/object/search/remote.go @@ -7,7 +7,7 @@ import ( "go.uber.org/zap" ) -func (exec *execCtx) processNode(ctx context.Context, addr *network.Address) { +func (exec *execCtx) processNode(ctx context.Context, addr network.Address) { log := exec.log.With(zap.Stringer("remote node", addr)) log.Debug("processing node...") diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 1b2aa94ded..827d98999d 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -84,7 +84,7 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap return res, nil } -func (c *testClientCache) get(mAddr *network.Address) (searchClient, error) { +func (c *testClientCache) get(mAddr network.Address) (searchClient, error) { v, ok := c.clients[mAddr.HostAddr()] if !ok { return nil, errors.New("could not construct client") @@ -200,8 +200,9 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { strconv.Itoa(60000+j), ) - var err error - na, err := network.AddressFromString(a) + var na network.Address + + err := na.FromString(a) require.NoError(t, err) as[j] = na.HostAddr() diff --git a/pkg/services/object/search/service.go b/pkg/services/object/search/service.go index 7b24426185..5b03c10571 100644 --- a/pkg/services/object/search/service.go +++ b/pkg/services/object/search/service.go @@ -27,7 +27,7 @@ type searchClient interface { } type ClientConstructor interface { - Get(*network.Address) (client.Client, error) + Get(network.Address) (client.Client, error) } type cfg struct { @@ -38,7 +38,7 @@ type cfg struct { } clientConstructor interface { - get(*network.Address) (searchClient, error) + get(network.Address) (searchClient, error) } traverserGenerator interface { diff --git a/pkg/services/object/search/util.go b/pkg/services/object/search/util.go index ba8c253a1b..c1f5c4e9d6 100644 --- a/pkg/services/object/search/util.go +++ b/pkg/services/object/search/util.go @@ -68,7 +68,7 @@ func (w *uniqueIDWriter) WriteIDs(list []*objectSDK.ID) error { return w.writer.WriteIDs(list) } -func (c *clientConstructorWrapper) get(addr *network.Address) (searchClient, error) { +func (c *clientConstructorWrapper) get(addr network.Address) (searchClient, error) { clt, err := c.constructor.Get(addr) return &clientWrapper{ diff --git a/pkg/services/object/util/log.go b/pkg/services/object/util/log.go index e01503b38a..7f90e3be47 100644 --- a/pkg/services/object/util/log.go +++ b/pkg/services/object/util/log.go @@ -7,7 +7,7 @@ import ( ) // LogServiceError writes debug error message of object service to provided logger. -func LogServiceError(l *logger.Logger, req string, node *network.Address, err error) { +func LogServiceError(l *logger.Logger, req string, node network.Address, err error) { l.Debug("object service error", zap.Stringer("node", node), zap.String("request", req), diff --git a/pkg/services/object/util/placement.go b/pkg/services/object/util/placement.go index 787e7cf29d..e7a9b42346 100644 --- a/pkg/services/object/util/placement.go +++ b/pkg/services/object/util/placement.go @@ -50,13 +50,15 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK. for i := range vs { for j := range vs[i] { - addr, err := network.AddressFromString(vs[i][j].Address()) + var addr network.Address + + err := addr.FromString(vs[i][j].Address()) if err != nil { // TODO: log error continue } - if network.IsLocalAddress(p.localAddrSrc, *addr) { + if network.IsLocalAddress(p.localAddrSrc, addr) { return []netmapSDK.Nodes{{vs[i][j]}}, nil } } @@ -82,13 +84,15 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK for i := range vs { for j := 0; j < len(vs[i]); j++ { - addr, err := network.AddressFromString(vs[i][j].Address()) + var addr network.Address + + err := addr.FromString(vs[i][j].Address()) if err != nil { // TODO: log error continue } - if network.IsLocalAddress(p.localAddrSrc, *addr) { + if network.IsLocalAddress(p.localAddrSrc, addr) { vs[i] = append(vs[i][:j], vs[i][j+1:]...) j-- } diff --git a/pkg/services/object_manager/placement/traverser.go b/pkg/services/object_manager/placement/traverser.go index 336951febd..23511e892f 100644 --- a/pkg/services/object_manager/placement/traverser.go +++ b/pkg/services/object_manager/placement/traverser.go @@ -122,7 +122,7 @@ func flatNodes(ns []netmap.Nodes) []netmap.Nodes { // Next returns next unprocessed address of the object placement. // // Returns nil if no nodes left or traversal operation succeeded. -func (t *Traverser) Next() []*network.Address { +func (t *Traverser) Next() []network.Address { t.mtx.Lock() defer t.mtx.Unlock() @@ -139,16 +139,14 @@ func (t *Traverser) Next() []*network.Address { count = len(t.vectors[0]) } - addrs := make([]*network.Address, 0, count) + addrs := make([]network.Address, count) for i := 0; i < count; i++ { - addr, err := network.AddressFromString(t.vectors[0][i].Address()) + err := addrs[i].FromString(t.vectors[0][i].Address()) if err != nil { // TODO: log error return nil } - - addrs = append(addrs, addr) } t.vectors[0] = t.vectors[0][count:] diff --git a/pkg/services/object_manager/placement/traverser_test.go b/pkg/services/object_manager/placement/traverser_test.go index a3bb48a806..1820629621 100644 --- a/pkg/services/object_manager/placement/traverser_test.go +++ b/pkg/services/object_manager/placement/traverser_test.go @@ -65,10 +65,12 @@ func testPlacement(t *testing.T, ss, rs []int) ([]netmap.Nodes, *container.Conta return nodes, container.New(container.WithPolicy(policy)) } -func assertSameAddress(t *testing.T, ni *netmap.NodeInfo, addr *network.Address) { - netAddr, err := network.AddressFromString(ni.Address()) +func assertSameAddress(t *testing.T, ni *netmap.NodeInfo, addr network.Address) { + var netAddr network.Address + + err := netAddr.FromString(ni.Address()) require.NoError(t, err) - require.True(t, netAddr.Equal(*addr)) + require.True(t, netAddr.Equal(addr)) } func TestTraverserObjectScenarios(t *testing.T) { @@ -122,10 +124,12 @@ func TestTraverserObjectScenarios(t *testing.T) { require.NotNil(t, tr.Next()) } - n, err := network.AddressFromString(nodes[1][0].Address()) + var n network.Address + + err = n.FromString(nodes[1][0].Address()) require.NoError(t, err) - require.Equal(t, []*network.Address{n}, tr.Next()) + require.Equal(t, []network.Address{n}, tr.Next()) }) t.Run("put scenario", func(t *testing.T) { diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index 6ba2f9cf21..800d28459c 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -61,14 +61,16 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes log := p.log.With(zap.String("node", netAddr)) - node, err := network.AddressFromString(netAddr) + var node network.Address + + err := node.FromString(netAddr) if err != nil { log.Error("could not parse network address") continue } - if network.IsLocalAddress(p.localAddrSrc, *node) { + if network.IsLocalAddress(p.localAddrSrc, node) { if shortage == 0 { // we can call the redundant copy callback // here to slightly improve the performance diff --git a/pkg/services/replicator/process.go b/pkg/services/replicator/process.go index c68d305fd5..693f50ccfc 100644 --- a/pkg/services/replicator/process.go +++ b/pkg/services/replicator/process.go @@ -70,7 +70,9 @@ func (p *Replicator) handleTask(ctx context.Context, task *Task) { log := p.log.With(zap.String("node", netAddr)) - node, err := network.AddressFromString(netAddr) + var node network.Address + + err := node.FromString(netAddr) if err != nil { log.Error("could not parse network address") From 9b87e6267dfe979e35bcefd0dcf7cc4d8f6bc638 Mon Sep 17 00:00:00 2001 From: ZhangTao1596 Date: Mon, 21 Jun 2021 17:42:09 +0800 Subject: [PATCH 058/219] [#568] shard/writecache: Maintain memory size and db size Signed-off-by: ZhangTao1596 --- pkg/local_object_storage/writecache/delete.go | 17 ++++++++++++----- pkg/local_object_storage/writecache/flush.go | 2 -- pkg/local_object_storage/writecache/persist.go | 18 +++++++----------- pkg/local_object_storage/writecache/storage.go | 15 +++++++++++++-- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/pkg/local_object_storage/writecache/delete.go b/pkg/local_object_storage/writecache/delete.go index c0d6533a0e..fb0f752d2f 100644 --- a/pkg/local_object_storage/writecache/delete.go +++ b/pkg/local_object_storage/writecache/delete.go @@ -19,6 +19,7 @@ func (c *cache) Delete(addr *objectSDK.Address) error { if saddr == c.mem[i].addr { copy(c.mem[i:], c.mem[i+1:]) c.mem = c.mem[:len(c.mem)-1] + c.curMemSize -= uint64(len(c.mem[i].data)) c.mtx.Unlock() return nil } @@ -26,18 +27,24 @@ func (c *cache) Delete(addr *objectSDK.Address) error { c.mtx.Unlock() // Check disk cache. - has := false + var has int _ = c.db.View(func(tx *bbolt.Tx) error { b := tx.Bucket(defaultBucket) - has = b.Get([]byte(saddr)) != nil + has = len(b.Get([]byte(saddr))) return nil }) - if has { - return c.db.Update(func(tx *bbolt.Tx) error { + if 0 < has { + err := c.db.Update(func(tx *bbolt.Tx) error { b := tx.Bucket(defaultBucket) - return b.Delete([]byte(saddr)) + err := b.Delete([]byte(saddr)) + return err }) + if err != nil { + return err + } + c.dbSize.Sub(uint64(has)) + return nil } err := c.fsTree.Delete(addr) diff --git a/pkg/local_object_storage/writecache/flush.go b/pkg/local_object_storage/writecache/flush.go index f42e01d9b9..8b682a465e 100644 --- a/pkg/local_object_storage/writecache/flush.go +++ b/pkg/local_object_storage/writecache/flush.go @@ -99,8 +99,6 @@ func (c *cache) flush() { c.flushed.Add(m[i].addr, true) } - c.dbSize.Sub(uint64(sz)) - c.log.Debug("flushed items from write-cache", zap.Int("count", len(m)), zap.String("start", base58.Encode(lastKey))) diff --git a/pkg/local_object_storage/writecache/persist.go b/pkg/local_object_storage/writecache/persist.go index 1d793decbf..636b061129 100644 --- a/pkg/local_object_storage/writecache/persist.go +++ b/pkg/local_object_storage/writecache/persist.go @@ -31,19 +31,13 @@ func (c *cache) persistLoop() { zap.Int("total", len(m))) c.mtx.Lock() + c.curMemSize = 0 n := copy(c.mem, c.mem[len(m):]) c.mem = c.mem[:n] for i := range c.mem { c.curMemSize += uint64(len(c.mem[i].data)) } c.mtx.Unlock() - - sz := 0 - for i := range m { - sz += len(m[i].addr) + m[i].obj.ToV2().StableSize() - } - c.dbSize.Add(uint64(sz)) - case <-c.closeCh: return } @@ -55,8 +49,8 @@ func (c *cache) persistToCache(objs []objectInfo) []int { failMem []int doneMem []int ) - - _ = c.db.Update(func(tx *bbolt.Tx) error { + var sz uint64 + err := c.db.Update(func(tx *bbolt.Tx) error { b := tx.Bucket(defaultBucket) for i := range objs { if uint64(len(objs[i].data)) >= c.smallObjectSize { @@ -68,12 +62,14 @@ func (c *cache) persistToCache(objs []objectInfo) []int { if err != nil { return err } - + sz += uint64(len(objs[i].data)) doneMem = append(doneMem, i) } return nil }) - + if err == nil { + c.dbSize.Add(sz) + } if len(doneMem) > 0 { c.evictObjects(len(doneMem)) for _, i := range doneMem { diff --git a/pkg/local_object_storage/writecache/storage.go b/pkg/local_object_storage/writecache/storage.go index 2e92b490d3..aa7386cb4d 100644 --- a/pkg/local_object_storage/writecache/storage.go +++ b/pkg/local_object_storage/writecache/storage.go @@ -8,6 +8,7 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/hashicorp/golang-lru/simplelru" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" "go.etcd.io/bbolt" "go.uber.org/zap" @@ -95,16 +96,26 @@ func (c *cache) deleteFromDB(keys [][]byte) error { if len(keys) == 0 { return nil } - - return c.db.Update(func(tx *bbolt.Tx) error { + var sz uint64 + err := c.db.Update(func(tx *bbolt.Tx) error { b := tx.Bucket(defaultBucket) for i := range keys { + has := b.Get(keys[i]) + if has == nil { + return object.ErrNotFound + } if err := b.Delete(keys[i]); err != nil { return err } + sz += uint64(len(has)) } return nil }) + if err != nil { + return err + } + c.dbSize.Sub(sz) + return nil } func (c *cache) deleteFromDisk(keys [][]byte) error { From 8a2b7f450118f118ea7dd03b77b0d1afd3a74f57 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 14:50:11 +0300 Subject: [PATCH 059/219] [#496] pkg/innerring: provide wrappers to processors The only thing we need hashes for is to process notifications. Balance contract if left for now, as it has some initialization. Signed-off-by: Evgenii Stratonikov --- pkg/innerring/innerring.go | 78 ++++++++----------- .../processors/alphabet/process_emit.go | 3 +- .../processors/alphabet/processor.go | 7 +- pkg/innerring/processors/audit/processor.go | 58 ++++++-------- .../processors/governance/process_update.go | 4 +- .../processors/governance/processor.go | 17 ++-- .../processors/neofs/process_assets.go | 14 ++-- .../processors/neofs/process_config.go | 5 +- pkg/innerring/processors/neofs/processor.go | 23 +++--- .../processors/netmap/process_cleanup.go | 6 +- .../processors/netmap/process_epoch.go | 7 +- .../processors/netmap/process_peers.go | 16 +--- pkg/innerring/processors/netmap/processor.go | 15 ++-- .../processors/netmap/snapshot/netmap.go | 61 --------------- pkg/morph/client/balance/client.go | 9 +++ pkg/morph/client/balance/transfer.go | 15 ++++ pkg/morph/client/balance/wrapper/transfer.go | 16 ++++ pkg/morph/client/netmap/client.go | 19 +++-- pkg/morph/client/netmap/config.go | 5 ++ pkg/morph/client/netmap/innerring.go | 13 ++++ pkg/morph/client/netmap/wrapper/config.go | 5 ++ pkg/morph/client/netmap/wrapper/innerring.go | 8 ++ pkg/morph/client/netmap/wrapper/new_epoch.go | 11 +-- pkg/morph/client/netmap/wrapper/snapshot.go | 28 +++++++ 24 files changed, 215 insertions(+), 228 deletions(-) delete mode 100644 pkg/innerring/processors/netmap/snapshot/netmap.go create mode 100644 pkg/morph/client/netmap/innerring.go create mode 100644 pkg/morph/client/netmap/wrapper/innerring.go create mode 100644 pkg/morph/client/netmap/wrapper/snapshot.go diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 2305063fc2..78c955e723 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -67,6 +67,8 @@ type ( precision precision.Fixed8Converter auditClient *auditWrapper.ClientWrapper healthStatus atomic.Value + balanceClient *balanceWrapper.Wrapper + netmapClient *nmWrapper.Wrapper // notary configuration feeConfig *config.FeeConfig @@ -139,10 +141,6 @@ const ( notaryExtraBlocks = 300 // amount of tries before notary deposit timeout. notaryDepositTimeout = 100 - - precisionMethod = "decimals" - // netmap - getEpochMethod = "epoch" ) var ( @@ -404,12 +402,12 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - nmClient, err := nmWrapper.NewFromMorph(server.morphClient, server.contracts.netmap, fee) + server.netmapClient, err = nmWrapper.NewFromMorph(server.morphClient, server.contracts.netmap, fee) if err != nil { return nil, err } - balClient, err := balanceWrapper.NewFromMorph(server.morphClient, server.contracts.balance, fee, balanceWrapper.TryNotary()) + server.balanceClient, err = balanceWrapper.NewFromMorph(server.morphClient, server.contracts.balance, fee, balanceWrapper.TryNotary()) if err != nil { return nil, err } @@ -425,7 +423,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error } // create global runtime config reader - globalConfig := config.NewGlobalConfigReader(cfg, nmClient) + globalConfig := config.NewGlobalConfigReader(cfg, server.netmapClient) clientCache := newClientCache(&clientCacheParams{ Log: log, @@ -459,18 +457,18 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error // create audit processor auditProcessor, err := audit.New(&audit.Params{ - Log: log, - NetmapContract: server.contracts.netmap, - ContainerContract: server.contracts.container, - AuditContract: server.contracts.audit, - MorphClient: server.morphClient, - IRList: server, - FeeProvider: server.feeConfig, - ClientCache: clientCache, - Key: &server.key.PrivateKey, - RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), - TaskManager: auditTaskManager, - Reporter: server, + Log: log, + NetmapClient: server.netmapClient, + ContainerClient: cnrClient, + AuditContract: server.contracts.audit, + MorphClient: server.morphClient, + IRList: server, + FeeProvider: server.feeConfig, + ClientCache: clientCache, + Key: &server.key.PrivateKey, + RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), + TaskManager: auditTaskManager, + Reporter: server, }) if err != nil { return nil, err @@ -482,9 +480,9 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error log: server.log, cnrSrc: cntWrapper.AsContainerSource(cnrClient), auditClient: server.auditClient, - nmSrc: nmClient, + nmSrc: server.netmapClient, clientCache: clientCache, - balanceClient: balClient, + balanceClient: server.balanceClient, } auditCalcDeps := &auditSettlementDeps{ @@ -528,7 +526,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error governanceProcessor, err := governance.New(&governance.Params{ Log: log, NeoFSContract: server.contracts.neofs, - NetmapContract: server.contracts.netmap, + NetmapClient: server.netmapClient, AlphabetState: server, EpochState: server, Voter: server, @@ -560,8 +558,8 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, PoolSize: cfg.GetInt("workers.netmap"), NetmapContract: server.contracts.netmap, + NetmapClient: server.netmapClient, EpochTimer: server, - MorphClient: server.morphClient, EpochState: server, AlphabetState: server, CleanupEnabled: cfg.GetBool("netmap_cleaner.enabled"), @@ -596,7 +594,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error FeeProvider: server.feeConfig, ContainerClient: cnrClient, NeoFSIDClient: neofsIDClient, - NetworkState: nmClient, + NetworkState: server.netmapClient, }) if err != nil { return nil, err @@ -632,9 +630,9 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, PoolSize: cfg.GetInt("workers.neofs"), NeoFSContract: server.contracts.neofs, - BalanceContract: server.contracts.balance, - NetmapContract: server.contracts.netmap, - NeoFSIDContract: server.contracts.neofsID, + NeoFSIDClient: neofsIDClient, + BalanceClient: server.balanceClient, + NetmapClient: server.netmapClient, MorphClient: server.morphClient, EpochState: server, AlphabetState: server, @@ -659,7 +657,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, PoolSize: cfg.GetInt("workers.alphabet"), AlphabetContracts: server.contracts.alphabet, - NetmapContract: server.contracts.netmap, + NetmapClient: server.netmapClient, MorphClient: server.morphClient, IRList: server, StorageEmission: cfg.GetUint64("emit.storage.amount"), @@ -683,7 +681,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error ReputationWrapper: repClient, ManagerBuilder: reputationcommon.NewManagerBuilder( reputationcommon.ManagersPrm{ - NetMapSource: nmClient, + NetMapSource: server.netmapClient, }, ), }) @@ -946,35 +944,25 @@ func parseAlphabetContracts(cfg *viper.Viper) (alphabetContracts, error) { func (s *Server) initConfigFromBlockchain() error { // get current epoch - val, err := s.morphClient.TestInvoke(s.contracts.netmap, getEpochMethod) - if err != nil { - return fmt.Errorf("can't read epoch: %w", err) - } - - epoch, err := client.IntFromStackItem(val[0]) + epoch, err := s.netmapClient.Epoch() if err != nil { return fmt.Errorf("can't parse epoch: %w", err) } // get balance precision - v, err := s.morphClient.TestInvoke(s.contracts.balance, precisionMethod) + balancePrecision, err := s.balanceClient.Decimals() if err != nil { return fmt.Errorf("can't read balance contract precision: %w", err) } - balancePrecision, err := client.IntFromStackItem(v[0]) - if err != nil { - return fmt.Errorf("can't parse balance contract precision: %w", err) - } - - s.epochCounter.Store(uint64(epoch)) - s.precision.SetBalancePrecision(uint32(balancePrecision)) + s.epochCounter.Store(epoch) + s.precision.SetBalancePrecision(balancePrecision) s.log.Debug("read config from blockchain", zap.Bool("active", s.IsActive()), zap.Bool("alphabet", s.IsAlphabet()), - zap.Int64("epoch", epoch), - zap.Uint32("precision", uint32(balancePrecision)), + zap.Uint64("epoch", epoch), + zap.Uint32("precision", balancePrecision), ) return nil diff --git a/pkg/innerring/processors/alphabet/process_emit.go b/pkg/innerring/processors/alphabet/process_emit.go index 742d97d7fb..fa880e6af6 100644 --- a/pkg/innerring/processors/alphabet/process_emit.go +++ b/pkg/innerring/processors/alphabet/process_emit.go @@ -5,7 +5,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" - "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/snapshot" "go.uber.org/zap" ) @@ -41,7 +40,7 @@ func (np *Processor) processEmit() { return } - networkMap, err := snapshot.Fetch(np.morphClient, np.netmapContract) + networkMap, err := np.netmapClient.Snapshot() if err != nil { np.log.Warn("can't get netmap snapshot to emit gas to storage nodes", zap.String("error", err.Error())) diff --git a/pkg/innerring/processors/alphabet/processor.go b/pkg/innerring/processors/alphabet/processor.go index d41d1a51db..54efc09802 100644 --- a/pkg/innerring/processors/alphabet/processor.go +++ b/pkg/innerring/processors/alphabet/processor.go @@ -6,6 +6,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/panjf2000/ants/v2" "go.uber.org/zap" @@ -34,7 +35,7 @@ type ( log *zap.Logger pool *ants.Pool alphabetContracts Contracts - netmapContract util.Uint160 + netmapClient *nmWrapper.Wrapper morphClient *client.Client irList Indexer storageEmission uint64 @@ -45,7 +46,7 @@ type ( Log *zap.Logger PoolSize int AlphabetContracts Contracts - NetmapContract util.Uint160 + NetmapClient *nmWrapper.Wrapper MorphClient *client.Client IRList Indexer StorageEmission uint64 @@ -74,7 +75,7 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, alphabetContracts: p.AlphabetContracts, - netmapContract: p.NetmapContract, + netmapClient: p.NetmapClient, morphClient: p.MorphClient, irList: p.IRList, storageEmission: p.StorageEmission, diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 23ef5259d9..04ff912d4a 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -42,15 +42,14 @@ type ( // Processor of events related with data audit. Processor struct { - log *zap.Logger - pool *ants.Pool - containerContract util.Uint160 - auditContract util.Uint160 - morphClient *client.Client - irList Indexer - clientCache NeoFSClientCache - key *ecdsa.PrivateKey - searchTimeout time.Duration + log *zap.Logger + pool *ants.Pool + auditContract util.Uint160 + morphClient *client.Client + irList Indexer + clientCache NeoFSClientCache + key *ecdsa.PrivateKey + searchTimeout time.Duration containerClient *wrapContainer.Wrapper netmapClient *wrapNetmap.Wrapper @@ -62,18 +61,18 @@ type ( // Params of the processor constructor. Params struct { - Log *zap.Logger - NetmapContract util.Uint160 - ContainerContract util.Uint160 - AuditContract util.Uint160 - MorphClient *client.Client - IRList Indexer - FeeProvider *config.FeeConfig - ClientCache NeoFSClientCache - RPCSearchTimeout time.Duration - TaskManager TaskManager - Reporter audit.Reporter - Key *ecdsa.PrivateKey + Log *zap.Logger + NetmapClient *wrapNetmap.Wrapper + ContainerClient *wrapContainer.Wrapper + AuditContract util.Uint160 + MorphClient *client.Client + IRList Indexer + FeeProvider *config.FeeConfig + ClientCache NeoFSClientCache + RPCSearchTimeout time.Duration + TaskManager TaskManager + Reporter audit.Reporter + Key *ecdsa.PrivateKey } ) @@ -114,30 +113,17 @@ func New(p *Params) (*Processor, error) { return nil, fmt.Errorf("ir/audit: can't create worker pool: %w", err) } - // creating enhanced client for getting network map - netmapClient, err := wrapNetmap.NewFromMorph(p.MorphClient, p.NetmapContract, p.FeeProvider.SideChainFee()) - if err != nil { - return nil, err - } - - // creating enhanced client for getting containers - containerClient, err := wrapContainer.NewFromMorph(p.MorphClient, p.ContainerContract, p.FeeProvider.SideChainFee()) - if err != nil { - return nil, err - } - return &Processor{ log: p.Log, pool: pool, - containerContract: p.ContainerContract, + containerClient: p.ContainerClient, auditContract: p.AuditContract, morphClient: p.MorphClient, irList: p.IRList, clientCache: p.ClientCache, key: p.Key, searchTimeout: p.RPCSearchTimeout, - containerClient: containerClient, - netmapClient: netmapClient, + netmapClient: p.NetmapClient, taskManager: p.TaskManager, reporter: p.Reporter, prevAuditCanceler: func() {}, diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 7b45cf589a..11cfa344f0 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -11,7 +11,6 @@ const ( alphabetUpdateIDPrefix = "AlphabetUpdate" alphabetUpdateMethod = "alphabetUpdate" - setInnerRingMethod = "updateInnerRing" ) func (gp *Processor) processAlphabetSync() { @@ -70,8 +69,7 @@ func (gp *Processor) processAlphabetSync() { sort.Sort(newInnerRing) if gp.notaryDisabled { - err = gp.morphClient.NotaryInvoke(gp.netmapContract, gp.feeProvider.SideChainFee(), setInnerRingMethod, - newInnerRing) + err = gp.netmapClient.SetInnerRing(newInnerRing) } else { err = gp.morphClient.UpdateNeoFSAlphabetList(newInnerRing) } diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index e663469ff5..d8fa00d471 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event/rolemanagement" "github.com/panjf2000/ants/v2" @@ -38,10 +39,10 @@ type ( // Processor of events related to governance in the network. Processor struct { - log *zap.Logger - pool *ants.Pool - neofsContract util.Uint160 - netmapContract util.Uint160 + log *zap.Logger + pool *ants.Pool + neofsContract util.Uint160 + netmapClient *nmWrapper.Wrapper alphabetState AlphabetState epochState EpochState @@ -56,9 +57,8 @@ type ( // Params of the processor constructor. Params struct { - Log *zap.Logger - NeoFSContract util.Uint160 - NetmapContract util.Uint160 + Log *zap.Logger + NeoFSContract util.Uint160 AlphabetState AlphabetState EpochState EpochState @@ -66,6 +66,7 @@ type ( MorphClient *client.Client MainnetClient *client.Client + NetmapClient *nmWrapper.Wrapper NotaryDisabled bool FeeProvider *config.FeeConfig @@ -100,7 +101,7 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, neofsContract: p.NeoFSContract, - netmapContract: p.NetmapContract, + netmapClient: p.NetmapClient, alphabetState: p.AlphabetState, epochState: p.EpochState, voter: p.Voter, diff --git a/pkg/innerring/processors/neofs/process_assets.go b/pkg/innerring/processors/neofs/process_assets.go index daeda154a5..987d748e78 100644 --- a/pkg/innerring/processors/neofs/process_assets.go +++ b/pkg/innerring/processors/neofs/process_assets.go @@ -9,10 +9,6 @@ import ( const ( // lockAccountLifeTime defines amount of epochs when lock account is valid. lockAccountLifetime uint64 = 20 - - burnMethod = "burn" - lockMethod = "lock" - mintMethod = "mint" ) // Process deposit event by invoking balance contract and sending native @@ -24,8 +20,8 @@ func (np *Processor) processDeposit(deposit *neofsEvent.Deposit) { } // send transferX to balance contract - err := np.morphClient.NotaryInvoke(np.balanceContract, np.feeProvider.SideChainFee(), mintMethod, - deposit.To().BytesBE(), + err := np.balanceClient.Mint( + deposit.To(), np.converter.ToBalancePrecision(deposit.Amount()), deposit.ID()) if err != nil { @@ -95,7 +91,7 @@ func (np *Processor) processWithdraw(withdraw *neofsEvent.Withdraw) { curEpoch := np.epochState.EpochCounter() - err = np.morphClient.NotaryInvoke(np.balanceContract, np.feeProvider.SideChainFee(), lockMethod, + err = np.balanceClient.Lock( withdraw.ID(), withdraw.User(), lock, @@ -114,8 +110,8 @@ func (np *Processor) processCheque(cheque *neofsEvent.Cheque) { return } - err := np.morphClient.NotaryInvoke(np.balanceContract, np.feeProvider.SideChainFee(), burnMethod, - cheque.LockAccount().BytesBE(), + err := np.balanceClient.Burn( + cheque.LockAccount(), np.converter.ToBalancePrecision(cheque.Amount()), cheque.ID()) if err != nil { diff --git a/pkg/innerring/processors/neofs/process_config.go b/pkg/innerring/processors/neofs/process_config.go index 283260b7da..3a494640db 100644 --- a/pkg/innerring/processors/neofs/process_config.go +++ b/pkg/innerring/processors/neofs/process_config.go @@ -5,8 +5,6 @@ import ( "go.uber.org/zap" ) -const setConfigMethod = "setConfig" - // Process config event by setting configuration value from main chain in // side chain. func (np *Processor) processConfig(config *neofsEvent.Config) { @@ -15,8 +13,7 @@ func (np *Processor) processConfig(config *neofsEvent.Config) { return } - err := np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), setConfigMethod, - config.ID(), config.Key(), config.Value()) + err := np.netmapClient.SetConfig(config.ID(), config.Key(), config.Value()) if err != nil { np.log.Error("can't relay set config event", zap.Error(err)) } diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index 814cc19a0c..47aa84bf3d 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -10,7 +10,9 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" + nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" neofsEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/neofs" "github.com/panjf2000/ants/v2" @@ -38,9 +40,9 @@ type ( log *zap.Logger pool *ants.Pool neofsContract util.Uint160 - balanceContract util.Uint160 - netmapContract util.Uint160 neofsIDContract util.Uint160 + balanceClient *balanceWrapper.Wrapper + netmapClient *nmWrapper.Wrapper morphClient *client.Client epochState EpochState alphabetState AlphabetState @@ -60,9 +62,9 @@ type ( Log *zap.Logger PoolSize int NeoFSContract util.Uint160 - BalanceContract util.Uint160 - NetmapContract util.Uint160 - NeoFSIDContract util.Uint160 + NeoFSIDClient *neofsid.ClientWrapper + BalanceClient *balanceWrapper.Wrapper + NetmapClient *nmWrapper.Wrapper MorphClient *client.Client EpochState EpochState AlphabetState AlphabetState @@ -113,17 +115,12 @@ func New(p *Params) (*Processor, error) { return nil, fmt.Errorf("ir/neofs: can't create LRU cache for gas emission: %w", err) } - clientWrapper, err := neofsid.NewFromMorph(p.MorphClient, p.NeoFSIDContract, p.FeeProvider.SideChainFee()) - if err != nil { - return nil, fmt.Errorf("could not create NeoFS ID client wrapper: %w", err) - } - return &Processor{ log: p.Log, pool: pool, neofsContract: p.NeoFSContract, - balanceContract: p.BalanceContract, - netmapContract: p.NetmapContract, + balanceClient: p.BalanceClient, + netmapClient: p.NetmapClient, morphClient: p.MorphClient, epochState: p.EpochState, alphabetState: p.AlphabetState, @@ -135,7 +132,7 @@ func New(p *Params) (*Processor, error) { mintEmitValue: p.MintEmitValue, gasBalanceThreshold: p.GasBalanceThreshold, - neofsIDClient: clientWrapper, + neofsIDClient: p.NeoFSIDClient, }, nil } diff --git a/pkg/innerring/processors/netmap/process_cleanup.go b/pkg/innerring/processors/netmap/process_cleanup.go index ab51cb327c..04cd159136 100644 --- a/pkg/innerring/processors/netmap/process_cleanup.go +++ b/pkg/innerring/processors/netmap/process_cleanup.go @@ -6,8 +6,6 @@ import ( "go.uber.org/zap" ) -const updatePeerStateMethod = "updateState" - func (np *Processor) processNetmapCleanupTick(epoch uint64) { if !np.alphabetState.IsAlphabet() { np.log.Info("non alphabet mode, ignore new netmap cleanup tick") @@ -26,9 +24,7 @@ func (np *Processor) processNetmapCleanupTick(epoch uint64) { np.log.Info("vote to remove node from netmap", zap.String("key", s)) - err = np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), updatePeerStateMethod, - int64(netmap.NodeStateOffline.ToV2()), - key.Bytes()) + err = np.netmapClient.UpdatePeerState(key.Bytes(), netmap.NodeStateOffline) if err != nil { np.log.Error("can't invoke netmap.UpdateState", zap.Error(err)) } diff --git a/pkg/innerring/processors/netmap/process_epoch.go b/pkg/innerring/processors/netmap/process_epoch.go index 87fcc1226a..1a94542f52 100644 --- a/pkg/innerring/processors/netmap/process_epoch.go +++ b/pkg/innerring/processors/netmap/process_epoch.go @@ -3,13 +3,10 @@ package netmap import ( "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/governance" - "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/snapshot" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement" "go.uber.org/zap" ) -const setNewEpochMethod = "newEpoch" - // Process new epoch notification by setting global epoch value and resetting // local epoch timer. func (np *Processor) processNewEpoch(epoch uint64) { @@ -20,7 +17,7 @@ func (np *Processor) processNewEpoch(epoch uint64) { } // get new netmap snapshot - networkMap, err := snapshot.Fetch(np.morphClient, np.netmapContract) + networkMap, err := np.netmapClient.Snapshot() if err != nil { np.log.Warn("can't get netmap snapshot to perform cleanup", zap.String("error", err.Error())) @@ -55,7 +52,7 @@ func (np *Processor) processNewEpochTick() { nextEpoch := np.epochState.EpochCounter() + 1 np.log.Debug("next epoch", zap.Uint64("value", nextEpoch)) - err := np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), setNewEpochMethod, int64(nextEpoch)) + err := np.netmapClient.NewEpoch(nextEpoch) if err != nil { np.log.Error("can't invoke netmap.NewEpoch", zap.Error(err)) } diff --git a/pkg/innerring/processors/netmap/process_peers.go b/pkg/innerring/processors/netmap/process_peers.go index 4f91b59a85..96f3c1e1fc 100644 --- a/pkg/innerring/processors/netmap/process_peers.go +++ b/pkg/innerring/processors/netmap/process_peers.go @@ -10,8 +10,6 @@ import ( "go.uber.org/zap" ) -const approvePeerMethod = "addPeer" - // Process add peer notification by sanity check of new node // local epoch timer. func (np *Processor) processAddPeer(node []byte) { @@ -52,14 +50,6 @@ func (np *Processor) processAddPeer(node []byte) { }) nodeInfo.SetAttributes(a...) - // marshal node info back to binary - node, err = nodeInfo.Marshal() - if err != nil { - np.log.Warn("can't marshal approved network map candidate", - zap.String("error", err.Error())) - return - } - keyString := hex.EncodeToString(nodeInfo.PublicKey()) exists := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter()) @@ -67,7 +57,7 @@ func (np *Processor) processAddPeer(node []byte) { np.log.Info("approving network map candidate", zap.String("key", keyString)) - err := np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), approvePeerMethod, node) + err := np.netmapClient.AddPeer(nodeInfo) if err != nil { np.log.Error("can't invoke netmap.AddPeer", zap.Error(err)) } @@ -94,9 +84,7 @@ func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) { // again before new epoch will tick np.netmapSnapshot.flag(hex.EncodeToString(ev.PublicKey().Bytes())) - err := np.morphClient.NotaryInvoke(np.netmapContract, np.feeProvider.SideChainFee(), updatePeerStateMethod, - int64(ev.Status().ToV2()), - ev.PublicKey().Bytes()) + err := np.netmapClient.UpdatePeerState(ev.PublicKey().Bytes(), ev.Status()) if err != nil { np.log.Error("can't invoke netmap.UpdatePeer", zap.Error(err)) } diff --git a/pkg/innerring/processors/netmap/processor.go b/pkg/innerring/processors/netmap/processor.go index 9633602c75..9e865d3321 100644 --- a/pkg/innerring/processors/netmap/processor.go +++ b/pkg/innerring/processors/netmap/processor.go @@ -7,8 +7,8 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" container "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" + nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" "github.com/panjf2000/ants/v2" @@ -57,7 +57,7 @@ type ( epochState EpochState alphabetState AlphabetState - morphClient *client.Client + netmapClient *nmWrapper.Wrapper containerWrp *container.Wrapper netmapSnapshot cleanupTable @@ -73,11 +73,12 @@ type ( // Params of the processor constructor. Params struct { - Log *zap.Logger - PoolSize int + Log *zap.Logger + PoolSize int + // TODO(@fyrchik): add `ContractHash` method to the NetmapClient and remove this parameter. NetmapContract util.Uint160 + NetmapClient *nmWrapper.Wrapper EpochTimer EpochTimerReseter - MorphClient *client.Client EpochState EpochState AlphabetState AlphabetState CleanupEnabled bool @@ -105,8 +106,6 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/netmap: logger is not set") - case p.MorphClient == nil: - return nil, errors.New("ir/netmap: morph client is not set") case p.EpochTimer == nil: return nil, errors.New("ir/netmap: epoch itmer is not set") case p.EpochState == nil: @@ -141,7 +140,7 @@ func New(p *Params) (*Processor, error) { epochTimer: p.EpochTimer, epochState: p.EpochState, alphabetState: p.AlphabetState, - morphClient: p.MorphClient, + netmapClient: p.NetmapClient, containerWrp: p.ContainerWrapper, netmapSnapshot: newCleanupTable(p.CleanupEnabled, p.CleanupThreshold), handleNewAudit: p.HandleAudit, diff --git a/pkg/innerring/processors/netmap/snapshot/netmap.go b/pkg/innerring/processors/netmap/snapshot/netmap.go deleted file mode 100644 index dbba45785c..0000000000 --- a/pkg/innerring/processors/netmap/snapshot/netmap.go +++ /dev/null @@ -1,61 +0,0 @@ -package snapshot - -import ( - "errors" - "fmt" - - "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" -) - -const getNetmapSnapshotMethod = "netmap" - -// Fetch returns current netmap node infos. -// Consider using pkg/morph/client/netmap for this. -func Fetch(cli *client.Client, contract util.Uint160) (*netmap.Netmap, error) { - rawNetmapStack, err := cli.TestInvoke(contract, getNetmapSnapshotMethod) - if err != nil { - return nil, err - } - - if ln := len(rawNetmapStack); ln != 1 { - return nil, errors.New("invalid RPC response") - } - - rawNodeInfos, err := client.ArrayFromStackItem(rawNetmapStack[0]) - if err != nil { - return nil, err - } - - result := make([]netmap.NodeInfo, 0, len(rawNodeInfos)) - - for i := range rawNodeInfos { - nodeInfo, err := peerInfoFromStackItem(rawNodeInfos[i]) - if err != nil { - return nil, fmt.Errorf("invalid RPC response: %w", err) - } - - result = append(result, *nodeInfo) - } - - return netmap.NewNetmap(netmap.NodesFromInfo(result)) -} - -func peerInfoFromStackItem(prm stackitem.Item) (*netmap.NodeInfo, error) { - node := netmap.NewNodeInfo() - - subItems, err := client.ArrayFromStackItem(prm) - if err != nil { - return nil, err - } else if ln := len(subItems); ln != 1 { - return nil, errors.New("invalid RPC response") - } else if rawNodeInfo, err := client.BytesFromStackItem(subItems[0]); err != nil { - return nil, err - } else if err = node.Unmarshal(rawNodeInfo); err != nil { - return nil, err - } - - return node, nil -} diff --git a/pkg/morph/client/balance/client.go b/pkg/morph/client/balance/client.go index 7e4d3799f5..74c6b559f6 100644 --- a/pkg/morph/client/balance/client.go +++ b/pkg/morph/client/balance/client.go @@ -29,12 +29,18 @@ type Option func(*cfg) type cfg struct { transferXMethod, // transferX method name for invocation + mintMethod, + burnMethod, + lockMethod, balanceOfMethod, // balanceOf method name for invocation decimalsMethod string // decimals method name for invocation } const ( defaultTransferXMethod = "transferX" // default "transferX" method name + defaultMintMethod = "mint" // default "mint" method name + defaultBurnMethod = "burn" // default "burn" method name + defaultLockMethod = "lock" // default "lock" method name defaultBalanceOfMethod = "balanceOf" // default "balance of" method name defaultDecimalsMethod = "decimals" // default decimals method name ) @@ -42,6 +48,9 @@ const ( func defaultConfig() *cfg { return &cfg{ transferXMethod: defaultTransferXMethod, + mintMethod: defaultMintMethod, + burnMethod: defaultBurnMethod, + lockMethod: defaultLockMethod, balanceOfMethod: defaultBalanceOfMethod, decimalsMethod: defaultDecimalsMethod, } diff --git a/pkg/morph/client/balance/transfer.go b/pkg/morph/client/balance/transfer.go index a24a1eb1b6..6f6094e8b7 100644 --- a/pkg/morph/client/balance/transfer.go +++ b/pkg/morph/client/balance/transfer.go @@ -56,3 +56,18 @@ func (c *Client) TransferX(args TransferXArgs) error { return nil } + +// Mint invokes `mint` method of the balance contract. +func (c *Client) Mint(to []byte, amount int64, id []byte) error { + return c.client.Invoke(c.mintMethod, to, amount, id) +} + +// Burn invokes `burn` method of the balance contract. +func (c *Client) Burn(to []byte, amount int64, id []byte) error { + return c.client.Invoke(c.burnMethod, to, amount, id) +} + +// Lock invokes `lock` method of the balance contract. +func (c *Client) Lock(id, user, lock []byte, amount, dueEpoch int64) error { + return c.client.Invoke(c.lockMethod, id, user, lock, amount, dueEpoch) +} diff --git a/pkg/morph/client/balance/wrapper/transfer.go b/pkg/morph/client/balance/wrapper/transfer.go index 406d391876..f3e01d7fd5 100644 --- a/pkg/morph/client/balance/wrapper/transfer.go +++ b/pkg/morph/client/balance/wrapper/transfer.go @@ -3,6 +3,7 @@ package wrapper import ( "fmt" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance" ) @@ -40,3 +41,18 @@ func (w *Wrapper) TransferX(p TransferPrm) error { return w.client.TransferX(args) } + +// Mint sends funds to the account. +func (w *Wrapper) Mint(to util.Uint160, amount int64, id []byte) error { + return w.client.Mint(to.BytesBE(), amount, id) +} + +// Burn destroys funds from the account. +func (w *Wrapper) Burn(to util.Uint160, amount int64, id []byte) error { + return w.client.Burn(to.BytesBE(), amount, id) +} + +// Lock locks fund on the user account. +func (w *Wrapper) Lock(id []byte, user, lock util.Uint160, amount, dueEpoch int64) error { + return w.client.Lock(id, user.BytesBE(), lock.BytesBE(), amount, dueEpoch) +} diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index 9afd706cac..f0b0015160 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -38,17 +38,21 @@ type cfg struct { epochSnapshotMethod, // get network map snapshot by epoch method name updateStateMethod, // update state method name for invocation epochMethod, // get epoch number method name + setInnerRing, // set inner ring method name + setConfigMethod, // set config method name configMethod string // get config value method name } const ( - defaultAddPeerMethod = "addPeer" // default add peer method name - defaultNewEpochMethod = "newEpoch" // default new epoch method name - defaultNetMapMethod = "netmap" // default get network map method name - defaultSnapshotMethod = "snapshot" // default get network map snapshot method name - defaultUpdateStateMethod = "updateState" // default update state method name - defaultEpochMethod = "epoch" // default get epoch number method name - defaultConfigMethod = "config" // default get config value method name + defaultAddPeerMethod = "addPeer" // default add peer method name + defaultNewEpochMethod = "newEpoch" // default new epoch method name + defaultNetMapMethod = "netmap" // default get network map method name + defaultSnapshotMethod = "snapshot" // default get network map snapshot method name + defaultUpdateStateMethod = "updateState" // default update state method name + defaultEpochMethod = "epoch" // default get epoch number method name + defaultSetInnerRingMethod = "updateInnerRing" // default set innerring method name + defaultSetConfigMethod = "setConfig" // default get config value method name + defaultConfigMethod = "config" // default get config value method name defaultEpochSnapshotMethod = "snapshotByEpoch" // default get network map snapshot by epoch method name ) @@ -62,6 +66,7 @@ func defaultConfig() *cfg { epochSnapshotMethod: defaultEpochSnapshotMethod, updateStateMethod: defaultUpdateStateMethod, epochMethod: defaultEpochMethod, + setConfigMethod: defaultSetConfigMethod, configMethod: defaultConfigMethod, } } diff --git a/pkg/morph/client/netmap/config.go b/pkg/morph/client/netmap/config.go index 33e08edc1f..f3bc65dd5e 100644 --- a/pkg/morph/client/netmap/config.go +++ b/pkg/morph/client/netmap/config.go @@ -56,6 +56,11 @@ func (c *Client) Config(args ConfigArgs, assert func(stackitem.Item) (interface{ }, nil } +// SetConfig invokes `setConfig` method of NeoFS Netmap contract. +func (c *Client) SetConfig(id, key []byte, value interface{}) error { + return c.client.Invoke(c.setConfigMethod, id, key, value) +} + func IntegerAssert(item stackitem.Item) (interface{}, error) { return client.IntFromStackItem(item) } diff --git a/pkg/morph/client/netmap/innerring.go b/pkg/morph/client/netmap/innerring.go new file mode 100644 index 0000000000..b82ef2a668 --- /dev/null +++ b/pkg/morph/client/netmap/innerring.go @@ -0,0 +1,13 @@ +package netmap + +import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + +// SetInnerRing updates inner ring members in netmap contract. +func (c *Client) SetInnerRing(keys keys.PublicKeys) error { + args := make([][]byte, len(keys)) + for i := range args { + args[i] = keys[i].Bytes() + } + + return c.client.Invoke(c.setInnerRing, args) +} diff --git a/pkg/morph/client/netmap/wrapper/config.go b/pkg/morph/client/netmap/wrapper/config.go index 6270b1b36f..77d1a2902d 100644 --- a/pkg/morph/client/netmap/wrapper/config.go +++ b/pkg/morph/client/netmap/wrapper/config.go @@ -154,3 +154,8 @@ func (w *Wrapper) readStringConfig(key string) (string, error) { return str, nil } + +// SetConfig sets config field. +func (w *Wrapper) SetConfig(id, key []byte, value interface{}) error { + return w.client.SetConfig(id, key, value) +} diff --git a/pkg/morph/client/netmap/wrapper/innerring.go b/pkg/morph/client/netmap/wrapper/innerring.go new file mode 100644 index 0000000000..c8007b8543 --- /dev/null +++ b/pkg/morph/client/netmap/wrapper/innerring.go @@ -0,0 +1,8 @@ +package wrapper + +import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + +// SetInnerRing updates inner ring keys. +func (w *Wrapper) SetInnerRing(keys keys.PublicKeys) error { + return w.client.SetInnerRing(keys) +} diff --git a/pkg/morph/client/netmap/wrapper/new_epoch.go b/pkg/morph/client/netmap/wrapper/new_epoch.go index db32f7481d..bbe6201cf9 100644 --- a/pkg/morph/client/netmap/wrapper/new_epoch.go +++ b/pkg/morph/client/netmap/wrapper/new_epoch.go @@ -1,11 +1,12 @@ package wrapper -// Epoch represents the NeoFS epoch. -// FIXME: correct the definition. -type Epoch struct{} +import "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" // NewEpoch updates NeoFS epoch number through // Netmap contract call. -func (w *Wrapper) NewEpoch(e Epoch) error { - panic("implement me") +func (w *Wrapper) NewEpoch(e uint64) error { + var args netmap.NewEpochArgs + args.SetEpochNumber(int64(e)) + + return w.client.NewEpoch(args) } diff --git a/pkg/morph/client/netmap/wrapper/snapshot.go b/pkg/morph/client/netmap/wrapper/snapshot.go new file mode 100644 index 0000000000..2c5c0397e8 --- /dev/null +++ b/pkg/morph/client/netmap/wrapper/snapshot.go @@ -0,0 +1,28 @@ +package wrapper + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" +) + +// Fetch returns current netmap node infos. +// Consider using pkg/morph/client/netmap for this. +func (w *Wrapper) Snapshot() (*netmap.Netmap, error) { + res, err := w.client.Snapshot(netmap2.GetSnapshotArgs{}) + if err != nil { + return nil, err + } + + peers := res.Peers() + result := make([]netmap.NodeInfo, len(peers)) + + for i := range peers { + if err := result[i].Unmarshal(peers[i]); err != nil { + return nil, fmt.Errorf("can't unmarshal node info: %w", err) + } + } + + return netmap.NewNetmap(netmap.NodesFromInfo(result)) +} From 7cf0093012b9d581819aed252a18f1cc93b86447 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 16:04:39 +0300 Subject: [PATCH 060/219] [#496] pkg/innerring: remove unused processor parameters Signed-off-by: Evgenii Stratonikov --- pkg/innerring/innerring.go | 7 ------- pkg/innerring/processors/audit/processor.go | 14 -------------- pkg/innerring/processors/container/processor.go | 12 ------------ pkg/innerring/processors/neofs/processor.go | 7 ------- pkg/innerring/processors/netmap/processor.go | 9 --------- 5 files changed, 49 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 78c955e723..150fb3ab28 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -460,10 +460,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, NetmapClient: server.netmapClient, ContainerClient: cnrClient, - AuditContract: server.contracts.audit, - MorphClient: server.morphClient, IRList: server, - FeeProvider: server.feeConfig, ClientCache: clientCache, Key: &server.key.PrivateKey, RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), @@ -573,7 +570,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error ), AlphabetSyncHandler: alphaSync, NodeValidator: locodeValidator, - FeeProvider: server.feeConfig, }) if err != nil { return nil, err @@ -589,9 +585,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, PoolSize: cfg.GetInt("workers.container"), ContainerContract: server.contracts.container, - MorphClient: server.morphClient, AlphabetState: server, - FeeProvider: server.feeConfig, ContainerClient: cnrClient, NeoFSIDClient: neofsIDClient, NetworkState: server.netmapClient, @@ -637,7 +631,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error EpochState: server, AlphabetState: server, Converter: &server.precision, - FeeProvider: server.feeConfig, MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"), MintEmitValue: fixedn.Fixed8(cfg.GetInt64("emit.mint.value")), diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 04ff912d4a..7244d74d2a 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -7,10 +7,7 @@ import ( "fmt" "time" - "github.com/nspcc-dev/neo-go/pkg/util" SDKClient "github.com/nspcc-dev/neofs-api-go/pkg/client" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" wrapContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" wrapNetmap "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -44,8 +41,6 @@ type ( Processor struct { log *zap.Logger pool *ants.Pool - auditContract util.Uint160 - morphClient *client.Client irList Indexer clientCache NeoFSClientCache key *ecdsa.PrivateKey @@ -64,10 +59,7 @@ type ( Log *zap.Logger NetmapClient *wrapNetmap.Wrapper ContainerClient *wrapContainer.Wrapper - AuditContract util.Uint160 - MorphClient *client.Client IRList Indexer - FeeProvider *config.FeeConfig ClientCache NeoFSClientCache RPCSearchTimeout time.Duration TaskManager TaskManager @@ -92,12 +84,8 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/audit: logger is not set") - case p.MorphClient == nil: - return nil, errors.New("ir/audit: neo:morph client is not set") case p.IRList == nil: return nil, errors.New("ir/audit: global state is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/audit: fee provider is not set") case p.ClientCache == nil: return nil, errors.New("ir/audit: neofs RPC client cache is not set") case p.TaskManager == nil: @@ -117,8 +105,6 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, containerClient: p.ContainerClient, - auditContract: p.AuditContract, - morphClient: p.MorphClient, irList: p.IRList, clientCache: p.ClientCache, key: p.Key, diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index dcee3ae2e6..c0bbf53990 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -5,8 +5,6 @@ import ( "fmt" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -26,9 +24,7 @@ type ( log *zap.Logger pool *ants.Pool containerContract util.Uint160 - morphClient *client.Client alphabetState AlphabetState - feeProvider *config.FeeConfig cnrClient *wrapper.Wrapper // notary must be enabled idClient *neofsid.ClientWrapper netState NetworkState @@ -39,9 +35,7 @@ type ( Log *zap.Logger PoolSize int ContainerContract util.Uint160 - MorphClient *client.Client AlphabetState AlphabetState - FeeProvider *config.FeeConfig ContainerClient *wrapper.Wrapper NeoFSIDClient *neofsid.ClientWrapper NetworkState NetworkState @@ -70,12 +64,8 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/container: logger is not set") - case p.MorphClient == nil: - return nil, errors.New("ir/container: neo:morph client is not set") case p.AlphabetState == nil: return nil, errors.New("ir/container: global state is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/container: fee provider is not set") case p.ContainerClient == nil: return nil, errors.New("ir/container: Container client is not set") case p.NeoFSIDClient == nil: @@ -95,9 +85,7 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, containerContract: p.ContainerContract, - morphClient: p.MorphClient, alphabetState: p.AlphabetState, - feeProvider: p.FeeProvider, cnrClient: p.ContainerClient, idClient: p.NeoFSIDClient, netState: p.NetworkState, diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index 47aa84bf3d..0b97e4f924 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -8,7 +8,6 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" @@ -40,14 +39,12 @@ type ( log *zap.Logger pool *ants.Pool neofsContract util.Uint160 - neofsIDContract util.Uint160 balanceClient *balanceWrapper.Wrapper netmapClient *nmWrapper.Wrapper morphClient *client.Client epochState EpochState alphabetState AlphabetState converter PrecisionConverter - feeProvider *config.FeeConfig mintEmitLock *sync.Mutex mintEmitCache *lru.Cache mintEmitThreshold uint64 @@ -69,7 +66,6 @@ type ( EpochState EpochState AlphabetState AlphabetState Converter PrecisionConverter - FeeProvider *config.FeeConfig MintEmitCacheSize int MintEmitThreshold uint64 // in epochs MintEmitValue fixedn.Fixed8 @@ -99,8 +95,6 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/neofs: global state is not set") case p.Converter == nil: return nil, errors.New("ir/neofs: balance precision converter is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/neofs: fee provider is not set") } p.Log.Debug("neofs worker pool", zap.Int("size", p.PoolSize)) @@ -125,7 +119,6 @@ func New(p *Params) (*Processor, error) { epochState: p.EpochState, alphabetState: p.AlphabetState, converter: p.Converter, - feeProvider: p.FeeProvider, mintEmitLock: new(sync.Mutex), mintEmitCache: lruCache, mintEmitThreshold: p.MintEmitThreshold, diff --git a/pkg/innerring/processors/netmap/processor.go b/pkg/innerring/processors/netmap/processor.go index 9e865d3321..922433f1c0 100644 --- a/pkg/innerring/processors/netmap/processor.go +++ b/pkg/innerring/processors/netmap/processor.go @@ -6,7 +6,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" container "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -67,8 +66,6 @@ type ( handleAlphabetSync event.Handler nodeValidator NodeValidator - - feeProvider *config.FeeConfig } // Params of the processor constructor. @@ -90,8 +87,6 @@ type ( AlphabetSyncHandler event.Handler NodeValidator NodeValidator - - FeeProvider *config.FeeConfig } ) @@ -122,8 +117,6 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/netmap: container contract wrapper is not set") case p.NodeValidator == nil: return nil, errors.New("ir/netmap: node validator is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/netmap: fee provider is not set") } p.Log.Debug("netmap worker pool", zap.Int("size", p.PoolSize)) @@ -150,8 +143,6 @@ func New(p *Params) (*Processor, error) { handleAlphabetSync: p.AlphabetSyncHandler, nodeValidator: p.NodeValidator, - - feeProvider: p.FeeProvider, }, nil } From 458fc4f5aee6469ca7de5720856923007e98ef2d Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Jun 2021 12:29:32 +0300 Subject: [PATCH 061/219] [#496] morph/client: provide notary options on client creation Signed-off-by: Evgenii Stratonikov --- pkg/innerring/innerring.go | 44 ++++++++++------------ pkg/morph/client/audit/wrapper/wrapper.go | 4 +- pkg/morph/client/constructor.go | 22 ++++++++++- pkg/morph/client/netmap/wrapper/wrapper.go | 4 +- pkg/morph/client/notary.go | 36 +++++++++++------- 5 files changed, 66 insertions(+), 44 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 150fb3ab28..f8f6ced881 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -327,20 +327,18 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } + // enable notary support in the client + var morphNotaryOpts []client.NotaryOption + if !server.sideNotaryConfig.disabled { + morphNotaryOpts = append(morphNotaryOpts, client.WithProxyContract(server.contracts.proxy)) + } + // create morph client - server.morphClient, err = createClient(ctx, morphChain) + server.morphClient, err = createClient(ctx, morphChain, morphNotaryOpts...) if err != nil { return nil, err } - // enable notary support in the client - if !server.sideNotaryConfig.disabled { - err = server.morphClient.EnableNotarySupport(server.contracts.proxy) - if err != nil { - return nil, err - } - } - withoutMainNet := cfg.GetBool("without_mainnet") if withoutMainNet { @@ -359,22 +357,19 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } + // enable notary support in the client + var mainnetNotaryOpts []client.NotaryOption + if !server.mainNotaryConfig.disabled { + mainnetNotaryOpts = append(mainnetNotaryOpts, + client.WithProxyContract(server.contracts.processing), + client.WithAlphabetSource(server.morphClient.Committee)) + } + // create mainnet client - server.mainnetClient, err = createClient(ctx, mainnetChain) + server.mainnetClient, err = createClient(ctx, mainnetChain, mainnetNotaryOpts...) if err != nil { return nil, err } - - // enable notary support in the client - if !server.mainNotaryConfig.disabled { - err = server.mainnetClient.EnableNotarySupport( - server.contracts.processing, - client.WithAlphabetSource(server.morphClient.Committee), - ) - if err != nil { - return nil, err - } - } } server.pubKey = server.key.PublicKey().Bytes() @@ -392,7 +387,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error fee := server.feeConfig.SideChainFee() - server.auditClient, err = auditWrapper.NewFromMorph(server.morphClient, server.contracts.audit, fee) + server.auditClient, err = auditWrapper.NewFromMorph(server.morphClient, server.contracts.audit, fee, client.TryNotary()) if err != nil { return nil, err } @@ -402,7 +397,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - server.netmapClient, err = nmWrapper.NewFromMorph(server.morphClient, server.contracts.netmap, fee) + server.netmapClient, err = nmWrapper.NewFromMorph(server.morphClient, server.contracts.netmap, fee, client.TryNotary()) if err != nil { return nil, err } @@ -811,13 +806,14 @@ func createListener(ctx context.Context, p *chainParams) (event.Listener, error) return listener, err } -func createClient(ctx context.Context, p *chainParams) (*client.Client, error) { +func createClient(ctx context.Context, p *chainParams, notaryOpts ...client.NotaryOption) (*client.Client, error) { return client.New( p.key, p.cfg.GetString(p.name+".endpoint.client"), client.WithContext(ctx), client.WithLogger(p.log), client.WithDialTimeout(p.cfg.GetDuration(p.name+".dial_timeout")), + client.WithNotaryOptions(notaryOpts...), ) } diff --git a/pkg/morph/client/audit/wrapper/wrapper.go b/pkg/morph/client/audit/wrapper/wrapper.go index 18ed37325f..c46a85912b 100644 --- a/pkg/morph/client/audit/wrapper/wrapper.go +++ b/pkg/morph/client/audit/wrapper/wrapper.go @@ -12,8 +12,8 @@ import ( type ClientWrapper audit.Client // NewFromMorph returns the wrapper instance from the raw morph client. -func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*ClientWrapper, error) { - staticClient, err := client.NewStatic(cli, contract, fee) +func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...client.StaticClientOption) (*ClientWrapper, error) { + staticClient, err := client.NewStatic(cli, contract, fee, opts...) if err != nil { return nil, err } diff --git a/pkg/morph/client/constructor.go b/pkg/morph/client/constructor.go index e2d89f4baa..7d8726168f 100644 --- a/pkg/morph/client/constructor.go +++ b/pkg/morph/client/constructor.go @@ -2,6 +2,7 @@ package client import ( "context" + "fmt" "time" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" @@ -27,6 +28,8 @@ type cfg struct { gas util.Uint160 // native gas script-hash waitInterval time.Duration + + notaryOpts []NotaryOption } const ( @@ -93,14 +96,22 @@ func New(key *keys.PrivateKey, endpoint string, opts ...Option) (*Client, error) return nil, err } - return &Client{ + c := &Client{ logger: cfg.logger, client: cli, acc: account, gas: gas, designate: designate, waitInterval: cfg.waitInterval, - }, nil + } + + if len(cfg.notaryOpts) != 0 { + if err := c.enableNotarySupport(cfg.notaryOpts...); err != nil { + return nil, fmt.Errorf("can't enable notary support: %w", err) + } + } + + return c, nil } // WithContext returns a client constructor option that @@ -144,3 +155,10 @@ func WithLogger(logger *logger.Logger) Option { } } } + +// WithNotaryOptions enables notary support and sets notary options for the client. +func WithNotaryOptions(opts ...NotaryOption) Option { + return func(c *cfg) { + c.notaryOpts = opts + } +} diff --git a/pkg/morph/client/netmap/wrapper/wrapper.go b/pkg/morph/client/netmap/wrapper/wrapper.go index 9310eeb17b..a05c924763 100644 --- a/pkg/morph/client/netmap/wrapper/wrapper.go +++ b/pkg/morph/client/netmap/wrapper/wrapper.go @@ -23,8 +23,8 @@ type Wrapper struct { } // NewFromMorph returns the wrapper instance from the raw morph client. -func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*Wrapper, error) { - staticClient, err := client.NewStatic(cli, contract, fee) +func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...client.StaticClientOption) (*Wrapper, error) { + staticClient, err := client.NewStatic(cli, contract, fee, opts...) if err != nil { return nil, fmt.Errorf("can't create netmap static client: %w", err) } diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index ea5dfe8311..f4355ec477 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -31,6 +31,8 @@ type ( } notaryCfg struct { + proxy util.Uint160 + txValidTime, roundTime, fallbackTime uint32 alphabetSource AlphabetKeys @@ -63,10 +65,10 @@ func defaultNotaryConfig(c *Client) *notaryCfg { } } -// EnableNotarySupport creates notary structure in client that provides +// enableNotarySupport creates notary structure in client that provides // ability for client to get alphabet keys from committee or provided source // and use proxy contract script hash to create tx for notary contract. -func (c *Client) EnableNotarySupport(proxy util.Uint160, opts ...NotaryOption) error { +func (c *Client) enableNotarySupport(opts ...NotaryOption) error { cfg := defaultNotaryConfig(c) for _, opt := range opts { @@ -78,9 +80,13 @@ func (c *Client) EnableNotarySupport(proxy util.Uint160, opts ...NotaryOption) e return fmt.Errorf("can't get notary contract script hash: %w", err) } + if cfg.proxy.Equals(util.Uint160{}) { + return errors.New("proxy contract hash is missing") + } + c.notary = ¬ary{ notary: notaryContract, - proxy: proxy, + proxy: cfg.proxy, txValidTime: cfg.txValidTime, roundTime: cfg.roundTime, fallbackTime: cfg.fallbackTime, @@ -91,7 +97,7 @@ func (c *Client) EnableNotarySupport(proxy util.Uint160, opts ...NotaryOption) e } // NotaryEnabled returns true if notary support was enabled in this instance -// of client by calling `EnableNotarySupport()`. Otherwise returns false. +// of client by providing notary options on client creation. Otherwise returns false. func (c *Client) NotaryEnabled() bool { return c.notary != nil } @@ -102,8 +108,7 @@ func (c *Client) NotaryEnabled() bool { // be called periodically. Notary support should be enabled in client to // use this function. // -// This function must be invoked after `EnableNotarySupport()` otherwise it -// throws panic. +// This function must be invoked with notary enabled otherwise it throws panic. func (c *Client) DepositNotary(amount fixedn.Fixed8, delta uint32) (util.Uint256, error) { if c.notary == nil { panic(notaryNotEnabledPanicMsg) @@ -138,8 +143,7 @@ func (c *Client) DepositNotary(amount fixedn.Fixed8, delta uint32) (util.Uint256 // GetNotaryDeposit returns deposit of client's account in notary contract. // Notary support should be enabled in client to use this function. // -// This function must be invoked after `EnableNotarySupport()` otherwise it -// throws panic. +// This function must be invoked with notary enabled otherwise it throws panic. func (c *Client) GetNotaryDeposit() (int64, error) { if c.notary == nil { panic(notaryNotEnabledPanicMsg) @@ -167,8 +171,7 @@ func (c *Client) GetNotaryDeposit() (int64, error) { // UpdateNotaryList updates list of notary nodes in designate contract. Requires // committee multi signature. // -// This function must be invoked after `EnableNotarySupport()` otherwise it -// throws panic. +// This function must be invoked with notary enabled otherwise it throws panic. func (c *Client) UpdateNotaryList(list keys.PublicKeys) error { if c.notary == nil { panic(notaryNotEnabledPanicMsg) @@ -185,8 +188,7 @@ func (c *Client) UpdateNotaryList(list keys.PublicKeys) error { // As for side chain list should contain all inner ring nodes. // Requires committee multi signature. // -// This function must be invoked after `EnableNotarySupport()` otherwise it -// throws panic. +// This function must be invoked with notary enabled otherwise it throws panic. func (c *Client) UpdateNeoFSAlphabetList(list keys.PublicKeys) error { if c.notary == nil { panic(notaryNotEnabledPanicMsg) @@ -203,8 +205,7 @@ func (c *Client) UpdateNeoFSAlphabetList(list keys.PublicKeys) error { // blockchain. Fallback tx is a `RET`. If Notary support is not enabled // it fallbacks to a simple `Invoke()`. // -// This function must be invoked after `EnableNotarySupport()` otherwise it -// throws panic. +// This function must be invoked with notary enabled otherwise it throws panic. func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...interface{}) error { if c.notary == nil { return c.Invoke(contract, fee, method, args...) @@ -497,6 +498,13 @@ func WithAlphabetSource(t AlphabetKeys) NotaryOption { } } +// WithProxyContract sets proxy contract hash. +func WithProxyContract(h util.Uint160) NotaryOption { + return func(c *notaryCfg) { + c.proxy = h + } +} + const alreadyOnChainErrorMessage = "already on chain" // Neo RPC node can return `core.ErrInvalidAttribute` error with From 16e9e726ff087efd571c2f22e6a37aad412f9c0b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Jun 2021 14:35:53 +0300 Subject: [PATCH 062/219] [#496] morph/client: add wrapper for neofs contract Signed-off-by: Evgenii Stratonikov --- pkg/innerring/innerring.go | 14 +++++++----- .../processors/balance/process_assets.go | 4 +--- pkg/innerring/processors/balance/processor.go | 19 ++++------------ .../processors/governance/process_update.go | 5 +---- .../processors/governance/processor.go | 22 +++++++------------ pkg/morph/client/neofs/cheque.go | 16 ++++++++++++++ pkg/morph/client/neofs/client.go | 14 ++++++++---- pkg/morph/client/neofs/wrapper/cheque.go | 17 ++++++++++++++ 8 files changed, 66 insertions(+), 45 deletions(-) create mode 100644 pkg/morph/client/neofs/cheque.go create mode 100644 pkg/morph/client/neofs/wrapper/cheque.go diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index f8f6ced881..f8e6076ac0 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -27,6 +27,7 @@ import ( auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" cntWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" + neofsWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" repWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" @@ -417,6 +418,12 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } + neofsClient, err := neofsWrapper.NewFromMorph(server.mainnetClient, server.contracts.neofs, + server.feeConfig.MainChainFee()) + if err != nil { + return nil, err + } + // create global runtime config reader globalConfig := config.NewGlobalConfigReader(cfg, server.netmapClient) @@ -517,7 +524,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error // create governance processor governanceProcessor, err := governance.New(&governance.Params{ Log: log, - NeoFSContract: server.contracts.neofs, + NeoFSClient: neofsClient, NetmapClient: server.netmapClient, AlphabetState: server, EpochState: server, @@ -525,7 +532,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error MorphClient: server.morphClient, MainnetClient: server.mainnetClient, NotaryDisabled: server.sideNotaryConfig.disabled, - FeeProvider: server.feeConfig, }) if err != nil { return nil, err @@ -598,12 +604,10 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error balanceProcessor, err := balance.New(&balance.Params{ Log: log, PoolSize: cfg.GetInt("workers.balance"), - NeoFSContract: server.contracts.neofs, + NeoFSClient: neofsClient, BalanceContract: server.contracts.balance, - MainnetClient: server.mainnetClient, AlphabetState: server, Converter: &server.precision, - FeeProvider: server.feeConfig, }) if err != nil { return nil, err diff --git a/pkg/innerring/processors/balance/process_assets.go b/pkg/innerring/processors/balance/process_assets.go index fd940f79e1..5ee16cdf90 100644 --- a/pkg/innerring/processors/balance/process_assets.go +++ b/pkg/innerring/processors/balance/process_assets.go @@ -5,8 +5,6 @@ import ( "go.uber.org/zap" ) -const chequeMethod = "cheque" - // Process lock event by invoking Cheque method in main net to send assets // back to the withdraw issuer. func (bp *Processor) processLock(lock *balanceEvent.Lock) { @@ -15,7 +13,7 @@ func (bp *Processor) processLock(lock *balanceEvent.Lock) { return } - err := bp.mainnetClient.NotaryInvoke(bp.neofsContract, bp.feeProvider.MainChainFee(), chequeMethod, + err := bp.neofsClient.Cheque( lock.ID(), lock.User(), bp.converter.ToFixed8(lock.Amount()), diff --git a/pkg/innerring/processors/balance/processor.go b/pkg/innerring/processors/balance/processor.go index ca6b6d74d2..49712d00fa 100644 --- a/pkg/innerring/processors/balance/processor.go +++ b/pkg/innerring/processors/balance/processor.go @@ -5,8 +5,7 @@ import ( "fmt" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" + neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" balanceEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/balance" "github.com/panjf2000/ants/v2" @@ -28,24 +27,20 @@ type ( Processor struct { log *zap.Logger pool *ants.Pool - neofsContract util.Uint160 + neofsClient *neofscontract.ClientWrapper balanceContract util.Uint160 - mainnetClient *client.Client alphabetState AlphabetState converter PrecisionConverter - feeProvider *config.FeeConfig } // Params of the processor constructor. Params struct { Log *zap.Logger PoolSize int - NeoFSContract util.Uint160 + NeoFSClient *neofscontract.ClientWrapper BalanceContract util.Uint160 - MainnetClient *client.Client AlphabetState AlphabetState Converter PrecisionConverter - FeeProvider *config.FeeConfig } ) @@ -58,14 +53,10 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/balance: logger is not set") - case p.MainnetClient == nil: - return nil, errors.New("ir/balance: neo:mainnet client is not set") case p.AlphabetState == nil: return nil, errors.New("ir/balance: global state is not set") case p.Converter == nil: return nil, errors.New("ir/balance: balance precision converter is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/balance: fee provider is not set") } p.Log.Debug("balance worker pool", zap.Int("size", p.PoolSize)) @@ -78,12 +69,10 @@ func New(p *Params) (*Processor, error) { return &Processor{ log: p.Log, pool: pool, - neofsContract: p.NeoFSContract, + neofsClient: p.NeoFSClient, balanceContract: p.BalanceContract, - mainnetClient: p.MainnetClient, alphabetState: p.AlphabetState, converter: p.Converter, - feeProvider: p.FeeProvider, }, nil } diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 11cfa344f0..9aa25ab3d1 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -9,8 +9,6 @@ import ( const ( alphabetUpdateIDPrefix = "AlphabetUpdate" - - alphabetUpdateMethod = "alphabetUpdate" ) func (gp *Processor) processAlphabetSync() { @@ -98,8 +96,7 @@ func (gp *Processor) processAlphabetSync() { id := append([]byte(alphabetUpdateIDPrefix), buf...) - err = gp.mainnetClient.NotaryInvoke(gp.neofsContract, gp.feeProvider.MainChainFee(), alphabetUpdateMethod, - id, newAlphabet) + err = gp.neofsClient.AlphabetUpdate(id, newAlphabet) if err != nil { gp.log.Error("can't update list of alphabet nodes in neofs contract", zap.String("error", err.Error())) diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index d8fa00d471..5b36bc7e84 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -6,9 +6,8 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event/rolemanagement" @@ -39,10 +38,10 @@ type ( // Processor of events related to governance in the network. Processor struct { - log *zap.Logger - pool *ants.Pool - neofsContract util.Uint160 - netmapClient *nmWrapper.Wrapper + log *zap.Logger + pool *ants.Pool + neofsClient *neofscontract.ClientWrapper + netmapClient *nmWrapper.Wrapper alphabetState AlphabetState epochState EpochState @@ -52,13 +51,11 @@ type ( morphClient *client.Client notaryDisabled bool - feeProvider *config.FeeConfig } // Params of the processor constructor. Params struct { - Log *zap.Logger - NeoFSContract util.Uint160 + Log *zap.Logger AlphabetState AlphabetState EpochState EpochState @@ -66,10 +63,10 @@ type ( MorphClient *client.Client MainnetClient *client.Client + NeoFSClient *neofscontract.ClientWrapper NetmapClient *nmWrapper.Wrapper NotaryDisabled bool - FeeProvider *config.FeeConfig } ) @@ -88,8 +85,6 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/governance: global state is not set") case p.Voter == nil: return nil, errors.New("ir/governance: global state is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/governance: fee provider is not set") } pool, err := ants.NewPool(ProcessorPoolSize, ants.WithNonblocking(true)) @@ -100,7 +95,7 @@ func New(p *Params) (*Processor, error) { return &Processor{ log: p.Log, pool: pool, - neofsContract: p.NeoFSContract, + neofsClient: p.NeoFSClient, netmapClient: p.NetmapClient, alphabetState: p.AlphabetState, epochState: p.EpochState, @@ -108,7 +103,6 @@ func New(p *Params) (*Processor, error) { mainnetClient: p.MainnetClient, morphClient: p.MorphClient, notaryDisabled: p.NotaryDisabled, - feeProvider: p.FeeProvider, }, nil } diff --git a/pkg/morph/client/neofs/cheque.go b/pkg/morph/client/neofs/cheque.go new file mode 100644 index 0000000000..6d844cb531 --- /dev/null +++ b/pkg/morph/client/neofs/cheque.go @@ -0,0 +1,16 @@ +package neofscontract + +import ( + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/util" +) + +// Cheque invokes `cheque` method of NeoFS contract. +func (x *Client) Cheque(id []byte, user util.Uint160, amount int64, lock util.Uint160) error { + return x.client.Invoke(x.chequeMethod, id, user.BytesBE(), amount, lock.BytesBE()) +} + +// AlphabetUpdate update list of alphabet nodes. +func (x *Client) AlphabetUpdate(id []byte, pubs keys.PublicKeys) error { + return x.client.Invoke(x.alphabetUpdateMethod, id, pubs) +} diff --git a/pkg/morph/client/neofs/client.go b/pkg/morph/client/neofs/client.go index 60b7aea8ff..2fef77c282 100644 --- a/pkg/morph/client/neofs/client.go +++ b/pkg/morph/client/neofs/client.go @@ -22,19 +22,25 @@ type Client struct { type Option func(*cfg) type cfg struct { + alphabetUpdateMethod, + chequeMethod, bindKeysMethod, unbindKeysMethod string } func defaultConfig() *cfg { const ( - defaultBindKeysMethod = "bind" - defaultUnbindKeysMethod = "unbind" + defaultBindKeysMethod = "bind" + defaultUnbindKeysMethod = "unbind" + defaultAlphabetUpdateMethod = "alphabetUpdate" + defaultChequeMethod = "cheque" ) return &cfg{ - bindKeysMethod: defaultBindKeysMethod, - unbindKeysMethod: defaultUnbindKeysMethod, + alphabetUpdateMethod: defaultAlphabetUpdateMethod, + chequeMethod: defaultChequeMethod, + bindKeysMethod: defaultBindKeysMethod, + unbindKeysMethod: defaultUnbindKeysMethod, } } diff --git a/pkg/morph/client/neofs/wrapper/cheque.go b/pkg/morph/client/neofs/wrapper/cheque.go new file mode 100644 index 0000000000..c03b8f7dab --- /dev/null +++ b/pkg/morph/client/neofs/wrapper/cheque.go @@ -0,0 +1,17 @@ +package neofscontract + +import ( + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/util" + neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs" +) + +// Cheque invokes `cheque` method of NeoFS contract. +func (x *ClientWrapper) Cheque(id []byte, user util.Uint160, amount int64, lock util.Uint160) error { + return (*neofscontract.Client)(x).Cheque(id, user, amount, lock) +} + +// AlphabetUpdate update list of alphabet nodes. +func (x *ClientWrapper) AlphabetUpdate(id []byte, pubs keys.PublicKeys) error { + return (*neofscontract.Client)(x).AlphabetUpdate(id, pubs) +} From ea5c74e7610ae76ceca155d8705f58ae41999857 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 13:11:57 +0300 Subject: [PATCH 063/219] [#622] pkg/network: Add multiaddress validation Validation checks: 1. if address can be parsed by network package; 2. if address contains correct amount of protocols; 3. if address's protocols are in correct order. Signed-off-by: Pavel Karpy --- pkg/network/validation.go | 87 ++++++++++++++++++++++++++++++++++ pkg/network/validation_test.go | 64 +++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 pkg/network/validation.go create mode 100644 pkg/network/validation_test.go diff --git a/pkg/network/validation.go b/pkg/network/validation.go new file mode 100644 index 0000000000..66dd5982a1 --- /dev/null +++ b/pkg/network/validation.go @@ -0,0 +1,87 @@ +package network + +import ( + "errors" + "fmt" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" +) + +const ( + // maxProtocolsAmount is maximal amount of protocols + // in multiaddress after parsing with network.AddressFromString + maxProtocolsAmount = 3 + + // minProtocolsAmount is minimal amount of protocols + // in multiaddress after parsing with network.AddressFromString: + // host(ip) and port. + minProtocolsAmount = 2 + + // network protocols + dns, ip4, ip6 = "dns4", "ip4", "ip6" + + // transport protocols + tcp = "tcp" +) + +var ( + errIncorrectProtocolAmount = errors.New("numbers of protocols in multiaddress incorrect") + errUnsupportedNetworkProtocol = errors.New("unsupported network protocol in multiaddress") + errUnsupportedTransportProtocol = errors.New("unsupported transport protocol in multiaddress") + errUnsupportedPresentationProtocol = errors.New("unsupported presentation protocol in multiaddress") +) + +// VerifyMultiAddress validates multiaddress of n. +// +// If n's address contains more than 3 protocols +// or less than 2 protocols an error returns. +// +// If n's address's protocol order is incorrect +// an error returns. +// +// Correct composition(and order from low to high level) +// of protocols: +// +// 1. dns4/ip4/ip6 +// 2. tcp +// 3. tls(optional, may be absent) +// +func VerifyMultiAddress(ni *netmap.NodeInfo) error { + // check if it can be parsed to network.Address + var netAddr Address + + err := netAddr.FromString(ni.Address()) + if err != nil { + return fmt.Errorf("could not parse multiaddr from NodeInfo: %w", err) + } + + // check amount of protocols and its order + return checkProtocols(netAddr) +} + +func checkProtocols(a Address) error { + pp := a.ma.Protocols() + parsedProtocolsAmount := len(pp) + + if parsedProtocolsAmount > maxProtocolsAmount || parsedProtocolsAmount < minProtocolsAmount { + return errIncorrectProtocolAmount + } + + switch pp[0].Name { + case dns, ip4, ip6: + default: + return errUnsupportedNetworkProtocol + } + + if pp[1].Name != tcp { + return errUnsupportedTransportProtocol + } + + if parsedProtocolsAmount != minProtocolsAmount { + if pp[2].Name != tlsProtocolName { + return errUnsupportedPresentationProtocol + } + } + + return nil +} diff --git a/pkg/network/validation_test.go b/pkg/network/validation_test.go new file mode 100644 index 0000000000..8409b29153 --- /dev/null +++ b/pkg/network/validation_test.go @@ -0,0 +1,64 @@ +package network + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/stretchr/testify/require" +) + +type testCase struct { + input string + err error +} + +func TestVerifyMultiAddress_Order(t *testing.T) { + testCases := []testCase{ + { + input: "/ip4/1.2.3.4/tcp/80", + err: nil, + }, + { + input: "/ip6/1.2.3.4/tcp/80", + err: nil, + }, + { + input: "/dns4/1.2.3.4/tcp/80", + err: nil, + }, + { + input: "/dns4/1.2.3.4/tcp/80/tls", + err: nil, + }, + { + input: "/tls/dns4/1.2.3.4/tcp/80", + err: errUnsupportedNetworkProtocol, + }, + { + input: "/dns4/1.2.3.4/tls/tcp/80", + err: errUnsupportedTransportProtocol, + }, + { + input: "/dns4/1.2.3.4/tcp/80/wss", + err: errUnsupportedPresentationProtocol, + }, + } + + for _, test := range testCases { + ni := constructNodeInfo(test.input) + + if test.err != nil { + require.EqualError(t, test.err, VerifyMultiAddress(ni).Error()) + } else { + require.NoError(t, VerifyMultiAddress(ni)) + } + } +} + +func constructNodeInfo(address string) *netmap.NodeInfo { + ni := new(netmap.NodeInfo) + + ni.SetAddress(address) + + return ni +} From 53b7e05b65d54c9d3c1b5b5af92d49f67f003659 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 13:18:48 +0300 Subject: [PATCH 064/219] [#622] pkg/innerring: Add multiaddress validator Add multiaddress validator that calls `network.VerifyAddress`. Signed-off-by: Pavel Karpy --- .../netmap/nodevalidation/maddress/calls.go | 18 ++++++++++++++++++ .../nodevalidation/maddress/validator.go | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go create mode 100644 pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go new file mode 100644 index 0000000000..2b99f3b64d --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/calls.go @@ -0,0 +1,18 @@ +package maddress + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-node/pkg/network" +) + +// VerifyAndUpdate calls network.VerifyAddress. +func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { + err := network.VerifyMultiAddress(n) + if err != nil { + return fmt.Errorf("could not verify multiaddress: %w", err) + } + + return nil +} diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go new file mode 100644 index 0000000000..91bb8da26a --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go @@ -0,0 +1,17 @@ +package maddress + +// Validator is an utility that verifies node +// multiaddress. +// +// For correct operation, Validator must be created +// using the constructor (New). After successful creation, +// the Validator is immediately ready to work through API. +type Validator struct {} + +// New creates a new instance of the Validator. +// +// The created Validator does not require additional +// initialization and is completely ready for work. +func New() *Validator { + return &Validator{} +} From 1cd0352babec193e0819289ed9114040067872b8 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 13:35:31 +0300 Subject: [PATCH 065/219] [#622] pkg/innerring: Add composite validator Add `CompositeValidator` that wraps `netmap.NodeValidator`s and implements `NodeValidator` interface itself. Signed-off-by: Pavel Karpy --- .../nodevalidation/maddress/validator.go | 2 +- .../netmap/nodevalidation/validator.go | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 pkg/innerring/processors/netmap/nodevalidation/validator.go diff --git a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go index 91bb8da26a..8f0c0f7863 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go +++ b/pkg/innerring/processors/netmap/nodevalidation/maddress/validator.go @@ -6,7 +6,7 @@ package maddress // For correct operation, Validator must be created // using the constructor (New). After successful creation, // the Validator is immediately ready to work through API. -type Validator struct {} +type Validator struct{} // New creates a new instance of the Validator. // diff --git a/pkg/innerring/processors/netmap/nodevalidation/validator.go b/pkg/innerring/processors/netmap/nodevalidation/validator.go new file mode 100644 index 0000000000..23fa64515e --- /dev/null +++ b/pkg/innerring/processors/netmap/nodevalidation/validator.go @@ -0,0 +1,37 @@ +package nodevalidation + +import ( + apinetmap "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap" +) + +// CompositeValidator wraps `netmap.NodeValidator`s. +// +// For correct operation, CompositeValidator must be created +// using the constructor (New). After successful creation, +// the CompositeValidator is immediately ready to work through +// API. +type CompositeValidator struct { + validators []netmap.NodeValidator +} + +// New creates a new instance of the CompositeValidator. +// +// The created CompositeValidator does not require additional +// initialization and is completely ready for work. +func New(validators ...netmap.NodeValidator) *CompositeValidator { + return &CompositeValidator{validators} +} + +// VerifyAndUpdate passes apinetmap.NodeInfo to wrapped validators. +// +// If error appears, returns it immediately. +func (c *CompositeValidator) VerifyAndUpdate(ni *apinetmap.NodeInfo) error { + for _, v := range c.validators { + if err := v.VerifyAndUpdate(ni); err != nil { + return err + } + } + + return nil +} From 7b3897253c7bc50e99fc86b80f860dcd60c8b3a5 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 13:42:03 +0300 Subject: [PATCH 066/219] [#622] pkg/innerring: Add multiaddress validation Start using multiaddress validation in netmap processor. Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index f8e6076ac0..2b455d54f9 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -20,6 +20,8 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/governance" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/neofs" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap" + nodevalidator "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/nodevalidation" + addrvalidator "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/nodevalidation/maddress" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/reputation" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement" auditSettlement "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/audit" @@ -570,7 +572,10 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error settlementProcessor.HandleAuditEvent, ), AlphabetSyncHandler: alphaSync, - NodeValidator: locodeValidator, + NodeValidator: nodevalidator.New( + addrvalidator.New(), + locodeValidator, + ), }) if err != nil { return nil, err From 8ddea8a5eec3195bcc6c32c2ed39452768036441 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 13:45:29 +0300 Subject: [PATCH 067/219] [#622] pkg/innerring: Change `NodeValidator` interface description Make changes of the `NodeInfo` by implementations of the `NodeValidator` interface optional. Signed-off-by: Pavel Karpy --- pkg/innerring/processors/netmap/processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/innerring/processors/netmap/processor.go b/pkg/innerring/processors/netmap/processor.go index 922433f1c0..607415bfbe 100644 --- a/pkg/innerring/processors/netmap/processor.go +++ b/pkg/innerring/processors/netmap/processor.go @@ -35,7 +35,7 @@ type ( // of information about the node and its finalization for adding // to the network map. NodeValidator interface { - // Must verify and update NodeInfo structure. + // Must verify and optionally update NodeInfo structure. // // Must return an error if NodeInfo input is invalid. // Must return an error if it is not possible to correctly From bb8d3b19970cc3abc049e1832544c35b30b055d5 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 14:01:08 +0300 Subject: [PATCH 068/219] [#629] go.mod/protobuf: Bump version - google.golang.org/protobuf v1.25.0 => v1.26.0 - github.com/golang/protobuf v1.4.3 => v1.5.2 Signed-off-by: Pavel Karpy --- go.mod | 4 ++-- go.sum | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index de4ce46c24..1eeb00868a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/nspcc-dev/neofs-node go 1.14 require ( - github.com/golang/protobuf v1.4.3 + github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.1.1 github.com/hashicorp/golang-lru v0.5.4 github.com/klauspost/compress v1.11.3 @@ -32,7 +32,7 @@ require ( golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect golang.org/x/tools v0.0.0-20200123022218-593de606220b // indirect google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.25.0 + google.golang.org/protobuf v1.26.0 ) // Used for debug reasons diff --git a/go.sum b/go.sum index 7fe381e644..de34ec27d6 100644 --- a/go.sum +++ b/go.sum @@ -68,6 +68,7 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -95,6 +96,7 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -130,8 +132,12 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -145,6 +151,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -152,6 +159,7 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -385,6 +393,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= @@ -578,6 +587,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -588,6 +599,9 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 7f45fcdbed949c2a8cd35c545cd849cc188bcdbf Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 14:05:43 +0300 Subject: [PATCH 069/219] [#629] go.mod/grpc: Bump version - github.com/google/uuid v1.1.1 => v1.1.2 - google.golang.org/grpc v1.29.1 => v1.38.0 Signed-off-by: Pavel Karpy --- go.mod | 4 ++-- go.sum | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 1eeb00868a..549e2ee4be 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.14 require ( github.com/golang/protobuf v1.5.2 - github.com/google/uuid v1.1.1 + github.com/google/uuid v1.2.0 github.com/hashicorp/golang-lru v0.5.4 github.com/klauspost/compress v1.11.3 github.com/mitchellh/go-homedir v1.1.0 @@ -31,7 +31,7 @@ require ( golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect golang.org/x/tools v0.0.0-20200123022218-593de606220b // indirect - google.golang.org/grpc v1.29.1 + google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index de34ec27d6..c358b1f43d 100644 --- a/go.sum +++ b/go.sum @@ -133,7 +133,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= @@ -149,17 +148,19 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -585,7 +586,6 @@ google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= @@ -597,7 +597,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= From 623d62440c0a94e9dc0f869ba306cb241fe20a53 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 14:15:15 +0300 Subject: [PATCH 070/219] [#629] go.mod/zap: Bump version - go.uber.org/zap v1.13.0 => v1.17.0 - github.com/stretchr/testify v1.6.1 => v1.7.0 - go.uber.org/atomic v1.5.1 => v1.8.0 Signed-off-by: Pavel Karpy --- go.mod | 9 +++------ go.sum | 38 +++++++++++++------------------------- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index 549e2ee4be..691a919d4b 100644 --- a/go.mod +++ b/go.mod @@ -22,15 +22,12 @@ require ( github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.7.0 - github.com/stretchr/testify v1.6.1 + github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.5 - go.uber.org/atomic v1.5.1 - go.uber.org/multierr v1.4.0 // indirect - go.uber.org/zap v1.13.0 + go.uber.org/atomic v1.8.0 + go.uber.org/zap v1.17.0 golang.org/x/crypto v0.0.0-20200117160349-530e935923ad // indirect - golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect - golang.org/x/tools v0.0.0-20200123022218-593de606220b // indirect google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index c358b1f43d..ae168d3b24 100644 --- a/go.sum +++ b/go.sum @@ -157,7 +157,6 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -395,8 +394,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= @@ -420,18 +420,15 @@ go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.5.1 h1:rsqfU5vBkVknbhUGbAUwQKR2H4ItV8tjJ+6kJX4cxHM= -go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= +go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.4.0 h1:f3WCSC2KzAcBXGATIxAB1E2XuCpNU255wNKZ505qi3E= -go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -441,7 +438,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -458,13 +454,10 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -549,14 +542,8 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200123022218-593de606220b h1:ztSlcncMErSAUzXwnVO1iTPxHwtvOHBB26SGiyYXIEE= -golang.org/x/tools v0.0.0-20200123022218-593de606220b/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -620,14 +607,15 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= From fc2fc9a4f4ed8b93031fc31754f04772bffde6ae Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 14:42:38 +0300 Subject: [PATCH 071/219] [#629] go.mod/spf13: Bump versions - github.com/spf13/cast v1.3.0 => v1.3.1 - github.com/spf13/cobra v1.0.0 => v1.1.3 - github.com/spf13/viper v1.7.0 => v1.8.0 Signed-off-by: Pavel Karpy --- go.mod | 9 +- go.sum | 335 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 312 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index 691a919d4b..d4c5cc2318 100644 --- a/go.mod +++ b/go.mod @@ -18,16 +18,13 @@ require ( github.com/panjf2000/ants/v2 v2.3.0 github.com/paulmach/orb v0.2.1 github.com/prometheus/client_golang v1.6.0 - github.com/spf13/cast v1.3.0 - github.com/spf13/cobra v1.0.0 - github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.7.0 + github.com/spf13/cast v1.3.1 + github.com/spf13/cobra v1.1.3 + github.com/spf13/viper v1.8.0 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.5 go.uber.org/atomic v1.8.0 go.uber.org/zap v1.17.0 - golang.org/x/crypto v0.0.0-20200117160349-530e935923ad // indirect - golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index ae168d3b24..77bec27592 100644 --- a/go.sum +++ b/go.sum @@ -5,13 +5,38 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= @@ -38,6 +63,7 @@ github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMw github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -48,6 +74,7 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -68,6 +95,7 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -76,6 +104,7 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -96,16 +125,21 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -114,18 +148,30 @@ github.com/go-redis/redis v6.10.2+incompatible h1:SLbqrO/Ik1nhXA5/cbEs1P5MUBo1Qq github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -135,6 +181,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -148,13 +195,29 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -164,12 +227,12 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -195,6 +258,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= @@ -205,17 +270,21 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= @@ -225,8 +294,9 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -249,8 +319,9 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -321,13 +392,15 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/paulmach/orb v0.2.1 h1:Pp9UuWpUlGVRXzRC5eFlOgdlOXd/a3ALWC3UFLM3gOc= github.com/paulmach/orb v0.2.1/go.mod h1:91bG5A8qKNOiZtlKc0BqKMB3O5kWfRQorTwo8BZ2B/0= github.com/paulmach/protoscan v0.2.0/go.mod h1:2c55sl1Hu6/tgRfc8Y8zADsxuSCYC2IrPh0JCqP/yrw= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -356,6 +429,7 @@ github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -372,22 +446,25 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.0 h1:QRwDgoG8xX+kp69di68D+YYTCWfYEckbZRfUlEIAal0= +github.com/spf13/viper v1.8.0/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -402,13 +479,17 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7 h1:Y17pEjKgx2X0A69WQPGa8hx/Myzu+4NdUxlkZpbAYio= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= @@ -417,8 +498,16 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= @@ -438,13 +527,20 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg= -golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -454,10 +550,22 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -471,21 +579,57 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191105084925-a882066a44e0 h1:QPlSTtPE2k6PZPasQUbzuK3p9JbS+vMXYVto8g/yrsg= -golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -505,24 +649,57 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -543,18 +720,74 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -564,16 +797,58 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -584,6 +859,7 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= @@ -597,19 +873,22 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -618,4 +897,8 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From ff0322067f220841fceff704f270eb84f75f9511 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 14:57:58 +0300 Subject: [PATCH 072/219] [#629] go.mod/prometheus: Bump version - github.com/prometheus/client_golang v1.6.0 => v1.11.0 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 33 ++++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index d4c5cc2318..c9413b994f 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 github.com/paulmach/orb v0.2.1 - github.com/prometheus/client_golang v1.6.0 + github.com/prometheus/client_golang v1.11.0 github.com/spf13/cast v1.3.1 github.com/spf13/cobra v1.1.3 github.com/spf13/viper v1.8.0 diff --git a/go.sum b/go.sum index 77bec27592..3c0c1e0f5d 100644 --- a/go.sum +++ b/go.sum @@ -59,6 +59,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMwWcqkLzDAQugVEwedisr5nRJ1r+7LYnv0U= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= @@ -142,8 +143,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-redis/redis v6.10.2+incompatible h1:SLbqrO/Ik1nhXA5/cbEs1P5MUBo1Qq4ihlNfGnnipPw= github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -266,16 +269,18 @@ github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -284,6 +289,7 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -348,6 +354,7 @@ github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw= github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY= github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk= @@ -408,8 +415,9 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= -github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -419,14 +427,16 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= -github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -438,6 +448,7 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= @@ -666,11 +677,12 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -678,14 +690,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -887,6 +901,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From a328c3bb80adf5fb8117c534d909f516d33e2033 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 15:02:20 +0300 Subject: [PATCH 073/219] [#629] go.mod/orb: Bump version - github.com/paulmach/orb v0.2.1 => v0.2.2 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c9413b994f..ee7161779b 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.3.0 - github.com/paulmach/orb v0.2.1 + github.com/paulmach/orb v0.2.2 github.com/prometheus/client_golang v1.11.0 github.com/spf13/cast v1.3.1 github.com/spf13/cobra v1.1.3 diff --git a/go.sum b/go.sum index 3c0c1e0f5d..e44525454a 100644 --- a/go.sum +++ b/go.sum @@ -154,7 +154,6 @@ github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaL github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -282,7 +281,6 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= @@ -396,9 +394,9 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/panjf2000/ants/v2 v2.3.0 h1:+l+41IiyMmpcK+YhWs2dn3tgL6cg4cvJzup1mBGmU00= github.com/panjf2000/ants/v2 v2.3.0/go.mod h1:LtwNaBX6OeF5qRtQlaeGndalVwJlS2ueur7uwoAHbPA= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulmach/orb v0.2.1 h1:Pp9UuWpUlGVRXzRC5eFlOgdlOXd/a3ALWC3UFLM3gOc= -github.com/paulmach/orb v0.2.1/go.mod h1:91bG5A8qKNOiZtlKc0BqKMB3O5kWfRQorTwo8BZ2B/0= -github.com/paulmach/protoscan v0.2.0/go.mod h1:2c55sl1Hu6/tgRfc8Y8zADsxuSCYC2IrPh0JCqP/yrw= +github.com/paulmach/orb v0.2.2 h1:PblToKAbU0xHVypex/GdZfibA1CeCfN5s0UjxyWExdo= +github.com/paulmach/orb v0.2.2/go.mod h1:FkcWtplUAIVqAuhAOV2d3rpbnQyliDOjOcLW9dUrfdU= +github.com/paulmach/protoscan v0.2.1-0.20210522164731-4e53c6875432/go.mod h1:2sV+uZ/oQh66m4XJVZm5iqUZ62BN88Ex1E+TTS0nLzI= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -717,7 +715,6 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= From 0f1369db8926f3faa9c4bbfb344f88763c0ca2cc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 15:12:09 +0300 Subject: [PATCH 074/219] [#629] go.mod/ants/v2: Bump version - github.com/panjf2000/ants/v2 v2.3.0 => v2.4.0 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ee7161779b..6617cb4245 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/nspcc-dev/neofs-api-go v1.27.1 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 - github.com/panjf2000/ants/v2 v2.3.0 + github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 github.com/prometheus/client_golang v1.11.0 github.com/spf13/cast v1.3.1 diff --git a/go.sum b/go.sum index e44525454a..012492b8ca 100644 --- a/go.sum +++ b/go.sum @@ -391,8 +391,8 @@ github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/panjf2000/ants/v2 v2.3.0 h1:+l+41IiyMmpcK+YhWs2dn3tgL6cg4cvJzup1mBGmU00= -github.com/panjf2000/ants/v2 v2.3.0/go.mod h1:LtwNaBX6OeF5qRtQlaeGndalVwJlS2ueur7uwoAHbPA= +github.com/panjf2000/ants/v2 v2.4.0 h1:embKPQeNWMRbnrRKURv4TXJwjQRWMEAfqZT6Pe5hZNc= +github.com/panjf2000/ants/v2 v2.4.0/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/paulmach/orb v0.2.2 h1:PblToKAbU0xHVypex/GdZfibA1CeCfN5s0UjxyWExdo= github.com/paulmach/orb v0.2.2/go.mod h1:FkcWtplUAIVqAuhAOV2d3rpbnQyliDOjOcLW9dUrfdU= From 7ac3fc93d9284ae4d569b890e37289aa43d38560 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 15:17:08 +0300 Subject: [PATCH 075/219] [#629] go.mod/go-multiaddr: Bump version - github.com/multiformats/go-multiaddr v0.3.1 => v0.3.2 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 6617cb4245..9547456e19 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/klauspost/compress v1.11.3 github.com/mitchellh/go-homedir v1.1.0 github.com/mr-tron/base58 v1.1.3 - github.com/multiformats/go-multiaddr v0.3.1 + github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.2 github.com/nspcc-dev/neofs-api-go v1.27.1 diff --git a/go.sum b/go.sum index 012492b8ca..150f4cf31c 100644 --- a/go.sum +++ b/go.sum @@ -339,10 +339,8 @@ github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= -github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI= -github.com/multiformats/go-multiaddr v0.3.1 h1:1bxa+W7j9wZKTZREySx1vPMs2TqrYWjVZ7zE6/XLG1I= -github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc= -github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA= +github.com/multiformats/go-multiaddr v0.3.2 h1:vapLUGlFpvvkaemMvKGGxjruOzaIzQbn41J6R9vxeyU= +github.com/multiformats/go-multiaddr v0.3.2/go.mod h1:lCKNGP1EQ1eZ35Za2wlqnabm9xQkib3fyB+nZXHLag0= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= From ad07b54d1170b16402620b0ab8212fd758b5aa02 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 15:20:41 +0300 Subject: [PATCH 076/219] [#629] go.mod/base58: Bump version - github.com/mr-tron/base58 v1.1.3 => v1.2.0 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 9547456e19..9d8b210ec6 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 github.com/klauspost/compress v1.11.3 github.com/mitchellh/go-homedir v1.1.0 - github.com/mr-tron/base58 v1.1.3 + github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.2 diff --git a/go.sum b/go.sum index 150f4cf31c..2725d6e7db 100644 --- a/go.sum +++ b/go.sum @@ -332,8 +332,9 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= From 8fac4acd788a0431560e626aa3c35c1744b338d0 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 15:43:10 +0300 Subject: [PATCH 077/219] [#629] go.mod/compress: Bump version - github.com/klauspost/compress v1.11.3 => v1.13.1 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 9d8b210ec6..ba5c707a77 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.2.0 github.com/hashicorp/golang-lru v0.5.4 - github.com/klauspost/compress v1.11.3 + github.com/klauspost/compress v1.13.1 github.com/mitchellh/go-homedir v1.1.0 github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.3.2 diff --git a/go.sum b/go.sum index 2725d6e7db..e301bd543c 100644 --- a/go.sum +++ b/go.sum @@ -187,8 +187,9 @@ github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -284,8 +285,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc= -github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= From dc122027573a5dd809c6494109f6efc53e3e227a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 09:43:55 +0300 Subject: [PATCH 078/219] [#624] cli/util: Sync command description's capitalization Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/util.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index 65457815e9..f7420eff2c 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -32,35 +32,35 @@ var ( signCmd = &cobra.Command{ Use: "sign", - Short: "sign NeoFS structure", + Short: "Sign NeoFS structure", } signBearerCmd = &cobra.Command{ Use: "bearer-token", - Short: "sign bearer token to use it in requests", + Short: "Sign bearer token to use it in requests", RunE: signBearerToken, } signSessionCmd = &cobra.Command{ Use: "session-token", - Short: "sign session token to use it in requests", + Short: "Sign session token to use it in requests", RunE: signSessionToken, } convertCmd = &cobra.Command{ Use: "convert", - Short: "convert representation of NeoFS structures", + Short: "Convert representation of NeoFS structures", } convertEACLCmd = &cobra.Command{ Use: "eacl", - Short: "convert representation of extended ACL table", + Short: "Convert representation of extended ACL table", RunE: convertEACLTable, } keyerCmd = &cobra.Command{ Use: "keyer", - Short: "generate or print information about keys", + Short: "Generate or print information about keys", RunE: processKeyer, } ) From e3b4216fa7e69f95fa5ef634511f5c1a2eb6abc3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 18 Jun 2021 09:48:08 +0300 Subject: [PATCH 079/219] [#624] cli/netmap: Delete logging usage without agrs Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/netmap.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 8ea8e5f638..1fcad7b4c9 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -25,9 +25,6 @@ var netmapCmd = &cobra.Command{ Use: "netmap", Short: "Operations with Network Map", Long: `Operations with Network Map`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("netmap called") - }, } func init() { From 87ce64fbbb8e6752381bbbd512319cf792567a2f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Sun, 20 Jun 2021 19:11:49 +0300 Subject: [PATCH 080/219] [#624] cli/root: Delete `version` command and add corresponding flag Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/root.go | 20 +++++++++++++- cmd/neofs-cli/modules/version.go | 47 -------------------------------- 2 files changed, 19 insertions(+), 48 deletions(-) delete mode 100644 cmd/neofs-cli/modules/version.go diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 4ebcc55c55..e40282fafd 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -17,6 +17,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-node/misc" "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -48,6 +49,7 @@ It contains commands for interaction with NeoFS nodes using different versions of neofs-api and some useful utilities for compiling ACL rules from JSON notation, managing container access through protocol gates, querying network map and much more!`, + Run: entryPoint, } var ( @@ -107,7 +109,23 @@ func init() { // Cobra also supports local flags, which will only run // when this action is called directly. - // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + rootCmd.Flags().Bool("version", false, "Application version and NeoFS API compatibility") +} + +func entryPoint(cmd *cobra.Command, _ []string) { + printVersion, _ := cmd.Flags().GetBool("version") + if printVersion { + cmd.Printf( + "Version: %s \nBuild: %s \nDebug: %s\n", + misc.Version, + misc.Build, + misc.Debug, + ) + + return + } + + _ = cmd.Usage() } // initConfig reads in config file and ENV variables if set. diff --git a/cmd/neofs-cli/modules/version.go b/cmd/neofs-cli/modules/version.go deleted file mode 100644 index 48fa940d20..0000000000 --- a/cmd/neofs-cli/modules/version.go +++ /dev/null @@ -1,47 +0,0 @@ -package cmd - -import ( - "encoding/json" - "fmt" - - "github.com/nspcc-dev/neofs-node/misc" - - "github.com/spf13/cobra" -) - -var ( - // versionCmd represents the version command - versionCmd = &cobra.Command{ - Use: "version", - Short: "Print version and exit", - Run: versionRun, - } -) - -var flagJSON bool - -type VersionInfo struct { - Version string `json:"Version,omitempty"` - Build string `json:"Build,omitempty"` - Debug string `json:"Debug,omitempty"` -} - -func init() { - rootCmd.AddCommand(versionCmd) - versionCmd.Flags().BoolVarP(&flagJSON, "json", "j", false, "Print version information in JSON") -} - -func versionRun(cmd *cobra.Command, args []string) { - versionInfo := VersionInfo{Version: misc.Version, Build: misc.Build, Debug: misc.Debug} - - if flagJSON { - bytes, _ := json.Marshal(versionInfo) - fmt.Printf("%s", string(bytes)+"\n") - return - } - - fmt.Printf("Version: %s \nBuild: %s \nDebug: %s\n", - versionInfo.Version, - versionInfo.Build, - versionInfo.Debug) -} From af72412b77646e8ad93950d25ae0d5d5ad6bfb38 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 00:44:26 +0300 Subject: [PATCH 081/219] [#624] cli/object: Fix error messages Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/object.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index a885aab6b9..d7115fcc08 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -361,7 +361,7 @@ func getObject(cmd *cobra.Command, _ []string) error { return nil } - return fmt.Errorf("can't put object: %w", err) + return fmt.Errorf("can't get object: %w", err) } if filename != "" { @@ -410,7 +410,7 @@ func getObjectHeader(cmd *cobra.Command, _ []string) error { return nil } - return fmt.Errorf("can't put object: %w", err) + return fmt.Errorf("can't get object header: %w", err) } return saveAndPrintHeader(cmd, obj, cmd.Flag("file").Value.String()) @@ -444,7 +444,7 @@ func searchObject(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't put object: %w", err) + return fmt.Errorf("can't search object: %w", err) } cmd.Printf("Found %d objects.\n", len(ids)) for _, id := range ids { @@ -492,7 +492,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't get object: %w", err) + return fmt.Errorf("can't get object header: %w", err) } switch typ { case hashSha256: From 02ca1c4cc1c77bedd914c7f8d93419ccdebd5ec7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 21 Jun 2021 02:02:56 +0300 Subject: [PATCH 082/219] [#624] cli: Do not print help on any failure Change usage function to `Run`(does not return err). Log errors with `cmd.PrintErrln`. Change all `fmt.Print*` to `cmd.Print*`. Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/accounting.go | 30 +-- cmd/neofs-cli/modules/container.go | 261 +++++++++++++++----------- cmd/neofs-cli/modules/control.go | 72 ++++--- cmd/neofs-cli/modules/netmap.go | 87 +++++---- cmd/neofs-cli/modules/object.go | 176 ++++++++++------- cmd/neofs-cli/modules/storagegroup.go | 93 +++++---- cmd/neofs-cli/modules/util.go | 120 ++++++------ 7 files changed, 479 insertions(+), 360 deletions(-) diff --git a/cmd/neofs-cli/modules/accounting.go b/cmd/neofs-cli/modules/accounting.go index 73d5394278..eb5448982d 100644 --- a/cmd/neofs-cli/modules/accounting.go +++ b/cmd/neofs-cli/modules/accounting.go @@ -25,48 +25,50 @@ var accountingBalanceCmd = &cobra.Command{ Use: "balance", Short: "Get internal balance of NeoFS account", Long: `Get internal balance of NeoFS account`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { var ( response *accounting.Decimal oid *owner.ID - err error ctx = context.Background() ) key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } if balanceOwner == "" { wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) if err != nil { - return err + cmd.PrintErrln(err) + return } oid = owner.NewIDFromNeo3Wallet(wallet) } else { oid, err = ownerFromString(balanceOwner) if err != nil { - return err + cmd.PrintErrln(err) + return } } response, err = cli.GetBalance(ctx, oid, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } // print to stdout - prettyPrintDecimal(response) - - return nil + prettyPrintDecimal(cmd, response) }, } @@ -87,14 +89,14 @@ func init() { accountingBalanceCmd.Flags().StringVar(&balanceOwner, "owner", "", "owner of balance account (omit to use owner from private key)") } -func prettyPrintDecimal(decimal *accounting.Decimal) { +func prettyPrintDecimal(cmd *cobra.Command, decimal *accounting.Decimal) { if decimal == nil { return } if verbose { - fmt.Println("value:", decimal.Value()) - fmt.Println("precision:", decimal.Precision()) + cmd.Println("value:", decimal.Value()) + cmd.Println("precision:", decimal.Precision()) } else { // divider = 10^{precision}; v:365, p:2 => 365 / 10^2 = 3.65 divider := math.Pow(10, float64(decimal.Precision())) @@ -102,6 +104,6 @@ func prettyPrintDecimal(decimal *accounting.Decimal) { // %0.8f\n for precision 8 format := fmt.Sprintf("%%0.%df\n", decimal.Precision()) - fmt.Printf(format, float64(decimal.Value())/divider) + cmd.Printf(format, float64(decimal.Value())/divider) } } diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 6cc13db990..520910cbad 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -78,48 +78,50 @@ var listContainersCmd = &cobra.Command{ Use: "list", Short: "List all created containers", Long: "List all created containers", - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { var ( response []*cid.ID oid *owner.ID - err error ctx = context.Background() ) key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } if containerOwner == "" { wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) if err != nil { - return err + cmd.PrintErrln(err) + return } oid = owner.NewIDFromNeo3Wallet(wallet) } else { oid, err = ownerFromString(containerOwner) if err != nil { - return err + cmd.PrintErrln(err) + return } } response, err = cli.ListContainers(ctx, oid, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } // print to stdout - prettyPrintContainerList(response) - - return nil + prettyPrintContainerList(cmd, response) }, } @@ -128,42 +130,49 @@ var createContainerCmd = &cobra.Command{ Short: "Create new container", Long: `Create new container and register it in the NeoFS. It will be stored in sidechain when inner ring will accepts it.`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } placementPolicy, err := parseContainerPolicy(containerPolicy) if err != nil { - return err + cmd.PrintErrln(err) + return } attributes, err := parseAttributes(containerAttributes) if err != nil { - return err + cmd.PrintErrln(err) + return } basicACL, err := parseBasicACL(containerACL) if err != nil { - return err + cmd.PrintErrln(err) + return } nonce, err := parseNonce(containerNonce) if err != nil { - return err + cmd.PrintErrln(err) + return } tok, err := getSessionToken(sessionTokenPath) if err != nil { - return err + cmd.PrintErrln(err) + return } cnr := container.New() @@ -176,28 +185,27 @@ It will be stored in sidechain when inner ring will accepts it.`, id, err := cli.PutContainer(ctx, cnr, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } - fmt.Println("container ID:", id) + cmd.Println("container ID:", id) if containerAwait { - fmt.Println("awaiting...") + cmd.Println("awaiting...") for i := 0; i < awaitTimeout; i++ { time.Sleep(1 * time.Second) _, err := cli.GetContainer(ctx, id, globalCallOptions()...) if err == nil { - fmt.Println("container has been persisted on sidechain") - return nil + cmd.Println("container has been persisted on sidechain") + return } } - return errors.New("timeout: container has not been persisted on sidechain") + cmd.PrintErrln("timeout: container has not been persisted on sidechain") } - - return nil }, } @@ -206,27 +214,31 @@ var deleteContainerCmd = &cobra.Command{ Short: "Delete existing container", Long: `Delete existing container. Only owner of the container has a permission to remove container.`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := parseContainerID(containerID) if err != nil { - return err + cmd.PrintErrln(err) + return } tok, err := getSessionToken(sessionTokenPath) if err != nil { - return err + cmd.PrintErrln(err) + return } callOpts := globalCallOptions() @@ -237,28 +249,27 @@ Only owner of the container has a permission to remove container.`, err = cli.DeleteContainer(ctx, id, callOpts...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } - fmt.Println("container delete method invoked") + cmd.Println("container delete method invoked") if containerAwait { - fmt.Println("awaiting...") + cmd.Println("awaiting...") for i := 0; i < awaitTimeout; i++ { time.Sleep(1 * time.Second) _, err := cli.GetContainer(ctx, id, globalCallOptions()...) if err != nil { - fmt.Println("container has been removed:", containerID) - return nil + cmd.Println("container has been removed:", containerID) + return } } - return errors.New("timeout: container has not been removed from sidechain") + cmd.PrintErrln("timeout: container has not been removed from sidechain") } - - return nil }, } @@ -266,27 +277,31 @@ var listContainerObjectsCmd = &cobra.Command{ Use: "list-objects", Short: "List existing objects in container", Long: `List existing objects in container`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := parseContainerID(containerID) if err != nil { - return err + cmd.PrintErrln(err) + return } sessionToken, err := cli.CreateSession(ctx, math.MaxUint64) if err != nil { - return fmt.Errorf("can't create session token: %w", err) + cmd.PrintErrln(fmt.Errorf("can't create session token: %w", err)) + return } filters := new(object.SearchFilters) @@ -302,14 +317,13 @@ var listContainerObjectsCmd = &cobra.Command{ )..., ) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } for i := range objectIDs { - fmt.Println(objectIDs[i]) + cmd.Println(objectIDs[i]) } - - return nil }, } @@ -317,7 +331,7 @@ var getContainerInfoCmd = &cobra.Command{ Use: "get", Short: "Get container field info", Long: `Get container field info`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { var ( cnr *container.Container @@ -327,36 +341,42 @@ var getContainerInfoCmd = &cobra.Command{ if containerPathFrom != "" { data, err := ioutil.ReadFile(containerPathFrom) if err != nil { - return fmt.Errorf("can't read file: %w", err) + cmd.PrintErrln(fmt.Errorf("can't read file: %w", err)) + return } cnr = container.New() if err := cnr.Unmarshal(data); err != nil { - return fmt.Errorf("can't unmarshal container: %w", err) + cmd.PrintErrln(fmt.Errorf("can't unmarshal container: %w", err)) + return } } else { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := parseContainerID(containerID) if err != nil { - return err + cmd.PrintErrln(err) + return } cnr, err = cli.GetContainer(ctx, id, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } } - prettyPrintContainer(cnr, containerJSON) + prettyPrintContainer(cmd, cnr, containerJSON) if containerPathTo != "" { var ( @@ -367,22 +387,23 @@ var getContainerInfoCmd = &cobra.Command{ if containerJSON { data, err = cnr.MarshalJSON() if err != nil { - return fmt.Errorf("can't JSON encode container: %w", err) + cmd.PrintErrln(fmt.Errorf("can't JSON encode container: %w", err)) + return } } else { data, err = cnr.Marshal() if err != nil { - return fmt.Errorf("can't binary encode container: %w", err) + cmd.PrintErrln(fmt.Errorf("can't binary encode container: %w", err)) + return } } err = ioutil.WriteFile(containerPathTo, data, 0644) if err != nil { - return fmt.Errorf("can't write container to file: %w", err) + cmd.PrintErrln(fmt.Errorf("can't write container to file: %w", err)) + return } } - - return nil }, } @@ -390,40 +411,44 @@ var getExtendedACLCmd = &cobra.Command{ Use: "get-eacl", Short: "Get extended ACL table of container", Long: `Get extended ACL talbe of container`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := parseContainerID(containerID) if err != nil { - return err + cmd.PrintErrln(err) + return } res, err := cli.GetEACL(ctx, id, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } eaclTable := res.EACL() sig := eaclTable.Signature() if containerPathTo == "" { - fmt.Println("eACL: ") - prettyPrintEACL(eaclTable) + cmd.Println("eACL: ") + prettyPrintEACL(cmd, eaclTable) - fmt.Println("Signature:") - printJSONMarshaler(sig, "signature") + cmd.Println("Signature:") + printJSONMarshaler(cmd, sig, "signature") - return nil + return } var data []byte @@ -431,21 +456,25 @@ var getExtendedACLCmd = &cobra.Command{ if containerJSON { data, err = eaclTable.MarshalJSON() if err != nil { - return fmt.Errorf("can't enode to JSON: %w", err) + cmd.PrintErrln(fmt.Errorf("can't enode to JSON: %w", err)) + return } } else { data, err = eaclTable.Marshal() if err != nil { - return fmt.Errorf("can't enode to binary: %w", err) + cmd.PrintErrln(fmt.Errorf("can't enode to binary: %w", err)) + return } } - fmt.Println("dumping data to file:", containerPathTo) + cmd.Println("dumping data to file:", containerPathTo) - fmt.Println("Signature:") - printJSONMarshaler(sig, "signature") + cmd.Println("Signature:") + printJSONMarshaler(cmd, sig, "signature") - return ioutil.WriteFile(containerPathTo, data, 0644) + if err = ioutil.WriteFile(containerPathTo, data, 0644); err != nil { + cmd.PrintErrln(err) + } }, } @@ -454,32 +483,37 @@ var setExtendedACLCmd = &cobra.Command{ Short: "Set new extended ACL table for container", Long: `Set new extended ACL table for container. Container ID in EACL table will be substituted with ID from the CLI.`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { ctx := context.Background() key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := parseContainerID(containerID) if err != nil { - return err + cmd.PrintErrln(err) + return } eaclTable, err := parseEACL(eaclPathFrom) if err != nil { - return err + cmd.PrintErrln(err) + return } tok, err := getSessionToken(sessionTokenPath) if err != nil { - return err + cmd.PrintErrln(err) + return } eaclTable.SetCID(id) @@ -487,16 +521,18 @@ Container ID in EACL table will be substituted with ID from the CLI.`, err = cli.SetEACL(ctx, eaclTable, globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } if containerAwait { exp, err := eaclTable.Marshal() if err != nil { - return errors.New("broken EACL table") + cmd.PrintErrln("broken EACL table") + return } - fmt.Println("awaiting...") + cmd.Println("awaiting...") for i := 0; i < awaitTimeout; i++ { time.Sleep(1 * time.Second) @@ -510,16 +546,15 @@ Container ID in EACL table will be substituted with ID from the CLI.`, } if bytes.Equal(exp, got) { - fmt.Println("EACL has been persisted on sidechain") - return nil + cmd.Println("EACL has been persisted on sidechain") + return } } } - return errors.New("timeout: EACL has not been persisted on sidechain") + cmd.PrintErrln("timeout: EACL has not been persisted on sidechain") + return } - - return nil }, } @@ -615,9 +650,9 @@ func getSessionToken(path string) (*session.Token, error) { return tok, nil } -func prettyPrintContainerList(list []*cid.ID) { +func prettyPrintContainerList(cmd *cobra.Command, list []*cid.ID) { for i := range list { - fmt.Println(list[i]) + cmd.Println(list[i]) } } @@ -730,7 +765,7 @@ func parseContainerID(idStr string) (*cid.ID, error) { return id, nil } -func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) { +func prettyPrintContainer(cmd *cobra.Command, cnr *container.Container, jsonEncoding bool) { if cnr == nil { return } @@ -746,35 +781,35 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) { printVerbose("Can't pretty print json: %w", err) } - fmt.Println(buf) + cmd.Println(buf) return } id := container.CalculateID(cnr) - fmt.Println("container ID:", id) + cmd.Println("container ID:", id) version := cnr.Version() - fmt.Printf("version: %d.%d\n", version.Major(), version.Minor()) + cmd.Printf("version: %d.%d\n", version.Major(), version.Minor()) - fmt.Println("owner ID:", cnr.OwnerID()) + cmd.Println("owner ID:", cnr.OwnerID()) basicACL := cnr.BasicACL() - fmt.Printf("basic ACL: %s", strconv.FormatUint(uint64(basicACL), 16)) + cmd.Printf("basic ACL: %s", strconv.FormatUint(uint64(basicACL), 16)) switch basicACL { case acl.PublicBasicRule: - fmt.Printf(" (%s)\n", basicACLPublic) + cmd.Printf(" (%s)\n", basicACLPublic) case acl.PrivateBasicRule: - fmt.Printf(" (%s)\n", basicACLPrivate) + cmd.Printf(" (%s)\n", basicACLPrivate) case acl.ReadOnlyBasicRule: - fmt.Printf(" (%s)\n", basicACLReadOnly) + cmd.Printf(" (%s)\n", basicACLReadOnly) default: - fmt.Println() + cmd.Println() } for _, attribute := range cnr.Attributes() { if attribute.Key() == container.AttributeTimestamp { - fmt.Printf("attribute: %s=%s (%s)\n", + cmd.Printf("attribute: %s=%s (%s)\n", attribute.Key(), attribute.Value(), prettyPrintUnixTime(attribute.Value())) @@ -782,18 +817,18 @@ func prettyPrintContainer(cnr *container.Container, jsonEncoding bool) { continue } - fmt.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value()) + cmd.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value()) } nonce, err := cnr.NonceUUID() if err == nil { - fmt.Println("nonce:", nonce) + cmd.Println("nonce:", nonce) } else { - fmt.Println("invalid nonce:", err) + cmd.Println("invalid nonce:", err) } - fmt.Println("placement policy:") - fmt.Println(strings.Join(policy.Encode(cnr.PlacementPolicy()), "\n")) + cmd.Println("placement policy:") + cmd.Println(strings.Join(policy.Encode(cnr.PlacementPolicy()), "\n")) } func parseEACL(eaclPath string) (*eacl.Table, error) { @@ -823,11 +858,11 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { return nil, fmt.Errorf("can't parse EACL table: %w", err) } -func prettyPrintEACL(table *eacl.Table) { - printJSONMarshaler(table, "eACL") +func prettyPrintEACL(cmd *cobra.Command, table *eacl.Table) { + printJSONMarshaler(cmd, table, "eACL") } -func printJSONMarshaler(j json.Marshaler, entity string) { +func printJSONMarshaler(cmd *cobra.Command, j json.Marshaler, entity string) { data, err := j.MarshalJSON() if err != nil { printVerbose("Can't convert %s to json: %w", entity, err) @@ -838,5 +873,5 @@ func printJSONMarshaler(j json.Marshaler, entity string) { printVerbose("Can't pretty print json: %w", err) return } - fmt.Println(buf) + cmd.Println(buf) } diff --git a/cmd/neofs-cli/modules/control.go b/cmd/neofs-cli/modules/control.go index a8ab229b5c..9aed2839bc 100644 --- a/cmd/neofs-cli/modules/control.go +++ b/cmd/neofs-cli/modules/control.go @@ -24,14 +24,14 @@ var healthCheckCmd = &cobra.Command{ Use: "healthcheck", Short: "Health check of the storage node", Long: "Health check of the storage node", - RunE: healthCheck, + Run: healthCheck, } var setNetmapStatusCmd = &cobra.Command{ Use: "set-status", Short: "Set status of the storage node in NeoFS network map", Long: "Set status of the storage node in NeoFS network map", - RunE: setNetmapStatus, + Run: setNetmapStatus, } const ( @@ -79,20 +79,22 @@ func init() { healthCheckCmd.Flags().BoolVar(&healthCheckIRVar, healthcheckIRFlag, false, "Communicate with IR node") } -func healthCheck(cmd *cobra.Command, _ []string) error { +func healthCheck(cmd *cobra.Command, _ []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } if healthCheckIRVar { healthCheckIR(cmd, key, cli) - return nil + return } req := new(control.HealthCheckRequest) @@ -100,12 +102,14 @@ func healthCheck(cmd *cobra.Command, _ []string) error { req.SetBody(new(control.HealthCheckRequest_Body)) if err := controlSvc.SignMessage(key, req); err != nil { - return err + cmd.PrintErrln(err) + return } resp, err := control.HealthCheck(cli.Raw(), req) if err != nil { - return err + cmd.PrintErrln(err) + return } sign := resp.GetSignature() @@ -113,13 +117,12 @@ func healthCheck(cmd *cobra.Command, _ []string) error { if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { return sign.GetKey(), sign.GetSign() }); err != nil { - return err + cmd.PrintErrln(err) + return } cmd.Printf("Network status: %s\n", resp.GetBody().GetNetmapStatus()) cmd.Printf("Health status: %s\n", resp.GetBody().GetHealthStatus()) - - return nil } func healthCheckIR(cmd *cobra.Command, key *ecdsa.PrivateKey, c client.Client) { @@ -150,17 +153,19 @@ func healthCheckIR(cmd *cobra.Command, key *ecdsa.PrivateKey, c client.Client) { cmd.Printf("Health status: %s\n", resp.GetBody().GetHealthStatus()) } -func setNetmapStatus(cmd *cobra.Command, _ []string) error { +func setNetmapStatus(cmd *cobra.Command, _ []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } var status control.NetmapStatus switch netmapStatus { default: - return fmt.Errorf("unsupported status %s", netmapStatus) + cmd.PrintErrln(fmt.Errorf("unsupported status %s", netmapStatus)) + return case netmapStatusOnline: status = control.NetmapStatus_ONLINE case netmapStatusOffline: @@ -175,17 +180,20 @@ func setNetmapStatus(cmd *cobra.Command, _ []string) error { body.SetStatus(status) if err := controlSvc.SignMessage(key, req); err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } resp, err := control.SetNetmapStatus(cli.Raw(), req) if err != nil { - return err + cmd.PrintErrln(err) + return } sign := resp.GetSignature() @@ -193,12 +201,11 @@ func setNetmapStatus(cmd *cobra.Command, _ []string) error { if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { return sign.GetKey(), sign.GetSign() }); err != nil { - return err + cmd.PrintErrln(err) + return } cmd.Println("Network status update request successfully sent.") - - return nil } const dropObjectsFlag = "objects" @@ -209,10 +216,11 @@ var dropObjectsCmd = &cobra.Command{ Use: "drop-objects", Short: "Drop objects from the node's local storage", Long: "Drop objects from the node's local storage", - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } binAddrList := make([][]byte, 0, len(dropObjectsList)) @@ -222,12 +230,14 @@ var dropObjectsCmd = &cobra.Command{ err := a.Parse(dropObjectsList[i]) if err != nil { - return fmt.Errorf("could not parse address #%d: %w", i, err) + cmd.PrintErrln(fmt.Errorf("could not parse address #%d: %w", i, err)) + return } binAddr, err := a.Marshal() if err != nil { - return fmt.Errorf("could not marshal the address: %w", err) + cmd.PrintErrln(fmt.Errorf("could not marshal the address: %w", err)) + return } binAddrList = append(binAddrList, binAddr) @@ -241,17 +251,20 @@ var dropObjectsCmd = &cobra.Command{ body.SetAddressList(binAddrList) if err := controlSvc.SignMessage(key, req); err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } resp, err := control.DropObjects(cli.Raw(), req) if err != nil { - return err + cmd.PrintErrln(err) + return } sign := resp.GetSignature() @@ -259,11 +272,10 @@ var dropObjectsCmd = &cobra.Command{ if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { return sign.GetKey(), sign.GetSign() }); err != nil { - return err + cmd.PrintErrln(err) + return } cmd.Println("Objects were successfully marked to be removed.") - - return nil }, } diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 1fcad7b4c9..7e095c09e9 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" "fmt" - "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -47,25 +46,26 @@ var getEpochCmd = &cobra.Command{ Use: "epoch", Short: "Get current epoch number", Long: "Get current epoch number", - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } netInfo, err := cli.NetworkInfo(context.Background(), globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } - fmt.Println(netInfo.CurrentEpoch()) - - return nil + cmd.Println(netInfo.CurrentEpoch()) }, } @@ -73,25 +73,26 @@ var localNodeInfoCmd = &cobra.Command{ Use: "nodeinfo", Short: "Get local node info", Long: `Get local node info`, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } nodeInfo, err := cli.EndpointInfo(context.Background(), globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } - prettyPrintNodeInfo(nodeInfo.NodeInfo(), nodeInfoJSON) - - return nil + prettyPrintNodeInfo(cmd, nodeInfo.NodeInfo(), nodeInfoJSON) }, } @@ -99,27 +100,31 @@ var snapshotCmd = &cobra.Command{ Use: "snapshot", Short: "Get network map snapshot", Long: "Get network map snapshot", - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } req := new(control.NetmapSnapshotRequest) req.SetBody(new(control.NetmapSnapshotRequest_Body)) if err := controlSvc.SignMessage(key, req); err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } resp, err := control.NetmapSnapshot(cli.Raw(), req) if err != nil { - return err + cmd.PrintErrln(err) + return } sign := resp.GetSignature() @@ -127,12 +132,11 @@ var snapshotCmd = &cobra.Command{ if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { return sign.GetKey(), sign.GetSign() }); err != nil { - return err + cmd.PrintErrln(err) + return } - prettyPrintNetmap(resp.GetBody().GetNetmap(), netmapSnapshotJSON) - - return nil + prettyPrintNetmap(cmd, resp.GetBody().GetNetmap(), netmapSnapshotJSON) }, } @@ -140,63 +144,64 @@ var netInfoCmd = &cobra.Command{ Use: "netinfo", Short: "Get information about NeoFS network", Long: "Get information about NeoFS network", - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } cli, err := getSDKClient(key) if err != nil { - return err + cmd.PrintErrln(err) + return } netInfo, err := cli.NetworkInfo(context.Background(), globalCallOptions()...) if err != nil { - return fmt.Errorf("rpc error: %w", err) + cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) + return } cmd.Printf("Epoch: %d\n", netInfo.CurrentEpoch()) magic := netInfo.MagicNumber() cmd.Printf("Network magic: [%s] %d\n", netmode.Magic(magic), magic) - - return nil }, } -func prettyPrintNodeInfo(i *netmap.NodeInfo, jsonEncoding bool) { +func prettyPrintNodeInfo(cmd *cobra.Command, i *netmap.NodeInfo, jsonEncoding bool) { if jsonEncoding { - printJSONMarshaler(i, "node info") + printJSONMarshaler(cmd, i, "node info") return } - fmt.Println("key:", hex.EncodeToString(i.PublicKey())) - fmt.Println("address:", i.Address()) - fmt.Println("state:", i.State()) + cmd.Println("key:", hex.EncodeToString(i.PublicKey())) + cmd.Println("address:", i.Address()) + cmd.Println("state:", i.State()) for _, attribute := range i.Attributes() { - fmt.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value()) + cmd.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value()) } } -func prettyPrintNetmap(nm *control.Netmap, jsonEncoding bool) { +func prettyPrintNetmap(cmd *cobra.Command, nm *control.Netmap, jsonEncoding bool) { if jsonEncoding { - printJSONMarshaler(nm, "netmap") + printJSONMarshaler(cmd, nm, "netmap") return } - fmt.Println("Epoch:", nm.GetEpoch()) + cmd.Println("Epoch:", nm.GetEpoch()) for i, node := range nm.GetNodes() { - fmt.Printf("Node %d: %s %s %s\n", i+1, + cmd.Printf("Node %d: %s %s %s\n", i+1, base58.Encode(node.GetPublicKey()), node.GetAddress(), node.GetState(), ) for _, attr := range node.GetAttributes() { - fmt.Printf("\t%s: %s\n", attr.GetKey(), attr.GetValue()) + cmd.Printf("\t%s: %s\n", attr.GetKey(), attr.GetValue()) } } } diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index d7115fcc08..047bcdc8c6 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -48,14 +48,14 @@ var ( Use: "put", Short: "Put object to NeoFS", Long: "Put object to NeoFS", - RunE: putObject, + Run: putObject, } objectGetCmd = &cobra.Command{ Use: "get", Short: "Get object from NeoFS", Long: "Get object from NeoFS", - RunE: getObject, + Run: getObject, } objectDelCmd = &cobra.Command{ @@ -63,7 +63,7 @@ var ( Aliases: []string{"del"}, Short: "Delete object from NeoFS", Long: "Delete object from NeoFS", - RunE: deleteObject, + Run: deleteObject, } searchFilters []string @@ -72,28 +72,28 @@ var ( Use: "search", Short: "Search object", Long: "Search object", - RunE: searchObject, + Run: searchObject, } objectHeadCmd = &cobra.Command{ Use: "head", Short: "Get object header", Long: "Get object header", - RunE: getObjectHeader, + Run: getObjectHeader, } objectHashCmd = &cobra.Command{ Use: "hash", Short: "Get object hash", Long: "Get object hash", - RunE: getObjectHash, + Run: getObjectHash, } objectRangeCmd = &cobra.Command{ Use: getRangeCmdUse, Short: getRangeCmdShortDesc, Long: getRangeCmdLongDesc, - RunE: getObjectRange, + Run: getObjectRange, } ) @@ -210,25 +210,29 @@ func initSession(ctx context.Context) (client.Client, *session.Token, error) { return cli, tok, nil } -func putObject(cmd *cobra.Command, _ []string) error { +func putObject(cmd *cobra.Command, _ []string) { ownerID, err := getOwnerID() if err != nil { - return err + cmd.PrintErrln(err) + return } cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } filename := cmd.Flag("file").Value.String() f, err := os.OpenFile(filename, os.O_RDONLY, os.ModePerm) if err != nil { - return fmt.Errorf("can't open file '%s': %w", filename, err) + cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) + return } attrs, err := parseObjectAttrs(cmd) if err != nil { - return fmt.Errorf("can't parse object attributes: %w", err) + cmd.PrintErrln(fmt.Errorf("can't parse object attributes: %w", err)) + return } expiresOn, _ := cmd.Flags().GetUint64(putExpiresOnFlag) @@ -259,11 +263,13 @@ func putObject(cmd *cobra.Command, _ []string) error { ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } oid, err := cli.PutObject(ctx, new(client.PutObjectParams). @@ -275,28 +281,31 @@ func putObject(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't put object: %w", err) + cmd.PrintErrln(fmt.Errorf("can't put object: %w", err)) + return } cmd.Printf("[%s] Object successfully stored\n", filename) cmd.Printf(" ID: %s\n CID: %s\n", oid, cid) - return nil } -func deleteObject(cmd *cobra.Command, _ []string) error { +func deleteObject(cmd *cobra.Command, _ []string) { objAddr, err := getObjectAddress(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } tombstoneAddr, err := client.DeleteObject(ctx, cli, @@ -307,18 +316,19 @@ func deleteObject(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return err + cmd.PrintErrln(err) + return } cmd.Println("Object removed successfully.") cmd.Printf(" ID: %s\n CID: %s\n", tombstoneAddr.ObjectID(), tombstoneAddr.ContainerID()) - return nil } -func getObject(cmd *cobra.Command, _ []string) error { +func getObject(cmd *cobra.Command, _ []string) { objAddr, err := getObjectAddress(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } var out io.Writer @@ -328,7 +338,8 @@ func getObject(cmd *cobra.Command, _ []string) error { } else { f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, os.ModePerm) if err != nil { - return fmt.Errorf("can't open file '%s': %w", filename, err) + cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) + return } defer f.Close() out = f @@ -337,11 +348,13 @@ func getObject(cmd *cobra.Command, _ []string) error { ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } raw, _ := cmd.Flags().GetBool(rawFlag) @@ -358,10 +371,11 @@ func getObject(cmd *cobra.Command, _ []string) error { ) if err != nil { if ok := printSplitInfoErr(cmd, err); ok { - return nil + return } - return fmt.Errorf("can't get object: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get object: %w", err)) + return } if filename != "" { @@ -371,25 +385,30 @@ func getObject(cmd *cobra.Command, _ []string) error { // Print header only if file is not streamed to stdout. hdrFile := cmd.Flag("header").Value.String() if filename != "" || hdrFile != "" { - return saveAndPrintHeader(cmd, obj, hdrFile) + if err = saveAndPrintHeader(cmd, obj, hdrFile); err != nil { + cmd.PrintErrln(err) + return + } } - return nil } -func getObjectHeader(cmd *cobra.Command, _ []string) error { +func getObjectHeader(cmd *cobra.Command, _ []string) { objAddr, err := getObjectAddress(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } ps := new(client.ObjectHeaderParams).WithAddress(objAddr) if ok, _ := cmd.Flags().GetBool("main-only"); ok { @@ -407,34 +426,42 @@ func getObjectHeader(cmd *cobra.Command, _ []string) error { ) if err != nil { if ok := printSplitInfoErr(cmd, err); ok { - return nil + return } - return fmt.Errorf("can't get object header: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get object header: %w", err)) + return } - return saveAndPrintHeader(cmd, obj, cmd.Flag("file").Value.String()) + if err = saveAndPrintHeader(cmd, obj, cmd.Flag("file").Value.String()); err != nil { + cmd.PrintErrln(err) + return + } } -func searchObject(cmd *cobra.Command, _ []string) error { +func searchObject(cmd *cobra.Command, _ []string) { cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } sf, err := parseSearchFilters(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } ps := new(client.SearchObjectParams).WithContainerID(cid).WithSearchFilters(sf) ids, err := cli.SearchObject(ctx, ps, @@ -444,44 +471,50 @@ func searchObject(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't search object: %w", err) + cmd.PrintErrln(fmt.Errorf("can't search object: %w", err)) + return } cmd.Printf("Found %d objects.\n", len(ids)) for _, id := range ids { cmd.Println(id) } - return nil } -func getObjectHash(cmd *cobra.Command, _ []string) error { +func getObjectHash(cmd *cobra.Command, _ []string) { objAddr, err := getObjectAddress(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ranges, err := getRangeList(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } typ, err := getHashType(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } strSalt := strings.TrimPrefix(cmd.Flag(getRangeHashSaltFlag).Value.String(), "0x") salt, err := hex.DecodeString(strSalt) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } btok, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } if len(ranges) == 0 { // hash of full payload obj, err := cli.GetObjectHeader(ctx, @@ -492,7 +525,8 @@ func getObjectHash(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't get object header: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get object header: %w", err)) + return } switch typ { case hashSha256: @@ -500,7 +534,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) error { case hashTz: cmd.Println(hex.EncodeToString(obj.PayloadHomomorphicHash().Sum())) } - return nil + return } ps := new(client.RangeChecksumParams). @@ -517,7 +551,8 @@ func getObjectHash(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return err + cmd.PrintErrln(err) + return } for i := range res { cmd.Printf("Offset=%d (Length=%d)\t: %s\n", ranges[i].GetOffset(), ranges[i].GetLength(), @@ -531,14 +566,14 @@ func getObjectHash(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return err + cmd.PrintErrln(err) + return } for i := range res { cmd.Printf("Offset=%d (Length=%d)\t: %s\n", ranges[i].GetOffset(), ranges[i].GetLength(), hex.EncodeToString(res[i][:])) } } - return nil } func getOwnerID() (*owner.ID, error) { @@ -861,17 +896,20 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er return tok, nil } -func getObjectRange(cmd *cobra.Command, _ []string) error { +func getObjectRange(cmd *cobra.Command, _ []string) { objAddr, err := getObjectAddress(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ranges, err := getRangeList(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } else if len(ranges) != 1 { - return errors.New("exactly one range must be specified") + cmd.PrintErrln(err) + return } var out io.Writer @@ -882,7 +920,8 @@ func getObjectRange(cmd *cobra.Command, _ []string) error { } else { f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, os.ModePerm) if err != nil { - return fmt.Errorf("can't open file '%s': %w", filename, err) + cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) + return } defer f.Close() @@ -894,12 +933,14 @@ func getObjectRange(cmd *cobra.Command, _ []string) error { c, sessionToken, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } bearerToken, err := getBearerToken(cmd, "bearer") if err != nil { - return err + cmd.PrintErrln(err) + return } raw, _ := cmd.Flags().GetBool(rawFlag) @@ -917,17 +958,16 @@ func getObjectRange(cmd *cobra.Command, _ []string) error { ) if err != nil { if ok := printSplitInfoErr(cmd, err); ok { - return nil + return } - return fmt.Errorf("can't get object payload range: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get object payload range: %w", err)) + return } if filename != "" { cmd.Printf("[%s] Payload successfully saved\n", filename) } - - return nil } func printSplitInfoErr(cmd *cobra.Command, err error) bool { diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index 8148016d82..5cfa2b9a5e 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -26,28 +26,28 @@ var sgPutCmd = &cobra.Command{ Use: "put", Short: "Put storage group to NeoFS", Long: "Put storage group to NeoFS", - RunE: putSG, + Run: putSG, } var sgGetCmd = &cobra.Command{ Use: "get", Short: "Get storage group from NeoFS", Long: "Get storage group from NeoFS", - RunE: getSG, + Run: getSG, } var sgListCmd = &cobra.Command{ Use: "list", Short: "List storage groups in NeoFS container", Long: "List storage groups in NeoFS container", - RunE: listSG, + Run: listSG, } var sgDelCmd = &cobra.Command{ Use: "delete", Short: "Delete storage group from NeoFS", Long: "Delete storage group from NeoFS", - RunE: delSG, + Run: delSG, } const ( @@ -127,15 +127,17 @@ func sgBearerToken(cmd *cobra.Command) (*token.BearerToken, error) { return getBearerToken(cmd, sgBearerFlag) } -func putSG(cmd *cobra.Command, _ []string) error { +func putSG(cmd *cobra.Command, _ []string) { ownerID, err := getOwnerID() if err != nil { - return err + cmd.PrintErrln(err) + return } cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } members := make([]*objectSDK.ID, 0, len(sgMembers)) @@ -143,7 +145,8 @@ func putSG(cmd *cobra.Command, _ []string) error { for i := range sgMembers { id := objectSDK.NewID() if err := id.Parse(sgMembers[i]); err != nil { - return err + cmd.PrintErrln(err) + return } members = append(members, id) @@ -151,14 +154,16 @@ func putSG(cmd *cobra.Command, _ []string) error { bearerToken, err := sgBearerToken(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } sg, err := storagegroup.CollectMembers(&sgHeadReceiver{ @@ -168,12 +173,14 @@ func putSG(cmd *cobra.Command, _ []string) error { bearerToken: bearerToken, }, cid, members) if err != nil { - return err + cmd.PrintErrln(err) + return } sgContent, err := sg.Marshal() if err != nil { - return err + cmd.PrintErrln(err) + return } obj := objectSDK.NewRaw() @@ -191,13 +198,12 @@ func putSG(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't put storage group: %w", err) + cmd.PrintErrln(fmt.Errorf("can't put storage group: %w", err)) + return } cmd.Println("Storage group successfully stored") cmd.Printf(" ID: %s\n CID: %s\n", oid, cid) - - return nil } func getSGID() (*objectSDK.ID, error) { @@ -207,20 +213,23 @@ func getSGID() (*objectSDK.ID, error) { return oid, err } -func getSG(cmd *cobra.Command, _ []string) error { +func getSG(cmd *cobra.Command, _ []string) { cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := getSGID() if err != nil { - return err + cmd.PrintErrln(err) + return } bearerToken, err := sgBearerToken(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } addr := objectSDK.NewAddress() @@ -231,7 +240,8 @@ func getSG(cmd *cobra.Command, _ []string) error { cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } obj, err := cli.GetObject(ctx, @@ -243,12 +253,14 @@ func getSG(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't get storage group: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get storage group: %w", err)) + return } sg := storagegroupAPI.New() if err := sg.Unmarshal(obj.Payload()); err != nil { - return err + cmd.PrintErrln(err) + return } cmd.Printf("Expiration epoch: %d\n", sg.ExpirationEpoch()) @@ -262,26 +274,27 @@ func getSG(cmd *cobra.Command, _ []string) error { cmd.Printf("\t%s\n", members[i]) } } - - return nil } -func listSG(cmd *cobra.Command, _ []string) error { +func listSG(cmd *cobra.Command, _ []string) { cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } bearerToken, err := sgBearerToken(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } ids, err := cli.SearchObject(ctx, @@ -294,7 +307,8 @@ func listSG(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't search storage groups: %w", err) + cmd.PrintErrln(fmt.Errorf("can't search storage groups: %w", err)) + return } cmd.Printf("Found %d storage groups.\n", len(ids)) @@ -302,31 +316,33 @@ func listSG(cmd *cobra.Command, _ []string) error { for _, id := range ids { cmd.Println(id) } - - return nil } -func delSG(cmd *cobra.Command, _ []string) error { +func delSG(cmd *cobra.Command, _ []string) { cid, err := getCID(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } id, err := getSGID() if err != nil { - return err + cmd.PrintErrln(err) + return } bearerToken, err := sgBearerToken(cmd) if err != nil { - return err + cmd.PrintErrln(err) + return } ctx := context.Background() cli, tok, err := initSession(ctx) if err != nil { - return err + cmd.PrintErrln(err) + return } addr := objectSDK.NewAddress() @@ -342,11 +358,10 @@ func delSG(cmd *cobra.Command, _ []string) error { )..., ) if err != nil { - return fmt.Errorf("can't get storage group: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get storage group: %w", err)) + return } cmd.Println("Storage group removed successfully.") cmd.Printf(" Tombstone: %s\n", tombstone.ObjectID()) - - return nil } diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index f7420eff2c..8781614935 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -38,13 +38,13 @@ var ( signBearerCmd = &cobra.Command{ Use: "bearer-token", Short: "Sign bearer token to use it in requests", - RunE: signBearerToken, + Run: signBearerToken, } signSessionCmd = &cobra.Command{ Use: "session-token", Short: "Sign session token to use it in requests", - RunE: signSessionToken, + Run: signSessionToken, } convertCmd = &cobra.Command{ @@ -55,13 +55,13 @@ var ( convertEACLCmd = &cobra.Command{ Use: "eacl", Short: "Convert representation of extended ACL table", - RunE: convertEACLTable, + Run: convertEACLTable, } keyerCmd = &cobra.Command{ Use: "keyer", Short: "Generate or print information about keys", - RunE: processKeyer, + Run: processKeyer, } ) @@ -96,7 +96,7 @@ var ( locodeGenerateCmd = &cobra.Command{ Use: "generate", Short: "generate UN/LOCODE database for NeoFS", - RunE: func(cmd *cobra.Command, _ []string) error { + Run: func(cmd *cobra.Command, _ []string) { locodeDB := csvlocode.New( csvlocode.Prm{ Path: locodeGenerateInPaths[0], @@ -120,7 +120,8 @@ var ( err := targetDB.Open() if err != nil { - return err + cmd.PrintErrln(err) + return } defer targetDB.Close() @@ -132,10 +133,9 @@ var ( err = locodedb.FillDatabase(locodeDB, airportDB, continentsDB, names, targetDB) if err != nil { - return err + cmd.PrintErrln(err) + return } - - return nil }, } ) @@ -152,34 +152,34 @@ var ( locodeInfoCmd = &cobra.Command{ Use: "info", Short: "print information about UN/LOCODE from NeoFS database", - RunE: func(cmd *cobra.Command, _ []string) error { + Run: func(cmd *cobra.Command, _ []string) { targetDB := locodebolt.New(locodebolt.Prm{ Path: locodeInfoDBPath, }) err := targetDB.Open() if err != nil { - return err + cmd.PrintErrln(err) + return } defer targetDB.Close() record, err := locodedb.LocodeRecord(targetDB, locodeInfoCode) if err != nil { - return err + cmd.PrintErrln(err) + return } - fmt.Printf("Country: %s\n", record.CountryName()) - fmt.Printf("Location: %s\n", record.LocationName()) - fmt.Printf("Continent: %s\n", record.Continent()) + cmd.Printf("Country: %s\n", record.CountryName()) + cmd.Printf("Location: %s\n", record.LocationName()) + cmd.Printf("Continent: %s\n", record.Continent()) if subDivCode := record.SubDivCode(); subDivCode != "" { - fmt.Printf("Subdivision: [%s] %s\n", subDivCode, record.SubDivName()) + cmd.Printf("Subdivision: [%s] %s\n", subDivCode, record.SubDivName()) } geoPoint := record.GeoPoint() - fmt.Printf("Coordinates: %0.2f, %0.2f\n", geoPoint.Latitude(), geoPoint.Longitude()) - - return nil + cmd.Printf("Coordinates: %0.2f, %0.2f\n", geoPoint.Latitude(), geoPoint.Longitude()) }, } ) @@ -254,25 +254,29 @@ func init() { _ = locodeGenerateCmd.MarkFlagRequired(locodeInfoCodeFlag) } -func signBearerToken(cmd *cobra.Command, _ []string) error { +func signBearerToken(cmd *cobra.Command, _ []string) { btok, err := getBearerToken(cmd, "from") if err != nil { - return err + cmd.PrintErrln(err) + return } key, err := getKey() if err != nil { - return err + cmd.PrintErrln(err) + return } err = completeBearerToken(btok) if err != nil { - return err + cmd.PrintErrln(err) + return } err = btok.SignToken(key) if err != nil { - return err + cmd.PrintErrln(err) + return } to := cmd.Flag("to").Value.String() @@ -282,113 +286,119 @@ func signBearerToken(cmd *cobra.Command, _ []string) error { if jsonFlag || len(to) == 0 { data, err = btok.MarshalJSON() if err != nil { - return fmt.Errorf("can't JSON encode bearer token: %w", err) + cmd.PrintErrln(fmt.Errorf("can't JSON encode bearer token: %w", err)) + return } } else { data, err = btok.Marshal() if err != nil { - return fmt.Errorf("can't binary encode bearer token: %w", err) + cmd.PrintErrln(fmt.Errorf("can't binary encode bearer token: %w", err)) + return } } if len(to) == 0 { prettyPrintJSON(cmd, data) - return nil + return } err = ioutil.WriteFile(to, data, 0644) if err != nil { - return fmt.Errorf("can't write signed bearer token to file: %w", err) + cmd.PrintErrln(fmt.Errorf("can't write signed bearer token to file: %w", err)) + return } cmd.Printf("signed bearer token was successfully dumped to %s\n", to) - - return nil } -func signSessionToken(cmd *cobra.Command, _ []string) error { +func signSessionToken(cmd *cobra.Command, _ []string) { path, err := cmd.Flags().GetString("from") if err != nil { - return err + cmd.PrintErrln(err) + return } stok, err := getSessionToken(path) if err != nil { - return fmt.Errorf("can't read session token from %s: %w", path, err) + cmd.PrintErrln(fmt.Errorf("can't read session token from %s: %w", path, err)) + return } key, err := getKey() if err != nil { - return fmt.Errorf("can't get private key, make sure it is provided: %w", err) + cmd.PrintErrln(fmt.Errorf("can't get private key, make sure it is provided: %w", err)) + return } err = stok.Sign(key) if err != nil { - return fmt.Errorf("can't sign token: %w", err) + cmd.PrintErrln(fmt.Errorf("can't sign token: %w", err)) + return } data, err := stok.MarshalJSON() if err != nil { - return fmt.Errorf("can't encode session token: %w", err) + cmd.PrintErrln(fmt.Errorf("can't encode session token: %w", err)) + return } to := cmd.Flag("to").Value.String() if len(to) == 0 { prettyPrintJSON(cmd, data) - return nil + return } err = ioutil.WriteFile(to, data, 0644) if err != nil { - return fmt.Errorf("can't write signed session token to %s: %w", to, err) + cmd.PrintErrln(fmt.Errorf("can't write signed session token to %s: %w", to, err)) + return } - fmt.Printf("signed session token saved in %s\n", to) - - return nil + cmd.Printf("signed session token saved in %s\n", to) } -func convertEACLTable(cmd *cobra.Command, _ []string) error { +func convertEACLTable(cmd *cobra.Command, _ []string) { pathFrom := cmd.Flag("from").Value.String() to := cmd.Flag("to").Value.String() jsonFlag, _ := cmd.Flags().GetBool("json") table, err := parseEACL(pathFrom) if err != nil { - return err + cmd.PrintErrln(err) + return } var data []byte if jsonFlag || len(to) == 0 { data, err = table.MarshalJSON() if err != nil { - return fmt.Errorf("can't JSON encode extended ACL table: %w", err) + cmd.PrintErrln(fmt.Errorf("can't JSON encode extended ACL table: %w", err)) + return } } else { data, err = table.Marshal() if err != nil { - return fmt.Errorf("can't binary encode extended ACL table: %w", err) + cmd.PrintErrln(fmt.Errorf("can't binary encode extended ACL table: %w", err)) + return } } if len(to) == 0 { prettyPrintJSON(cmd, data) - - return nil + return } err = ioutil.WriteFile(to, data, 0644) if err != nil { - return fmt.Errorf("can't write exteded ACL table to file: %w", err) + cmd.PrintErrln(fmt.Errorf("can't write exteded ACL table to file: %w", err)) + return } cmd.Printf("extended ACL table was successfully dumped to %s\n", to) - - return nil } -func processKeyer(cmd *cobra.Command, args []string) error { +func processKeyer(cmd *cobra.Command, args []string) { var ( err error @@ -403,7 +413,8 @@ func processKeyer(cmd *cobra.Command, args []string) error { err = result.ParseMultiSig(args) } else { if len(args) > 1 { - return errKeyerSingleArgument + cmd.PrintErrln(errKeyerSingleArgument) + return } var argument string @@ -422,12 +433,11 @@ func processKeyer(cmd *cobra.Command, args []string) error { } if err != nil { - return err + cmd.PrintErrln(err) + return } result.PrettyPrint(uncompressed, useHex) - - return nil } func completeBearerToken(btok *token.BearerToken) error { From 14afc6a1e5679b9693dc2ffabeae245bea70c37a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 22 Jun 2021 19:21:18 +0300 Subject: [PATCH 083/219] [#635] cli: Do not enter password twice Obtain key once in every cobra command to pass it to `getOwnerID` and `initSession` and do not ask to enter password more than one time in `put` and `putSG` operations. Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/object.go | 71 ++++++++++++++++++++------- cmd/neofs-cli/modules/storagegroup.go | 34 +++++++++++-- 2 files changed, 82 insertions(+), 23 deletions(-) diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index 047bcdc8c6..34f943c6d0 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -2,6 +2,7 @@ package cmd import ( "context" + "crypto/ecdsa" "encoding/hex" "errors" "fmt" @@ -194,11 +195,7 @@ func init() { // objectCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } -func initSession(ctx context.Context) (client.Client, *session.Token, error) { - key, err := getKey() - if err != nil { - return nil, nil, fmt.Errorf("can't fetch private key: %w", err) - } +func initSession(ctx context.Context, key *ecdsa.PrivateKey) (client.Client, *session.Token, error) { cli, err := getSDKClient(key) if err != nil { return nil, nil, fmt.Errorf("can't create client: %w", err) @@ -211,7 +208,13 @@ func initSession(ctx context.Context) (client.Client, *session.Token, error) { } func putObject(cmd *cobra.Command, _ []string) { - ownerID, err := getOwnerID() + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + + ownerID, err := getOwnerID(key) if err != nil { cmd.PrintErrln(err) return @@ -261,7 +264,7 @@ func putObject(cmd *cobra.Command, _ []string) { obj.SetAttributes(attrs...) ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -290,6 +293,12 @@ func putObject(cmd *cobra.Command, _ []string) { } func deleteObject(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + objAddr, err := getObjectAddress(cmd) if err != nil { cmd.PrintErrln(err) @@ -297,7 +306,7 @@ func deleteObject(cmd *cobra.Command, _ []string) { } ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -325,6 +334,12 @@ func deleteObject(cmd *cobra.Command, _ []string) { } func getObject(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + objAddr, err := getObjectAddress(cmd) if err != nil { cmd.PrintErrln(err) @@ -346,7 +361,7 @@ func getObject(cmd *cobra.Command, _ []string) { } ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -393,6 +408,12 @@ func getObject(cmd *cobra.Command, _ []string) { } func getObjectHeader(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + objAddr, err := getObjectAddress(cmd) if err != nil { cmd.PrintErrln(err) @@ -400,7 +421,7 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { } ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -440,6 +461,12 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { } func searchObject(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + cid, err := getCID(cmd) if err != nil { cmd.PrintErrln(err) @@ -453,7 +480,7 @@ func searchObject(cmd *cobra.Command, _ []string) { } ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -481,6 +508,12 @@ func searchObject(cmd *cobra.Command, _ []string) { } func getObjectHash(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + objAddr, err := getObjectAddress(cmd) if err != nil { cmd.PrintErrln(err) @@ -506,7 +539,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) { } ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -576,11 +609,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) { } } -func getOwnerID() (*owner.ID, error) { - key, err := getKey() - if err != nil { - return nil, err - } +func getOwnerID(key *ecdsa.PrivateKey) (*owner.ID, error) { w, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) if err != nil { return nil, err @@ -897,6 +926,12 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er } func getObjectRange(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + objAddr, err := getObjectAddress(cmd) if err != nil { cmd.PrintErrln(err) @@ -931,7 +966,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) { ctx := context.Background() - c, sessionToken, err := initSession(ctx) + c, sessionToken, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index 5cfa2b9a5e..b1aae78698 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -128,7 +128,13 @@ func sgBearerToken(cmd *cobra.Command) (*token.BearerToken, error) { } func putSG(cmd *cobra.Command, _ []string) { - ownerID, err := getOwnerID() + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + + ownerID, err := getOwnerID(key) if err != nil { cmd.PrintErrln(err) return @@ -160,7 +166,7 @@ func putSG(cmd *cobra.Command, _ []string) { ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -214,6 +220,12 @@ func getSGID() (*objectSDK.ID, error) { } func getSG(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + cid, err := getCID(cmd) if err != nil { cmd.PrintErrln(err) @@ -238,7 +250,7 @@ func getSG(cmd *cobra.Command, _ []string) { ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -277,6 +289,12 @@ func getSG(cmd *cobra.Command, _ []string) { } func listSG(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + cid, err := getCID(cmd) if err != nil { cmd.PrintErrln(err) @@ -291,7 +309,7 @@ func listSG(cmd *cobra.Command, _ []string) { ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return @@ -319,6 +337,12 @@ func listSG(cmd *cobra.Command, _ []string) { } func delSG(cmd *cobra.Command, _ []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) + return + } + cid, err := getCID(cmd) if err != nil { cmd.PrintErrln(err) @@ -339,7 +363,7 @@ func delSG(cmd *cobra.Command, _ []string) { ctx := context.Background() - cli, tok, err := initSession(ctx) + cli, tok, err := initSession(ctx, key) if err != nil { cmd.PrintErrln(err) return From 8b2058e0e92995e285be46cd4f6f347eb5c209ce Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 23 Jun 2021 12:31:28 +0300 Subject: [PATCH 084/219] [#637] build: Delete useless var in Makefile Signed-off-by: Pavel Karpy --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 5b2d3a239a..39c39f55c0 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ DIRS= $(BIN) # List of binaries to build. CMDS = $(notdir $(basename $(wildcard cmd/*))) -CMS = $(addprefix $(BIN)/, $(CMDS)) BINS = $(addprefix $(BIN)/, $(CMDS)) .PHONY: help all dep clean fmts fmt imports test lint docker/lint From 75709deb6f7356f702deb8437a1d2fc5a2762fde Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 23 Jun 2021 13:02:34 +0300 Subject: [PATCH 085/219] Revert "go.mod/spf13: Bump versions" This reverts commit fc2fc9a4f4ed8b93031fc31754f04772bffde6ae. go1.14 fails `make build*` command. Go version should be updated. Signed-off-by: Alex Vanin --- go.mod | 6 +- go.sum | 308 +++++---------------------------------------------------- 2 files changed, 25 insertions(+), 289 deletions(-) diff --git a/go.mod b/go.mod index ba5c707a77..392c2e226f 100644 --- a/go.mod +++ b/go.mod @@ -18,9 +18,9 @@ require ( github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 github.com/prometheus/client_golang v1.11.0 - github.com/spf13/cast v1.3.1 - github.com/spf13/cobra v1.1.3 - github.com/spf13/viper v1.8.0 + github.com/spf13/cast v1.3.0 + github.com/spf13/cobra v1.0.0 + github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.5 go.uber.org/atomic v1.8.0 diff --git a/go.sum b/go.sum index e301bd543c..9cc8448f03 100644 --- a/go.sum +++ b/go.sum @@ -5,38 +5,13 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= @@ -64,7 +39,6 @@ github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMw github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -75,7 +49,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -96,7 +69,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -105,7 +77,6 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -126,21 +97,16 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -151,29 +117,18 @@ github.com/go-redis/redis v6.10.2+incompatible h1:SLbqrO/Ik1nhXA5/cbEs1P5MUBo1Qq github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -183,7 +138,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -198,29 +152,14 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -230,12 +169,12 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -261,8 +200,6 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= @@ -276,7 +213,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -289,7 +225,6 @@ github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74 github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= @@ -299,9 +234,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -324,9 +258,8 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -397,15 +330,13 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/paulmach/orb v0.2.2 h1:PblToKAbU0xHVypex/GdZfibA1CeCfN5s0UjxyWExdo= github.com/paulmach/orb v0.2.2/go.mod h1:FkcWtplUAIVqAuhAOV2d3rpbnQyliDOjOcLW9dUrfdU= github.com/paulmach/protoscan v0.2.1-0.20210522164731-4e53c6875432/go.mod h1:2sV+uZ/oQh66m4XJVZm5iqUZ62BN88Ex1E+TTS0nLzI= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -437,7 +368,6 @@ github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3x github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -455,25 +385,21 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.8.0 h1:QRwDgoG8xX+kp69di68D+YYTCWfYEckbZRfUlEIAal0= -github.com/spf13/viper v1.8.0/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -488,17 +414,15 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7 h1:Y17pEjKgx2X0A69WQPGa8hx/Myzu+4NdUxlkZpbAYio= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= @@ -507,16 +431,8 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= @@ -536,7 +452,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -545,11 +460,6 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -559,22 +469,12 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -588,57 +488,25 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -658,60 +526,29 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -731,40 +568,9 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -775,30 +581,10 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -808,58 +594,16 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -870,7 +614,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= @@ -884,23 +627,20 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -909,8 +649,4 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 6efeee5ce0550ac9bec09cc9928e7447c3b1a16d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 23 Jun 2021 15:45:42 +0300 Subject: [PATCH 086/219] [#641] ir/container: Add unique attributes check Signed-off-by: Pavel Karpy --- pkg/core/container/fmt.go | 21 ++++++++++++++++++++- pkg/core/container/fmt_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/pkg/core/container/fmt.go b/pkg/core/container/fmt.go index 69275f38f9..e63673e5e7 100644 --- a/pkg/core/container/fmt.go +++ b/pkg/core/container/fmt.go @@ -9,7 +9,11 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/owner" ) -var errNilPolicy = errors.New("placement policy is nil") +var ( + errNilPolicy = errors.New("placement policy is nil") + errRepeatedAttributes = errors.New("repeated attributes found") + errEmptyAttribute = errors.New("empty attribute found") +) // CheckFormat conducts an initial check of the v2 container data. // @@ -32,5 +36,20 @@ func CheckFormat(c *container.Container) error { return fmt.Errorf("incorrect nonce: %w", err) } + // check if there are repeated attributes + attrs := c.Attributes() + uniqueAttr := make(map[string]struct{}, len(attrs)) + for _, attr := range attrs { + if _, exists := uniqueAttr[attr.Key()]; exists { + return errRepeatedAttributes + } + + if attr.Value() == "" { + return errEmptyAttribute + } + + uniqueAttr[attr.Key()] = struct{}{} + } + return nil } diff --git a/pkg/core/container/fmt_test.go b/pkg/core/container/fmt_test.go index 34581182ab..024d597c31 100644 --- a/pkg/core/container/fmt_test.go +++ b/pkg/core/container/fmt_test.go @@ -41,4 +41,30 @@ func TestCheckFormat(t *testing.T) { c.SetNonceUUID(uuid.New()) require.NoError(t, CheckFormat(c)) + + // set empty value attribute + attr1 := container.NewAttribute() + attr1.SetKey("attr") + attrs := container.Attributes{attr1} + + c.SetAttributes(attrs) + + require.ErrorIs(t, CheckFormat(c), errEmptyAttribute) + + // add same key attribute + attr2 := container.NewAttribute() + attr2.SetKey(attr1.Key()) + attr2.SetValue("val") + + attr1.SetValue(attr2.Value()) + + attrs = append(attrs, attr2) + + c.SetAttributes(attrs) + + require.ErrorIs(t, CheckFormat(c), errRepeatedAttributes) + + attr2.SetKey(attr1.Key() + "smth") + + require.NoError(t, CheckFormat(c)) } From 01dd17e30ac05ea4f3d9171659f8916fd0d0ecf0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 16:30:14 +0300 Subject: [PATCH 087/219] [#633] object: Prevent duplicate attributes by key Keys of object attributes must be unique according to NeoFS specification. Make `FormatValidator.Validate` method to return an error if at least one attribute is duplicated. Signed-off-by: Leonard Lyubich --- pkg/core/object/fmt.go | 24 ++++++++++++++++++++++++ pkg/core/object/fmt_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index e12aaed56f..40e07e748d 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -77,6 +77,10 @@ func (v *FormatValidator) Validate(obj *Object) error { } for ; obj != nil; obj = obj.GetParent() { + if err := v.checkAttributes(obj); err != nil { + return fmt.Errorf("invalid attributes: %w", err) + } + if err := v.validateSignatureKey(obj); err != nil { return fmt.Errorf("(%T) could not validate signature key: %w", v, err) } @@ -227,6 +231,26 @@ func expirationEpochAttribute(obj *Object) (uint64, error) { return 0, errNoExpirationEpoch } +var errDuplAttr = errors.New("duplication of attributes detected") + +func (v *FormatValidator) checkAttributes(obj *Object) error { + as := obj.Attributes() + + mUnique := make(map[string]struct{}, len(as)) + + for _, a := range as { + key := a.Key() + + if _, was := mUnique[key]; was { + return errDuplAttr + } + + mUnique[key] = struct{}{} + } + + return nil +} + // WithNetState returns options to set network state interface. // // FIXME: network state is a required parameter. diff --git a/pkg/core/object/fmt_test.go b/pkg/core/object/fmt_test.go index 0fbb4ce5b7..c23ee28b80 100644 --- a/pkg/core/object/fmt_test.go +++ b/pkg/core/object/fmt_test.go @@ -219,4 +219,28 @@ func TestFormatValidator_Validate(t *testing.T) { require.NoError(t, err) }) }) + + t.Run("attributes", func(t *testing.T) { + t.Run("duplication", func(t *testing.T) { + obj := blankValidObject(t, ownerKey) + + a1 := object.NewAttribute() + a1.SetKey("key1") + a1.SetValue("val1") + + a2 := object.NewAttribute() + a2.SetKey("key2") + a2.SetValue("val2") + + obj.SetAttributes(a1, a2) + + err := v.checkAttributes(obj.Object()) + require.NoError(t, err) + + a2.SetKey(a1.Key()) + + err = v.checkAttributes(obj.Object()) + require.Equal(t, errDuplAttr, err) + }) + }) } From 25391111ad265ccec282be7759774fab6141a5f0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 17:20:13 +0300 Subject: [PATCH 088/219] [#633] object: Disallow empty attribute values Values of object attributes must not be empty according to NeoFS specification. Make `FormatValidator.Validate` method to return an error if at least one attribute has empty value. Signed-off-by: Leonard Lyubich --- pkg/core/object/fmt.go | 9 ++++++++- pkg/core/object/fmt_test.go | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index 40e07e748d..b0741e1541 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -231,7 +231,10 @@ func expirationEpochAttribute(obj *Object) (uint64, error) { return 0, errNoExpirationEpoch } -var errDuplAttr = errors.New("duplication of attributes detected") +var ( + errDuplAttr = errors.New("duplication of attributes detected") + errEmptyAttrVal = errors.New("empty attribute value") +) func (v *FormatValidator) checkAttributes(obj *Object) error { as := obj.Attributes() @@ -245,6 +248,10 @@ func (v *FormatValidator) checkAttributes(obj *Object) error { return errDuplAttr } + if a.Value() == "" { + return errEmptyAttrVal + } + mUnique[key] = struct{}{} } diff --git a/pkg/core/object/fmt_test.go b/pkg/core/object/fmt_test.go index c23ee28b80..f186182b30 100644 --- a/pkg/core/object/fmt_test.go +++ b/pkg/core/object/fmt_test.go @@ -222,7 +222,7 @@ func TestFormatValidator_Validate(t *testing.T) { t.Run("attributes", func(t *testing.T) { t.Run("duplication", func(t *testing.T) { - obj := blankValidObject(t, ownerKey) + obj := blankValidObject(t, &ownerKey.PrivateKey) a1 := object.NewAttribute() a1.SetKey("key1") @@ -242,5 +242,17 @@ func TestFormatValidator_Validate(t *testing.T) { err = v.checkAttributes(obj.Object()) require.Equal(t, errDuplAttr, err) }) + + t.Run("empty value", func(t *testing.T) { + obj := blankValidObject(t, &ownerKey.PrivateKey) + + a := object.NewAttribute() + a.SetKey("key") + + obj.SetAttributes(a) + + err := v.checkAttributes(obj.Object()) + require.Equal(t, errEmptyAttrVal, err) + }) }) } From 48827f42d3d0717bae64671368c803019c7b591d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 23 Jun 2021 16:29:46 +0300 Subject: [PATCH 089/219] [#643] pkg: Sync method names and commentaries to them Signed-off-by: Pavel Karpy --- cmd/neofs-node/reputation/intermediate/storage.go | 2 +- pkg/innerring/processors/alphabet/processor.go | 2 +- pkg/innerring/processors/audit/processor.go | 6 +++--- pkg/innerring/processors/governance/processor.go | 6 +++--- pkg/local_object_storage/blobovnicza/blobovnicza.go | 2 +- pkg/local_object_storage/blobovnicza/get_range.go | 4 ++-- pkg/local_object_storage/blobstor/get_small.go | 2 +- pkg/local_object_storage/blobstor/info.go | 2 +- pkg/local_object_storage/engine/range.go | 2 +- pkg/local_object_storage/metabase/movable.go | 2 +- pkg/local_object_storage/shard/move.go | 2 +- pkg/local_object_storage/shard/range.go | 2 +- pkg/local_object_storage/shard/shard.go | 2 +- pkg/morph/client/audit/wrapper/result.go | 2 +- pkg/morph/client/balance/wrapper/wrapper.go | 2 +- pkg/morph/client/container/load.go | 2 +- pkg/morph/client/container/wrapper/container.go | 2 +- pkg/morph/client/container/wrapper/wrapper.go | 2 +- pkg/morph/client/netmap/config.go | 4 ++-- pkg/morph/client/netmap/netmap.go | 2 +- pkg/morph/client/netmap/wrapper/snapshot.go | 2 +- pkg/morph/client/reputation/wrapper/get.go | 2 +- pkg/morph/client/reputation/wrapper/wrapper.go | 2 +- pkg/morph/client/static.go | 2 +- pkg/services/audit/taskmanager/manager.go | 4 ++-- pkg/services/container/announcement/load/controller/deps.go | 2 +- pkg/services/object/acl/opts.go | 2 +- pkg/services/object/delete/service.go | 4 ++-- pkg/services/object/search/v2/service.go | 2 +- pkg/services/object_manager/transformer/types.go | 2 +- .../reputation/eigentrust/storage/daughters/calls.go | 2 +- pkg/services/util/response/client_stream.go | 2 +- pkg/util/locode/db/boltdb/calls.go | 2 +- 33 files changed, 41 insertions(+), 41 deletions(-) diff --git a/cmd/neofs-node/reputation/intermediate/storage.go b/cmd/neofs-node/reputation/intermediate/storage.go index 520a7b5d03..2a7fb3d724 100644 --- a/cmd/neofs-node/reputation/intermediate/storage.go +++ b/cmd/neofs-node/reputation/intermediate/storage.go @@ -68,7 +68,7 @@ func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator( // InitConsumersIterator returns iterator over all daughters // of the current node(manager) and all their consumers' local // trusts for ctx.Epoch() epoch and ctx.I() iteration. - +// // Returns ErrNoData if there is no trust data for // specified epoch and iteration. func (ip *DaughterTrustIteratorProvider) InitConsumersIterator( diff --git a/pkg/innerring/processors/alphabet/processor.go b/pkg/innerring/processors/alphabet/processor.go index 54efc09802..823ceca232 100644 --- a/pkg/innerring/processors/alphabet/processor.go +++ b/pkg/innerring/processors/alphabet/processor.go @@ -21,7 +21,7 @@ type ( // Contracts is an interface of the storage // of the alphabet contract addresses. Contracts interface { - // Get by index must return address of the + // GetByIndex must return address of the // alphabet contract by index of the glagolitic // letter (e.g 0 for Az, 40 for Izhitsa). // diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 7244d74d2a..113c967109 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -74,9 +74,9 @@ type epochAuditReporter struct { rep audit.Reporter } -// AuditProcessor manages audit tasks and fills queue for next epoch. This -// process must not be interrupted by new audit epoch, so we limit pool size -// for processor to one. +// ProcessorPoolSize limits pool size for audit Processor. Processor manages +// audit tasks and fills queue for next epoch. This process must not be interrupted +// by new audit epoch, so we limit pool size for processor to one. const ProcessorPoolSize = 1 // New creates audit processor instance. diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index 5b36bc7e84..588403ad13 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -15,9 +15,9 @@ import ( "go.uber.org/zap" ) -// GovernanceProcessor manages governance sync tasks. This process must not be -// interrupted by other sync operation, so we limit pool size for processor to -// one. +// ProcessorPoolSize limits pool size for governance Processor. Processor manages +// governance sync tasks. This process must not be interrupted by other sync +// operation, so we limit pool size for processor to one. const ProcessorPoolSize = 1 type ( diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza.go b/pkg/local_object_storage/blobovnicza/blobovnicza.go index 77701ff21c..d316f3d79f 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza.go @@ -83,7 +83,7 @@ func WithPermissions(perm os.FileMode) Option { } } -// WithSizeLimit returns option to specify maximum size +// WithObjectSizeLimit returns option to specify maximum size // of the objects stored in Blobovnicza. func WithObjectSizeLimit(lim uint64) Option { return func(c *cfg) { diff --git a/pkg/local_object_storage/blobovnicza/get_range.go b/pkg/local_object_storage/blobovnicza/get_range.go index 77895547f5..29c0a873b1 100644 --- a/pkg/local_object_storage/blobovnicza/get_range.go +++ b/pkg/local_object_storage/blobovnicza/get_range.go @@ -24,7 +24,7 @@ func (p *GetRangePrm) SetAddress(addr *objectSDK.Address) { p.addr = addr } -// SetAddress sets range of the requested payload data . +// SetRange sets range of the requested payload data . func (p *GetRangePrm) SetRange(rng *objectSDK.Range) { p.rng = rng } @@ -34,7 +34,7 @@ func (p *GetRangeRes) RangeData() []byte { return p.rngData } -// Get reads the object from Blobovnicza by address. +// GetRange reads range of the object from Blobovnicza by address. // // Returns any error encountered that // did not allow to completely read the object. diff --git a/pkg/local_object_storage/blobstor/get_small.go b/pkg/local_object_storage/blobstor/get_small.go index f7af3b36ed..7ff5d89e87 100644 --- a/pkg/local_object_storage/blobstor/get_small.go +++ b/pkg/local_object_storage/blobstor/get_small.go @@ -6,7 +6,7 @@ type GetSmallPrm struct { rwBlobovniczaID } -// GetBigRes groups resulting values of GetBig operation. +// GetSmallRes groups resulting values of GetSmall operation. type GetSmallRes struct { roObject } diff --git a/pkg/local_object_storage/blobstor/info.go b/pkg/local_object_storage/blobstor/info.go index cb1a11c5fc..9f24212c53 100644 --- a/pkg/local_object_storage/blobstor/info.go +++ b/pkg/local_object_storage/blobstor/info.go @@ -2,7 +2,7 @@ package blobstor import "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree" -// FSTree returns file-system tree for big object store. +// DumpInfo returns information about blob stor. func (b *BlobStor) DumpInfo() fstree.Info { return b.fsTree.Info } diff --git a/pkg/local_object_storage/engine/range.go b/pkg/local_object_storage/engine/range.go index ee6b2a4e91..7d58318ea4 100644 --- a/pkg/local_object_storage/engine/range.go +++ b/pkg/local_object_storage/engine/range.go @@ -17,7 +17,7 @@ type RngPrm struct { addr *objectSDK.Address } -// GetRes groups resulting values of GetRange operation. +// RngRes groups resulting values of GetRange operation. type RngRes struct { obj *object.Object } diff --git a/pkg/local_object_storage/metabase/movable.go b/pkg/local_object_storage/metabase/movable.go index d81f74e3ae..3e7867b745 100644 --- a/pkg/local_object_storage/metabase/movable.go +++ b/pkg/local_object_storage/metabase/movable.go @@ -49,7 +49,7 @@ type MovableRes struct { addrList []*objectSDK.Address } -// WithAddress sets address of the object to prevent moving into another shard. +// AddressList returns resulting addresses of Movable operation. func (p *MovableRes) AddressList() []*objectSDK.Address { return p.addrList } diff --git a/pkg/local_object_storage/shard/move.go b/pkg/local_object_storage/shard/move.go index f160c4bcd7..421b7e22c4 100644 --- a/pkg/local_object_storage/shard/move.go +++ b/pkg/local_object_storage/shard/move.go @@ -14,7 +14,7 @@ type ToMoveItPrm struct { // ToMoveItRes encapsulates results of ToMoveIt operation. type ToMoveItRes struct{} -// WithAdderss sets object address that should be marked to move into another +// WithAddress sets object address that should be marked to move into another // shard. func (p *ToMoveItPrm) WithAddress(addr *objectSDK.Address) *ToMoveItPrm { if p != nil { diff --git a/pkg/local_object_storage/shard/range.go b/pkg/local_object_storage/shard/range.go index 26d043e0e8..2b4d03a690 100644 --- a/pkg/local_object_storage/shard/range.go +++ b/pkg/local_object_storage/shard/range.go @@ -16,7 +16,7 @@ type RngPrm struct { addr *objectSDK.Address } -// RngPrm groups resulting values of GetRange operation. +// RngRes groups resulting values of GetRange operation. type RngRes struct { obj *object.Object } diff --git a/pkg/local_object_storage/shard/shard.go b/pkg/local_object_storage/shard/shard.go index f32c2d0188..b85403e290 100644 --- a/pkg/local_object_storage/shard/shard.go +++ b/pkg/local_object_storage/shard/shard.go @@ -110,7 +110,7 @@ func WithMetaBaseOptions(opts ...meta.Option) Option { } } -// WithMetaBaseOptions returns option to set internal metabase options. +// WithWriteCacheOptions returns option to set internal write cache options. func WithWriteCacheOptions(opts ...writecache.Option) Option { return func(c *cfg) { c.writeCacheOpts = opts diff --git a/pkg/morph/client/audit/wrapper/result.go b/pkg/morph/client/audit/wrapper/result.go index 6992b4db2a..3d891c6870 100644 --- a/pkg/morph/client/audit/wrapper/result.go +++ b/pkg/morph/client/audit/wrapper/result.go @@ -31,7 +31,7 @@ func (w *ClientWrapper) PutAuditResult(result *auditAPI.Result) error { PutAuditResult(args) } -// ListAuditResults returns a list of all audit result IDs inside audit contract. +// ListAllAuditResultID returns a list of all audit result IDs inside audit contract. func (w *ClientWrapper) ListAllAuditResultID() ([]ResultID, error) { args := audit.ListResultsArgs{} diff --git a/pkg/morph/client/balance/wrapper/wrapper.go b/pkg/morph/client/balance/wrapper/wrapper.go index d76da2da72..434352ff2b 100644 --- a/pkg/morph/client/balance/wrapper/wrapper.go +++ b/pkg/morph/client/balance/wrapper/wrapper.go @@ -32,7 +32,7 @@ func defaultOpts() *opts { return new(opts) } -// TryNotaryInvoke returns option to enable +// TryNotary returns option to enable // notary invocation tries. func TryNotary() Option { return func(o *opts) { diff --git a/pkg/morph/client/container/load.go b/pkg/morph/client/container/load.go index c417617594..2c588987a5 100644 --- a/pkg/morph/client/container/load.go +++ b/pkg/morph/client/container/load.go @@ -41,7 +41,7 @@ func (p *PutSizeArgs) SetReporterKey(v []byte) { p.reporterKey = v } -// Put invokes the call of put container method +// PutSize invokes the call of put container size method // of NeoFS Container contract. func (c *Client) PutSize(args PutSizeArgs) error { err := c.client.Invoke( diff --git a/pkg/morph/client/container/wrapper/container.go b/pkg/morph/client/container/wrapper/container.go index 30c4b51038..47a185c85b 100644 --- a/pkg/morph/client/container/wrapper/container.go +++ b/pkg/morph/client/container/wrapper/container.go @@ -278,7 +278,7 @@ type Estimation struct { Reporter []byte } -// Estimation is a structure of grouped container load estimation inside Container contract. +// Estimations is a structure of grouped container load estimation inside Container contract. type Estimations struct { ContainerID *cid.ID diff --git a/pkg/morph/client/container/wrapper/wrapper.go b/pkg/morph/client/container/wrapper/wrapper.go index 5db748d95c..4e1f23da33 100644 --- a/pkg/morph/client/container/wrapper/wrapper.go +++ b/pkg/morph/client/container/wrapper/wrapper.go @@ -31,7 +31,7 @@ func defaultOpts() *opts { return new(opts) } -// TryNotaryInvoke returns option to enable +// TryNotary returns option to enable // notary invocation tries. func TryNotary() Option { return func(o *opts) { diff --git a/pkg/morph/client/netmap/config.go b/pkg/morph/client/netmap/config.go index f3bc65dd5e..d418f69d88 100644 --- a/pkg/morph/client/netmap/config.go +++ b/pkg/morph/client/netmap/config.go @@ -13,8 +13,8 @@ type ConfigArgs struct { key []byte } -// EpochValues groups the stack parameters -// returned by get epoch number test invoke. +// ConfigValues groups the stack parameters +// returned by get config test invoke. type ConfigValues struct { val interface{} } diff --git a/pkg/morph/client/netmap/netmap.go b/pkg/morph/client/netmap/netmap.go index f75c9aba5a..3707901bbc 100644 --- a/pkg/morph/client/netmap/netmap.go +++ b/pkg/morph/client/netmap/netmap.go @@ -69,7 +69,7 @@ func (c *Client) NetMap(_ GetNetMapArgs) (*GetNetMapValues, error) { return peersFromStackItems(prms, c.netMapMethod) } -// NetMap performs the test invoke of get snapshot of network map +// Snapshot performs the test invoke of get snapshot of network map // from NeoFS Netmap contract. Contract saves only one previous epoch, // so all invokes with diff > 1 return error. func (c *Client) Snapshot(a GetSnapshotArgs) (*GetNetMapValues, error) { diff --git a/pkg/morph/client/netmap/wrapper/snapshot.go b/pkg/morph/client/netmap/wrapper/snapshot.go index 2c5c0397e8..83a0d72f7f 100644 --- a/pkg/morph/client/netmap/wrapper/snapshot.go +++ b/pkg/morph/client/netmap/wrapper/snapshot.go @@ -7,7 +7,7 @@ import ( netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" ) -// Fetch returns current netmap node infos. +// Snapshot returns current netmap node infos. // Consider using pkg/morph/client/netmap for this. func (w *Wrapper) Snapshot() (*netmap.Netmap, error) { res, err := w.client.Snapshot(netmap2.GetSnapshotArgs{}) diff --git a/pkg/morph/client/reputation/wrapper/get.go b/pkg/morph/client/reputation/wrapper/get.go index 4f4219a5b2..a99cdef503 100644 --- a/pkg/morph/client/reputation/wrapper/get.go +++ b/pkg/morph/client/reputation/wrapper/get.go @@ -20,7 +20,7 @@ type ( id ReputationID } - // GetResults groups the result of "get reputation value" and + // GetResult groups the result of "get reputation value" and // "get reputation value by reputation id" test invocations. GetResult struct { reputations []reputation.GlobalTrust diff --git a/pkg/morph/client/reputation/wrapper/wrapper.go b/pkg/morph/client/reputation/wrapper/wrapper.go index b65ddd2784..f9b315aad5 100644 --- a/pkg/morph/client/reputation/wrapper/wrapper.go +++ b/pkg/morph/client/reputation/wrapper/wrapper.go @@ -23,7 +23,7 @@ func defaultOpts() *opts { return new(opts) } -// TryNotaryInvoke returns option to enable +// TryNotary returns option to enable // notary invocation tries. func TryNotary() Option { return func(o *opts) { diff --git a/pkg/morph/client/static.go b/pkg/morph/client/static.go index cf14cdcfda..d438bc8215 100644 --- a/pkg/morph/client/static.go +++ b/pkg/morph/client/static.go @@ -37,7 +37,7 @@ func defaultStaticOpts() *staticOpts { return new(staticOpts) } -// TryNotaryInvoke returns option to enable +// TryNotary returns option to enable // notary invocation tries. func TryNotary() StaticClientOption { return func(o *staticOpts) { diff --git a/pkg/services/audit/taskmanager/manager.go b/pkg/services/audit/taskmanager/manager.go index ffc8d3a761..8df658d0ec 100644 --- a/pkg/services/audit/taskmanager/manager.go +++ b/pkg/services/audit/taskmanager/manager.go @@ -90,14 +90,14 @@ func WithMaxPDPSleepInterval(dur time.Duration) Option { } } -// WithPDPWorkerPool returns option to set worker pool for PDP pairs processing. +// WithPDPWorkerPoolGenerator returns option to set worker pool for PDP pairs processing. func WithPDPWorkerPoolGenerator(f func() (util.WorkerPool, error)) Option { return func(c *cfg) { c.pdpPoolGenerator = f } } -// WithPoRWorkerPool returns option to set worker pool for PoR SG processing. +// WithPoRWorkerPoolGenerator returns option to set worker pool for PoR SG processing. func WithPoRWorkerPoolGenerator(f func() (util.WorkerPool, error)) Option { return func(c *cfg) { c.porPoolGenerator = f diff --git a/pkg/services/container/announcement/load/controller/deps.go b/pkg/services/container/announcement/load/controller/deps.go index 0a72850dd1..c598ea2619 100644 --- a/pkg/services/container/announcement/load/controller/deps.go +++ b/pkg/services/container/announcement/load/controller/deps.go @@ -73,7 +73,7 @@ type Writer interface { io.Closer } -// IteratorProvider is a group of methods provided +// WriterProvider is a group of methods provided // by entity which generates keepers of // UsedSpaceAnnouncement values. type WriterProvider interface { diff --git a/pkg/services/object/acl/opts.go b/pkg/services/object/acl/opts.go index df3b47a4f4..85bae05206 100644 --- a/pkg/services/object/acl/opts.go +++ b/pkg/services/object/acl/opts.go @@ -29,7 +29,7 @@ func WithNextService(v objectSvc.ServiceServer) Option { } } -// WithEACLValidator returns options to set eACL validator options. +// WithEACLValidatorOptions returns options to set eACL validator options. func WithEACLValidatorOptions(v ...eacl.Option) Option { return func(c *cfg) { c.eACLOpts = v diff --git a/pkg/services/object/delete/service.go b/pkg/services/object/delete/service.go index b6e249d45e..bb10179724 100644 --- a/pkg/services/object/delete/service.go +++ b/pkg/services/object/delete/service.go @@ -86,14 +86,14 @@ func WithHeadService(h *getsvc.Service) Option { } } -// WithClientCache returns option to set cache of remote node clients. +// WithSearchService returns option to set search service. func WithSearchService(s *searchsvc.Service) Option { return func(c *cfg) { c.searcher = (*searchSvcWrapper)(s) } } -// WithClientOptions returns option to specify options of remote node clients. +// WithPutService returns option to specify put service. func WithPutService(p *putsvc.Service) Option { return func(c *cfg) { c.placer = (*putSvcWrapper)(p) diff --git a/pkg/services/object/search/v2/service.go b/pkg/services/object/search/v2/service.go index 0d6bc3e168..2022269380 100644 --- a/pkg/services/object/search/v2/service.go +++ b/pkg/services/object/search/v2/service.go @@ -34,7 +34,7 @@ func NewService(opts ...Option) *Service { } } -// Get calls internal service and returns v2 object stream. +// Search calls internal service and returns v2 object stream. func (s *Service) Search(req *objectV2.SearchRequest, stream objectSvc.SearchStream) error { p, err := s.toPrm(req, stream) if err != nil { diff --git a/pkg/services/object_manager/transformer/types.go b/pkg/services/object_manager/transformer/types.go index 42c537f09c..ddbe12abd8 100644 --- a/pkg/services/object_manager/transformer/types.go +++ b/pkg/services/object_manager/transformer/types.go @@ -100,7 +100,7 @@ func (a *AccessIdentifiers) Parent() *objectSDK.Object { return nil } -// WithParentID returns AccessIdentifiers with passed parent identifier. +// WithParent returns AccessIdentifiers with passed parent identifier. func (a *AccessIdentifiers) WithParent(v *objectSDK.Object) *AccessIdentifiers { res := a if res == nil { diff --git a/pkg/services/reputation/eigentrust/storage/daughters/calls.go b/pkg/services/reputation/eigentrust/storage/daughters/calls.go index 96fd39d127..28ddb628b8 100644 --- a/pkg/services/reputation/eigentrust/storage/daughters/calls.go +++ b/pkg/services/reputation/eigentrust/storage/daughters/calls.go @@ -65,7 +65,7 @@ func (x *Storage) AllDaughterTrusts(epoch uint64) (*DaughterStorage, bool) { return s, ok } -// maps IDs of daughter peers to repositories of the local trusts to their providers. +// DaughterStorage maps IDs of daughter peers to repositories of the local trusts to their providers. type DaughterStorage struct { mtx sync.RWMutex diff --git a/pkg/services/util/response/client_stream.go b/pkg/services/util/response/client_stream.go index 0ad3b42fda..ec0b124cff 100644 --- a/pkg/services/util/response/client_stream.go +++ b/pkg/services/util/response/client_stream.go @@ -16,7 +16,7 @@ type ClientMessageStreamer struct { close util.ClientStreamCloser } -// Recv calls send method of internal streamer. +// Send calls send method of internal streamer. func (s *ClientMessageStreamer) Send(req interface{}) error { if err := s.send(req); err != nil { return fmt.Errorf("(%T) could not send the request: %w", s, err) diff --git a/pkg/util/locode/db/boltdb/calls.go b/pkg/util/locode/db/boltdb/calls.go index 4176e21b0c..6d6c4333c0 100644 --- a/pkg/util/locode/db/boltdb/calls.go +++ b/pkg/util/locode/db/boltdb/calls.go @@ -132,7 +132,7 @@ func (db *DB) Put(key locodedb.Key, rec locodedb.Record) error { var errRecordNotFound = errors.New("record not found") -// Put reads the record by key from underlying BoltDB instance. +// Get reads the record by key from underlying BoltDB instance. // // Returns an error if no record is presented by key in DB. // From 2da5a309f77fbd24b83a9392f88c822c1f9afd98 Mon Sep 17 00:00:00 2001 From: tivizi Date: Thu, 24 Jun 2021 20:31:50 +0800 Subject: [PATCH 090/219] [#626] Support default config file Signed-off-by: Tivizi Jing --- cmd/neofs-cli/modules/root.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index e40282fafd..c325380fe3 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "strings" "github.com/mitchellh/go-homedir" @@ -141,9 +142,11 @@ func initConfig() { os.Exit(1) } - // Search config in home directory with name ".main" (without extension). - viper.AddConfigPath(home) - viper.SetConfigName(".config/neofs-cli") + // Search config in `$HOME/.config/neofs-cli/` or `$PWD` with name "config.yaml" + viper.AddConfigPath(filepath.Join(home, ".config", "neofs-cli")) + viper.AddConfigPath(".") + viper.SetConfigName("config") + viper.SetConfigType("yaml") } viper.SetEnvPrefix(envPrefix) From 1f461baf0b74d41b5c9fd6d3c75ce32a512544c1 Mon Sep 17 00:00:00 2001 From: tivizi Date: Fri, 25 Jun 2021 08:23:10 +0800 Subject: [PATCH 091/219] [#626] The default config file location Signed-off-by: Tivizi Jing --- cmd/neofs-cli/modules/root.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index c325380fe3..486721827a 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -142,9 +142,8 @@ func initConfig() { os.Exit(1) } - // Search config in `$HOME/.config/neofs-cli/` or `$PWD` with name "config.yaml" + // Search config in `$HOME/.config/neofs-cli/` with name "config.yaml" viper.AddConfigPath(filepath.Join(home, ".config", "neofs-cli")) - viper.AddConfigPath(".") viper.SetConfigName("config") viper.SetConfigType("yaml") } From 5df55bcfaf343659b3c5dde81096fd42e3932726 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 25 Jun 2021 16:21:03 +0300 Subject: [PATCH 092/219] [#648] morph/client: Fix method name in NewEpoch Signed-off-by: Alex Vanin --- pkg/morph/client/netmap/new_epoch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/morph/client/netmap/new_epoch.go b/pkg/morph/client/netmap/new_epoch.go index d09c135216..d87388dce7 100644 --- a/pkg/morph/client/netmap/new_epoch.go +++ b/pkg/morph/client/netmap/new_epoch.go @@ -18,7 +18,7 @@ func (a *NewEpochArgs) SetEpochNumber(v int64) { // NewEpoch invokes the call of new epoch method // of NeoFS Netmap contract. func (c *Client) NewEpoch(args NewEpochArgs) error { - if err := c.client.Invoke(c.addPeerMethod, args.number); err != nil { + if err := c.client.Invoke(c.newEpochMethod, args.number); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.newEpochMethod, err) } return nil From 6d4154bce63336e623c858c09f096ba58b149500 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 13:30:21 +0300 Subject: [PATCH 093/219] [#607] Update NeoFS API Go library with updated interface of NodeInfo Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 392c2e226f..ecc70dbd4c 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.2 - github.com/nspcc-dev/neofs-api-go v1.27.1 + github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 9cc8448f03..24cc0acb3f 100644 --- a/go.sum +++ b/go.sum @@ -226,6 +226,7 @@ github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -302,8 +303,8 @@ github.com/nspcc-dev/neo-go v0.95.2 h1:WaFdqzdqDK2xjXuCUZENTL55fW7RodU23uGdTqx45 github.com/nspcc-dev/neo-go v0.95.2/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= -github.com/nspcc-dev/neofs-api-go v1.27.1 h1:ONdKOnm0/hK6m38VTUliCHY6RTxg+IpAzY4G+BeOZG4= -github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc h1:GLLzWOQVeO9FATZodCG/AzmcV05mh8CcEXgoa3/SSM8= +github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= @@ -334,6 +335,7 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -536,6 +538,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= From 5e4208648aa97d7b8826c3bdca06b373e1a443da Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 13:32:48 +0300 Subject: [PATCH 094/219] [#607] network: Implement AddressGroup type Define `network.AddressGroup` type which represents group of network addresses. This type is going to be used to support group-address of the storage node. Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 105 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 pkg/network/group.go diff --git a/pkg/network/group.go b/pkg/network/group.go new file mode 100644 index 0000000000..24d6a0b3ad --- /dev/null +++ b/pkg/network/group.go @@ -0,0 +1,105 @@ +package network + +import ( + "errors" + + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" +) + +// AddressGroup represents list of network addresses of the node. +// +// List is sorted by priority of use. +type AddressGroup []Address + +// IterateAddresses iterates over all network addresses of the node. +// +// Breaks iterating on handler's true return. +// +// Handler should not be nil. +func (x AddressGroup) IterateAddresses(f func(Address) bool) { + for i := range x { + if f(x[i]) { + break + } + } +} + +// MultiAddressIterator is an interface of network address group. +type MultiAddressIterator interface { + // Must iterate over network addresses and pass each one + // to the handler until it returns true. + IterateAddresses(func(string) bool) + + // Must return number of addresses in group. + NumberOfAddresses() int +} + +// FromIterator forms AddressGroup from MultiAddressIterator structure. +// +// Returns an error in the absence of addresses or if any of the addresses are incorrect. +func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { + as := *x + + addrNum := iter.NumberOfAddresses() + if addrNum <= 0 { + err = errors.New("missing network addresses") + return + } + + if cap(as) >= addrNum { + as = as[:0] + } else { + as = make(AddressGroup, 0, addrNum) + } + + iter.IterateAddresses(func(s string) bool { + var a Address + + err = a.FromString(s) + + fail := err != nil + if !fail { + as = append(as, a) + } + + return fail + }) + + if err == nil { + *x = as + } + + return +} + +// GroupFromAddress wraps single Address into AddressGroup. +// +// Deprecated: use AddressGroup.FromIterator method. +func GroupFromAddress(addr Address) AddressGroup { + return AddressGroup{addr} +} + +// WriteToNodeInfo writes AddressGroup to netmap.NodeInfo structure. +func (x AddressGroup) WriteToNodeInfo(ni *netmap.NodeInfo) { + addrs := make([]string, len(x)) + + for i := range x { + addrs[i] = x[i].String() + } + + ni.SetAddresses(addrs...) +} + +// Intersects checks if two AddressGroup have +// at least one common address. +func (x AddressGroup) Intersects(x2 AddressGroup) bool { + for i := range x { + for j := range x2 { + if x[i].Equal(x2[j]) { + return true + } + } + } + + return false +} From 3805b0f638b741ad8cc26cbd61cfbb0040bd3efc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 17:13:08 +0300 Subject: [PATCH 095/219] [#607] client: Overload Client interface There is a need to generalize single-address client to group-address client. To do this, we can re-implement `Client` interface from NeoFS API Go library and still use it in the application code. There is a problem with method `Raw` which must return single-address raw client. So as not to make changes to API library we need to overload Client interface in order to support `Raw` method in group-address client implementation. Define `Client` interface in new `pkg/core/client` package. Completely inherit API `Client` interface. Add `RawForAddress` method to build raw client for the single node address. Adopt the application code that used Raw method to work with new `Client`. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 33 ++++++++++++++++++++--- pkg/core/client/client.go | 17 ++++++++++++ pkg/services/object/get/get_test.go | 2 +- pkg/services/object/get/prm.go | 4 ++- pkg/services/object/get/remote.go | 2 +- pkg/services/object/get/service.go | 4 +-- pkg/services/object/get/util.go | 7 ++--- pkg/services/object/get/v2/util.go | 15 ++++++----- pkg/services/object/put/prm.go | 7 ++--- pkg/services/object/put/service.go | 2 +- pkg/services/object/put/streamer.go | 6 ++--- pkg/services/object/put/v2/streamer.go | 7 ++--- pkg/services/object/search/prm.go | 4 ++- pkg/services/object/search/remote.go | 2 +- pkg/services/object/search/search_test.go | 2 +- pkg/services/object/search/service.go | 4 +-- pkg/services/object/search/util.go | 6 ++--- pkg/services/object/search/v2/util.go | 7 ++--- 18 files changed, 91 insertions(+), 40 deletions(-) create mode 100644 pkg/core/client/client.go diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index bd5805d929..b97e3b1527 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -11,12 +11,14 @@ import ( cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + client3 "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" apiclientconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/apiclient" policerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/policer" replicatorconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/replicator" + client2 "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -146,6 +148,27 @@ func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { return result, nil } +type coreClientConstructor reputationClientConstructor + +func (x *coreClientConstructor) Get(addr network.Address) (client2.Client, error) { + c, err := (*reputationClientConstructor)(x).Get(addr) + if err != nil { + return nil, err + } + + return apiclient{ + Client: c, + }, nil +} + +type apiclient struct { + client.Client +} + +func (x apiclient) RawForAddress(network.Address) *client3.Client { + return x.Client.Raw() +} + func initObjectService(c *cfg) { ls := c.cfgObject.cfgLocalStorage.localStorage keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore) @@ -169,6 +192,8 @@ func initObjectService(c *cfg) { basicConstructor: clientCache, } + coreConstructor := (*coreClientConstructor)(clientConstructor) + irFetcher := &innerRingFetcher{ sidechain: c.cfgMorph.client, } @@ -185,7 +210,7 @@ func initObjectService(c *cfg) { ), replicator.WithLocalStorage(ls), replicator.WithRemoteSender( - putsvc.NewRemoteSender(keyStorage, clientConstructor), + putsvc.NewRemoteSender(keyStorage, coreConstructor), ), ) @@ -237,7 +262,7 @@ func initObjectService(c *cfg) { sPut := putsvc.NewService( putsvc.WithKeyStorage(keyStorage), - putsvc.WithClientConstructor(clientConstructor), + putsvc.WithClientConstructor(coreConstructor), putsvc.WithMaxSizeSource(c), putsvc.WithLocalStorage(ls), putsvc.WithContainerSource(c.cfgObject.cnrStorage), @@ -259,7 +284,7 @@ func initObjectService(c *cfg) { sSearch := searchsvc.New( searchsvc.WithLogger(c.log), searchsvc.WithLocalStorageEngine(ls), - searchsvc.WithClientConstructor(clientConstructor), + searchsvc.WithClientConstructor(coreConstructor), searchsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.WithoutSuccessTracking(), @@ -276,7 +301,7 @@ func initObjectService(c *cfg) { sGet := getsvc.New( getsvc.WithLogger(c.log), getsvc.WithLocalStorageEngine(ls), - getsvc.WithClientConstructor(clientConstructor), + getsvc.WithClientConstructor(coreConstructor), getsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.SuccessAfter(1), diff --git a/pkg/core/client/client.go b/pkg/core/client/client.go new file mode 100644 index 0000000000..80b676534c --- /dev/null +++ b/pkg/core/client/client.go @@ -0,0 +1,17 @@ +package client + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg/client" + rawclient "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-node/pkg/network" +) + +// Client is an interface of NeoFS storage +// node's client. +type Client interface { + client.Client + + // RawForAddress must return rawclient.Client + // for the passed network.Address. + RawForAddress(network.Address) *rawclient.Client +} diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index 549afd6183..e7ad1577d7 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -100,7 +100,7 @@ func newTestClient() *testClient { } } -func (c *testClient) getObject(exec *execCtx) (*objectSDK.Object, error) { +func (c *testClient) getObject(exec *execCtx, _ network.Address) (*objectSDK.Object, error) { v, ok := c.results[exec.address().String()] if !ok { return nil, object.ErrNotFound diff --git a/pkg/services/object/get/prm.go b/pkg/services/object/get/prm.go index a10fb30037..e5c81db11c 100644 --- a/pkg/services/object/get/prm.go +++ b/pkg/services/object/get/prm.go @@ -5,7 +5,9 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/object" + "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" ) @@ -32,7 +34,7 @@ type RangeHashPrm struct { salt []byte } -type RequestForwarder func(client.Client) (*objectSDK.Object, error) +type RequestForwarder func(network.Address, coreclient.Client) (*objectSDK.Object, error) // HeadPrm groups parameters of Head service call. type HeadPrm struct { diff --git a/pkg/services/object/get/remote.go b/pkg/services/object/get/remote.go index acea51f64a..fe700d7851 100644 --- a/pkg/services/object/get/remote.go +++ b/pkg/services/object/get/remote.go @@ -20,7 +20,7 @@ func (exec *execCtx) processNode(ctx context.Context, addr network.Address) bool return true } - obj, err := client.getObject(exec) + obj, err := client.getObject(exec, addr) var errSplitInfo *objectSDK.SplitInfoError diff --git a/pkg/services/object/get/service.go b/pkg/services/object/get/service.go index ab8d51e83c..76e07333e0 100644 --- a/pkg/services/object/get/service.go +++ b/pkg/services/object/get/service.go @@ -1,8 +1,8 @@ package getsvc import ( - "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -22,7 +22,7 @@ type Service struct { type Option func(*cfg) type getClient interface { - getObject(*execCtx) (*objectSDK.Object, error) + getObject(*execCtx, network.Address) (*objectSDK.Object, error) } type cfg struct { diff --git a/pkg/services/object/get/util.go b/pkg/services/object/get/util.go index 72578458ee..098f94ca37 100644 --- a/pkg/services/object/get/util.go +++ b/pkg/services/object/get/util.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -22,7 +23,7 @@ type clientCacheWrapper struct { } type clientWrapper struct { - client client.Client + client coreclient.Client } type storageEngineWrapper struct { @@ -80,9 +81,9 @@ func (c *clientCacheWrapper) get(addr network.Address) (getClient, error) { }, err } -func (c *clientWrapper) getObject(exec *execCtx) (*objectSDK.Object, error) { +func (c *clientWrapper) getObject(exec *execCtx, addr network.Address) (*objectSDK.Object, error) { if !exec.assembling && exec.prm.forwarder != nil { - return exec.prm.forwarder(c.client) + return exec.prm.forwarder(addr, c.client) } if exec.headOnly() { diff --git a/pkg/services/object/get/v2/util.go b/pkg/services/object/get/v2/util.go index 5085b5ebfb..080a8eeab9 100644 --- a/pkg/services/object/get/v2/util.go +++ b/pkg/services/object/get/v2/util.go @@ -9,7 +9,6 @@ import ( "io" "sync" - "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" sessionsdk "github.com/nspcc-dev/neofs-api-go/pkg/session" rpcclient "github.com/nspcc-dev/neofs-api-go/rpc/client" @@ -19,7 +18,9 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/rpc" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/object" + "github.com/nspcc-dev/neofs-node/pkg/network" objectSvc "github.com/nspcc-dev/neofs-node/pkg/services/object" getsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/get" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" @@ -54,7 +55,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -78,7 +79,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre // perhaps it is worth highlighting the utility function in neofs-api-go // open stream - stream, err := rpc.GetObject(c.Raw(), req, rpcclient.WithContext(stream.Context())) + stream, err := rpc.GetObject(c.RawForAddress(addr), req, rpcclient.WithContext(stream.Context())) if err != nil { return nil, fmt.Errorf("stream opening failed: %w", err) } @@ -176,7 +177,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -200,7 +201,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get // perhaps it is worth highlighting the utility function in neofs-api-go // open stream - stream, err := rpc.GetObjectRange(c.Raw(), req, rpcclient.WithContext(stream.Context())) + stream, err := rpc.GetObjectRange(c.RawForAddress(addr), req, rpcclient.WithContext(stream.Context())) if err != nil { return nil, fmt.Errorf("could not create Get payload range stream: %w", err) } @@ -339,7 +340,7 @@ func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -363,7 +364,7 @@ func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp // perhaps it is worth highlighting the utility function in neofs-api-go // send Head request - resp, err := rpc.HeadObject(c.Raw(), req, rpcclient.WithContext(ctx)) + resp, err := rpc.HeadObject(c.RawForAddress(addr), req, rpcclient.WithContext(ctx)) if err != nil { return nil, fmt.Errorf("sending the request failed: %w", err) } diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index f7a766c517..00a4458c5c 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -1,8 +1,9 @@ package putsvc import ( - "github.com/nspcc-dev/neofs-api-go/pkg/client" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/object" + "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" ) @@ -14,7 +15,7 @@ type PutInitPrm struct { traverseOpts []placement.Option - relay func(client.Client) error + relay func(network.Address, client.Client) error } type PutChunkPrm struct { @@ -45,7 +46,7 @@ func (p *PutInitPrm) WithObject(v *object.RawObject) *PutInitPrm { return p } -func (p *PutInitPrm) WithRelay(f func(client.Client) error) *PutInitPrm { +func (p *PutInitPrm) WithRelay(f func(network.Address, client.Client) error) *PutInitPrm { if p != nil { p.relay = f } diff --git a/pkg/services/object/put/service.go b/pkg/services/object/put/service.go index d010226d75..266116860c 100644 --- a/pkg/services/object/put/service.go +++ b/pkg/services/object/put/service.go @@ -3,7 +3,7 @@ package putsvc import ( "context" - "github.com/nspcc-dev/neofs-api-go/pkg/client" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/core/object" diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 459fdfca4d..3d607da357 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/nspcc-dev/neofs-api-go/pkg/client" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" @@ -20,7 +20,7 @@ type Streamer struct { target transformer.ObjectTarget - relay func(client.Client) error + relay func(network.Address, client.Client) error maxPayloadSz uint64 // network config } @@ -159,7 +159,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { return fmt.Errorf("could not create SDK client %s: %w", addr, err) } - return p.relay(c) + return p.relay(addr, c) } } diff --git a/pkg/services/object/put/v2/streamer.go b/pkg/services/object/put/v2/streamer.go index 9f07975f94..e1dd393408 100644 --- a/pkg/services/object/put/v2/streamer.go +++ b/pkg/services/object/put/v2/streamer.go @@ -4,12 +4,13 @@ import ( "errors" "fmt" - "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/session" "github.com/nspcc-dev/neofs-api-go/v2/object" "github.com/nspcc-dev/neofs-api-go/v2/rpc" sessionV2 "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-node/pkg/core/client" + "github.com/nspcc-dev/neofs-node/pkg/network" putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" ) @@ -124,11 +125,11 @@ func (s *streamer) CloseAndRecv() (*object.PutResponse, error) { return fromPutResponse(resp), nil } -func (s *streamer) relayRequest(c client.Client) error { +func (s *streamer) relayRequest(addr network.Address, c client.Client) error { // open stream resp := new(object.PutResponse) - stream, err := rpc.PutObject(c.Raw(), resp) + stream, err := rpc.PutObject(c.RawForAddress(addr), resp) if err != nil { return fmt.Errorf("stream opening failed: %w", err) } diff --git a/pkg/services/object/search/prm.go b/pkg/services/object/search/prm.go index 11144cc114..3340cb40a5 100644 --- a/pkg/services/object/search/prm.go +++ b/pkg/services/object/search/prm.go @@ -3,6 +3,8 @@ package searchsvc import ( "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client" + "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" ) @@ -25,7 +27,7 @@ type IDListWriter interface { // RequestForwarder is a callback for forwarding of the // original Search requests. -type RequestForwarder func(client.Client) ([]*objectSDK.ID, error) +type RequestForwarder func(network.Address, coreclient.Client) ([]*objectSDK.ID, error) // SetCommonParameters sets common parameters of the operation. func (p *Prm) SetCommonParameters(common *util.CommonPrm) { diff --git a/pkg/services/object/search/remote.go b/pkg/services/object/search/remote.go index cdf8ed706a..d4646b3d74 100644 --- a/pkg/services/object/search/remote.go +++ b/pkg/services/object/search/remote.go @@ -17,7 +17,7 @@ func (exec *execCtx) processNode(ctx context.Context, addr network.Address) { return } - ids, err := client.searchObjects(exec) + ids, err := client.searchObjects(exec, addr) if err != nil { exec.log.Debug("local operation failed", diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 827d98999d..8e8c200c5d 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -102,7 +102,7 @@ func (s *testStorage) search(exec *execCtx) ([]*objectSDK.ID, error) { return v.ids, v.err } -func (c *testStorage) searchObjects(exec *execCtx) ([]*objectSDK.ID, error) { +func (c *testStorage) searchObjects(exec *execCtx, _ network.Address) ([]*objectSDK.ID, error) { v, ok := c.items[exec.containerID().String()] if !ok { return nil, nil diff --git a/pkg/services/object/search/service.go b/pkg/services/object/search/service.go index 5b03c10571..b68fee63e6 100644 --- a/pkg/services/object/search/service.go +++ b/pkg/services/object/search/service.go @@ -1,9 +1,9 @@ package searchsvc import ( - "github.com/nspcc-dev/neofs-api-go/pkg/client" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/network" @@ -23,7 +23,7 @@ type Service struct { type Option func(*cfg) type searchClient interface { - searchObjects(*execCtx) ([]*object.ID, error) + searchObjects(*execCtx, network.Address) ([]*object.ID, error) } type ClientConstructor interface { diff --git a/pkg/services/object/search/util.go b/pkg/services/object/search/util.go index c1f5c4e9d6..81cecbacf5 100644 --- a/pkg/services/object/search/util.go +++ b/pkg/services/object/search/util.go @@ -3,9 +3,9 @@ package searchsvc import ( "sync" - "github.com/nspcc-dev/neofs-api-go/pkg/client" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/network" @@ -76,9 +76,9 @@ func (c *clientConstructorWrapper) get(addr network.Address) (searchClient, erro }, err } -func (c *clientWrapper) searchObjects(exec *execCtx) ([]*objectSDK.ID, error) { +func (c *clientWrapper) searchObjects(exec *execCtx, addr network.Address) ([]*objectSDK.ID, error) { if exec.prm.forwarder != nil { - return exec.prm.forwarder(c.client) + return exec.prm.forwarder(addr, c.client) } return c.client.SearchObject(exec.context(), diff --git a/pkg/services/object/search/v2/util.go b/pkg/services/object/search/v2/util.go index bec092b45e..b2d4c5d330 100644 --- a/pkg/services/object/search/v2/util.go +++ b/pkg/services/object/search/v2/util.go @@ -6,7 +6,6 @@ import ( "io" "sync" - "github.com/nspcc-dev/neofs-api-go/pkg/client" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" sessionsdk "github.com/nspcc-dev/neofs-api-go/pkg/session" @@ -15,6 +14,8 @@ import ( "github.com/nspcc-dev/neofs-api-go/v2/rpc" "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-api-go/v2/signature" + "github.com/nspcc-dev/neofs-node/pkg/core/client" + "github.com/nspcc-dev/neofs-node/pkg/network" objectSvc "github.com/nspcc-dev/neofs-node/pkg/services/object" searchsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/search" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" @@ -45,7 +46,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(c client.Client) ([]*objectSDK.ID, error) { + p.SetRequestForwarder(func(addr network.Address, c client.Client) ([]*objectSDK.ID, error) { var err error // once compose and resign forwarding request @@ -65,7 +66,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre return nil, err } - stream, err := rpc.SearchObjects(c.Raw(), req, rpcclient.WithContext(stream.Context())) + stream, err := rpc.SearchObjects(c.RawForAddress(addr), req, rpcclient.WithContext(stream.Context())) if err != nil { return nil, err } From c82615667d069e8e3400de5104ec10ea66b6f48d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 17:56:19 +0300 Subject: [PATCH 096/219] [#607] network: Return group-address client from ClientCache Add group-address `Client` implementation. Return instances of this implementation from `ClientCache.Get` method. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 21 +-- pkg/network/cache/client.go | 12 +- pkg/network/cache/multi.go | 332 ++++++++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+), 27 deletions(-) create mode 100644 pkg/network/cache/multi.go diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index b97e3b1527..b7afcfb8ba 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -11,14 +11,13 @@ import ( cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" - client3 "github.com/nspcc-dev/neofs-api-go/rpc/client" "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" apiclientconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/apiclient" policerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/policer" replicatorconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/replicator" - client2 "github.com/nspcc-dev/neofs-node/pkg/core/client" + coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" @@ -150,23 +149,13 @@ func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { type coreClientConstructor reputationClientConstructor -func (x *coreClientConstructor) Get(addr network.Address) (client2.Client, error) { +func (x *coreClientConstructor) Get(addr network.Address) (coreclient.Client, error) { c, err := (*reputationClientConstructor)(x).Get(addr) if err != nil { return nil, err } - return apiclient{ - Client: c, - }, nil -} - -type apiclient struct { - client.Client -} - -func (x apiclient) RawForAddress(network.Address) *client3.Client { - return x.Client.Raw() + return c.(coreclient.Client), nil } func initObjectService(c *cfg) { @@ -438,7 +427,7 @@ type reputationClientConstructor struct { } type reputationClient struct { - client.Client + coreclient.Client prm truststorage.UpdatePrm @@ -535,7 +524,7 @@ func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, prm.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) return &reputationClient{ - Client: cl, + Client: cl.(coreclient.Client), prm: prm, cons: c, }, nil diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index 225f83bb60..020dfb988d 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -1,7 +1,6 @@ package cache import ( - "crypto/tls" "sync" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -54,16 +53,7 @@ func (c *ClientCache) Get(netAddr network.Address) (client.Client, error) { return cli, nil } - opts := append(c.opts, client.WithAddress(netAddr.HostAddr())) - - if netAddr.TLSEnabled() { - opts = append(opts, client.WithTLSConfig(&tls.Config{})) - } - - cli, err := client.New(opts...) - if err != nil { - return nil, err - } + cli := newMultiClient(network.GroupFromAddress(netAddr), c.opts) c.clients[mAddr] = cli diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go new file mode 100644 index 0000000000..5d3fed4607 --- /dev/null +++ b/pkg/network/cache/multi.go @@ -0,0 +1,332 @@ +package cache + +import ( + "context" + "crypto/sha256" + "crypto/tls" + "io" + "sync" + + "github.com/nspcc-dev/neofs-api-go/pkg/accounting" + "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" + "github.com/nspcc-dev/neofs-api-go/pkg/client" + "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" + "github.com/nspcc-dev/neofs-api-go/pkg/netmap" + "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/pkg/session" + rawclient "github.com/nspcc-dev/neofs-api-go/rpc/client" + "github.com/nspcc-dev/neofs-node/pkg/network" +) + +type multiClient struct { + mtx sync.RWMutex + + clients map[string]client.Client + + addr network.AddressGroup + + opts []client.Option +} + +func newMultiClient(addr network.AddressGroup, opts []client.Option) *multiClient { + return &multiClient{ + clients: make(map[string]client.Client), + addr: addr, + opts: opts, + } +} + +// note: must be wrapped into mutex lock. +func (x *multiClient) createForAddress(addr network.Address) client.Client { + opts := append(x.opts, client.WithAddress(addr.HostAddr())) + + if addr.TLSEnabled() { + opts = append(opts, client.WithTLSConfig(&tls.Config{})) + } + + c, err := client.New(opts...) + if err != nil { + // client never returns an error + panic(err) + } + + x.clients[addr.String()] = c + + return c +} + +func (x *multiClient) iterateClients(f func(client.Client) error) error { + var firstErr error + + x.addr.IterateAddresses(func(addr network.Address) bool { + x.mtx.Lock() + + strAddr := addr.String() + + var err error + + c, cached := x.clients[strAddr] + if !cached { + c = x.createForAddress(addr) + } + + x.mtx.Unlock() + + err = f(c) + + success := err == nil + + if success || firstErr == nil { + firstErr = err + } + + return success + }) + + return firstErr +} + +func (x *multiClient) PutObject(ctx context.Context, p *client.PutObjectParams, opts ...client.CallOption) (*object.ID, error) { + var res *object.ID + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.PutObject(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) GetBalance(ctx context.Context, id *owner.ID, opts ...client.CallOption) (*accounting.Decimal, error) { + var res *accounting.Decimal + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.GetBalance(ctx, id, opts...) + return + }) + + return res, err +} + +func (x *multiClient) PutContainer(ctx context.Context, cnr *container.Container, opts ...client.CallOption) (*cid.ID, error) { + var res *cid.ID + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.PutContainer(ctx, cnr, opts...) + return + }) + + return res, err +} + +func (x *multiClient) GetContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) (*container.Container, error) { + var res *container.Container + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.GetContainer(ctx, id, opts...) + return + }) + + return res, err +} + +func (x *multiClient) ListContainers(ctx context.Context, id *owner.ID, opts ...client.CallOption) ([]*cid.ID, error) { + var res []*cid.ID + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.ListContainers(ctx, id, opts...) + return + }) + + return res, err +} + +func (x *multiClient) DeleteContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) error { + return x.iterateClients(func(c client.Client) error { + return c.DeleteContainer(ctx, id, opts...) + }) +} + +func (x *multiClient) GetEACL(ctx context.Context, id *cid.ID, opts ...client.CallOption) (*client.EACLWithSignature, error) { + var res *client.EACLWithSignature + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.GetEACL(ctx, id, opts...) + return + }) + + return res, err +} + +func (x *multiClient) SetEACL(ctx context.Context, t *eacl.Table, opts ...client.CallOption) error { + return x.iterateClients(func(c client.Client) error { + return c.SetEACL(ctx, t, opts...) + }) +} + +func (x *multiClient) AnnounceContainerUsedSpace(ctx context.Context, as []container.UsedSpaceAnnouncement, opts ...client.CallOption) error { + return x.iterateClients(func(c client.Client) error { + return c.AnnounceContainerUsedSpace(ctx, as, opts...) + }) +} + +func (x *multiClient) EndpointInfo(ctx context.Context, opts ...client.CallOption) (*client.EndpointInfo, error) { + var res *client.EndpointInfo + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.EndpointInfo(ctx, opts...) + return + }) + + return res, err +} + +func (x *multiClient) NetworkInfo(ctx context.Context, opts ...client.CallOption) (*netmap.NetworkInfo, error) { + var res *netmap.NetworkInfo + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.NetworkInfo(ctx, opts...) + return + }) + + return res, err +} + +func (x *multiClient) DeleteObject(ctx context.Context, p *client.DeleteObjectParams, opts ...client.CallOption) error { + return x.iterateClients(func(c client.Client) error { + return c.DeleteObject(ctx, p, opts...) + }) +} + +func (x *multiClient) GetObject(ctx context.Context, p *client.GetObjectParams, opts ...client.CallOption) (*object.Object, error) { + var res *object.Object + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.GetObject(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) GetObjectHeader(ctx context.Context, p *client.ObjectHeaderParams, opts ...client.CallOption) (*object.Object, error) { + var res *object.Object + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.GetObjectHeader(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) ObjectPayloadRangeData(ctx context.Context, p *client.RangeDataParams, opts ...client.CallOption) ([]byte, error) { + var res []byte + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.ObjectPayloadRangeData(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) ObjectPayloadRangeSHA256(ctx context.Context, p *client.RangeChecksumParams, opts ...client.CallOption) ([][sha256.Size]byte, error) { + var res [][sha256.Size]byte + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.ObjectPayloadRangeSHA256(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) ObjectPayloadRangeTZ(ctx context.Context, p *client.RangeChecksumParams, opts ...client.CallOption) ([][client.TZSize]byte, error) { + var res [][client.TZSize]byte + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.ObjectPayloadRangeTZ(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) SearchObject(ctx context.Context, p *client.SearchObjectParams, opts ...client.CallOption) ([]*object.ID, error) { + var res []*object.ID + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.SearchObject(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) CreateSession(ctx context.Context, exp uint64, opts ...client.CallOption) (*session.Token, error) { + var res *session.Token + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.CreateSession(ctx, exp, opts...) + return + }) + + return res, err +} + +func (x *multiClient) AnnounceLocalTrust(ctx context.Context, p client.AnnounceLocalTrustPrm, opts ...client.CallOption) (*client.AnnounceLocalTrustRes, error) { + var res *client.AnnounceLocalTrustRes + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.AnnounceLocalTrust(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) AnnounceIntermediateTrust(ctx context.Context, p client.AnnounceIntermediateTrustPrm, opts ...client.CallOption) (*client.AnnounceIntermediateTrustRes, error) { + var res *client.AnnounceIntermediateTrustRes + + err := x.iterateClients(func(c client.Client) (err error) { + res, err = c.AnnounceIntermediateTrust(ctx, p, opts...) + return + }) + + return res, err +} + +func (x *multiClient) Raw() *rawclient.Client { + panic("multiClient.Raw() must not be called") +} + +func (x *multiClient) Conn() io.Closer { + return x +} + +func (x *multiClient) Close() error { + x.mtx.RLock() + + { + for _, c := range x.clients { + _ = c.Conn().Close() + } + } + + x.mtx.RUnlock() + + return nil +} + +func (x *multiClient) RawForAddress(addr network.Address) *rawclient.Client { + x.mtx.Lock() + + c := x.createForAddress(addr).Raw() + + x.mtx.Unlock() + + return c +} From 5db7c5c2a8974967a822a65e9055feb219209df7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 19:50:00 +0300 Subject: [PATCH 097/219] [#607] network: Implement function to stringify AddressGroup Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/network/group.go b/pkg/network/group.go index 24d6a0b3ad..d5fedae426 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -11,6 +11,21 @@ import ( // List is sorted by priority of use. type AddressGroup []Address +// StringifyGroup returns concatenation of all addresses +// from the AddressGroup. +// +// The result is order-dependent. +func StringifyGroup(x AddressGroup) string { + var s string + + x.IterateAddresses(func(addr Address) bool { + s += addr.String() + return false + }) + + return s +} + // IterateAddresses iterates over all network addresses of the node. // // Breaks iterating on handler's true return. From e11f50ec8e8cd503283d1bec354821e78719b163 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 21 Jun 2021 19:59:05 +0300 Subject: [PATCH 098/219] [#607] network: Make ClientCache to accept AddressGroup Change type of the `ClientCache.Get` method's parameter to `AddressGroup`. Use `GroupFromAddress` to call the method from the wrappers in order to no change their interface. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/container.go | 4 ++-- cmd/neofs-node/object.go | 4 ++-- cmd/neofs-node/reputation/common/remote.go | 4 ++-- pkg/innerring/rpc.go | 4 ++-- pkg/network/cache/client.go | 11 ++++++++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index c44da3dcdc..daa98bc060 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -205,7 +205,7 @@ type remoteLoadAnnounceProvider struct { loadAddrSrc network.LocalAddressSource clientCache interface { - Get(network.Address) (apiClient.Client, error) + Get(network.AddressGroup) (apiClient.Client, error) } deadEndProvider loadcontroller.WriterProvider @@ -230,7 +230,7 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil } - c, err := r.clientCache.Get(netAddr) + c, err := r.clientCache.Get(network.GroupFromAddress(netAddr)) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) } diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index b7afcfb8ba..8a01e6d5c8 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -422,7 +422,7 @@ type reputationClientConstructor struct { trustStorage *truststorage.Storage basicConstructor interface { - Get(network.Address) (client.Client, error) + Get(network.AddressGroup) (client.Client, error) } } @@ -507,7 +507,7 @@ func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchO } func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, error) { - cl, err := c.basicConstructor.Get(addr) + cl, err := c.basicConstructor.Get(network.GroupFromAddress(addr)) if err != nil { return nil, err } diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index 5c4c88d51e..cd08ae062d 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -11,7 +11,7 @@ import ( ) type clientCache interface { - Get(network.Address) (apiClient.Client, error) + Get(network.AddressGroup) (apiClient.Client, error) } // clientKeyRemoteProvider must provide remote writer and take into account @@ -84,7 +84,7 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil } - c, err := rtp.clientCache.Get(netAddr) + c, err := rtp.clientCache.Get(network.GroupFromAddress(netAddr)) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) } diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index ade22dbd01..584bb93019 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -22,7 +22,7 @@ type ( ClientCache struct { log *zap.Logger cache interface { - Get(address network.Address) (client.Client, error) + Get(address network.AddressGroup) (client.Client, error) CloseAll() } key *ecdsa.PrivateKey @@ -52,7 +52,7 @@ func newClientCache(p *clientCacheParams) *ClientCache { func (c *ClientCache) Get(address network.Address) (client.Client, error) { // Because cache is used by `ClientCache` exclusively, // client will always have valid key. - return c.cache.Get(address) + return c.cache.Get(network.GroupFromAddress(address)) } // GetSG polls the container from audit task to get the object by id. diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index 020dfb988d..0ce87dac66 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -28,11 +28,16 @@ func NewSDKClientCache(opts ...client.Option) *ClientCache { } // Get function returns existing client or creates a new one. -func (c *ClientCache) Get(netAddr network.Address) (client.Client, error) { +func (c *ClientCache) Get(netAddr network.AddressGroup) (client.Client, error) { // multiaddr is used as a key in client cache since // same host may have different connections(with tls or not), // therefore, host+port pair is not unique - mAddr := netAddr.String() + + // FIXME: we should calculate map key regardless of the address order, + // but network.StringifyGroup is order-dependent. + // This works until the same mixed group is transmitted + // (for a network map, it seems to be true). + mAddr := network.StringifyGroup(netAddr) c.mu.RLock() if cli, ok := c.clients[mAddr]; ok { @@ -53,7 +58,7 @@ func (c *ClientCache) Get(netAddr network.Address) (client.Client, error) { return cli, nil } - cli := newMultiClient(network.GroupFromAddress(netAddr), c.opts) + cli := newMultiClient(netAddr, c.opts) c.clients[mAddr] = cli From 6e5d7f84afdc2764d4e72af5a4e42badd57231de Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 13:25:44 +0300 Subject: [PATCH 099/219] [#607] network: Generalize LocalAddressSource to address group Make `LocalAddressSource.LocalAddress` method to return `AddressGroup`. Make `IsLocalAddress` function to accept parameter of type `AddressGroup`. Adopt the application code with temporary `GroupFromAddress` helper. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 6 +++--- cmd/neofs-node/container.go | 2 +- cmd/neofs-node/reputation/common/remote.go | 2 +- pkg/network/address.go | 10 +++++----- pkg/services/object/put/streamer.go | 4 ++-- pkg/services/object/util/placement.go | 4 ++-- pkg/services/policer/check.go | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index ddd3f1cb8f..b77a027213 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -90,7 +90,7 @@ type cfg struct { cfgNodeInfo cfgNodeInfo - localAddr network.Address + localAddr network.AddressGroup cfgObject cfgObject @@ -285,7 +285,7 @@ func initCfg(path string) *cfg { tlsCertFile: tlsCertFile, tlsKeyFile: tlsKeyFile, }, - localAddr: netAddr, + localAddr: network.GroupFromAddress(netAddr), respSvc: response.NewService( response.WithNetworkState(state), ), @@ -308,7 +308,7 @@ func initCfg(path string) *cfg { return c } -func (c *cfg) LocalAddress() network.Address { +func (c *cfg) LocalAddress() network.AddressGroup { return c.localAddr } diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index daa98bc060..514613c0d2 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -225,7 +225,7 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(r.loadAddrSrc, netAddr) { + if network.IsLocalAddress(r.loadAddrSrc, network.GroupFromAddress(netAddr)) { // if local => return no-op writer return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil } diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index cd08ae062d..fec8f0768a 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -79,7 +79,7 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(rtp.localAddrSrc, netAddr) { + if network.IsLocalAddress(rtp.localAddrSrc, network.GroupFromAddress(netAddr)) { // if local => return no-op writer return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil } diff --git a/pkg/network/address.go b/pkg/network/address.go index b18987ffb6..3a34a0cf34 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -25,7 +25,7 @@ type Address struct { // LocalAddressSource is an interface of local // network address container with read access. type LocalAddressSource interface { - LocalAddress() Address + LocalAddress() AddressGroup } // String returns multiaddr string. @@ -107,8 +107,8 @@ func multiaddrStringFromHostAddr(host string) (string, error) { return strings.Join([]string{prefix, addr, l4Protocol, port}, "/"), nil } -// IsLocalAddress returns true if network endpoint from local address -// source is equal to network endpoint of passed address. -func IsLocalAddress(src LocalAddressSource, addr Address) bool { - return src.LocalAddress().Equal(addr) +// IsLocalAddress returns true if network endpoints from local address group +// source intersects with network endpoints of passed address group. +func IsLocalAddress(src LocalAddressSource, addr AddressGroup) bool { + return src.LocalAddress().Intersects(addr) } diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 3d607da357..675f9aa47d 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -150,7 +150,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { var relay func(network.Address) error if p.relay != nil { relay = func(addr network.Address) error { - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { return errLocalAddress } @@ -167,7 +167,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { traverseOpts: prm.traverseOpts, workerPool: p.workerPool, nodeTargetInitializer: func(addr network.Address) transformer.ObjectTarget { - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { return &localTarget{ storage: p.localStore, } diff --git a/pkg/services/object/util/placement.go b/pkg/services/object/util/placement.go index e7a9b42346..9fca0ec018 100644 --- a/pkg/services/object/util/placement.go +++ b/pkg/services/object/util/placement.go @@ -58,7 +58,7 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK. continue } - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { return []netmapSDK.Nodes{{vs[i][j]}}, nil } } @@ -92,7 +92,7 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK continue } - if network.IsLocalAddress(p.localAddrSrc, addr) { + if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { vs[i] = append(vs[i][:j], vs[i][j+1:]...) j-- } diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index 800d28459c..76f9103e72 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -70,7 +70,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes continue } - if network.IsLocalAddress(p.localAddrSrc, node) { + if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(node)) { if shortage == 0 { // we can call the redundant copy callback // here to slightly improve the performance From 8972f84672eda9b3ce62fb17dada1df6e2b71f9c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 14:12:57 +0300 Subject: [PATCH 100/219] [#607] object/put: Make client constructor to work with group address Make Object Put service to work with `AddressGroup` instead of `Address` in order to support multiple addresses of the storage node. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 17 +++++- pkg/services/object/put/distributed.go | 10 ++-- pkg/services/object/put/prm.go | 4 +- pkg/services/object/put/remote.go | 6 +-- pkg/services/object/put/service.go | 2 +- pkg/services/object/put/streamer.go | 12 ++--- pkg/services/object/put/v2/streamer.go | 74 +++++++++++++++++--------- pkg/services/replicator/process.go | 13 ++--- 8 files changed, 89 insertions(+), 49 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 8a01e6d5c8..6c3da104d3 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -158,6 +158,17 @@ func (x *coreClientConstructor) Get(addr network.Address) (coreclient.Client, er return c.(coreclient.Client), nil } +type addressGroupClientConstructor coreClientConstructor + +func (x *addressGroupClientConstructor) Get(addrGroup network.AddressGroup) (c coreclient.Client, err error) { + addrGroup.IterateAddresses(func(addr network.Address) bool { + c, err = (*coreClientConstructor)(x).Get(addr) + return true + }) + + return +} + func initObjectService(c *cfg) { ls := c.cfgObject.cfgLocalStorage.localStorage keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore) @@ -183,6 +194,8 @@ func initObjectService(c *cfg) { coreConstructor := (*coreClientConstructor)(clientConstructor) + groupConstructor := (*addressGroupClientConstructor)(coreConstructor) + irFetcher := &innerRingFetcher{ sidechain: c.cfgMorph.client, } @@ -199,7 +212,7 @@ func initObjectService(c *cfg) { ), replicator.WithLocalStorage(ls), replicator.WithRemoteSender( - putsvc.NewRemoteSender(keyStorage, coreConstructor), + putsvc.NewRemoteSender(keyStorage, groupConstructor), ), ) @@ -251,7 +264,7 @@ func initObjectService(c *cfg) { sPut := putsvc.NewService( putsvc.WithKeyStorage(keyStorage), - putsvc.WithClientConstructor(coreConstructor), + putsvc.WithClientConstructor(groupConstructor), putsvc.WithMaxSizeSource(c), putsvc.WithLocalStorage(ls), putsvc.WithContainerSource(c.cfgObject.cnrStorage), diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index eed9c9bdbf..903c175eec 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -23,9 +23,9 @@ type distributedTarget struct { chunks [][]byte - nodeTargetInitializer func(network.Address) transformer.ObjectTarget + nodeTargetInitializer func(network.AddressGroup) transformer.ObjectTarget - relay func(network.Address) error + relay func(network.AddressGroup) error fmt *object.FormatValidator @@ -68,7 +68,7 @@ func (t *distributedTarget) Close() (*transformer.AccessIdentifiers, error) { return t.iteratePlacement(t.sendObject) } -func (t *distributedTarget) sendObject(addr network.Address) error { +func (t *distributedTarget) sendObject(addr network.AddressGroup) error { if t.relay != nil { err := t.relay(addr) if err == nil || !errors.Is(err, errLocalAddress) { @@ -86,7 +86,7 @@ func (t *distributedTarget) sendObject(addr network.Address) error { return nil } -func (t *distributedTarget) iteratePlacement(f func(network.Address) error) (*transformer.AccessIdentifiers, error) { +func (t *distributedTarget) iteratePlacement(f func(network.AddressGroup) error) (*transformer.AccessIdentifiers, error) { traverser, err := placement.NewTraverser( append(t.traverseOpts, placement.ForObject(t.obj.ID()))..., ) @@ -110,7 +110,7 @@ loop: if err := t.workerPool.Submit(func() { defer wg.Done() - if err := f(addr); err != nil { + if err := f(network.GroupFromAddress(addr)); err != nil { svcutil.LogServiceError(t.log, "PUT", addr, err) return } diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index 00a4458c5c..61e042db3e 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -15,7 +15,7 @@ type PutInitPrm struct { traverseOpts []placement.Option - relay func(network.Address, client.Client) error + relay func(network.AddressGroup, client.Client) error } type PutChunkPrm struct { @@ -46,7 +46,7 @@ func (p *PutInitPrm) WithObject(v *object.RawObject) *PutInitPrm { return p } -func (p *PutInitPrm) WithRelay(f func(network.Address, client.Client) error) *PutInitPrm { +func (p *PutInitPrm) WithRelay(f func(network.AddressGroup, client.Client) error) *PutInitPrm { if p != nil { p.relay = f } diff --git a/pkg/services/object/put/remote.go b/pkg/services/object/put/remote.go index 33e790b19c..2339a39ef8 100644 --- a/pkg/services/object/put/remote.go +++ b/pkg/services/object/put/remote.go @@ -20,7 +20,7 @@ type remoteTarget struct { commonPrm *util.CommonPrm - addr network.Address + addr network.AddressGroup obj *object.Object @@ -37,7 +37,7 @@ type RemoteSender struct { // RemotePutPrm groups remote put operation parameters. type RemotePutPrm struct { - node network.Address + node network.AddressGroup obj *object.Object } @@ -86,7 +86,7 @@ func NewRemoteSender(keyStorage *util.KeyStorage, cons ClientConstructor) *Remot } // WithNodeAddress sets network address of the remote node. -func (p *RemotePutPrm) WithNodeAddress(v network.Address) *RemotePutPrm { +func (p *RemotePutPrm) WithNodeAddress(v network.AddressGroup) *RemotePutPrm { if p != nil { p.node = v } diff --git a/pkg/services/object/put/service.go b/pkg/services/object/put/service.go index 266116860c..14817d3a37 100644 --- a/pkg/services/object/put/service.go +++ b/pkg/services/object/put/service.go @@ -30,7 +30,7 @@ type Service struct { type Option func(*cfg) type ClientConstructor interface { - Get(network.Address) (client.Client, error) + Get(network.AddressGroup) (client.Client, error) } type cfg struct { diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 675f9aa47d..5474e07117 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -20,7 +20,7 @@ type Streamer struct { target transformer.ObjectTarget - relay func(network.Address, client.Client) error + relay func(network.AddressGroup, client.Client) error maxPayloadSz uint64 // network config } @@ -147,10 +147,10 @@ func (p *Streamer) preparePrm(prm *PutInitPrm) error { var errLocalAddress = errors.New("can't relay to local address") func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { - var relay func(network.Address) error + var relay func(network.AddressGroup) error if p.relay != nil { - relay = func(addr network.Address) error { - if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { + relay = func(addr network.AddressGroup) error { + if network.IsLocalAddress(p.localAddrSrc, addr) { return errLocalAddress } @@ -166,8 +166,8 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { return &distributedTarget{ traverseOpts: prm.traverseOpts, workerPool: p.workerPool, - nodeTargetInitializer: func(addr network.Address) transformer.ObjectTarget { - if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { + nodeTargetInitializer: func(addr network.AddressGroup) transformer.ObjectTarget { + if network.IsLocalAddress(p.localAddrSrc, addr) { return &localTarget{ storage: p.localStore, } diff --git a/pkg/services/object/put/v2/streamer.go b/pkg/services/object/put/v2/streamer.go index e1dd393408..4386e4e3fe 100644 --- a/pkg/services/object/put/v2/streamer.go +++ b/pkg/services/object/put/v2/streamer.go @@ -125,36 +125,62 @@ func (s *streamer) CloseAndRecv() (*object.PutResponse, error) { return fromPutResponse(resp), nil } -func (s *streamer) relayRequest(addr network.Address, c client.Client) error { +func (s *streamer) relayRequest(addr network.AddressGroup, c client.Client) error { // open stream resp := new(object.PutResponse) - stream, err := rpc.PutObject(c.RawForAddress(addr), resp) - if err != nil { - return fmt.Errorf("stream opening failed: %w", err) - } + var firstErr error - // send init part - err = stream.Write(s.init) - if err != nil { - return fmt.Errorf("sending the initial message to stream failed: %w", err) - } + addr.IterateAddresses(func(addr network.Address) (stop bool) { + var err error + + defer func() { + stop = err == nil + + if stop || firstErr == nil { + firstErr = err + } - for i := range s.chunks { - if err := stream.Write(s.chunks[i]); err != nil { - return fmt.Errorf("sending the chunk %d failed: %w", i, err) + // would be nice to log otherwise + }() + + var stream *rpc.PutRequestWriter + + stream, err = rpc.PutObject(c.RawForAddress(addr), resp) + if err != nil { + err = fmt.Errorf("stream opening failed: %w", err) + return } - } - // close object stream and receive response from remote node - err = stream.Close() - if err != nil { - return fmt.Errorf("closing the stream failed: %w", err) - } + // send init part + err = stream.Write(s.init) + if err != nil { + err = fmt.Errorf("sending the initial message to stream failed: %w", err) + return + } - // verify response structure - if err := signature.VerifyServiceMessage(resp); err != nil { - return fmt.Errorf("response verification failed: %w", err) - } - return nil + for i := range s.chunks { + if err = stream.Write(s.chunks[i]); err != nil { + err = fmt.Errorf("sending the chunk %d failed: %w", i, err) + return + } + } + + // close object stream and receive response from remote node + err = stream.Close() + if err != nil { + err = fmt.Errorf("closing the stream failed: %w", err) + return + } + + // verify response structure + err = signature.VerifyServiceMessage(resp) + if err != nil { + err = fmt.Errorf("response verification failed: %w", err) + } + + return + }) + + return firstErr } diff --git a/pkg/services/replicator/process.go b/pkg/services/replicator/process.go index 693f50ccfc..3786698f3a 100644 --- a/pkg/services/replicator/process.go +++ b/pkg/services/replicator/process.go @@ -2,6 +2,7 @@ package replicator import ( "context" + "encoding/hex" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/network" @@ -66,15 +67,15 @@ func (p *Replicator) handleTask(ctx context.Context, task *Task) { default: } - netAddr := task.nodes[i].Address() + log := p.log.With(zap.String("node", hex.EncodeToString(task.nodes[i].PublicKey()))) - log := p.log.With(zap.String("node", netAddr)) + var node network.AddressGroup - var node network.Address - - err := node.FromString(netAddr) + err := node.FromIterator(task.nodes[i]) if err != nil { - log.Error("could not parse network address") + log.Error("could not parse network address", + zap.String("error", err.Error()), + ) continue } From ad14df07f648a382ecb8591136849609f8b63565 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 15:08:17 +0300 Subject: [PATCH 101/219] [#607] object/get: Make client constructor to work with group address Make Object Get service to work with `AddressGroup` instead of `Address` in order to support multiple addresses of the storage node. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 2 +- pkg/services/object/get/container.go | 3 +- pkg/services/object/get/exec.go | 6 ++-- pkg/services/object/get/get_test.go | 18 ++++++------ pkg/services/object/get/prm.go | 2 +- pkg/services/object/get/remote.go | 8 ++---- pkg/services/object/get/service.go | 6 ++-- pkg/services/object/get/util.go | 4 +-- pkg/services/object/get/v2/util.go | 41 ++++++++++++++++++++++++---- 9 files changed, 58 insertions(+), 32 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 6c3da104d3..54388036b4 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -303,7 +303,7 @@ func initObjectService(c *cfg) { sGet := getsvc.New( getsvc.WithLogger(c.log), getsvc.WithLocalStorageEngine(ls), - getsvc.WithClientConstructor(coreConstructor), + getsvc.WithClientConstructor(groupConstructor), getsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.SuccessAfter(1), diff --git a/pkg/services/object/get/container.go b/pkg/services/object/get/container.go index 62e070c40a..f56e720699 100644 --- a/pkg/services/object/get/container.go +++ b/pkg/services/object/get/container.go @@ -3,6 +3,7 @@ package getsvc import ( "context" + "github.com/nspcc-dev/neofs-node/pkg/network" "go.uber.org/zap" ) @@ -78,7 +79,7 @@ func (exec *execCtx) processCurrentEpoch() bool { // TODO: consider parallel execution // TODO: consider optimization: if status == SPLIT we can continue until // we reach the best result - split info with linking object ID. - if exec.processNode(ctx, addrs[i]) { + if exec.processNode(ctx, network.GroupFromAddress(addrs[i])) { exec.log.Debug("completing the operation") return true } diff --git a/pkg/services/object/get/exec.go b/pkg/services/object/get/exec.go index 6848aa42f7..d92a29d2cb 100644 --- a/pkg/services/object/get/exec.go +++ b/pkg/services/object/get/exec.go @@ -270,9 +270,7 @@ func (exec *execCtx) headChild(id *objectSDK.ID) (*object.Object, bool) { } } -func (exec execCtx) remoteClient(node network.Address) (getClient, bool) { - log := exec.log.With(zap.Stringer("node", node)) - +func (exec execCtx) remoteClient(node network.AddressGroup) (getClient, bool) { c, err := exec.svc.clientCache.get(node) switch { @@ -280,7 +278,7 @@ func (exec execCtx) remoteClient(node network.Address) (getClient, bool) { exec.status = statusUndefined exec.err = err - log.Debug("could not construct remote node client") + exec.log.Debug("could not construct remote node client") case err == nil: return c, true } diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index e7ad1577d7..94c2a38854 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -82,8 +82,8 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap return vs, nil } -func (c *testClientCache) get(mAddr network.Address) (getClient, error) { - v, ok := c.clients[mAddr.HostAddr()] +func (c *testClientCache) get(mAddr network.AddressGroup) (getClient, error) { + v, ok := c.clients[network.StringifyGroup(mAddr)] if !ok { return nil, errors.New("could not construct client") } @@ -100,7 +100,7 @@ func newTestClient() *testClient { } } -func (c *testClient) getObject(exec *execCtx, _ network.Address) (*objectSDK.Object, error) { +func (c *testClient) getObject(exec *execCtx, _ network.AddressGroup) (*objectSDK.Object, error) { v, ok := c.results[exec.address().String()] if !ok { return nil, object.ErrNotFound @@ -406,15 +406,15 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { strconv.Itoa(60000+j), ) - var na network.Address + ni := netmap.NewNodeInfo() + ni.SetAddress(a) - err := na.FromString(a) - require.NoError(t, err) + var na network.AddressGroup - as[j] = na.HostAddr() + err := na.FromIterator(ni) + require.NoError(t, err) - ni := netmap.NewNodeInfo() - ni.SetAddress(a) + as[j] = network.StringifyGroup(na) ns[j] = *ni } diff --git a/pkg/services/object/get/prm.go b/pkg/services/object/get/prm.go index e5c81db11c..2caa48bf4c 100644 --- a/pkg/services/object/get/prm.go +++ b/pkg/services/object/get/prm.go @@ -34,7 +34,7 @@ type RangeHashPrm struct { salt []byte } -type RequestForwarder func(network.Address, coreclient.Client) (*objectSDK.Object, error) +type RequestForwarder func(network.AddressGroup, coreclient.Client) (*objectSDK.Object, error) // HeadPrm groups parameters of Head service call. type HeadPrm struct { diff --git a/pkg/services/object/get/remote.go b/pkg/services/object/get/remote.go index fe700d7851..269771059f 100644 --- a/pkg/services/object/get/remote.go +++ b/pkg/services/object/get/remote.go @@ -10,10 +10,8 @@ import ( "go.uber.org/zap" ) -func (exec *execCtx) processNode(ctx context.Context, addr network.Address) bool { - log := exec.log.With(zap.Stringer("remote node", addr)) - - log.Debug("processing node...") +func (exec *execCtx) processNode(ctx context.Context, addr network.AddressGroup) bool { + exec.log.Debug("processing node...") client, ok := exec.remoteClient(addr) if !ok { @@ -29,7 +27,7 @@ func (exec *execCtx) processNode(ctx context.Context, addr network.Address) bool exec.status = statusUndefined exec.err = object.ErrNotFound - log.Debug("remote call failed", + exec.log.Debug("remote call failed", zap.String("error", err.Error()), ) case err == nil: diff --git a/pkg/services/object/get/service.go b/pkg/services/object/get/service.go index 76e07333e0..8d23db48d5 100644 --- a/pkg/services/object/get/service.go +++ b/pkg/services/object/get/service.go @@ -22,7 +22,7 @@ type Service struct { type Option func(*cfg) type getClient interface { - getObject(*execCtx, network.Address) (*objectSDK.Object, error) + getObject(*execCtx, network.AddressGroup) (*objectSDK.Object, error) } type cfg struct { @@ -35,7 +35,7 @@ type cfg struct { } clientCache interface { - get(network.Address) (getClient, error) + get(network.AddressGroup) (getClient, error) } traverserGenerator interface { @@ -93,7 +93,7 @@ func WithLocalStorageEngine(e *engine.StorageEngine) Option { } type ClientConstructor interface { - Get(network.Address) (client.Client, error) + Get(network.AddressGroup) (client.Client, error) } // WithClientConstructor returns option to set constructor of remote node clients. diff --git a/pkg/services/object/get/util.go b/pkg/services/object/get/util.go index 098f94ca37..90ea40a59a 100644 --- a/pkg/services/object/get/util.go +++ b/pkg/services/object/get/util.go @@ -73,7 +73,7 @@ func (s *SimpleObjectWriter) Object() *object.Object { return s.obj.Object() } -func (c *clientCacheWrapper) get(addr network.Address) (getClient, error) { +func (c *clientCacheWrapper) get(addr network.AddressGroup) (getClient, error) { clt, err := c.cache.Get(addr) return &clientWrapper{ @@ -81,7 +81,7 @@ func (c *clientCacheWrapper) get(addr network.Address) (getClient, error) { }, err } -func (c *clientWrapper) getObject(exec *execCtx, addr network.Address) (*objectSDK.Object, error) { +func (c *clientWrapper) getObject(exec *execCtx, addr network.AddressGroup) (*objectSDK.Object, error) { if !exec.assembling && exec.prm.forwarder != nil { return exec.prm.forwarder(addr, c.client) } diff --git a/pkg/services/object/get/v2/util.go b/pkg/services/object/get/v2/util.go index 080a8eeab9..6ecfb1c084 100644 --- a/pkg/services/object/get/v2/util.go +++ b/pkg/services/object/get/v2/util.go @@ -55,7 +55,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(groupAddressRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -144,7 +144,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre // convert the object return objectSDK.NewFromV2(obj), nil - }) + })) } return p, nil @@ -177,7 +177,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(groupAddressRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -242,7 +242,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get obj.SetPayload(payload) return obj.Object(), nil - }) + })) } return p, nil @@ -340,7 +340,7 @@ func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { + p.SetRequestForwarder(groupAddressRequestForwarder(func(addr network.Address, c client.Client) (*objectSDK.Object, error) { var err error // once compose and resign forwarding request @@ -439,7 +439,7 @@ func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp // convert the object return raw.Object().SDK(), nil - }) + })) } return p, nil @@ -507,3 +507,32 @@ func toShortObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { return sh } + +func groupAddressRequestForwarder(f func(network.Address, client.Client) (*objectSDK.Object, error)) getsvc.RequestForwarder { + return func(addrGroup network.AddressGroup, c client.Client) (*objectSDK.Object, error) { + var ( + firstErr error + res *objectSDK.Object + ) + + addrGroup.IterateAddresses(func(addr network.Address) (stop bool) { + var err error + + defer func() { + stop = err == nil + + if stop || firstErr == nil { + firstErr = err + } + + // would be nice to log otherwise + }() + + res, err = f(addr, c) + + return + }) + + return res, firstErr + } +} From d0e48c949b1cb32b402db856274844f1b39a45db Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 15:19:30 +0300 Subject: [PATCH 102/219] [#607] object/search: Make client constructor to work with group address Make Object Search service to work with `AddressGroup` instead of `Address` in order to support multiple addresses of the storage node. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 2 +- pkg/services/object/search/container.go | 3 ++- pkg/services/object/search/exec.go | 6 ++--- pkg/services/object/search/prm.go | 2 +- pkg/services/object/search/remote.go | 6 ++--- pkg/services/object/search/search_test.go | 18 ++++++------- pkg/services/object/search/service.go | 6 ++--- pkg/services/object/search/util.go | 4 +-- pkg/services/object/search/v2/util.go | 33 +++++++++++++++++++++-- 9 files changed, 53 insertions(+), 27 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 54388036b4..b9f541a1c8 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -286,7 +286,7 @@ func initObjectService(c *cfg) { sSearch := searchsvc.New( searchsvc.WithLogger(c.log), searchsvc.WithLocalStorageEngine(ls), - searchsvc.WithClientConstructor(coreConstructor), + searchsvc.WithClientConstructor(groupConstructor), searchsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.WithoutSuccessTracking(), diff --git a/pkg/services/object/search/container.go b/pkg/services/object/search/container.go index 25e3a4d2c5..d287897ce4 100644 --- a/pkg/services/object/search/container.go +++ b/pkg/services/object/search/container.go @@ -3,6 +3,7 @@ package searchsvc import ( "context" + "github.com/nspcc-dev/neofs-node/pkg/network" "go.uber.org/zap" ) @@ -76,7 +77,7 @@ func (exec *execCtx) processCurrentEpoch() bool { } // TODO: consider parallel execution - exec.processNode(ctx, addrs[i]) + exec.processNode(ctx, network.GroupFromAddress(addrs[i])) } } diff --git a/pkg/services/object/search/exec.go b/pkg/services/object/search/exec.go index 75fababac6..784506b925 100644 --- a/pkg/services/object/search/exec.go +++ b/pkg/services/object/search/exec.go @@ -117,16 +117,14 @@ func (exec *execCtx) generateTraverser(cid *cid.ID) (*placement.Traverser, bool) } } -func (exec execCtx) remoteClient(node network.Address) (searchClient, bool) { - log := exec.log.With(zap.Stringer("node", node)) - +func (exec execCtx) remoteClient(node network.AddressGroup) (searchClient, bool) { c, err := exec.svc.clientConstructor.get(node) switch { default: exec.status = statusUndefined exec.err = err - log.Debug("could not construct remote node client") + exec.log.Debug("could not construct remote node client") case err == nil: return c, true } diff --git a/pkg/services/object/search/prm.go b/pkg/services/object/search/prm.go index 3340cb40a5..31719c5ec7 100644 --- a/pkg/services/object/search/prm.go +++ b/pkg/services/object/search/prm.go @@ -27,7 +27,7 @@ type IDListWriter interface { // RequestForwarder is a callback for forwarding of the // original Search requests. -type RequestForwarder func(network.Address, coreclient.Client) ([]*objectSDK.ID, error) +type RequestForwarder func(network.AddressGroup, coreclient.Client) ([]*objectSDK.ID, error) // SetCommonParameters sets common parameters of the operation. func (p *Prm) SetCommonParameters(common *util.CommonPrm) { diff --git a/pkg/services/object/search/remote.go b/pkg/services/object/search/remote.go index d4646b3d74..332a17eb24 100644 --- a/pkg/services/object/search/remote.go +++ b/pkg/services/object/search/remote.go @@ -7,10 +7,8 @@ import ( "go.uber.org/zap" ) -func (exec *execCtx) processNode(ctx context.Context, addr network.Address) { - log := exec.log.With(zap.Stringer("remote node", addr)) - - log.Debug("processing node...") +func (exec *execCtx) processNode(ctx context.Context, addr network.AddressGroup) { + exec.log.Debug("processing node...") client, ok := exec.remoteClient(addr) if !ok { diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 8e8c200c5d..8ec231b9e9 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -84,8 +84,8 @@ func (p *testPlacementBuilder) BuildPlacement(addr *objectSDK.Address, _ *netmap return res, nil } -func (c *testClientCache) get(mAddr network.Address) (searchClient, error) { - v, ok := c.clients[mAddr.HostAddr()] +func (c *testClientCache) get(mAddr network.AddressGroup) (searchClient, error) { + v, ok := c.clients[network.StringifyGroup(mAddr)] if !ok { return nil, errors.New("could not construct client") } @@ -102,7 +102,7 @@ func (s *testStorage) search(exec *execCtx) ([]*objectSDK.ID, error) { return v.ids, v.err } -func (c *testStorage) searchObjects(exec *execCtx, _ network.Address) ([]*objectSDK.ID, error) { +func (c *testStorage) searchObjects(exec *execCtx, _ network.AddressGroup) ([]*objectSDK.ID, error) { v, ok := c.items[exec.containerID().String()] if !ok { return nil, nil @@ -200,15 +200,15 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { strconv.Itoa(60000+j), ) - var na network.Address + ni := netmap.NewNodeInfo() + ni.SetAddress(a) - err := na.FromString(a) - require.NoError(t, err) + var na network.AddressGroup - as[j] = na.HostAddr() + err := na.FromIterator(ni) + require.NoError(t, err) - ni := netmap.NewNodeInfo() - ni.SetAddress(a) + as[j] = network.StringifyGroup(na) ns[j] = *ni } diff --git a/pkg/services/object/search/service.go b/pkg/services/object/search/service.go index b68fee63e6..cd5c282076 100644 --- a/pkg/services/object/search/service.go +++ b/pkg/services/object/search/service.go @@ -23,11 +23,11 @@ type Service struct { type Option func(*cfg) type searchClient interface { - searchObjects(*execCtx, network.Address) ([]*object.ID, error) + searchObjects(*execCtx, network.AddressGroup) ([]*object.ID, error) } type ClientConstructor interface { - Get(network.Address) (client.Client, error) + Get(network.AddressGroup) (client.Client, error) } type cfg struct { @@ -38,7 +38,7 @@ type cfg struct { } clientConstructor interface { - get(network.Address) (searchClient, error) + get(network.AddressGroup) (searchClient, error) } traverserGenerator interface { diff --git a/pkg/services/object/search/util.go b/pkg/services/object/search/util.go index 81cecbacf5..bb26bc3920 100644 --- a/pkg/services/object/search/util.go +++ b/pkg/services/object/search/util.go @@ -68,7 +68,7 @@ func (w *uniqueIDWriter) WriteIDs(list []*objectSDK.ID) error { return w.writer.WriteIDs(list) } -func (c *clientConstructorWrapper) get(addr network.Address) (searchClient, error) { +func (c *clientConstructorWrapper) get(addr network.AddressGroup) (searchClient, error) { clt, err := c.constructor.Get(addr) return &clientWrapper{ @@ -76,7 +76,7 @@ func (c *clientConstructorWrapper) get(addr network.Address) (searchClient, erro }, err } -func (c *clientWrapper) searchObjects(exec *execCtx, addr network.Address) ([]*objectSDK.ID, error) { +func (c *clientWrapper) searchObjects(exec *execCtx, addr network.AddressGroup) ([]*objectSDK.ID, error) { if exec.prm.forwarder != nil { return exec.prm.forwarder(addr, c.client) } diff --git a/pkg/services/object/search/v2/util.go b/pkg/services/object/search/v2/util.go index b2d4c5d330..ce8b2bd1a5 100644 --- a/pkg/services/object/search/v2/util.go +++ b/pkg/services/object/search/v2/util.go @@ -46,7 +46,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre if !commonPrm.LocalOnly() { var onceResign sync.Once - p.SetRequestForwarder(func(addr network.Address, c client.Client) ([]*objectSDK.ID, error) { + p.SetRequestForwarder(groupAddressRequestForwarder(func(addr network.Address, c client.Client) ([]*objectSDK.ID, error) { var err error // once compose and resign forwarding request @@ -101,7 +101,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre } return searchResult, nil - }) + })) } body := req.GetBody() @@ -110,3 +110,32 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre return p, nil } + +func groupAddressRequestForwarder(f func(network.Address, client.Client) ([]*objectSDK.ID, error)) searchsvc.RequestForwarder { + return func(addrGroup network.AddressGroup, c client.Client) ([]*objectSDK.ID, error) { + var ( + firstErr error + res []*objectSDK.ID + ) + + addrGroup.IterateAddresses(func(addr network.Address) (stop bool) { + var err error + + defer func() { + stop = err == nil + + if stop || firstErr == nil { + firstErr = err + } + + // would be nice to log otherwise + }() + + res, err = f(addr, c) + + return + }) + + return res, firstErr + } +} From 8ac3c6251806c0d87bf5f03fbcf1d5499b170fa6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 15:31:13 +0300 Subject: [PATCH 103/219] [#607] object/head: Make client constructor to work with group address Make Object Head service to work with `AddressGroup` instead of `Address` in order to support multiple addresses of the storage node. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 32 ++++++++++++++++++------------ pkg/services/object/head/remote.go | 8 ++++---- pkg/services/policer/check.go | 16 +++++++-------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index b9f541a1c8..75ba5ed3d0 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -149,20 +149,26 @@ func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { type coreClientConstructor reputationClientConstructor -func (x *coreClientConstructor) Get(addr network.Address) (coreclient.Client, error) { - c, err := (*reputationClientConstructor)(x).Get(addr) - if err != nil { - return nil, err +func (x *coreClientConstructor) Get(addrGroup network.AddressGroup) (cc coreclient.Client, err error) { + var c client.Client + + addrGroup.IterateAddresses(func(addr network.Address) bool { + c, err = (*reputationClientConstructor)(x).Get(addr) + return true + }) + + if err == nil { + cc = c.(coreclient.Client) } - return c.(coreclient.Client), nil + return } -type addressGroupClientConstructor coreClientConstructor +type addressGroupClientConstructor reputationClientConstructor -func (x *addressGroupClientConstructor) Get(addrGroup network.AddressGroup) (c coreclient.Client, err error) { +func (x *addressGroupClientConstructor) Get(addrGroup network.AddressGroup) (c client.Client, err error) { addrGroup.IterateAddresses(func(addr network.Address) bool { - c, err = (*coreClientConstructor)(x).Get(addr) + c, err = (*reputationClientConstructor)(x).Get(addr) return true }) @@ -212,7 +218,7 @@ func initObjectService(c *cfg) { ), replicator.WithLocalStorage(ls), replicator.WithRemoteSender( - putsvc.NewRemoteSender(keyStorage, groupConstructor), + putsvc.NewRemoteSender(keyStorage, coreConstructor), ), ) @@ -231,7 +237,7 @@ func initObjectService(c *cfg) { policer.WithExpansionRate(10), policer.WithTrigger(ch), policer.WithRemoteHeader( - headsvc.NewRemoteHeader(keyStorage, clientConstructor), + headsvc.NewRemoteHeader(keyStorage, groupConstructor), ), policer.WithLocalAddressSource(c), policer.WithHeadTimeout( @@ -264,7 +270,7 @@ func initObjectService(c *cfg) { sPut := putsvc.NewService( putsvc.WithKeyStorage(keyStorage), - putsvc.WithClientConstructor(groupConstructor), + putsvc.WithClientConstructor(coreConstructor), putsvc.WithMaxSizeSource(c), putsvc.WithLocalStorage(ls), putsvc.WithContainerSource(c.cfgObject.cnrStorage), @@ -286,7 +292,7 @@ func initObjectService(c *cfg) { sSearch := searchsvc.New( searchsvc.WithLogger(c.log), searchsvc.WithLocalStorageEngine(ls), - searchsvc.WithClientConstructor(groupConstructor), + searchsvc.WithClientConstructor(coreConstructor), searchsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.WithoutSuccessTracking(), @@ -303,7 +309,7 @@ func initObjectService(c *cfg) { sGet := getsvc.New( getsvc.WithLogger(c.log), getsvc.WithLocalStorageEngine(ls), - getsvc.WithClientConstructor(groupConstructor), + getsvc.WithClientConstructor(coreConstructor), getsvc.WithTraverserGenerator( traverseGen.WithTraverseOptions( placement.SuccessAfter(1), diff --git a/pkg/services/object/head/remote.go b/pkg/services/object/head/remote.go index 921a35a488..0bd2ab8900 100644 --- a/pkg/services/object/head/remote.go +++ b/pkg/services/object/head/remote.go @@ -13,7 +13,7 @@ import ( ) type ClientConstructor interface { - Get(network.Address) (client.Client, error) + Get(network.AddressGroup) (client.Client, error) } // RemoteHeader represents utility for getting @@ -28,7 +28,7 @@ type RemoteHeader struct { type RemoteHeadPrm struct { commonHeadPrm *Prm - node network.Address + node network.AddressGroup } var ErrNotFound = errors.New("object header not found") @@ -41,8 +41,8 @@ func NewRemoteHeader(keyStorage *util.KeyStorage, cache ClientConstructor) *Remo } } -// WithNodeAddress sets network address of the remote node. -func (p *RemoteHeadPrm) WithNodeAddress(v network.Address) *RemoteHeadPrm { +// WithNodeAddress sets network address group of the remote node. +func (p *RemoteHeadPrm) WithNodeAddress(v network.AddressGroup) *RemoteHeadPrm { if p != nil { p.node = v } diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index 76f9103e72..c337055fed 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -57,20 +57,18 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes default: } - netAddr := nodes[i].Address() + var node network.AddressGroup - log := p.log.With(zap.String("node", netAddr)) - - var node network.Address - - err := node.FromString(netAddr) + err := node.FromIterator(nodes[i]) if err != nil { - log.Error("could not parse network address") + p.log.Error("could not parse network address", + zap.String("error", err.Error()), + ) continue } - if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(node)) { + if network.IsLocalAddress(p.localAddrSrc, node) { if shortage == 0 { // we can call the redundant copy callback // here to slightly improve the performance @@ -93,7 +91,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes if strings.Contains(err.Error(), headsvc.ErrNotFound.Error()) { continue } else { - log.Error("could not receive object header", + p.log.Error("could not receive object header", zap.String("error", err.Error()), ) From b3dd9a3254372a850687b6a1fa4ac316a2734ce4 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 18:22:40 +0300 Subject: [PATCH 104/219] [#607] placement: Make traverser to return list of address groups Make placement `Traverser.Next` method to return ``[]network.AddressGroup` in order to support multiple addresses of the storeage nodes. Signed-off-by: Leonard Lyubich --- pkg/services/object/get/container.go | 3 +-- pkg/services/object/put/distributed.go | 2 +- pkg/services/object/search/container.go | 3 +-- pkg/services/object/util/log.go | 4 ++-- pkg/services/object_manager/placement/traverser.go | 6 +++--- .../object_manager/placement/traverser_test.go | 14 +++++++------- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pkg/services/object/get/container.go b/pkg/services/object/get/container.go index f56e720699..62e070c40a 100644 --- a/pkg/services/object/get/container.go +++ b/pkg/services/object/get/container.go @@ -3,7 +3,6 @@ package getsvc import ( "context" - "github.com/nspcc-dev/neofs-node/pkg/network" "go.uber.org/zap" ) @@ -79,7 +78,7 @@ func (exec *execCtx) processCurrentEpoch() bool { // TODO: consider parallel execution // TODO: consider optimization: if status == SPLIT we can continue until // we reach the best result - split info with linking object ID. - if exec.processNode(ctx, network.GroupFromAddress(addrs[i])) { + if exec.processNode(ctx, addrs[i]) { exec.log.Debug("completing the operation") return true } diff --git a/pkg/services/object/put/distributed.go b/pkg/services/object/put/distributed.go index 903c175eec..9b48b15725 100644 --- a/pkg/services/object/put/distributed.go +++ b/pkg/services/object/put/distributed.go @@ -110,7 +110,7 @@ loop: if err := t.workerPool.Submit(func() { defer wg.Done() - if err := f(network.GroupFromAddress(addr)); err != nil { + if err := f(addr); err != nil { svcutil.LogServiceError(t.log, "PUT", addr, err) return } diff --git a/pkg/services/object/search/container.go b/pkg/services/object/search/container.go index d287897ce4..25e3a4d2c5 100644 --- a/pkg/services/object/search/container.go +++ b/pkg/services/object/search/container.go @@ -3,7 +3,6 @@ package searchsvc import ( "context" - "github.com/nspcc-dev/neofs-node/pkg/network" "go.uber.org/zap" ) @@ -77,7 +76,7 @@ func (exec *execCtx) processCurrentEpoch() bool { } // TODO: consider parallel execution - exec.processNode(ctx, network.GroupFromAddress(addrs[i])) + exec.processNode(ctx, addrs[i]) } } diff --git a/pkg/services/object/util/log.go b/pkg/services/object/util/log.go index 7f90e3be47..c111c2b8d8 100644 --- a/pkg/services/object/util/log.go +++ b/pkg/services/object/util/log.go @@ -7,9 +7,9 @@ import ( ) // LogServiceError writes debug error message of object service to provided logger. -func LogServiceError(l *logger.Logger, req string, node network.Address, err error) { +func LogServiceError(l *logger.Logger, req string, node network.AddressGroup, err error) { l.Debug("object service error", - zap.Stringer("node", node), + zap.String("node", network.StringifyGroup(node)), zap.String("request", req), zap.String("error", err.Error()), ) diff --git a/pkg/services/object_manager/placement/traverser.go b/pkg/services/object_manager/placement/traverser.go index 23511e892f..381353bba1 100644 --- a/pkg/services/object_manager/placement/traverser.go +++ b/pkg/services/object_manager/placement/traverser.go @@ -122,7 +122,7 @@ func flatNodes(ns []netmap.Nodes) []netmap.Nodes { // Next returns next unprocessed address of the object placement. // // Returns nil if no nodes left or traversal operation succeeded. -func (t *Traverser) Next() []network.Address { +func (t *Traverser) Next() []network.AddressGroup { t.mtx.Lock() defer t.mtx.Unlock() @@ -139,10 +139,10 @@ func (t *Traverser) Next() []network.Address { count = len(t.vectors[0]) } - addrs := make([]network.Address, count) + addrs := make([]network.AddressGroup, count) for i := 0; i < count; i++ { - err := addrs[i].FromString(t.vectors[0][i].Address()) + err := addrs[i].FromIterator(t.vectors[0][i]) if err != nil { // TODO: log error return nil diff --git a/pkg/services/object_manager/placement/traverser_test.go b/pkg/services/object_manager/placement/traverser_test.go index 1820629621..ed25d0667d 100644 --- a/pkg/services/object_manager/placement/traverser_test.go +++ b/pkg/services/object_manager/placement/traverser_test.go @@ -65,12 +65,12 @@ func testPlacement(t *testing.T, ss, rs []int) ([]netmap.Nodes, *container.Conta return nodes, container.New(container.WithPolicy(policy)) } -func assertSameAddress(t *testing.T, ni *netmap.NodeInfo, addr network.Address) { - var netAddr network.Address +func assertSameAddress(t *testing.T, ni *netmap.NodeInfo, addr network.AddressGroup) { + var netAddr network.AddressGroup - err := netAddr.FromString(ni.Address()) + err := netAddr.FromIterator(ni) require.NoError(t, err) - require.True(t, netAddr.Equal(addr)) + require.True(t, netAddr.Intersects(addr)) } func TestTraverserObjectScenarios(t *testing.T) { @@ -124,12 +124,12 @@ func TestTraverserObjectScenarios(t *testing.T) { require.NotNil(t, tr.Next()) } - var n network.Address + var n network.AddressGroup - err = n.FromString(nodes[1][0].Address()) + err = n.FromIterator(nodes[1][0]) require.NoError(t, err) - require.Equal(t, []network.Address{n}, tr.Next()) + require.Equal(t, []network.AddressGroup{n}, tr.Next()) }) t.Run("put scenario", func(t *testing.T) { From 9033cf5aa14d9e953e22bf84a704e4ff245d59ff Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 18:27:25 +0300 Subject: [PATCH 105/219] [#607] placement: Work with AddressGroup Make `PlacementBuilder` implementations to work `network.AddressGroup` type. Signed-off-by: Leonard Lyubich --- pkg/services/object/util/placement.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/services/object/util/placement.go b/pkg/services/object/util/placement.go index 9fca0ec018..7959c16118 100644 --- a/pkg/services/object/util/placement.go +++ b/pkg/services/object/util/placement.go @@ -50,15 +50,15 @@ func (p *localPlacement) BuildPlacement(addr *object.Address, policy *netmapSDK. for i := range vs { for j := range vs[i] { - var addr network.Address + var addr network.AddressGroup - err := addr.FromString(vs[i][j].Address()) + err := addr.FromIterator(vs[i][j]) if err != nil { // TODO: log error continue } - if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { + if network.IsLocalAddress(p.localAddrSrc, addr) { return []netmapSDK.Nodes{{vs[i][j]}}, nil } } @@ -84,15 +84,15 @@ func (p *remotePlacement) BuildPlacement(addr *object.Address, policy *netmapSDK for i := range vs { for j := 0; j < len(vs[i]); j++ { - var addr network.Address + var addr network.AddressGroup - err := addr.FromString(vs[i][j].Address()) + err := addr.FromIterator(vs[i][j]) if err != nil { // TODO: log error continue } - if network.IsLocalAddress(p.localAddrSrc, network.GroupFromAddress(addr)) { + if network.IsLocalAddress(p.localAddrSrc, addr) { vs[i] = append(vs[i][:j], vs[i][j+1:]...) j-- } From f7b42a1525768ab937451d28b16669a10f1e4665 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 18:34:44 +0300 Subject: [PATCH 106/219] [#607] ir: Work with AddressGroup instead of single Address Signed-off-by: Leonard Lyubich --- pkg/innerring/processors/audit/process.go | 4 ++-- pkg/innerring/processors/audit/processor.go | 2 +- pkg/innerring/rpc.go | 21 ++++++++++----------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index c3a78fa772..0138c40d4b 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -118,9 +118,9 @@ func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*ob zap.Int("total_tries", ln), ) - var netAddr network.Address + var netAddr network.AddressGroup - err := netAddr.FromString(shuffled[i].Address()) + err := netAddr.FromIterator(shuffled[i]) if err != nil { log.Warn("can't parse remote address", zap.String("error", err.Error())) diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 113c967109..f10b782670 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -26,7 +26,7 @@ type ( // NeoFSClientCache is an interface for cache of neofs RPC clients NeoFSClientCache interface { - Get(address network.Address) (SDKClient.Client, error) + Get(network.AddressGroup) (SDKClient.Client, error) } TaskManager interface { diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index 584bb93019..be0158d295 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -49,10 +49,10 @@ func newClientCache(p *clientCacheParams) *ClientCache { } } -func (c *ClientCache) Get(address network.Address) (client.Client, error) { +func (c *ClientCache) Get(address network.AddressGroup) (client.Client, error) { // Because cache is used by `ClientCache` exclusively, // client will always have valid key. - return c.cache.Get(network.GroupFromAddress(address)) + return c.cache.Get(address) } // GetSG polls the container from audit task to get the object by id. @@ -75,9 +75,9 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma getParams.WithAddress(addr) for _, node := range placement.FlattenNodes(nodes) { - var netAddr network.Address + var netAddr network.AddressGroup - err := netAddr.FromString(node.Address()) + err := netAddr.FromIterator(node) if err != nil { c.log.Warn("can't parse remote address", zap.String("address", node.Address()), @@ -89,7 +89,6 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma cli, err := c.Get(netAddr) if err != nil { c.log.Warn("can't setup remote connection", - zap.Stringer("address", netAddr), zap.String("error", err.Error())) continue @@ -139,11 +138,11 @@ func (c *ClientCache) GetHeader(task *audit.Task, node *netmap.Node, id *object. headParams.WithMainFields() headParams.WithAddress(objAddress) - var netAddr network.Address + var netAddr network.AddressGroup - err := netAddr.FromString(node.Address()) + err := netAddr.FromIterator(node) if err != nil { - return nil, fmt.Errorf("can't parse remote address %s: %w", node.Address(), err) + return nil, fmt.Errorf("can't parse remote address: %w", err) } cli, err := c.Get(netAddr) @@ -177,11 +176,11 @@ func (c *ClientCache) GetRangeHash(task *audit.Task, node *netmap.Node, id *obje rangeParams.WithRangeList(rng) rangeParams.WithSalt(nil) // it MUST be nil for correct hash concatenation in PDP game - var netAddr network.Address + var netAddr network.AddressGroup - err := netAddr.FromString(node.Address()) + err := netAddr.FromIterator(node) if err != nil { - return nil, fmt.Errorf("can't parse remote address %s: %w", node.Address(), err) + return nil, fmt.Errorf("can't parse remote address: %w", err) } cli, err := c.Get(netAddr) From 44a2c81f8efb2e85c9d9ad3a113a2e9f588a5724 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 18:40:39 +0300 Subject: [PATCH 107/219] [#607] reputation/router: Use public keys as keys to server cache In future server info will contain multiple endpoints whose string representation will be worse suited to the cache key. Signed-off-by: Leonard Lyubich --- pkg/services/reputation/common/router/calls.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/services/reputation/common/router/calls.go b/pkg/services/reputation/common/router/calls.go index 76df4e7c49..2794107d0d 100644 --- a/pkg/services/reputation/common/router/calls.go +++ b/pkg/services/reputation/common/router/calls.go @@ -1,6 +1,7 @@ package router import ( + "encoding/hex" "sync" "github.com/nspcc-dev/neofs-node/pkg/services/reputation" @@ -80,13 +81,13 @@ func (w *trustWriter) Write(t reputation.Trust) error { } for _, remoteInfo := range route { - var endpoint string + var key string if remoteInfo != nil { - endpoint = remoteInfo.Address() + key = hex.EncodeToString(remoteInfo.PublicKey()) } - remoteWriter, ok := w.mServers[endpoint] + remoteWriter, ok := w.mServers[key] if !ok { provider, err := w.router.remoteProvider.InitRemote(remoteInfo) if err != nil { @@ -107,7 +108,7 @@ func (w *trustWriter) Write(t reputation.Trust) error { continue } - w.mServers[endpoint] = remoteWriter + w.mServers[key] = remoteWriter } err := remoteWriter.Write(t) @@ -122,11 +123,11 @@ func (w *trustWriter) Write(t reputation.Trust) error { } func (w *trustWriter) Close() error { - for endpoint, wRemote := range w.mServers { + for key, wRemote := range w.mServers { err := wRemote.Close() if err != nil { w.router.log.Debug("could not close remote server writer", - zap.String("endpoint", endpoint), + zap.String("key", key), zap.String("error", err.Error()), ) } From d6bb697726a94e3180386313c27741f004cde6d0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 18:56:36 +0300 Subject: [PATCH 108/219] [#607] container/announce: Use public keys as keys to server cache In future server info will contain multiple endpoints whose string representation will be worse suited to the cache key. Signed-off-by: Leonard Lyubich --- .../container/announcement/load/route/calls.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/services/container/announcement/load/route/calls.go b/pkg/services/container/announcement/load/route/calls.go index f0e4147f15..7ad6a83b37 100644 --- a/pkg/services/container/announcement/load/route/calls.go +++ b/pkg/services/container/announcement/load/route/calls.go @@ -2,6 +2,7 @@ package loadroute import ( "context" + "encoding/hex" "sync" "github.com/nspcc-dev/neofs-api-go/pkg/container" @@ -110,13 +111,13 @@ func (w *loadWriter) Put(a container.UsedSpaceAnnouncement) error { } for _, remoteInfo := range routeValues.route { - var endpoint string + var key string if remoteInfo != nil { - endpoint = remoteInfo.Address() + key = hex.EncodeToString(remoteInfo.PublicKey()) } - remoteWriter, ok := w.mServers[endpoint] + remoteWriter, ok := w.mServers[key] if !ok { provider, err := w.router.remoteProvider.InitRemote(remoteInfo) if err != nil { @@ -136,7 +137,7 @@ func (w *loadWriter) Put(a container.UsedSpaceAnnouncement) error { continue // best effort } - w.mServers[endpoint] = remoteWriter + w.mServers[key] = remoteWriter } err := remoteWriter.Put(a) @@ -153,11 +154,11 @@ func (w *loadWriter) Put(a container.UsedSpaceAnnouncement) error { } func (w *loadWriter) Close() error { - for endpoint, wRemote := range w.mServers { + for key, wRemote := range w.mServers { err := wRemote.Close() if err != nil { w.router.log.Debug("could not close remote server writer", - zap.String("endpoint", endpoint), + zap.String("key", key), zap.String("error", err.Error()), ) } From cede2b4ed716fcc97c4ac8a4bd72ede9d423123b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 19:00:00 +0300 Subject: [PATCH 109/219] [#607] reputation,container: Support address groups in ServerInfo There is a need to support multiple server endpoints for reputation and container transmission. Replace `ServerInfo.Address` getter with `ServerInfo.IterateAddresses` iterator. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/container.go | 33 ++++++++++++------- cmd/neofs-node/netmap.go | 8 +++-- cmd/neofs-node/reputation/common/remote.go | 10 +++--- cmd/neofs-node/reputation/common/util.go | 7 ++-- .../container/announcement/load/route/deps.go | 12 ++++--- pkg/services/reputation/common/deps.go | 12 ++++--- 6 files changed, 50 insertions(+), 32 deletions(-) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 514613c0d2..44034ab867 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -216,21 +216,19 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc return r.deadEndProvider, nil } - addr := srv.Address() + var netAddr network.AddressGroup - var netAddr network.Address - - err := netAddr.FromString(addr) + err := netAddr.FromIterator(srv) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(r.loadAddrSrc, network.GroupFromAddress(netAddr)) { + if network.IsLocalAddress(r.loadAddrSrc, netAddr) { // if local => return no-op writer return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil } - c, err := r.clientCache.Get(network.GroupFromAddress(netAddr)) + c, err := r.clientCache.Get(netAddr) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) } @@ -369,16 +367,24 @@ func (c *cfg) PublicKey() []byte { return nodeKeyFromNetmap(c) } -func (c *cfg) Address() string { - return nodeAddressFromNetmap(c) +func (c *cfg) IterateAddresses(f func(string) bool) { + c.iterateNetworkAddresses(f) +} + +func (c *cfg) NumberOfAddresses() int { + return c.addressNum() } func (c *usedSpaceService) PublicKey() []byte { return nodeKeyFromNetmap(c.cfg) } -func (c *usedSpaceService) Address() string { - return nodeAddressFromNetmap(c.cfg) +func (c *usedSpaceService) IterateAddresses(f func(string) bool) { + c.cfg.iterateNetworkAddresses(f) +} + +func (c *usedSpaceService) NumberOfAddresses() int { + return c.cfg.addressNum() } func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *containerV2.AnnounceUsedSpaceRequest) (*containerV2.AnnounceUsedSpaceResponse, error) { @@ -425,8 +431,11 @@ func (i *containerOnlyKeyRemoteServerInfo) PublicKey() []byte { return i.key } -func (*containerOnlyKeyRemoteServerInfo) Address() string { - return "" +func (*containerOnlyKeyRemoteServerInfo) IterateAddresses(func(string) bool) { +} + +func (*containerOnlyKeyRemoteServerInfo) NumberOfAddresses() int { + return 0 } func (l *loadPlacementBuilder) isNodeFromContainerKey(epoch uint64, cid *cid.ID, key []byte) (bool, error) { diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 7305304479..fca68409a9 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -68,8 +68,12 @@ func nodeKeyFromNetmap(c *cfg) []byte { return c.cfgNetmap.state.getNodeInfo().PublicKey() } -func nodeAddressFromNetmap(c *cfg) string { - return c.cfgNetmap.state.getNodeInfo().Address() +func (c *cfg) iterateNetworkAddresses(f func(string) bool) { + c.cfgNetmap.state.getNodeInfo().IterateAddresses(f) +} + +func (c *cfg) addressNum() int { + return c.cfgNetmap.state.getNodeInfo().NumberOfAddresses() } func initNetmapService(c *cfg) { diff --git a/cmd/neofs-node/reputation/common/remote.go b/cmd/neofs-node/reputation/common/remote.go index fec8f0768a..d14098c048 100644 --- a/cmd/neofs-node/reputation/common/remote.go +++ b/cmd/neofs-node/reputation/common/remote.go @@ -70,21 +70,19 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep return rtp.deadEndProvider, nil } - addr := srv.Address() + var netAddr network.AddressGroup - var netAddr network.Address - - err := netAddr.FromString(addr) + err := netAddr.FromIterator(srv) if err != nil { return nil, fmt.Errorf("could not convert address to IP format: %w", err) } - if network.IsLocalAddress(rtp.localAddrSrc, network.GroupFromAddress(netAddr)) { + if network.IsLocalAddress(rtp.localAddrSrc, netAddr) { // if local => return no-op writer return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil } - c, err := rtp.clientCache.Get(network.GroupFromAddress(netAddr)) + c, err := rtp.clientCache.Get(netAddr) if err != nil { return nil, fmt.Errorf("could not initialize API client: %w", err) } diff --git a/cmd/neofs-node/reputation/common/util.go b/cmd/neofs-node/reputation/common/util.go index 56ee5de2b6..a0a8a2946f 100644 --- a/cmd/neofs-node/reputation/common/util.go +++ b/cmd/neofs-node/reputation/common/util.go @@ -37,8 +37,11 @@ func (i *OnlyKeyRemoteServerInfo) PublicKey() []byte { return i.Key } -func (*OnlyKeyRemoteServerInfo) Address() string { - return "" +func (*OnlyKeyRemoteServerInfo) IterateAddresses(func(string) bool) { +} + +func (*OnlyKeyRemoteServerInfo) NumberOfAddresses() int { + return 0 } const invalidPrmValFmt = "invalid parameter %s (%T):%v" diff --git a/pkg/services/container/announcement/load/route/deps.go b/pkg/services/container/announcement/load/route/deps.go index e6dba9240a..c6389c48e6 100644 --- a/pkg/services/container/announcement/load/route/deps.go +++ b/pkg/services/container/announcement/load/route/deps.go @@ -12,11 +12,13 @@ type ServerInfo interface { // from the route in a binary representation. PublicKey() []byte - // Returns network address of the node - // in the route. - // - // Can be empty. - Address() string + // Iterates over network addresses of the node + // in the route. Breaks iterating on true return + // of the handler. + IterateAddresses(func(string) bool) + + // Returns number of server's network addresses. + NumberOfAddresses() int } // Builder groups methods to route values in the network. diff --git a/pkg/services/reputation/common/deps.go b/pkg/services/reputation/common/deps.go index e2282bbfa6..5ab59d47a3 100644 --- a/pkg/services/reputation/common/deps.go +++ b/pkg/services/reputation/common/deps.go @@ -69,9 +69,11 @@ type ServerInfo interface { // from the route in a binary representation. PublicKey() []byte - // Returns network address of the node - // in the route. - // - // Can be empty. - Address() string + // Iterates over network addresses of the node + // in the route. Breaks iterating on true return + // of the handler. + IterateAddresses(func(string) bool) + + // Returns number of server's network addresses. + NumberOfAddresses() int } From c444118f478601bd39be51f1aad1cb3c35b1c765 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 19:04:49 +0300 Subject: [PATCH 110/219] [#607] cmd/node: Make reputationClientConstructor to accept AddressGroup Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 41 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 75ba5ed3d0..69ce9058bf 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -149,30 +149,13 @@ func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { type coreClientConstructor reputationClientConstructor -func (x *coreClientConstructor) Get(addrGroup network.AddressGroup) (cc coreclient.Client, err error) { - var c client.Client - - addrGroup.IterateAddresses(func(addr network.Address) bool { - c, err = (*reputationClientConstructor)(x).Get(addr) - return true - }) - - if err == nil { - cc = c.(coreclient.Client) +func (x *coreClientConstructor) Get(addrGroup network.AddressGroup) (coreclient.Client, error) { + c, err := (*reputationClientConstructor)(x).Get(addrGroup) + if err != nil { + return nil, err } - return -} - -type addressGroupClientConstructor reputationClientConstructor - -func (x *addressGroupClientConstructor) Get(addrGroup network.AddressGroup) (c client.Client, err error) { - addrGroup.IterateAddresses(func(addr network.Address) bool { - c, err = (*reputationClientConstructor)(x).Get(addr) - return true - }) - - return + return c.(coreclient.Client), nil } func initObjectService(c *cfg) { @@ -200,8 +183,6 @@ func initObjectService(c *cfg) { coreConstructor := (*coreClientConstructor)(clientConstructor) - groupConstructor := (*addressGroupClientConstructor)(coreConstructor) - irFetcher := &innerRingFetcher{ sidechain: c.cfgMorph.client, } @@ -237,7 +218,7 @@ func initObjectService(c *cfg) { policer.WithExpansionRate(10), policer.WithTrigger(ch), policer.WithRemoteHeader( - headsvc.NewRemoteHeader(keyStorage, groupConstructor), + headsvc.NewRemoteHeader(keyStorage, clientConstructor), ), policer.WithLocalAddressSource(c), policer.WithHeadTimeout( @@ -525,8 +506,8 @@ func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchO return ids, err } -func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, error) { - cl, err := c.basicConstructor.Get(network.GroupFromAddress(addr)) +func (c *reputationClientConstructor) Get(addr network.AddressGroup) (client.Client, error) { + cl, err := c.basicConstructor.Get(addr) if err != nil { return nil, err } @@ -534,11 +515,11 @@ func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, nm, err := netmap.GetLatestNetworkMap(c.nmSrc) if err == nil { for i := range nm.Nodes { - var netAddr network.Address + var netAddr network.AddressGroup - err := netAddr.FromString(nm.Nodes[i].Address()) + err := netAddr.FromIterator(nm.Nodes[i]) if err == nil { - if netAddr.Equal(addr) { + if netAddr.Intersects(addr) { prm := truststorage.UpdatePrm{} prm.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) From d1eb9c3b0f9d08f7e3d857f3a83c14188559a6f7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 19:27:47 +0300 Subject: [PATCH 111/219] [#607] cmd/node: Empty Control server address as disable In previous implementation if Control listen endpoint was omitted in config the gRPC listening endpoint was used instead. Consider empty address as an option to disable the service. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/control.go | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/cmd/neofs-node/control.go b/cmd/neofs-node/control.go index 3b35ef01b4..4db45fad12 100644 --- a/cmd/neofs-node/control.go +++ b/cmd/neofs-node/control.go @@ -6,7 +6,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/object" controlconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/control" - grpcconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/grpc" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/services/control" controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server" @@ -14,6 +13,11 @@ import ( ) func initControlService(c *cfg) { + endpoint := controlconfig.GRPC(c.appCfg).Endpoint() + if endpoint == controlconfig.GRPCEndpointDefault { + return + } + pubs := controlconfig.AuthorizedKeys(c.appCfg) rawPubs := make([][]byte, 0, len(pubs)+1) // +1 for node key @@ -38,21 +42,10 @@ func initControlService(c *cfg) { }), ) - var ( - err error - lis net.Listener - endpoint = controlconfig.GRPC(c.appCfg).Endpoint() - ) + lis, err := net.Listen("tcp", endpoint) + fatalOnErr(err) - if endpoint == "" || endpoint == grpcconfig.Endpoint(c.appCfg) { - lis = c.cfgGRPC.listener - c.cfgControlService.server = c.cfgGRPC.server - } else { - lis, err = net.Listen("tcp", endpoint) - fatalOnErr(err) - - c.cfgControlService.server = grpc.NewServer() - } + c.cfgControlService.server = grpc.NewServer() c.onShutdown(func() { stopGRPC("NeoFS Control API", c.cfgControlService.server, c.log) From 806073573260c40ae45c5cad09abeeee1fbac320 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 20:25:18 +0300 Subject: [PATCH 112/219] [#607] cmd/node: Serve gRPC on multiple interfaces Generalize single gRPC interface of the storage node to a group of interfaces. Each interface calls the same RPC handler. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/accounting.go | 20 ++++--- cmd/neofs-node/config.go | 30 +--------- cmd/neofs-node/config/grpc/config.go | 72 +++++++++++++++-------- cmd/neofs-node/config/grpc/config_test.go | 62 ++++++++----------- cmd/neofs-node/container.go | 30 +++++----- cmd/neofs-node/grpc.go | 57 ++++++++++-------- cmd/neofs-node/netmap.go | 30 +++++----- cmd/neofs-node/object.go | 8 ++- cmd/neofs-node/reputation.go | 30 +++++----- cmd/neofs-node/session.go | 20 ++++--- config/example/node.env | 16 +++-- config/example/node.json | 19 ++++-- config/example/node.yaml | 17 ++++-- 13 files changed, 221 insertions(+), 190 deletions(-) diff --git a/cmd/neofs-node/accounting.go b/cmd/neofs-node/accounting.go index e0491709b3..ec2289fce9 100644 --- a/cmd/neofs-node/accounting.go +++ b/cmd/neofs-node/accounting.go @@ -16,17 +16,19 @@ func initAccountingService(c *cfg) { balanceMorphWrapper, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0) fatalOnErr(err) - accountingGRPC.RegisterAccountingServiceServer(c.cfgGRPC.server, - accountingTransportGRPC.New( - accountingService.NewSignService( - &c.key.PrivateKey, - accountingService.NewResponseService( - accountingService.NewExecutionService( - accounting.NewExecutor(balanceMorphWrapper), - ), - c.respSvc, + server := accountingTransportGRPC.New( + accountingService.NewSignService( + &c.key.PrivateKey, + accountingService.NewResponseService( + accountingService.NewExecutionService( + accounting.NewExecutor(balanceMorphWrapper), ), + c.respSvc, ), ), ) + + for _, srv := range c.cfgGRPC.servers { + accountingGRPC.RegisterAccountingServiceServer(srv, server) + } } diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index b77a027213..74716fb369 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -17,7 +17,6 @@ import ( contractsconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/contracts" engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine" shardconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard" - grpcconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/grpc" loggerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/logger" metricsconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/metrics" nodeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/node" @@ -112,17 +111,13 @@ type cfg struct { } type cfgGRPC struct { - listener net.Listener + listeners []net.Listener - server *grpc.Server + servers []*grpc.Server maxChunkSize uint64 maxAddrAmount uint64 - - tlsEnabled bool - tlsCertFile string - tlsKeyFile string } type cfgMorph struct { @@ -225,24 +220,6 @@ func initCfg(path string) *cfg { maxChunkSize := uint64(maxMsgSize) * 3 / 4 // 25% to meta, 75% to payload maxAddrAmount := uint64(maxChunkSize) / addressSize // each address is about 72 bytes - var ( - tlsEnabled bool - tlsCertFile string - tlsKeyFile string - - tlsConfig = grpcconfig.TLS(appCfg) - ) - - if tlsConfig.Enabled() { - tlsEnabled = true - tlsCertFile = tlsConfig.CertificateFile() - tlsKeyFile = tlsConfig.KeyFile() - } - - if tlsEnabled { - netAddr.AddTLS() - } - state := newNetworkState() containerWorkerPool, err := ants.NewPool(notificationHandlerPoolSize) @@ -281,9 +258,6 @@ func initCfg(path string) *cfg { cfgGRPC: cfgGRPC{ maxChunkSize: maxChunkSize, maxAddrAmount: maxAddrAmount, - tlsEnabled: tlsEnabled, - tlsCertFile: tlsCertFile, - tlsKeyFile: tlsKeyFile, }, localAddr: network.GroupFromAddress(netAddr), respSvc: response.NewService( diff --git a/cmd/neofs-node/config/grpc/config.go b/cmd/neofs-node/config/grpc/config.go index fd35860545..6029b5658d 100644 --- a/cmd/neofs-node/config/grpc/config.go +++ b/cmd/neofs-node/config/grpc/config.go @@ -2,33 +2,28 @@ package grpcconfig import ( "errors" + "strconv" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) -const ( - subsection = "grpc" - tlsSubsection = "tls" -) - var ( errEndpointNotSet = errors.New("empty/not set endpoint, see `grpc.endpoint` section") errTLSKeyNotSet = errors.New("empty/not set TLS key file path, see `grpc.tls.key` section") errTLSCertNotSet = errors.New("empty/not set TLS certificate file path, see `grpc.tls.certificate` section") ) -// TLSConfig is a wrapper over "tls" config section which provides access -// to TLS configuration of gRPC connection. -type TLSConfig struct { - cfg *config.Config -} +// Config is a wrapper over the config section +// which provides access to gRPC server configurations. +type Config config.Config -// Endpoint returns value of "endpoint" config parameter -// from "grpc" section. +// Endpoint returns value of "endpoint" config parameter. // // Panics if value is not a non-empty string. -func Endpoint(c *config.Config) string { - v := config.StringSafe(c.Sub(subsection), "endpoint") +func (x *Config) Endpoint() string { + v := config.StringSafe( + (*config.Config)(x), + "endpoint") if v == "" { panic(errEndpointNotSet) } @@ -36,19 +31,27 @@ func Endpoint(c *config.Config) string { return v } -// TLS returns structure that provides access to "tls" subsection of -// "grpc" section. -func TLS(c *config.Config) TLSConfig { - return TLSConfig{ - cfg: c.Sub(subsection).Sub(tlsSubsection), +// TLS returns "tls" subsection as a TLSConfig. +// +// Returns nil if "enabled" value of "tls" subsection is false. +func (x *Config) TLS() *TLSConfig { + sub := (*config.Config)(x). + Sub("tls") + + if !config.BoolSafe(sub, "enabled") { + return nil + } + + return &TLSConfig{ + cfg: sub, } } -// Enabled returns value of "enabled" config parameter. -// -// Returns false if value is not set. -func (tls TLSConfig) Enabled() bool { - return config.BoolSafe(tls.cfg, "enabled") +// TLSConfig is a wrapper over the config section +// which provides access to TLS configurations +// of the gRPC server. +type TLSConfig struct { + cfg *config.Config } // KeyFile returns value of "key" config parameter. @@ -74,3 +77,24 @@ func (tls TLSConfig) CertificateFile() string { return v } + +// IterateEndpoints iterates over subsections ["0":"N") (N - "num" value) +// of "grpc" section of c, wrap them into Config and passes to f. +// +// Panics if N is not a positive number. +func IterateEndpoints(c *config.Config, f func(*Config)) { + c = c.Sub("grpc") + + num := config.Uint(c, "num") + if num == 0 { + panic("no gRPC server configured") + } + + for i := uint64(0); i < num; i++ { + si := strconv.FormatUint(i, 10) + + sc := (*Config)(c.Sub(si)) + + f(sc) + } +} diff --git a/cmd/neofs-node/config/grpc/config_test.go b/cmd/neofs-node/config/grpc/config_test.go index 5c6d50144a..2247c4c749 100644 --- a/cmd/neofs-node/config/grpc/config_test.go +++ b/cmd/neofs-node/config/grpc/config_test.go @@ -10,49 +10,35 @@ import ( func TestGRPCSection(t *testing.T) { t.Run("defaults", func(t *testing.T) { - empty := configtest.EmptyConfig() - - tlsEnabled := TLS(empty).Enabled() - - require.Equal(t, false, tlsEnabled) - - require.PanicsWithError( - t, - errEndpointNotSet.Error(), - func() { - Endpoint(empty) - }, - ) - - require.PanicsWithError( - t, - errTLSKeyNotSet.Error(), - func() { - TLS(empty).KeyFile() - }, - ) - - require.PanicsWithError( - t, - errTLSCertNotSet.Error(), - func() { - TLS(empty).CertificateFile() - }, - ) + require.Panics(t, func() { + IterateEndpoints(configtest.EmptyConfig(), nil) + }) }) const path = "../../../../config/example/node" var fileConfigTest = func(c *config.Config) { - addr := Endpoint(c) - tlsEnabled := TLS(c).Enabled() - tlsCert := TLS(c).CertificateFile() - tlsKey := TLS(c).KeyFile() - - require.Equal(t, "s01.neofs.devenv:8080", addr) - require.Equal(t, true, tlsEnabled) - require.Equal(t, "/path/to/cert", tlsCert) - require.Equal(t, "/path/to/key", tlsKey) + num := 0 + + IterateEndpoints(c, func(sc *Config) { + defer func() { + num++ + }() + + tls := sc.TLS() + + switch num { + case 0: + require.Equal(t, "s01.neofs.devenv:8080", sc.Endpoint()) + + require.Equal(t, "/path/to/cert", tls.CertificateFile()) + require.Equal(t, "/path/to/key", tls.KeyFile()) + case 1: + require.Equal(t, "s02.neofs.devenv:8080", sc.Endpoint()) + + require.Nil(t, tls) + } + }) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 44034ab867..63f0cc140b 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -114,23 +114,25 @@ func initContainerService(c *cfg) { }) }) - containerGRPC.RegisterContainerServiceServer(c.cfgGRPC.server, - containerTransportGRPC.New( - containerService.NewSignService( - &c.key.PrivateKey, - containerService.NewResponseService( - &usedSpaceService{ - Server: containerService.NewExecutionService(containerMorph.NewExecutor(wrap)), - loadWriterProvider: loadRouter, - loadPlacementBuilder: loadPlacementBuilder, - routeBuilder: routeBuilder, - cfg: c, - }, - c.respSvc, - ), + server := containerTransportGRPC.New( + containerService.NewSignService( + &c.key.PrivateKey, + containerService.NewResponseService( + &usedSpaceService{ + Server: containerService.NewExecutionService(containerMorph.NewExecutor(wrap)), + loadWriterProvider: loadRouter, + loadPlacementBuilder: loadPlacementBuilder, + routeBuilder: routeBuilder, + cfg: c, + }, + c.respSvc, ), ), ) + + for _, srv := range c.cfgGRPC.servers { + containerGRPC.RegisterContainerServiceServer(srv, server) + } } // addContainerNotificationHandler adds handler that will be executed synchronously diff --git a/cmd/neofs-node/grpc.go b/cmd/neofs-node/grpc.go index ef9c39a0a1..a93ae222c1 100644 --- a/cmd/neofs-node/grpc.go +++ b/cmd/neofs-node/grpc.go @@ -12,41 +12,52 @@ import ( ) func initGRPC(c *cfg) { - var err error + grpcconfig.IterateEndpoints(c.appCfg, func(sc *grpcconfig.Config) { + lis, err := net.Listen("tcp", sc.Endpoint()) + fatalOnErr(err) - c.cfgGRPC.listener, err = net.Listen("tcp", grpcconfig.Endpoint(c.appCfg)) - fatalOnErr(err) + c.cfgGRPC.listeners = append(c.cfgGRPC.listeners, lis) - serverOpts := []grpc.ServerOption{ - grpc.MaxSendMsgSize(maxMsgSize), - } + serverOpts := []grpc.ServerOption{ + grpc.MaxSendMsgSize(maxMsgSize), + } - if c.cfgGRPC.tlsEnabled { - creds, err := credentials.NewServerTLSFromFile(c.cfgGRPC.tlsCertFile, c.cfgGRPC.tlsKeyFile) - fatalOnErrDetails("could not read credentials from file", err) + tlsCfg := sc.TLS() - serverOpts = append(serverOpts, grpc.Creds(creds)) - } + if tlsCfg != nil { + creds, err := credentials.NewServerTLSFromFile(tlsCfg.CertificateFile(), tlsCfg.KeyFile()) + fatalOnErrDetails("could not read credentials from file", err) + + serverOpts = append(serverOpts, grpc.Creds(creds)) + } + + srv := grpc.NewServer(serverOpts...) - c.cfgGRPC.server = grpc.NewServer(serverOpts...) + c.onShutdown(func() { + stopGRPC("NeoFS Public API", srv, c.log) + }) - c.onShutdown(func() { - stopGRPC("NeoFS Public API", c.cfgGRPC.server, c.log) + c.cfgGRPC.servers = append(c.cfgGRPC.servers, srv) }) } func serveGRPC(c *cfg) { - c.wg.Add(1) + for i := range c.cfgGRPC.servers { + c.wg.Add(1) - go func() { - defer func() { - c.wg.Done() - }() + srv := c.cfgGRPC.servers[i] + lis := c.cfgGRPC.listeners[i] - if err := c.cfgGRPC.server.Serve(c.cfgGRPC.listener); err != nil { - fmt.Println("gRPC server error", err) - } - }() + go func() { + defer func() { + c.wg.Done() + }() + + if err := srv.Serve(lis); err != nil { + fmt.Println("gRPC server error", err) + } + }() + } } func stopGRPC(name string, s *grpc.Server, l *logger.Logger) { diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index fca68409a9..6d6106cbb4 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -86,25 +86,27 @@ func initNetmapService(c *cfg) { initMorphComponents(c) } - netmapGRPC.RegisterNetmapServiceServer(c.cfgGRPC.server, - netmapTransportGRPC.New( - netmapService.NewSignService( - &c.key.PrivateKey, - netmapService.NewResponseService( - netmapService.NewExecutionService( - c, - c.apiVersion, - &netInfo{ - netState: c.cfgNetmap.state, - magic: c.cfgMorph.client, - }, - ), - c.respSvc, + server := netmapTransportGRPC.New( + netmapService.NewSignService( + &c.key.PrivateKey, + netmapService.NewResponseService( + netmapService.NewExecutionService( + c, + c.apiVersion, + &netInfo{ + netState: c.cfgNetmap.state, + magic: c.cfgMorph.client, + }, ), + c.respSvc, ), ), ) + for _, srv := range c.cfgGRPC.servers { + netmapGRPC.RegisterNetmapServiceServer(srv, server) + } + addNewEpochNotificationHandler(c, func(ev event.Event) { c.cfgNetmap.state.setCurrentEpoch(ev.(netmapEvent.NewEpoch).EpochNumber()) }) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 69ce9058bf..c9c9a44296 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -371,9 +371,11 @@ func initObjectService(c *cfg) { firstSvc = objectService.NewMetricCollector(aclSvc, c.metricsCollector) } - objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server, - objectTransportGRPC.New(firstSvc), - ) + server := objectTransportGRPC.New(firstSvc) + + for _, srv := range c.cfgGRPC.servers { + objectGRPC.RegisterObjectServiceServer(srv, server) + } } type morphEACLStorage struct { diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index b4e02ebe90..b6f3784f13 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -186,24 +186,26 @@ func initReputationService(c *cfg) { }, ) - v2reputationgrpc.RegisterReputationServiceServer(c.cfgGRPC.server, - grpcreputation.New( - reputationrpc.NewSignService( - &c.key.PrivateKey, - reputationrpc.NewResponseService( - &reputationServer{ - cfg: c, - log: c.log, - localRouter: localTrustRouter, - intermediateRouter: intermediateTrustRouter, - routeBuilder: localRouteBuilder, - }, - c.respSvc, - ), + server := grpcreputation.New( + reputationrpc.NewSignService( + &c.key.PrivateKey, + reputationrpc.NewResponseService( + &reputationServer{ + cfg: c, + log: c.log, + localRouter: localTrustRouter, + intermediateRouter: intermediateTrustRouter, + routeBuilder: localRouteBuilder, + }, + c.respSvc, ), ), ) + for _, srv := range c.cfgGRPC.servers { + v2reputationgrpc.RegisterReputationServiceServer(srv, server) + } + // initialize eigen trust block timer durationMeter := NewEigenTrustDuration(c.cfgNetmap.wrapper) diff --git a/cmd/neofs-node/session.go b/cmd/neofs-node/session.go index 654236af67..dfda3e5c93 100644 --- a/cmd/neofs-node/session.go +++ b/cmd/neofs-node/session.go @@ -10,17 +10,19 @@ import ( func initSessionService(c *cfg) { c.privateTokenStore = storage.New() - sessionGRPC.RegisterSessionServiceServer(c.cfgGRPC.server, - sessionTransportGRPC.New( - sessionSvc.NewSignService( - &c.key.PrivateKey, - sessionSvc.NewResponseService( - sessionSvc.NewExecutionService( - c.privateTokenStore, - ), - c.respSvc, + server := sessionTransportGRPC.New( + sessionSvc.NewSignService( + &c.key.PrivateKey, + sessionSvc.NewResponseService( + sessionSvc.NewExecutionService( + c.privateTokenStore, ), + c.respSvc, ), ), ) + + for _, srv := range c.cfgGRPC.servers { + sessionGRPC.RegisterSessionServiceServer(srv, server) + } } diff --git a/config/example/node.env b/config/example/node.env index 9e492ffd82..d979f5c594 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -17,10 +17,18 @@ NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK NEOFS_NODE_RELAY=true # gRPC section -NEOFS_GRPC_ENDPOINT=s01.neofs.devenv:8080 -NEOFS_GRPC_TLS_ENABLED=true -NEOFS_GRPC_TLS_CERTIFICATE=/path/to/cert -NEOFS_GRPC_TLS_KEY=/path/to/key +NEOFS_GRPC_NUM=2 +## 0 server +NEOFS_GRPC_0_ENDPOINT=s01.neofs.devenv:8080 +### TLS config +NEOFS_GRPC_0_TLS_ENABLED=true +NEOFS_GRPC_0_TLS_CERTIFICATE=/path/to/cert +NEOFS_GRPC_0_TLS_KEY=/path/to/key + +## 1 server +NEOFS_GRPC_1_ENDPOINT=s02.neofs.devenv:8080 +### TLS config +NEOFS_GRPC_1_TLS_ENABLED=false # Control service section NEOFS_CONTROL_AUTHORIZED_KEYS=035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6 diff --git a/config/example/node.json b/config/example/node.json index c5fa0ee771..9b78d9d5a8 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -23,11 +23,20 @@ "relay": true }, "grpc": { - "endpoint": "s01.neofs.devenv:8080", - "tls": { - "enabled": true, - "certificate": "/path/to/cert", - "key": "/path/to/key" + "num": 2, + "0": { + "endpoint": "s01.neofs.devenv:8080", + "tls": { + "enabled": true, + "certificate": "/path/to/cert", + "key": "/path/to/key" + } + }, + "1": { + "endpoint": "s02.neofs.devenv:8080", + "tls": { + "enabled": false + } } }, "control": { diff --git a/config/example/node.yaml b/config/example/node.yaml index 65e0a3d9f9..bc79e97353 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -21,11 +21,18 @@ node: relay: true grpc: - endpoint: s01.neofs.devenv:8080 - tls: - enabled: true - certificate: /path/to/cert - key: /path/to/key + num: 2 + 0: + endpoint: s01.neofs.devenv:8080 + tls: + enabled: true + certificate: /path/to/cert + key: /path/to/key + + 1: + endpoint: s02.neofs.devenv:8080 + tls: + enabled: false control: authorized_keys: From 163c24a2d24c5dbf81e87120892b1d4b612491f0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 20:35:56 +0300 Subject: [PATCH 113/219] [#607] cmd/node: Configure group of bootstrap addresses There is a need to support multiple network addresses of the storage nodes. Make `BootstrapAddress` to return `network.AddressGroup` (and rename). Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 4 +-- cmd/neofs-node/config/node/config.go | 36 ++++++++++++++--------- cmd/neofs-node/config/node/config_test.go | 16 +++++----- config/example/node.env | 2 +- config/example/node.json | 5 +++- config/example/node.yaml | 4 ++- 6 files changed, 41 insertions(+), 26 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 74716fb369..c3d72a38f4 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -215,7 +215,7 @@ func initCfg(path string) *cfg { log, err := logger.NewLogger(logPrm) fatalOnErr(err) - netAddr := nodeconfig.BootstrapAddress(appCfg) + netAddr := nodeconfig.BootstrapAddresses(appCfg) maxChunkSize := uint64(maxMsgSize) * 3 / 4 // 25% to meta, 75% to payload maxAddrAmount := uint64(maxChunkSize) / addressSize // each address is about 72 bytes @@ -259,7 +259,7 @@ func initCfg(path string) *cfg { maxChunkSize: maxChunkSize, maxAddrAmount: maxAddrAmount, }, - localAddr: network.GroupFromAddress(netAddr), + localAddr: netAddr, respSvc: response.NewService( response.WithNetworkState(state), ), diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index 1e1f0bf85c..c22fb239a0 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -18,10 +18,7 @@ const ( attributePrefix = "attribute" ) -var ( - errKeyNotSet = errors.New("empty/not set key address, see `node.key` section") - errAddressNotSet = errors.New("empty/not set bootstrap address, see `node.address` section") -) +var errKeyNotSet = errors.New("empty/not set key address, see `node.key` section") // Key returns value of "key" config parameter // from "node" section. @@ -63,19 +60,30 @@ func Wallet(c *config.Config) *keys.PrivateKey { return acc.PrivateKey() } -// BootstrapAddress returns value of "address" config parameter -// from "node" section as network.Address. -// -// Panics if value is not a valid NeoFS network address -func BootstrapAddress(c *config.Config) (addr network.Address) { - v := config.StringSafe(c.Sub(subsection), "address") - if v == "" { - panic(errAddressNotSet) +type stringAddressGroup []string + +func (x stringAddressGroup) IterateAddresses(f func(string) bool) { + for i := range x { + if f(x[i]) { + break + } } +} + +func (x stringAddressGroup) NumberOfAddresses() int { + return len(x) +} + +// BootstrapAddresses returns value of "addresses" config parameter +// from "node" section as network.AddressGroup. +// +// Panics if value is not a string list of valid NeoFS network addresses. +func BootstrapAddresses(c *config.Config) (addr network.AddressGroup) { + v := config.StringSlice(c.Sub(subsection), "addresses") - err := addr.FromString(v) + err := addr.FromIterator(stringAddressGroup(v)) if err != nil { - panic(fmt.Errorf("could not convert bootstrap address %s to %T: %w", v, addr, err)) + panic(fmt.Errorf("could not parse bootstrap addresses: %w", err)) } return addr diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index d20c1b09f6..00b67e424b 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -22,11 +22,10 @@ func TestNodeSection(t *testing.T) { }, ) - require.PanicsWithError( + require.Panics( t, - errAddressNotSet.Error(), func() { - BootstrapAddress(empty) + BootstrapAddresses(empty) }, ) @@ -41,18 +40,21 @@ func TestNodeSection(t *testing.T) { var fileConfigTest = func(c *config.Config) { key := Key(c) - addr := BootstrapAddress(c) + addr := BootstrapAddresses(c) attributes := Attributes(c) relay := Relay(c) wKey := Wallet(c) - var expectedAddr network.Address + var expectedAddr network.AddressGroup - err := expectedAddr.FromString("s01.neofs.devenv:8080") + err := expectedAddr.FromIterator(stringAddressGroup([]string{ + "s01.neofs.devenv:8080", + "s02.neofs.devenv:8081", + })) require.NoError(t, err) require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address()) - require.Equal(t, true, addr.Equal(expectedAddr)) + require.Equal(t, expectedAddr, addr) require.Equal(t, true, relay) require.Len(t, attributes, 2) diff --git a/config/example/node.env b/config/example/node.env index d979f5c594..42e395c4d2 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -11,7 +11,7 @@ NEOFS_NODE_KEY=./wallet.key NEOFS_NODE_WALLET_PATH=./wallet.json NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz NEOFS_NODE_WALLET_PASSWORD=password -NEOFS_NODE_ADDRESS=s01.neofs.devenv:8080 +NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 s02.neofs.devenv:8081 NEOFS_NODE_ATTRIBUTE_0=Price:11 NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK NEOFS_NODE_RELAY=true diff --git a/config/example/node.json b/config/example/node.json index 9b78d9d5a8..bd6baceeed 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -17,7 +17,10 @@ "address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz", "password": "password" }, - "address": "s01.neofs.devenv:8080", + "addresses": [ + "s01.neofs.devenv:8080", + "s02.neofs.devenv:8081" + ], "attribute_0": "Price:11", "attribute_1": "UN-LOCODE:RU MSK", "relay": true diff --git a/config/example/node.yaml b/config/example/node.yaml index bc79e97353..c7c576f3de 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -15,7 +15,9 @@ node: path: "./wallet.json" address: "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz" password: "password" - address: s01.neofs.devenv:8080 + addresses: + - s01.neofs.devenv:8080 + - s02.neofs.devenv:8081 attribute_0: "Price:11" attribute_1: UN-LOCODE:RU MSK relay: true From 1e52e86bbc5a179bd8a77c4011885aa2611516cb Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Jun 2021 22:48:33 +0300 Subject: [PATCH 114/219] [#607] node/control: Make group address in NodeInfo message Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/netmap.go | 5 +- .../control/server/netmap_snapshot.go | 7 +- pkg/services/control/types.go | 10 +-- pkg/services/control/types.pb.go | 74 +++++++++---------- pkg/services/control/types.proto | 2 +- pkg/services/control/types_test.go | 15 +++- 6 files changed, 65 insertions(+), 48 deletions(-) diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 7e095c09e9..4cb7a3acab 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "fmt" + "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -194,10 +195,10 @@ func prettyPrintNetmap(cmd *cobra.Command, nm *control.Netmap, jsonEncoding bool cmd.Println("Epoch:", nm.GetEpoch()) for i, node := range nm.GetNodes() { - cmd.Printf("Node %d: %s %s %s\n", i+1, + cmd.Printf("Node %d: %s %s %v\n", i+1, base58.Encode(node.GetPublicKey()), - node.GetAddress(), node.GetState(), + node.GetAddresses(), ) for _, attr := range node.GetAttributes() { diff --git a/pkg/services/control/server/netmap_snapshot.go b/pkg/services/control/server/netmap_snapshot.go index d7252b330f..4c55cf1e26 100644 --- a/pkg/services/control/server/netmap_snapshot.go +++ b/pkg/services/control/server/netmap_snapshot.go @@ -53,7 +53,12 @@ func nodesFromAPI(apiNodes netmapAPI.Nodes) []*control.NodeInfo { for _, apiNode := range apiNodes { node := new(control.NodeInfo) node.SetPublicKey(apiNode.PublicKey()) - node.SetAddress(apiNode.Address()) + + addrs := make([]string, apiNode.NumberOfAddresses()) + netmapAPI.IterateAllAddresses(apiNode.NodeInfo, func(s string) { + addrs = append(addrs, s) + }) + node.SetAddresses(addrs) node.SetAttributes(attributesFromAPI(apiNode.Attributes())) node.SetState(stateFromAPI(apiNode.State())) diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index d19275feff..ed563337e8 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -125,10 +125,10 @@ func (x *NodeInfo) SetPublicKey(v []byte) { } } -// SetAddress sets ways to connect to a node. -func (x *NodeInfo) SetAddress(v string) { +// SetAddresses sets ways to connect to a node. +func (x *NodeInfo) SetAddresses(v []string) { if x != nil { - x.Address = v + x.Addresses = v } } @@ -184,7 +184,7 @@ func (x *NodeInfo) StableMarshal(buf []byte) ([]byte, error) { offset += n - n, err = proto.StringMarshal(nodeAddrFNum, buf[offset:], x.Address) + n, err = proto.RepeatedStringMarshal(nodeAddrFNum, buf[offset:], x.Addresses) if err != nil { return nil, err } @@ -220,7 +220,7 @@ func (x *NodeInfo) StableSize() int { size := 0 size += proto.BytesSize(nodePubKeyFNum, x.PublicKey) - size += proto.StringSize(nodeAddrFNum, x.Address) + size += proto.RepeatedStringSize(nodeAddrFNum, x.Addresses) for i := range x.Attributes { size += proto.NestedStructureSize(nodeAttrsFNum, x.Attributes[i]) diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index 528de009a7..17c2f0806a 100644 --- a/pkg/services/control/types.pb.go +++ b/pkg/services/control/types.pb.go @@ -202,7 +202,7 @@ type NodeInfo struct { // Public key of the NeoFS node in a binary format. PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // Ways to connect to a node. - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` // Carries list of the NeoFS node attributes in a key-value form. Key name // must be a node-unique valid UTF-8 string. Value can't be empty. NodeInfo // structures with duplicated attribute names or attributes with empty values @@ -251,11 +251,11 @@ func (x *NodeInfo) GetPublicKey() []byte { return nil } -func (x *NodeInfo) GetAddress() string { +func (x *NodeInfo) GetAddresses() []string { if x != nil { - return x.Address + return x.Addresses } - return "" + return nil } func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute { @@ -445,41 +445,41 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{ 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x22, 0xfc, 0x01, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x75, 0x72, 0x65, 0x22, 0x80, 0x02, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, - 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, - 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x1a, 0x4d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x73, 0x22, 0x47, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f, - 0x63, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x2a, 0x3d, 0x0a, 0x0c, 0x4e, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x53, - 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, - 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x2a, 0x57, 0x0a, 0x0c, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x45, - 0x41, 0x4c, 0x54, 0x48, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, - 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54, - 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02, - 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x48, 0x55, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x4f, 0x57, - 0x4e, 0x10, 0x03, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, - 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x3b, 0x0a, + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x6f, 0x64, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x4d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, + 0x61, 0x72, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x47, 0x0a, 0x06, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x2a, + 0x3d, 0x0a, 0x0c, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x14, 0x0a, 0x10, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, + 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x2a, 0x57, + 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, + 0x0a, 0x17, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, + 0x54, 0x41, 0x52, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, + 0x44, 0x59, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x48, 0x55, 0x54, 0x54, 0x49, 0x4e, 0x47, + 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, + 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/services/control/types.proto b/pkg/services/control/types.proto index d9cc9d77e0..4a53824f84 100644 --- a/pkg/services/control/types.proto +++ b/pkg/services/control/types.proto @@ -31,7 +31,7 @@ message NodeInfo { bytes public_key = 1 [json_name = "publicKey"]; // Ways to connect to a node. - string address = 2 [json_name = "address"]; + repeated string addresses = 2 [json_name = "addresses"]; // Administrator-defined Attributes of the NeoFS Storage Node. // diff --git a/pkg/services/control/types_test.go b/pkg/services/control/types_test.go index faed9ba772..64143975d2 100644 --- a/pkg/services/control/types_test.go +++ b/pkg/services/control/types_test.go @@ -24,7 +24,7 @@ func generateNetmap() *control.Netmap { for i := 0; i < nodeCount; i++ { n := new(control.NodeInfo) n.SetPublicKey(testData(33)) - n.SetAddress(testString()) + n.SetAddresses([]string{testString(), testString()}) n.SetState(control.NetmapStatus_ONLINE) const attrCount = 2 @@ -81,11 +81,22 @@ func equalNetmaps(nm1, nm2 *control.Netmap) bool { func equalNodeInfos(n1, n2 *control.NodeInfo) bool { if !bytes.Equal(n1.GetPublicKey(), n2.GetPublicKey()) || - n1.GetAddress() != n2.GetAddress() || n1.GetState() != n2.GetState() { return false } + na1, na2 := n1.GetAddresses(), n2.GetAddresses() + + if len(na1) != len(na2) { + return false + } + + for i := range na1 { + if na1[i] != na2[i] { + return false + } + } + a1, a2 := n1.GetAttributes(), n2.GetAttributes() if len(a1) != len(a2) { From 149367cab9c84d3d34271e90ff0d052fad9c6a22 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:17:37 +0300 Subject: [PATCH 115/219] [#607] network: Sort addresses in AddressGroup.FromIterator method Implement `sort.Interface` interface on `AddressGroup` and perform sorting in `AddressGroup.FromIterator` method. Addresses with enabled TLS are "less" in terms of slice position. Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/network/group.go b/pkg/network/group.go index d5fedae426..b2bf5fabe8 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -2,6 +2,7 @@ package network import ( "errors" + "sort" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" ) @@ -39,6 +40,22 @@ func (x AddressGroup) IterateAddresses(f func(Address) bool) { } } +// Len returns number of addresses in AddressGroup. +func (x AddressGroup) Len() int { + return len(x) +} + +// Less returns true if i-th address in AddressGroup supports TLS +// and j-th one doesn't. +func (x AddressGroup) Less(i, j int) bool { + return x[i].TLSEnabled() && !x[j].TLSEnabled() +} + +// Swap swaps i-th and j-th addresses in AddressGroup. +func (x AddressGroup) Swap(i, j int) { + x[i], x[j] = x[j], x[i] +} + // MultiAddressIterator is an interface of network address group. type MultiAddressIterator interface { // Must iterate over network addresses and pass each one @@ -50,6 +67,7 @@ type MultiAddressIterator interface { } // FromIterator forms AddressGroup from MultiAddressIterator structure. +// The result is sorted with sort.Sort. // // Returns an error in the absence of addresses or if any of the addresses are incorrect. func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { @@ -81,6 +99,7 @@ func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { }) if err == nil { + sort.Sort(as) *x = as } From 61cc70d89951a8982aaafbc3dab2e40aaffca54e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:20:45 +0300 Subject: [PATCH 116/219] [#607] network: Remove no longer used `Address.WriteToNodeInfo` method Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 6 ------ pkg/network/address_test.go | 20 -------------------- 2 files changed, 26 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index 3a34a0cf34..a7831dcfb9 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -7,7 +7,6 @@ import ( "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr/net" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" ) /* @@ -38,11 +37,6 @@ func (a Address) Equal(addr Address) bool { return a.ma.Equal(addr.ma) } -// WriteToNodeInfo writes Address to netmap.NodeInfo structure. -func (a Address) WriteToNodeInfo(ni *netmap.NodeInfo) { - ni.SetAddress(a.ma.String()) -} - // HostAddr returns host address in string format. // // Panics if host address cannot be fetched from Address. diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index 91f606a858..a293b7ed14 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/multiformats/go-multiaddr" - "github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/stretchr/testify/require" ) @@ -66,22 +65,3 @@ func buildMultiaddr(s string, t *testing.T) multiaddr.Multiaddr { require.NoError(t, err) return ma } - -func TestAddress_WriteToNodeInfo(t *testing.T) { - a := "127.0.0.1:8080" - - var addr Address - - err := addr.FromString(a) - require.NoError(t, err) - - var ni netmap.NodeInfo - - addr.WriteToNodeInfo(&ni) - - var restored Address - - err = restored.FromString(ni.Address()) - require.NoError(t, err) - require.True(t, restored.Equal(addr)) -} From b723c92ef86b2ce1e12b86e0268b7673503652fc Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:24:01 +0300 Subject: [PATCH 117/219] [#607] network: Make Address.Equal method unexported The method is used only in the same package. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 4 ++-- pkg/network/group.go | 2 +- pkg/network/tls_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index a7831dcfb9..8fe808a201 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -32,8 +32,8 @@ func (a Address) String() string { return a.ma.String() } -// Equal compares Address's. -func (a Address) Equal(addr Address) bool { +// equal compares Address's. +func (a Address) equal(addr Address) bool { return a.ma.Equal(addr.ma) } diff --git a/pkg/network/group.go b/pkg/network/group.go index b2bf5fabe8..ec99950839 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -129,7 +129,7 @@ func (x AddressGroup) WriteToNodeInfo(ni *netmap.NodeInfo) { func (x AddressGroup) Intersects(x2 AddressGroup) bool { for i := range x { for j := range x2 { - if x[i].Equal(x2[j]) { + if x[i].equal(x2[j]) { return true } } diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go index 122568b33b..cdcf1e7697 100644 --- a/pkg/network/tls_test.go +++ b/pkg/network/tls_test.go @@ -48,6 +48,6 @@ func TestAddress_AddTLS(t *testing.T) { err := netAddr.FromString(test.want) require.NoError(t, err) - require.True(t, netAddr.Equal(addr), test.input) + require.True(t, netAddr.equal(addr), test.input) } } From e3eade619dff25d45d2bfe0585936206d3c63c5b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:28:19 +0300 Subject: [PATCH 118/219] [#607] network: Remove no longer used `Address.AddTLS` method Signed-off-by: Leonard Lyubich --- pkg/network/tls.go | 11 ----------- pkg/network/tls_test.go | 27 --------------------------- 2 files changed, 38 deletions(-) diff --git a/pkg/network/tls.go b/pkg/network/tls.go index a552480eb3..821f482b34 100644 --- a/pkg/network/tls.go +++ b/pkg/network/tls.go @@ -54,14 +54,3 @@ func (a Address) TLSEnabled() bool { return false } - -// AddTLS encapsulates a Address if there is no TLS yet. -func (a *Address) AddTLS() { - // not need to add TLS if it is - // already included - if a.TLSEnabled() { - return - } - - a.ma = a.ma.Encapsulate(tls) -} diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go index cdcf1e7697..541369c7fd 100644 --- a/pkg/network/tls_test.go +++ b/pkg/network/tls_test.go @@ -24,30 +24,3 @@ func TestAddress_TLSEnabled(t *testing.T) { require.Equal(t, test.wantTLS, addr.TLSEnabled(), test.input) } } - -func TestAddress_AddTLS(t *testing.T) { - input, tls := "/dns4/localhost/tcp/8080", tls.String() - - testCases := [...]struct { - input string - want string - }{ - {input, input + tls}, - {input + tls, input + tls}, - } - - for _, test := range testCases { - addr := Address{ - ma: buildMultiaddr(test.input, t), - } - - addr.AddTLS() - - var netAddr Address - - err := netAddr.FromString(test.want) - require.NoError(t, err) - - require.True(t, netAddr.equal(addr), test.input) - } -} From 359bbe319a591116b26a371c9339cae19615e475 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:30:31 +0300 Subject: [PATCH 119/219] [#607] network: Remove no longer needed GroupFromAddress function Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pkg/network/group.go b/pkg/network/group.go index ec99950839..0feb3a0b1f 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -106,13 +106,6 @@ func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { return } -// GroupFromAddress wraps single Address into AddressGroup. -// -// Deprecated: use AddressGroup.FromIterator method. -func GroupFromAddress(addr Address) AddressGroup { - return AddressGroup{addr} -} - // WriteToNodeInfo writes AddressGroup to netmap.NodeInfo structure. func (x AddressGroup) WriteToNodeInfo(ni *netmap.NodeInfo) { addrs := make([]string, len(x)) From 119031c8c758a7bd4dbfd23baf52c7f8e21c938e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:50:40 +0300 Subject: [PATCH 120/219] [#607] network: Make `AddressGroup.WriteToNodeInfo` method a function Method implementation doesn't use any private logic. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/netmap.go | 3 ++- pkg/network/group.go | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 6d6106cbb4..c5d3504adc 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/morph/event" netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" + "github.com/nspcc-dev/neofs-node/pkg/network" netmapTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/netmap/grpc" "github.com/nspcc-dev/neofs-node/pkg/services/control" netmapService "github.com/nspcc-dev/neofs-node/pkg/services/netmap" @@ -77,7 +78,7 @@ func (c *cfg) addressNum() int { } func initNetmapService(c *cfg) { - c.localAddr.WriteToNodeInfo(&c.cfgNodeInfo.localInfo) + network.WriteToNodeInfo(c.localAddr, &c.cfgNodeInfo.localInfo) c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes()) c.cfgNodeInfo.localInfo.SetAttributes(parseAttributes(c.appCfg)...) c.cfgNodeInfo.localInfo.SetState(netmapSDK.NodeStateOffline) diff --git a/pkg/network/group.go b/pkg/network/group.go index 0feb3a0b1f..43c5c6641e 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -107,12 +107,14 @@ func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { } // WriteToNodeInfo writes AddressGroup to netmap.NodeInfo structure. -func (x AddressGroup) WriteToNodeInfo(ni *netmap.NodeInfo) { - addrs := make([]string, len(x)) +func WriteToNodeInfo(g AddressGroup, ni *netmap.NodeInfo) { + num := g.Len() + addrs := make([]string, 0, num) - for i := range x { - addrs[i] = x[i].String() - } + g.IterateAddresses(func(addr Address) bool { + addrs = append(addrs, addr.String()) + return false + }) ni.SetAddresses(addrs...) } From cbe20a2bac53bf82dcf4a170666bf43069dc7c7d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 12:57:03 +0300 Subject: [PATCH 121/219] [#607] network: Add helper function to iterate over all addresses Signed-off-by: Leonard Lyubich --- pkg/network/group.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/network/group.go b/pkg/network/group.go index 43c5c6641e..d56b4c8dc4 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -19,9 +19,8 @@ type AddressGroup []Address func StringifyGroup(x AddressGroup) string { var s string - x.IterateAddresses(func(addr Address) bool { + iterateAllAddresses(x, func(addr Address) { s += addr.String() - return false }) return s @@ -40,6 +39,15 @@ func (x AddressGroup) IterateAddresses(f func(Address) bool) { } } +// iterateAllAddresses iterates over all network addresses of g +// and passes each of them to f. +func iterateAllAddresses(g AddressGroup, f func(Address)) { + g.IterateAddresses(func(addr Address) bool { + f(addr) + return false + }) +} + // Len returns number of addresses in AddressGroup. func (x AddressGroup) Len() int { return len(x) @@ -111,9 +119,8 @@ func WriteToNodeInfo(g AddressGroup, ni *netmap.NodeInfo) { num := g.Len() addrs := make([]string, 0, num) - g.IterateAddresses(func(addr Address) bool { + iterateAllAddresses(g, func(addr Address) { addrs = append(addrs, addr.String()) - return false }) ni.SetAddresses(addrs...) From 43eff09944c40b762bd14d22d848c27f802d0a92 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 23 Jun 2021 15:27:00 +0300 Subject: [PATCH 122/219] [#607] *: Do not use deprecated elements of code Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/netmap.go | 4 +- pkg/innerring/processors/audit/process.go | 3 +- pkg/innerring/rpc.go | 3 +- pkg/network/group.go | 38 ++++++++++++------- pkg/network/validation.go | 12 +----- pkg/network/validation_test.go | 2 +- pkg/services/audit/auditor/pdp.go | 3 +- pkg/services/audit/auditor/por.go | 3 +- pkg/services/object/get/get_test.go | 2 +- pkg/services/object/search/search_test.go | 2 +- .../placement/traverser_test.go | 2 +- 11 files changed, 41 insertions(+), 33 deletions(-) diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 4cb7a3acab..a253831163 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -178,8 +178,10 @@ func prettyPrintNodeInfo(cmd *cobra.Command, i *netmap.NodeInfo, jsonEncoding bo } cmd.Println("key:", hex.EncodeToString(i.PublicKey())) - cmd.Println("address:", i.Address()) cmd.Println("state:", i.State()) + netmap.IterateAllAddresses(i, func(s string) { + cmd.Println("address:", s) + }) for _, attribute := range i.Attributes() { cmd.Printf("attribute: %s=%s\n", attribute.Key(), attribute.Value()) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index 0138c40d4b..c9957aca1d 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -2,6 +2,7 @@ package audit import ( "context" + "encoding/hex" "github.com/nspcc-dev/neofs-api-go/pkg/client" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" @@ -113,7 +114,7 @@ func (ap *Processor) findStorageGroups(cid *cid.ID, shuffled netmap.Nodes) []*ob for i := range shuffled { // consider iterating over some part of container log := ap.log.With( zap.Stringer("cid", cid), - zap.String("address", shuffled[0].Address()), + zap.String("key", hex.EncodeToString(shuffled[0].PublicKey())), zap.Int("try", i), zap.Int("total_tries", ln), ) diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index be0158d295..e78c2b1e5d 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -3,6 +3,7 @@ package innerring import ( "context" "crypto/ecdsa" + "encoding/hex" "fmt" "time" @@ -80,7 +81,7 @@ func (c *ClientCache) getSG(ctx context.Context, addr *object.Address, nm *netma err := netAddr.FromIterator(node) if err != nil { c.log.Warn("can't parse remote address", - zap.String("address", node.Address()), + zap.String("key", hex.EncodeToString(node.PublicKey())), zap.String("error", err.Error())) continue diff --git a/pkg/network/group.go b/pkg/network/group.go index d56b4c8dc4..8c2a8be87f 100644 --- a/pkg/network/group.go +++ b/pkg/network/group.go @@ -2,6 +2,7 @@ package network import ( "errors" + "fmt" "sort" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -78,13 +79,12 @@ type MultiAddressIterator interface { // The result is sorted with sort.Sort. // // Returns an error in the absence of addresses or if any of the addresses are incorrect. -func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { +func (x *AddressGroup) FromIterator(iter MultiAddressIterator) error { as := *x addrNum := iter.NumberOfAddresses() if addrNum <= 0 { - err = errors.New("missing network addresses") - return + return errors.New("missing network addresses") } if cap(as) >= addrNum { @@ -93,23 +93,35 @@ func (x *AddressGroup) FromIterator(iter MultiAddressIterator) (err error) { as = make(AddressGroup, 0, addrNum) } + err := iterateParsedAddresses(iter, func(a Address) error { + as = append(as, a) + return nil + }) + + if err == nil { + sort.Sort(as) + *x = as + } + + return err +} + +// iterateParsedAddresses parses each address from MultiAddressIterator and passes it to f +// until 1st parsing failure or f's error. +func iterateParsedAddresses(iter MultiAddressIterator, f func(s Address) error) (err error) { iter.IterateAddresses(func(s string) bool { var a Address err = a.FromString(s) - - fail := err != nil - if !fail { - as = append(as, a) + if err != nil { + err = fmt.Errorf("could not parse address from string: %w", err) + return true } - return fail - }) + err = f(a) - if err == nil { - sort.Sort(as) - *x = as - } + return err != nil + }) return } diff --git a/pkg/network/validation.go b/pkg/network/validation.go index 66dd5982a1..fb2aa153f8 100644 --- a/pkg/network/validation.go +++ b/pkg/network/validation.go @@ -2,7 +2,6 @@ package network import ( "errors" - "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" ) @@ -47,16 +46,7 @@ var ( // 3. tls(optional, may be absent) // func VerifyMultiAddress(ni *netmap.NodeInfo) error { - // check if it can be parsed to network.Address - var netAddr Address - - err := netAddr.FromString(ni.Address()) - if err != nil { - return fmt.Errorf("could not parse multiaddr from NodeInfo: %w", err) - } - - // check amount of protocols and its order - return checkProtocols(netAddr) + return iterateParsedAddresses(ni, checkProtocols) } func checkProtocols(a Address) error { diff --git a/pkg/network/validation_test.go b/pkg/network/validation_test.go index 8409b29153..d27517f7ca 100644 --- a/pkg/network/validation_test.go +++ b/pkg/network/validation_test.go @@ -58,7 +58,7 @@ func TestVerifyMultiAddress_Order(t *testing.T) { func constructNodeInfo(address string) *netmap.NodeInfo { ni := new(netmap.NodeInfo) - ni.SetAddress(address) + ni.SetAddresses(address) return ni } diff --git a/pkg/services/audit/auditor/pdp.go b/pkg/services/audit/auditor/pdp.go index 39d2e6bb62..49e481c119 100644 --- a/pkg/services/audit/auditor/pdp.go +++ b/pkg/services/audit/auditor/pdp.go @@ -2,6 +2,7 @@ package auditor import ( "bytes" + "encoding/hex" "sync" "time" @@ -117,7 +118,7 @@ func (c *Context) collectHashes(p *gamePair) { if err != nil { c.log.Debug("could not get payload range hash", zap.Stringer("id", p.id), - zap.String("node", n.Address()), + zap.String("node", hex.EncodeToString(n.PublicKey())), zap.String("error", err.Error()), ) return diff --git a/pkg/services/audit/auditor/por.go b/pkg/services/audit/auditor/por.go index afb88278dd..a0c65a1ee9 100644 --- a/pkg/services/audit/auditor/por.go +++ b/pkg/services/audit/auditor/por.go @@ -2,6 +2,7 @@ package auditor import ( "bytes" + "encoding/hex" "sync" "github.com/nspcc-dev/neofs-api-go/pkg/object" @@ -80,7 +81,7 @@ func (c *Context) checkStorageGroupPoR(ind int, sg *object.ID) { hdr, err := c.cnrCom.GetHeader(c.task, flat[j], members[i], true) if err != nil { c.log.Debug("can't head object", - zap.String("remote_node", flat[j].Address()), + zap.String("remote_node", hex.EncodeToString(flat[j].PublicKey())), zap.Stringer("oid", members[i])) continue diff --git a/pkg/services/object/get/get_test.go b/pkg/services/object/get/get_test.go index 94c2a38854..8708777e6b 100644 --- a/pkg/services/object/get/get_test.go +++ b/pkg/services/object/get/get_test.go @@ -407,7 +407,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { ) ni := netmap.NewNodeInfo() - ni.SetAddress(a) + ni.SetAddresses(a) var na network.AddressGroup diff --git a/pkg/services/object/search/search_test.go b/pkg/services/object/search/search_test.go index 8ec231b9e9..ec8b32c242 100644 --- a/pkg/services/object/search/search_test.go +++ b/pkg/services/object/search/search_test.go @@ -201,7 +201,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([]netmap.Nodes, [][]string) { ) ni := netmap.NewNodeInfo() - ni.SetAddress(a) + ni.SetAddresses(a) var na network.AddressGroup diff --git a/pkg/services/object_manager/placement/traverser_test.go b/pkg/services/object_manager/placement/traverser_test.go index ed25d0667d..59f833822b 100644 --- a/pkg/services/object_manager/placement/traverser_test.go +++ b/pkg/services/object_manager/placement/traverser_test.go @@ -20,7 +20,7 @@ func (b testBuilder) BuildPlacement(*object.Address, *netmap.PlacementPolicy) ([ } func testNode(v uint32) (n netmap.NodeInfo) { - n.SetAddress("/ip4/0.0.0.0/tcp/" + strconv.Itoa(int(v))) + n.SetAddresses("/ip4/0.0.0.0/tcp/" + strconv.Itoa(int(v))) return n } From 6f861b64893291acb010591dc44eb76612648ae1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Jun 2021 15:25:11 +0300 Subject: [PATCH 123/219] [#607] network: Support URI address strings Make Address.FromString method to parse URI addresses and enable TLS for TLS schemes. Signed-off-by: Leonard Lyubich --- pkg/network/address.go | 39 +++++++++++++++++++++++++++++++++++-- pkg/network/address_test.go | 2 ++ pkg/network/tls_test.go | 9 ++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/pkg/network/address.go b/pkg/network/address.go index 8fe808a201..a1758a4971 100644 --- a/pkg/network/address.go +++ b/pkg/network/address.go @@ -3,6 +3,7 @@ package network import ( "fmt" "net" + "net/url" "strings" "github.com/multiformats/go-multiaddr" @@ -13,6 +14,7 @@ import ( HostAddr strings: "localhost:8080", ":8080", "192.168.0.1:8080" MultiAddr strings: "/dns4/localhost/tcp/8080", "/ip4/192.168.0.1/tcp/8080" IPAddr strings: "192.168.0.1:8080" + URIAddr strings: "127.0.0.1:8080" */ // Address represents the NeoFS node @@ -53,21 +55,54 @@ func (a Address) HostAddr() string { // FromString restores Address from a string representation. // -// Supports MultiAddr and HostAddr strings. +// Supports URIAddr, MultiAddr and HostAddr strings. func (a *Address) FromString(s string) error { var err error a.ma, err = multiaddr.NewMultiaddr(s) if err != nil { - s, err = multiaddrStringFromHostAddr(s) + var u uri + + u.parse(s) + + s, err = multiaddrStringFromHostAddr(u.host) if err == nil { a.ma, err = multiaddr.NewMultiaddr(s) + if err == nil && u.tls { + a.ma = a.ma.Encapsulate(tls) + } } } return err } +type uri struct { + host string + tls bool +} + +const grpcTLSScheme = "grpcs" + +func (u *uri) parse(s string) { + // TODO: code is copy-pasted from client.WithURIAddress function. + // Would be nice to share the code. + uri, err := url.ParseRequestURI(s) + isURI := err == nil + + if isURI && uri.Host != "" { + u.host = uri.Host + } else { + u.host = s + } + + // check if passed string was parsed correctly + // URIs that do not start with a slash after the scheme are interpreted as: + // `scheme:opaque` => if `opaque` is not empty, then it is supposed that URI + // is in `host:port` format + u.tls = isURI && uri.Opaque == "" && uri.Scheme == grpcTLSScheme +} + // multiaddrStringFromHostAddr converts "localhost:8080" to "/dns4/localhost/tcp/8080" func multiaddrStringFromHostAddr(host string) (string, error) { endpoint, port, err := net.SplitHostPort(host) diff --git a/pkg/network/address_test.go b/pkg/network/address_test.go index a293b7ed14..91148a9e3f 100644 --- a/pkg/network/address_test.go +++ b/pkg/network/address_test.go @@ -17,6 +17,8 @@ func TestAddressFromString(t *testing.T) { {"example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)}, {"213.44.87.1:32512", buildMultiaddr("/ip4/213.44.87.1/tcp/32512", t)}, {"[2004:eb1::1]:8080", buildMultiaddr("/ip6/2004:eb1::1/tcp/8080", t)}, + {"grpc://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070", t)}, + {grpcTLSScheme + "://example.com:7070", buildMultiaddr("/dns4/example.com/tcp/7070/"+tlsProtocolName, t)}, } var addr Address diff --git a/pkg/network/tls_test.go b/pkg/network/tls_test.go index 541369c7fd..c7715b449d 100644 --- a/pkg/network/tls_test.go +++ b/pkg/network/tls_test.go @@ -14,12 +14,15 @@ func TestAddress_TLSEnabled(t *testing.T) { {"/dns4/localhost/tcp/8080", false}, {"/dns4/localhost/tcp/8080/tls", true}, {"/tls/dns4/localhost/tcp/8080", true}, + {"grpc://localhost:8080", false}, + {"grpcs://localhost:8080", true}, } + var addr Address + for _, test := range testCases { - addr := Address{ - ma: buildMultiaddr(test.input, t), - } + err := addr.FromString(test.input) + require.NoError(t, err) require.Equal(t, test.wantTLS, addr.TLSEnabled(), test.input) } From 81ddaeca169bb184b9c0e24029cbf06baaa59154 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 24 Jun 2021 15:41:19 +0300 Subject: [PATCH 124/219] [#607] config/example: Add all formats of node's network addresses Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config/node/config_test.go | 48 ++++++++++++++++++----- config/example/node.env | 2 +- config/example/node.json | 4 +- config/example/node.yaml | 4 +- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index 00b67e424b..6e49a85545 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -40,21 +40,51 @@ func TestNodeSection(t *testing.T) { var fileConfigTest = func(c *config.Config) { key := Key(c) - addr := BootstrapAddresses(c) + addrs := BootstrapAddresses(c) attributes := Attributes(c) relay := Relay(c) wKey := Wallet(c) - var expectedAddr network.AddressGroup - - err := expectedAddr.FromIterator(stringAddressGroup([]string{ - "s01.neofs.devenv:8080", - "s02.neofs.devenv:8081", - })) - require.NoError(t, err) + expectedAddr := []struct { + str string + host string + tls bool + }{ + { + str: "/dns4/localhost/tcp/8083/tls", + host: "localhost:8083", + tls: true, + }, + { + str: "/dns4/s01.neofs.devenv/tcp/8080", + host: "s01.neofs.devenv:8080", + }, + { + str: "/dns4/s02.neofs.devenv/tcp/8081", + host: "s02.neofs.devenv:8081", + }, + { + str: "/ip4/127.0.0.1/tcp/8082", + host: "127.0.0.1:8082", + }, + } require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address()) - require.Equal(t, expectedAddr, addr) + + require.EqualValues(t, len(expectedAddr), addrs.Len()) + + ind := 0 + + addrs.IterateAddresses(func(addr network.Address) bool { + require.Equal(t, expectedAddr[ind].str, addr.String()) + require.Equal(t, expectedAddr[ind].host, addr.HostAddr()) + require.Equal(t, expectedAddr[ind].tls, addr.TLSEnabled()) + + ind++ + + return false + }) + require.Equal(t, true, relay) require.Len(t, attributes, 2) diff --git a/config/example/node.env b/config/example/node.env index 42e395c4d2..1a62c8641b 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -11,7 +11,7 @@ NEOFS_NODE_KEY=./wallet.key NEOFS_NODE_WALLET_PATH=./wallet.json NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz NEOFS_NODE_WALLET_PASSWORD=password -NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 s02.neofs.devenv:8081 +NEOFS_NODE_ADDRESSES=s01.neofs.devenv:8080 /dns4/s02.neofs.devenv/tcp/8081 grpc://127.0.0.1:8082 grpcs://localhost:8083 NEOFS_NODE_ATTRIBUTE_0=Price:11 NEOFS_NODE_ATTRIBUTE_1=UN-LOCODE:RU MSK NEOFS_NODE_RELAY=true diff --git a/config/example/node.json b/config/example/node.json index bd6baceeed..abea66e9d8 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -19,7 +19,9 @@ }, "addresses": [ "s01.neofs.devenv:8080", - "s02.neofs.devenv:8081" + "/dns4/s02.neofs.devenv/tcp/8081", + "grpc://127.0.0.1:8082", + "grpcs://localhost:8083" ], "attribute_0": "Price:11", "attribute_1": "UN-LOCODE:RU MSK", diff --git a/config/example/node.yaml b/config/example/node.yaml index c7c576f3de..f3dccb8bfe 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -17,7 +17,9 @@ node: password: "password" addresses: - s01.neofs.devenv:8080 - - s02.neofs.devenv:8081 + - /dns4/s02.neofs.devenv/tcp/8081 + - grpc://127.0.0.1:8082 + - grpcs://localhost:8083 attribute_0: "Price:11" attribute_1: UN-LOCODE:RU MSK relay: true From f8ee6b11646b3cf2a2e9e5a85dbad70995d8c75f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 25 Jun 2021 18:38:58 +0300 Subject: [PATCH 125/219] [#607] services/netmap: Support backward compatibility Make Netmap service to return single network address on `LocalNodeInfo` RPC in order to older clients. Signed-off-by: Leonard Lyubich --- pkg/services/netmap/executor.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/services/netmap/executor.go b/pkg/services/netmap/executor.go index c8ff143629..12b3ffd4e1 100644 --- a/pkg/services/netmap/executor.go +++ b/pkg/services/netmap/executor.go @@ -45,12 +45,30 @@ func NewExecutionService(s NodeState, v *pkg.Version, netInfo NetworkInfo) Serve func (s *executorSvc) LocalNodeInfo( _ context.Context, - _ *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) { + req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) { + ver := pkg.NewVersionFromV2(req.GetMetaHeader().GetVersion()) + if err := pkg.IsSupportedVersion(ver); err != nil { + return nil, err + } + ni, err := s.state.LocalNodeInfo() if err != nil { return nil, err } + if addrNum := ni.NumberOfAddresses(); addrNum > 0 && ver.Minor() <= 7 { + ni2 := new(netmap.NodeInfo) + ni2.SetPublicKey(ni.GetPublicKey()) + ni2.SetState(ni.GetState()) + ni2.SetAttributes(ni.GetAttributes()) + ni.IterateAddresses(func(s string) bool { + ni2.SetAddresses(s) + return true + }) + + ni = ni2 + } + body := new(netmap.LocalNodeInfoResponseBody) body.SetVersion(s.version.ToV2()) body.SetNodeInfo(ni) From 8eadf18e015981dd8a11e4ce661e6fc2b5388a2e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 15:44:20 +0300 Subject: [PATCH 126/219] [#607] services/control: Fix incorrect allocation in NetmapSnapshot Fix make with length + subsequent append. Signed-off-by: Leonard Lyubich --- pkg/services/control/server/netmap_snapshot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/control/server/netmap_snapshot.go b/pkg/services/control/server/netmap_snapshot.go index 4c55cf1e26..19250d65e8 100644 --- a/pkg/services/control/server/netmap_snapshot.go +++ b/pkg/services/control/server/netmap_snapshot.go @@ -54,7 +54,7 @@ func nodesFromAPI(apiNodes netmapAPI.Nodes) []*control.NodeInfo { node := new(control.NodeInfo) node.SetPublicKey(apiNode.PublicKey()) - addrs := make([]string, apiNode.NumberOfAddresses()) + addrs := make([]string, 0, apiNode.NumberOfAddresses()) netmapAPI.IterateAllAddresses(apiNode.NodeInfo, func(s string) { addrs = append(addrs, s) }) From 61f48a27367adcd8e3fd716a17f2b52c4b1a7593 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 16:28:12 +0300 Subject: [PATCH 127/219] [#651] cmd/cli: Replace netmap snapshot from netmap section to control There is a need to have all `Control` service-related commands in `control` section. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/control.go | 48 ++++++++++++++++++++++++++++++ cmd/neofs-cli/modules/netmap.go | 50 -------------------------------- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/cmd/neofs-cli/modules/control.go b/cmd/neofs-cli/modules/control.go index 9aed2839bc..692c275ab8 100644 --- a/cmd/neofs-cli/modules/control.go +++ b/cmd/neofs-cli/modules/control.go @@ -60,6 +60,7 @@ func init() { healthCheckCmd, setNetmapStatusCmd, dropObjectsCmd, + snapshotCmd, ) setNetmapStatusCmd.Flags().StringVarP(&netmapStatus, netmapStatusFlag, "", "", @@ -77,6 +78,9 @@ func init() { _ = dropObjectsCmd.MarkFlagRequired(dropObjectsFlag) healthCheckCmd.Flags().BoolVar(&healthCheckIRVar, healthcheckIRFlag, false, "Communicate with IR node") + + snapshotCmd.Flags().BoolVar(&netmapSnapshotJSON, "json", false, + "print netmap structure in JSON format") } func healthCheck(cmd *cobra.Command, _ []string) { @@ -279,3 +283,47 @@ var dropObjectsCmd = &cobra.Command{ cmd.Println("Objects were successfully marked to be removed.") }, } + +var snapshotCmd = &cobra.Command{ + Use: "netmap-snapshot", + Short: "Get network map snapshot", + Long: "Get network map snapshot", + Run: func(cmd *cobra.Command, args []string) { + key, err := getKey() + if err != nil { + cmd.PrintErrln(err) + return + } + + req := new(control.NetmapSnapshotRequest) + req.SetBody(new(control.NetmapSnapshotRequest_Body)) + + if err := controlSvc.SignMessage(key, req); err != nil { + cmd.PrintErrln(err) + return + } + + cli, err := getSDKClient(key) + if err != nil { + cmd.PrintErrln(err) + return + } + + resp, err := control.NetmapSnapshot(cli.Raw(), req) + if err != nil { + cmd.PrintErrln(err) + return + } + + sign := resp.GetSignature() + + if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }); err != nil { + cmd.PrintErrln(err) + return + } + + prettyPrintNetmap(cmd, resp.GetBody().GetNetmap(), netmapSnapshotJSON) + }, +} diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index a253831163..1ec9d8be50 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -8,9 +8,7 @@ import ( "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/config/netmode" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-node/pkg/services/control" - controlSvc "github.com/nspcc-dev/neofs-node/pkg/services/control/server" "github.com/spf13/cobra" ) @@ -33,14 +31,10 @@ func init() { netmapCmd.AddCommand( getEpochCmd, localNodeInfoCmd, - snapshotCmd, netInfoCmd, ) localNodeInfoCmd.Flags().BoolVar(&nodeInfoJSON, "json", false, "print node info in JSON format") - - snapshotCmd.Flags().BoolVar(&netmapSnapshotJSON, "json", false, - "print netmap structure in JSON format") } var getEpochCmd = &cobra.Command{ @@ -97,50 +91,6 @@ var localNodeInfoCmd = &cobra.Command{ }, } -var snapshotCmd = &cobra.Command{ - Use: "snapshot", - Short: "Get network map snapshot", - Long: "Get network map snapshot", - Run: func(cmd *cobra.Command, args []string) { - key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } - - req := new(control.NetmapSnapshotRequest) - req.SetBody(new(control.NetmapSnapshotRequest_Body)) - - if err := controlSvc.SignMessage(key, req); err != nil { - cmd.PrintErrln(err) - return - } - - cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } - - resp, err := control.NetmapSnapshot(cli.Raw(), req) - if err != nil { - cmd.PrintErrln(err) - return - } - - sign := resp.GetSignature() - - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(err) - return - } - - prettyPrintNetmap(cmd, resp.GetBody().GetNetmap(), netmapSnapshotJSON) - }, -} - var netInfoCmd = &cobra.Command{ Use: "netinfo", Short: "Get information about NeoFS network", From 56d441091331396dd1591aa916c468a789e62aaf Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 17:01:31 +0300 Subject: [PATCH 128/219] [#638] Update to Go 1.16 Changes: * replace `iotuil` elements with the ones from `os` package; * replace `os.Filemode` with `fs.FileMode`; * use `signal.NotifyContext` instead of `NewGracefulContext` (removed). Signed-off-by: Leonard Lyubich --- .github/workflows/go.yml | 2 +- Dockerfile.cli | 2 +- Dockerfile.ir | 2 +- Dockerfile.storage | 2 +- Dockerfile.storage-testnet | 2 +- cmd/neofs-cli/modules/container.go | 13 ++++---- cmd/neofs-cli/modules/object.go | 7 ++-- cmd/neofs-cli/modules/root.go | 3 +- cmd/neofs-cli/modules/util.go | 11 +++---- cmd/neofs-ir/main.go | 8 +++-- cmd/neofs-node/config/engine/config_test.go | 6 ++-- .../config/engine/shard/blobstor/config.go | 8 ++--- .../config/engine/shard/metabase/config.go | 8 ++--- cmd/neofs-node/config/node/config.go | 4 +-- cmd/neofs-node/main.go | 5 +-- go.mod | 2 +- go.sum | 3 -- .../blobovnicza/blobovnicza.go | 5 +-- pkg/local_object_storage/blobstor/blobstor.go | 4 +-- .../blobstor/fstree/fstree.go | 12 +++---- pkg/local_object_storage/metabase/db.go | 3 +- pkg/local_object_storage/metabase/info.go | 4 +-- pkg/util/grace/grace.go | 32 ------------------- pkg/util/locode/db/airports/db.go | 4 +-- pkg/util/locode/db/airports/opts.go | 8 ++--- pkg/util/locode/db/boltdb/db.go | 4 +-- pkg/util/locode/db/boltdb/opts.go | 3 +- .../locode/db/continents/geojson/calls.go | 4 +-- pkg/util/locode/table/csv/opts.go | 4 +-- pkg/util/locode/table/csv/table.go | 4 +-- 30 files changed, 74 insertions(+), 105 deletions(-) delete mode 100644 pkg/util/grace/grace.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 762a49a315..90a9135499 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - go: [ '1.14.x', '1.15.x', '1.16.x' ] + go: [ '1.16.x' ] steps: - name: Setup go uses: actions/setup-go@v2 diff --git a/Dockerfile.cli b/Dockerfile.cli index 3ba2fbed82..1b309cc9e5 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.ir b/Dockerfile.ir index b6978f1077..aeba28db5a 100644 --- a/Dockerfile.ir +++ b/Dockerfile.ir @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.storage b/Dockerfile.storage index cc3d7d75ba..006839e283 100644 --- a/Dockerfile.storage +++ b/Dockerfile.storage @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/Dockerfile.storage-testnet b/Dockerfile.storage-testnet index 4f570ccb16..9db54d53cb 100644 --- a/Dockerfile.storage-testnet +++ b/Dockerfile.storage-testnet @@ -1,4 +1,4 @@ -FROM golang:1.14-alpine as basebuilder +FROM golang:1.16-alpine as basebuilder RUN apk add --update make bash FROM basebuilder as builder diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 520910cbad..55ddcd9c00 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "math" "os" "strconv" @@ -339,7 +338,7 @@ var getContainerInfoCmd = &cobra.Command{ ) if containerPathFrom != "" { - data, err := ioutil.ReadFile(containerPathFrom) + data, err := os.ReadFile(containerPathFrom) if err != nil { cmd.PrintErrln(fmt.Errorf("can't read file: %w", err)) return @@ -398,7 +397,7 @@ var getContainerInfoCmd = &cobra.Command{ } } - err = ioutil.WriteFile(containerPathTo, data, 0644) + err = os.WriteFile(containerPathTo, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write container to file: %w", err)) return @@ -472,7 +471,7 @@ var getExtendedACLCmd = &cobra.Command{ cmd.Println("Signature:") printJSONMarshaler(cmd, sig, "signature") - if err = ioutil.WriteFile(containerPathTo, data, 0644); err != nil { + if err = os.WriteFile(containerPathTo, data, 0644); err != nil { cmd.PrintErrln(err) } }, @@ -636,7 +635,7 @@ func getSessionToken(path string) (*session.Token, error) { var tok *session.Token if path != "" { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } @@ -661,7 +660,7 @@ func parseContainerPolicy(policyString string) (*netmap.PlacementPolicy, error) if err == nil { printVerbose("Reading placement policy from file: %s", policyString) - data, err := ioutil.ReadFile(policyString) + data, err := os.ReadFile(policyString) if err != nil { return nil, fmt.Errorf("can't read file with placement policy: %w", err) } @@ -839,7 +838,7 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { printVerbose("Reading EACL from file: %s", eaclPath) - data, err := ioutil.ReadFile(eaclPath) + data, err := os.ReadFile(eaclPath) if err != nil { return nil, fmt.Errorf("can't read file with EACL: %w", err) } diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index 34f943c6d0..d020f5ed6f 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "os" "path/filepath" @@ -638,7 +637,7 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) { default: return nil, fmt.Errorf("invalid field number: %d", len(words)) case 1: - data, err := ioutil.ReadFile(words[0]) + data, err := os.ReadFile(words[0]) if err != nil { return nil, err } @@ -808,7 +807,7 @@ func saveAndPrintHeader(cmd *cobra.Command, obj *object.Object, filename string) cmd.Println(string(bs)) return nil } - err := ioutil.WriteFile(filename, bs, os.ModePerm) + err := os.WriteFile(filename, bs, os.ModePerm) if err != nil { return err } @@ -906,7 +905,7 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er return nil, nil } - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("can't read bearer token file: %w", err) } diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 486721827a..6ae57f06c4 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -195,7 +194,7 @@ func getKey() (*ecdsa.PrivateKey, error) { } func getKeyFromFile(keyPath string) (*ecdsa.PrivateKey, error) { - data, err := ioutil.ReadFile(keyPath) + data, err := os.ReadFile(keyPath) if err != nil { return nil, fmt.Errorf("%w: %v", errInvalidKey, err) } diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index 8781614935..64aa148d77 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "os" "strconv" "time" @@ -303,7 +302,7 @@ func signBearerToken(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write signed bearer token to file: %w", err)) return @@ -349,7 +348,7 @@ func signSessionToken(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write signed session token to %s: %w", to, err)) return @@ -389,7 +388,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) { return } - err = ioutil.WriteFile(to, data, 0644) + err = os.WriteFile(to, data, 0644) if err != nil { cmd.PrintErrln(fmt.Errorf("can't write exteded ACL table to file: %w", err)) return @@ -486,7 +485,7 @@ func keyerGenerate(filename string, d *keyer.Dashboard) error { } if filename != "" { - return ioutil.WriteFile(filename, key, 0600) + return os.WriteFile(filename, key, 0600) } return nil @@ -502,7 +501,7 @@ func fileExists(filename string) bool { } func keyerParseFile(filename string, d *keyer.Dashboard) error { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return fmt.Errorf("can't open %v file: %w", filename, err) } diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index bfbb4ccfb2..aad9891990 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -1,16 +1,18 @@ package main import ( + "context" "flag" "fmt" "net/http" "os" + "os/signal" "strings" + "syscall" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/misc" "github.com/nspcc-dev/neofs-node/pkg/innerring" - "github.com/nspcc-dev/neofs-node/pkg/util/grace" httputil "github.com/nspcc-dev/neofs-node/pkg/util/http" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -58,7 +60,9 @@ func main() { log, err := logger.NewLogger(logPrm) exitErr(err) - ctx := grace.NewGracefulContext(log) + ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) + defer cancel() + intErr := make(chan error) // internal inner ring errors httpServers := initHTTPServers(cfg) diff --git a/cmd/neofs-node/config/engine/config_test.go b/cmd/neofs-node/config/engine/config_test.go index 98ce0ea1dc..d540b9a70c 100644 --- a/cmd/neofs-node/config/engine/config_test.go +++ b/cmd/neofs-node/config/engine/config_test.go @@ -1,7 +1,7 @@ package engineconfig_test import ( - "os" + "io/fs" "testing" "time" @@ -47,7 +47,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 555, wc.WorkersNumber()) require.Equal(t, "tmp/0/meta", meta.Path()) - require.Equal(t, os.FileMode(0700), meta.Perm()) + require.Equal(t, fs.FileMode(0700), meta.Perm()) require.Equal(t, "tmp/0/blob", blob.Path()) require.EqualValues(t, 0666, blob.Perm()) @@ -73,7 +73,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 556, wc.WorkersNumber()) require.Equal(t, "tmp/1/meta", meta.Path()) - require.Equal(t, os.FileMode(0701), meta.Perm()) + require.Equal(t, fs.FileMode(0701), meta.Perm()) require.Equal(t, "tmp/1/blob", blob.Path()) require.EqualValues(t, 0667, blob.Perm()) diff --git a/cmd/neofs-node/config/engine/shard/blobstor/config.go b/cmd/neofs-node/config/engine/shard/blobstor/config.go index 4194046371..791dfb1930 100644 --- a/cmd/neofs-node/config/engine/shard/blobstor/config.go +++ b/cmd/neofs-node/config/engine/shard/blobstor/config.go @@ -1,7 +1,7 @@ package blobstorconfig import ( - "os" + "io/fs" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" blobovniczaconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard/blobstor/blobovnicza" @@ -45,10 +45,10 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a os.FileMode. +// Perm returns value of "perm" config parameter as a fs.FileMode. // // Returns PermDefault if value is not a non-zero number. -func (x *Config) Perm() os.FileMode { +func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), "perm", @@ -58,7 +58,7 @@ func (x *Config) Perm() os.FileMode { p = PermDefault } - return os.FileMode(p) + return fs.FileMode(p) } // ShallowDepth returns value of "shallow_depth" config parameter. diff --git a/cmd/neofs-node/config/engine/shard/metabase/config.go b/cmd/neofs-node/config/engine/shard/metabase/config.go index a5df71e6c6..0a0466ef2a 100644 --- a/cmd/neofs-node/config/engine/shard/metabase/config.go +++ b/cmd/neofs-node/config/engine/shard/metabase/config.go @@ -1,7 +1,7 @@ package metabaseconfig import ( - "os" + "io/fs" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) @@ -37,10 +37,10 @@ func (x *Config) Path() string { return p } -// Perm returns value of "perm" config parameter as a os.FileMode. +// Perm returns value of "perm" config parameter as a fs.FileMode. // // Returns PermDefault if value is not a positive number. -func (x *Config) Perm() os.FileMode { +func (x *Config) Perm() fs.FileMode { p := config.UintSafe( (*config.Config)(x), "perm", @@ -50,5 +50,5 @@ func (x *Config) Perm() os.FileMode { p = PermDefault } - return os.FileMode(p) + return fs.FileMode(p) } diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index c22fb239a0..2aad548b50 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -3,7 +3,7 @@ package nodeconfig import ( "errors" "fmt" - "io/ioutil" + "os" "strconv" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -35,7 +35,7 @@ func Key(c *config.Config) *keys.PrivateKey { err error data []byte ) - if data, err = ioutil.ReadFile(v); err == nil { + if data, err = os.ReadFile(v); err == nil { key, err = keys.NewPrivateKeyFromBytes(data) } diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index 70f891f22c..d311857f9a 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -5,10 +5,11 @@ import ( "flag" "fmt" "log" + "os/signal" + "syscall" "github.com/nspcc-dev/neofs-node/misc" "github.com/nspcc-dev/neofs-node/pkg/services/control" - "github.com/nspcc-dev/neofs-node/pkg/util/grace" "go.uber.org/zap" ) @@ -48,7 +49,7 @@ func main() { } func initApp(c *cfg) { - c.ctx, c.ctxCancel = context.WithCancel(grace.NewGracefulContext(nil)) + c.ctx, c.ctxCancel = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) initGRPC(c) diff --git a/go.mod b/go.mod index ecc70dbd4c..c8e8e887e2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/neofs-node -go 1.14 +go 1.16 require ( github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 24cc0acb3f..5887cf045d 100644 --- a/go.sum +++ b/go.sum @@ -226,7 +226,6 @@ github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -335,7 +334,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -538,7 +536,6 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza.go b/pkg/local_object_storage/blobovnicza/blobovnicza.go index d316f3d79f..fc7795d354 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza.go @@ -1,6 +1,7 @@ package blobovnicza import ( + "io/fs" "os" "time" @@ -33,7 +34,7 @@ type cfg struct { } type boltDBCfg struct { - perm os.FileMode + perm fs.FileMode path string @@ -77,7 +78,7 @@ func WithPath(path string) Option { // WithPermissions returns option to specify permission bits // of Blobovnicza's system path. -func WithPermissions(perm os.FileMode) Option { +func WithPermissions(perm fs.FileMode) Option { return func(c *cfg) { c.perm = perm } diff --git a/pkg/local_object_storage/blobstor/blobstor.go b/pkg/local_object_storage/blobstor/blobstor.go index aa3fdddcf8..30ee25d65c 100644 --- a/pkg/local_object_storage/blobstor/blobstor.go +++ b/pkg/local_object_storage/blobstor/blobstor.go @@ -2,7 +2,7 @@ package blobstor import ( "encoding/hex" - "os" + "io/fs" "path" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" @@ -145,7 +145,7 @@ func WithRootPath(rootDir string) Option { // WithRootPerm returns option to set permission // bits of the fs tree. -func WithRootPerm(perm os.FileMode) Option { +func WithRootPerm(perm fs.FileMode) Option { return func(c *cfg) { c.fsTree.Permissions = perm c.blzOpts = append(c.blzOpts, blobovnicza.WithPermissions(perm)) diff --git a/pkg/local_object_storage/blobstor/fstree/fstree.go b/pkg/local_object_storage/blobstor/fstree/fstree.go index 840e9d08e8..d22fd73cce 100644 --- a/pkg/local_object_storage/blobstor/fstree/fstree.go +++ b/pkg/local_object_storage/blobstor/fstree/fstree.go @@ -3,7 +3,7 @@ package fstree import ( "crypto/sha256" "errors" - "io/ioutil" + "io/fs" "os" "path" "strings" @@ -23,7 +23,7 @@ type FSTree struct { // Info groups the information about file storage. type Info struct { // Permission bits of the root directory. - Permissions os.FileMode + Permissions fs.FileMode // Full path to the root directory. RootPath string @@ -73,7 +73,7 @@ func (t *FSTree) Iterate(f func(addr *objectSDK.Address, data []byte) error) err func (t *FSTree) iterate(depth int, curPath []string, f func(*objectSDK.Address, []byte) error) error { curName := strings.Join(curPath[1:], "") - des, err := ioutil.ReadDir(path.Join(curPath...)) + des, err := os.ReadDir(path.Join(curPath...)) if err != nil { return err } @@ -101,7 +101,7 @@ func (t *FSTree) iterate(depth int, curPath []string, f func(*objectSDK.Address, continue } - data, err := ioutil.ReadFile(path.Join(curPath...)) + data, err := os.ReadFile(path.Join(curPath...)) if err != nil { return err } @@ -161,7 +161,7 @@ func (t *FSTree) Put(addr *objectSDK.Address, data []byte) error { return err } - return ioutil.WriteFile(p, data, t.Permissions) + return os.WriteFile(p, data, t.Permissions) } // Get returns object from storage by address. @@ -172,5 +172,5 @@ func (t *FSTree) Get(addr *objectSDK.Address) ([]byte, error) { return nil, ErrFileNotFound } - return ioutil.ReadFile(p) + return os.ReadFile(p) } diff --git a/pkg/local_object_storage/metabase/db.go b/pkg/local_object_storage/metabase/db.go index 0b219fc597..bee091a6b1 100644 --- a/pkg/local_object_storage/metabase/db.go +++ b/pkg/local_object_storage/metabase/db.go @@ -3,6 +3,7 @@ package meta import ( "encoding/binary" "encoding/hex" + "io/fs" "os" "strconv" @@ -132,7 +133,7 @@ func WithPath(path string) Option { // WithPermissions returns option to specify permission bits // of Metabase system path. -func WithPermissions(perm os.FileMode) Option { +func WithPermissions(perm fs.FileMode) Option { return func(c *cfg) { c.info.Permission = perm } diff --git a/pkg/local_object_storage/metabase/info.go b/pkg/local_object_storage/metabase/info.go index 967e9c713e..7d1bfefb7e 100644 --- a/pkg/local_object_storage/metabase/info.go +++ b/pkg/local_object_storage/metabase/info.go @@ -1,7 +1,7 @@ package meta import ( - "os" + "io/fs" ) // Info groups the information about DB. @@ -10,7 +10,7 @@ type Info struct { Path string // Permission of database file. - Permission os.FileMode + Permission fs.FileMode } // DumpInfo returns information about the DB. diff --git a/pkg/util/grace/grace.go b/pkg/util/grace/grace.go deleted file mode 100644 index 100e124d05..0000000000 --- a/pkg/util/grace/grace.go +++ /dev/null @@ -1,32 +0,0 @@ -package grace - -import ( - "context" - "fmt" - "os" - "os/signal" - "syscall" - - "go.uber.org/zap" -) - -// NewGracefulContext returns grace context that cancelled by sigint, -// sigterm and sighup. -func NewGracefulContext(l *zap.Logger) context.Context { - ctx, cancel := context.WithCancel(context.Background()) - - go func() { - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP) - sig := <-ch - if l != nil { - l.Info("received signal", - zap.String("signal", sig.String())) - } else { - fmt.Printf("received signal %s\n", sig) - } - cancel() - }() - - return ctx -} diff --git a/pkg/util/locode/db/airports/db.go b/pkg/util/locode/db/airports/db.go index d63aaa518e..f14414cc17 100644 --- a/pkg/util/locode/db/airports/db.go +++ b/pkg/util/locode/db/airports/db.go @@ -2,7 +2,7 @@ package airportsdb import ( "fmt" - "os" + "io/fs" "sync" ) @@ -41,7 +41,7 @@ type DB struct { type pathMode struct { path string - mode os.FileMode + mode fs.FileMode } const invalidPrmValFmt = "invalid parameter %s (%T):%v" diff --git a/pkg/util/locode/db/airports/opts.go b/pkg/util/locode/db/airports/opts.go index 1f5a3ea6ae..3799d9e270 100644 --- a/pkg/util/locode/db/airports/opts.go +++ b/pkg/util/locode/db/airports/opts.go @@ -1,19 +1,19 @@ package airportsdb import ( - "os" + "io/fs" ) // Option sets an optional parameter of DB. type Option func(*options) type options struct { - airportMode, countryMode os.FileMode + airportMode, countryMode fs.FileMode } func defaultOpts() *options { return &options{ - airportMode: os.ModePerm, // 0777 - countryMode: os.ModePerm, // 0777 + airportMode: fs.ModePerm, // 0777 + countryMode: fs.ModePerm, // 0777 } } diff --git a/pkg/util/locode/db/boltdb/db.go b/pkg/util/locode/db/boltdb/db.go index 53a23b22d1..56655841a9 100644 --- a/pkg/util/locode/db/boltdb/db.go +++ b/pkg/util/locode/db/boltdb/db.go @@ -2,7 +2,7 @@ package locodebolt import ( "fmt" - "os" + "io/fs" "go.etcd.io/bbolt" ) @@ -34,7 +34,7 @@ type Prm struct { type DB struct { path string - mode os.FileMode + mode fs.FileMode boltOpts *bbolt.Options diff --git a/pkg/util/locode/db/boltdb/opts.go b/pkg/util/locode/db/boltdb/opts.go index 62b132596a..db0cccd3a0 100644 --- a/pkg/util/locode/db/boltdb/opts.go +++ b/pkg/util/locode/db/boltdb/opts.go @@ -1,6 +1,7 @@ package locodebolt import ( + "io/fs" "os" "time" @@ -11,7 +12,7 @@ import ( type Option func(*options) type options struct { - mode os.FileMode + mode fs.FileMode boltOpts *bbolt.Options } diff --git a/pkg/util/locode/db/continents/geojson/calls.go b/pkg/util/locode/db/continents/geojson/calls.go index 288fded6f7..06842e3369 100644 --- a/pkg/util/locode/db/continents/geojson/calls.go +++ b/pkg/util/locode/db/continents/geojson/calls.go @@ -2,7 +2,7 @@ package continentsdb import ( "fmt" - "io/ioutil" + "os" locodedb "github.com/nspcc-dev/neofs-node/pkg/util/locode/db" "github.com/paulmach/orb" @@ -53,7 +53,7 @@ func (db *DB) PointContinent(point *locodedb.Point) (*locodedb.Continent, error) } func (db *DB) init() error { - data, err := ioutil.ReadFile(db.path) + data, err := os.ReadFile(db.path) if err != nil { return fmt.Errorf("could not read data file: %w", err) } diff --git a/pkg/util/locode/table/csv/opts.go b/pkg/util/locode/table/csv/opts.go index b638d25d55..e521ddf7f1 100644 --- a/pkg/util/locode/table/csv/opts.go +++ b/pkg/util/locode/table/csv/opts.go @@ -1,14 +1,14 @@ package csvlocode import ( - "os" + "io/fs" ) // Option sets an optional parameter of Table. type Option func(*options) type options struct { - mode os.FileMode + mode fs.FileMode extraPaths []string } diff --git a/pkg/util/locode/table/csv/table.go b/pkg/util/locode/table/csv/table.go index e9bc3e2070..ef5e996dc9 100644 --- a/pkg/util/locode/table/csv/table.go +++ b/pkg/util/locode/table/csv/table.go @@ -2,7 +2,7 @@ package csvlocode import ( "fmt" - "os" + "io/fs" "sync" ) @@ -32,7 +32,7 @@ type Prm struct { type Table struct { paths []string - mode os.FileMode + mode fs.FileMode subDivPath string From 4eca4dc52746135d963f0ff382b7a0a5ea442919 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 17:07:32 +0300 Subject: [PATCH 129/219] [#638] Update github.com/spf13 packages Update: * `viper` to v1.8.1; * `cobra` to v1.1.3. Signed-off-by: Leonard Lyubich --- go.mod | 6 +- go.sum | 308 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 289 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index c8e8e887e2..422bbc8a90 100644 --- a/go.mod +++ b/go.mod @@ -18,9 +18,9 @@ require ( github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 github.com/prometheus/client_golang v1.11.0 - github.com/spf13/cast v1.3.0 - github.com/spf13/cobra v1.0.0 - github.com/spf13/viper v1.7.0 + github.com/spf13/cast v1.3.1 + github.com/spf13/cobra v1.1.3 + github.com/spf13/viper v1.8.1 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.5 go.uber.org/atomic v1.8.0 diff --git a/go.sum b/go.sum index 5887cf045d..fd5acc1acd 100644 --- a/go.sum +++ b/go.sum @@ -5,13 +5,38 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= @@ -39,6 +64,7 @@ github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMw github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -49,6 +75,7 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -69,6 +96,7 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -77,6 +105,7 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -97,16 +126,21 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -117,18 +151,29 @@ github.com/go-redis/redis v6.10.2+incompatible h1:SLbqrO/Ik1nhXA5/cbEs1P5MUBo1Qq github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -138,6 +183,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -152,14 +198,29 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -169,12 +230,12 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -200,6 +261,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= @@ -213,6 +276,7 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -225,6 +289,7 @@ github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74 github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= @@ -234,8 +299,9 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -258,8 +324,9 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -330,13 +397,15 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/paulmach/orb v0.2.2 h1:PblToKAbU0xHVypex/GdZfibA1CeCfN5s0UjxyWExdo= github.com/paulmach/orb v0.2.2/go.mod h1:FkcWtplUAIVqAuhAOV2d3rpbnQyliDOjOcLW9dUrfdU= github.com/paulmach/protoscan v0.2.1-0.20210522164731-4e53c6875432/go.mod h1:2sV+uZ/oQh66m4XJVZm5iqUZ62BN88Ex1E+TTS0nLzI= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -368,6 +437,7 @@ github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3x github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -385,21 +455,25 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -414,15 +488,17 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7 h1:Y17pEjKgx2X0A69WQPGa8hx/Myzu+4NdUxlkZpbAYio= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= @@ -431,8 +507,16 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= @@ -452,6 +536,7 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -460,6 +545,11 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -469,12 +559,22 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -488,25 +588,57 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -526,29 +658,60 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -568,9 +731,40 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -581,10 +775,30 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -594,16 +808,58 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -614,6 +870,7 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= @@ -627,20 +884,23 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -649,4 +909,8 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From dab33e0f9b664e3efc3179170a717a28f54da0e2 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 17:24:04 +0300 Subject: [PATCH 130/219] [#652] Update Neo Go to v0.95.3 Add `keys.NEP2ScryptParams()` to `keys.NEP2Decrypt` call arguments. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/root.go | 4 ++-- go.mod | 2 +- go.sum | 5 +++-- pkg/util/config/crypto.go | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 6ae57f06c4..2fcaeb866d 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -214,7 +214,7 @@ func getKeyFromNEP2(encryptedWif string) (*ecdsa.PrivateKey, error) { return nil, errInvalidPassword } - k, err := keys.NEP2Decrypt(encryptedWif, pass) + k, err := keys.NEP2Decrypt(encryptedWif, pass, keys.NEP2ScryptParams()) if err != nil { printVerbose("Invalid key or password: %v", err) return nil, errInvalidPassword @@ -247,7 +247,7 @@ func getKeyFromWallet(w *wallet.Wallet, addrStr string) (*ecdsa.PrivateKey, erro return nil, errInvalidPassword } - if err := acc.Decrypt(pass); err != nil { + if err := acc.Decrypt(pass, keys.NEP2ScryptParams()); err != nil { printVerbose("Can't decrypt account: %v", err) return nil, errInvalidPassword } diff --git a/go.mod b/go.mod index 422bbc8a90..10f6dbd24f 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.2 + github.com/nspcc-dev/neo-go v0.95.3 github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index fd5acc1acd..10c70ac20a 100644 --- a/go.sum +++ b/go.sum @@ -365,10 +365,11 @@ github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1: github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= -github.com/nspcc-dev/neo-go v0.95.2 h1:WaFdqzdqDK2xjXuCUZENTL55fW7RodU23uGdTqx45RY= -github.com/nspcc-dev/neo-go v0.95.2/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= +github.com/nspcc-dev/neo-go v0.95.3 h1:RxBKcmmatbSM2cETGhv3ritmrkU0gUnWItNZvtrBtI0= +github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= +github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc h1:GLLzWOQVeO9FATZodCG/AzmcV05mh8CcEXgoa3/SSM8= github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= diff --git a/pkg/util/config/crypto.go b/pkg/util/config/crypto.go index 2564b21c07..0e74da950c 100644 --- a/pkg/util/config/crypto.go +++ b/pkg/util/config/crypto.go @@ -3,6 +3,7 @@ package config import ( "errors" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/wallet" ) @@ -26,7 +27,7 @@ func LoadAccount(path, addr, password string) (*wallet.Account, error) { return nil, errors.New("account is missing") } - if err := acc.Decrypt(password); err != nil { + if err := acc.Decrypt(password, keys.NEP2ScryptParams()); err != nil { return nil, err } From 29f9ed90f6a51ea50a0205fe6d86c9587f6aa0ab Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 17:26:20 +0300 Subject: [PATCH 131/219] [#652] Update API Go to v1.28.0 Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 10f6dbd24f..3818934942 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.3 - github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc + github.com/nspcc-dev/neofs-api-go v1.28.0 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 10c70ac20a..49a09f73d2 100644 --- a/go.sum +++ b/go.sum @@ -370,8 +370,8 @@ github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6A github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc h1:GLLzWOQVeO9FATZodCG/AzmcV05mh8CcEXgoa3/SSM8= -github.com/nspcc-dev/neofs-api-go v1.27.2-0.20210623145243-07fcaa4ba5cc/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= +github.com/nspcc-dev/neofs-api-go v1.28.0 h1:q3FNNz0as4XDqm/AJlAIWMX8YH0nLNbi+G9bONhnKnU= +github.com/nspcc-dev/neofs-api-go v1.28.0/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From 47b6a3a8b2c453b90bee937c35b1afd227fb2d50 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 28 Jun 2021 19:05:52 +0300 Subject: [PATCH 132/219] [#652] Update testnet config with address groups Signed-off-by: Leonard Lyubich --- config/testnet/node_config.env | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/config/testnet/node_config.env b/config/testnet/node_config.env index 904a8d7302..52e9db1a4a 100644 --- a/config/testnet/node_config.env +++ b/config/testnet/node_config.env @@ -1,20 +1,19 @@ # # Specify your public IP address or domain name with the open port -# in NODE_ADDRESS and BIND_ADDRESS +# in NODE_ADDRESSES and GRPC_0_ENDPOINT # By default keep these addresses the same. # This is used for the public announcement in the network map # -#NEOFS_NODE_ADDRESS= -#NEOFS_NODE_ADDRESS=1.1.1.1:36512 -NEOFS_NODE_ADDRESS= +#NEOFS_NODE_ADDRESSES=1.1.1.1:36512 +NEOFS_NODE_ADDRESSES= -# This is used to open the connection listening socket on your machine +# This is used to open the connection listening socket(s) on your machine # -#NEOFS_GRPC_ENDPOINT= -#NEOFS_GRPC_ENDPOINT=1.1.1.1:36512 -NEOFS_GRPC_ENDPOINT= +#NEOFS_GRPC_0_ENDPOINT=1.1.1.1:36512 +NEOFS_GRPC_0_ENDPOINT= +NEOFS_GRPC_NUM=1 #https://unece.org/trade/cefact/unlocode-code-list-country-and-territory From fbee2d522e25721afa1872d6596b4f6115cbd36c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 29 Jun 2021 11:26:12 +0300 Subject: [PATCH 133/219] Update changelog for v0.22.0 release Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6daabb6f9..534d114711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,50 @@ # Changelog Changelog for NeoFS Node +## [0.22.0] - 2021-06-29 - Muuido (무의도, 舞衣島) + +Storage nodes with a group of network endpoints. + +### Added +- Support of Neo wallet credentials in CLI ([#610](https://github.com/nspcc-dev/neofs-node/issues/610)). +- More reliable approval of trust value by IR ([#500](https://github.com/nspcc-dev/neofs-node/issues/500)). +- Storage node's ability to announce and serve on multiple network addresses ([#607](https://github.com/nspcc-dev/neofs-node/issues/607)). +- Validation of network addresses of netmap candidates in IR ([#557](https://github.com/nspcc-dev/neofs-node/issues/557)). +- Control service with healthcheck RPC in IR and CLI support ([#414](https://github.com/nspcc-dev/neofs-node/issues/414)). + +### Fixed +- Approval of objects with with duplicate attribute keys or empty values ([#633](https://github.com/nspcc-dev/neofs-node/issues/633)). +- Approval of containers with with duplicate attribute keys or empty values ([#634](https://github.com/nspcc-dev/neofs-node/issues/634)). +- Default path for CLI config ([#626](https://github.com/nspcc-dev/neofs-node/issues/626)). + +### Changed +- `version` command replaced with `--version` flag in CLI ([#571](https://github.com/nspcc-dev/neofs-node/issues/571)). +- Command usage text is not printed on errors in CLI ([#623](https://github.com/nspcc-dev/neofs-node/issues/623)). +- `netmap snapshot` command replaced with `control netmap-snapshot` one in CLI ([#651](https://github.com/nspcc-dev/neofs-node/issues/651)). +- IR does not include nodes with LOCODE derived attributes to the network map ([#412](https://github.com/nspcc-dev/neofs-node/issues/412)). +- IR uses morph/client packages for contract invocations ([#496](https://github.com/nspcc-dev/neofs-node/issues/496)). +- Writecache decreases local size when objects are flushed ([#568](https://github.com/nspcc-dev/neofs-node/issues/568)). +- IR can override global configuration values only in debug build ([#363](https://github.com/nspcc-dev/neofs-node/issues/363)). + +### Updated +- Neo Go: [v0.95.3](https://github.com/nspcc-dev/neo-go/releases/tag/v0.95.3). +- NeoFS API Go: [v1.28.0](https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.28.0). +- protobuf: [v1.26.0](https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.26.0). +- uuid: [v1.2.0](https://github.com/google/uuid/releases/tag/v1.2.0). +- compress: [v1.13.1](https://github.com/klauspost/compress/releases/tag/v1.13.1). +- base58: [v1.2.0](https://github.com/mr-tron/base58/releases/tag/v1.2.0). +- multiaddr: [v0.3.2](https://github.com/multiformats/go-multiaddr/releases/tag/v0.3.2). +- ants: [v2.4.0](https://github.com/panjf2000/ants/releases/tag/v2.4.0). +- orb: [v0.2.2](https://github.com/paulmach/orb/releases/tag/v0.2.2). +- prometheus: [v1.11.0](https://github.com/prometheus/client_golang/releases/tag/v1.11.0). +- testify: [v1.7.0](https://github.com/stretchr/testify/releases/tag/v1.7.0). +- atomic: [v1.8.0](https://github.com/uber-go/atomic/releases/tag/v1.8.0). +- zap: [v1.17.0](https://github.com/uber-go/zap/releases/tag/v1.17.0). +- grpc: [v1.38.0](https://github.com/grpc/grpc-go/releases/tag/v1.38.0). +- cast: [v1.3.1](https://github.com/spf13/cast/releases/tag/v1.3.1). +- cobra: [1.1.3](https://github.com/spf13/cobra/releases/tag/v1.1.3). +- viper: [v1.8.1](https://github.com/spf13/viper/releases/tag/v1.8.1). + ## [0.21.1] - 2021-06-10 ### Fixed @@ -406,6 +450,7 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. +[0.22.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.1...v0.22.0 [0.21.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.0...v0.21.1 [0.21.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.20.0...v0.21.0 [0.20.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.19.0...v0.20.0 From 4075bed0689584b03ec513a8742b0accbf5aa414 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 29 Jun 2021 11:27:54 +0300 Subject: [PATCH 134/219] Add unreleased section to changelog Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 534d114711..15c67bc808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog Changelog for NeoFS Node +## [Unreleased] + ## [0.22.0] - 2021-06-29 - Muuido (무의도, 舞衣島) Storage nodes with a group of network endpoints. @@ -450,6 +452,7 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...master [0.22.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.1...v0.22.0 [0.21.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.0...v0.21.1 [0.21.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.20.0...v0.21.0 From 403f836968cb7b6298bf6c911d269019f5f69398 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 25 Jun 2021 14:16:03 +0300 Subject: [PATCH 135/219] [#647] pkg/morph: Add constant var to err message Use defined constant variable instead of hardcoded number in error message. Signed-off-by: Pavel Karpy --- pkg/morph/client/netmap/netmap.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/morph/client/netmap/netmap.go b/pkg/morph/client/netmap/netmap.go index 3707901bbc..1a0dd83920 100644 --- a/pkg/morph/client/netmap/netmap.go +++ b/pkg/morph/client/netmap/netmap.go @@ -140,7 +140,11 @@ func peerInfoFromStackItem(prm stackitem.Item) ([]byte, error) { if err != nil { return nil, fmt.Errorf("could not get stack item array (PeerInfo): %w", err) } else if ln := len(prms); ln != nodeInfoFixedPrmNumber { - return nil, fmt.Errorf("unexpected stack item count (PeerInfo): expected %d, has %d", 1, ln) + return nil, fmt.Errorf( + "unexpected stack item count (PeerInfo): expected %d, has %d", + nodeInfoFixedPrmNumber, + ln, + ) } return client.BytesFromStackItem(prms[0]) From d664a00e944215960b5007b70a801b39e3f84ab2 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 25 Jun 2021 18:23:29 +0300 Subject: [PATCH 136/219] [#647] pkg/morph/netmap: Add `netmapCandidates` method Add `netmapCandidates` method to `netmap` client wrapper. Method parses node storages candidates for the next epoch. Signed-off-by: Pavel Karpy --- pkg/morph/client/netmap/client.go | 39 ++++----- pkg/morph/client/netmap/netmap.go | 129 +++++++++++++++++++++++++++++- 2 files changed, 149 insertions(+), 19 deletions(-) diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index f0b0015160..805e5b1f45 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -34,6 +34,7 @@ type cfg struct { addPeerMethod, // add peer method name for invocation newEpochMethod, // new epoch method name for invocation netMapMethod, // get network map method name + netMapCandidatesMethod, // get network candidates method name snapshotMethod, // get network map snapshot method name epochSnapshotMethod, // get network map snapshot by epoch method name updateStateMethod, // update state method name for invocation @@ -44,30 +45,32 @@ type cfg struct { } const ( - defaultAddPeerMethod = "addPeer" // default add peer method name - defaultNewEpochMethod = "newEpoch" // default new epoch method name - defaultNetMapMethod = "netmap" // default get network map method name - defaultSnapshotMethod = "snapshot" // default get network map snapshot method name - defaultUpdateStateMethod = "updateState" // default update state method name - defaultEpochMethod = "epoch" // default get epoch number method name - defaultSetInnerRingMethod = "updateInnerRing" // default set innerring method name - defaultSetConfigMethod = "setConfig" // default get config value method name - defaultConfigMethod = "config" // default get config value method name + defaultAddPeerMethod = "addPeer" // default add peer method name + defaultConfigMethod = "config" // default get config value method name + defaultEpochMethod = "epoch" // default get epoch number method name + defaultNetMapCandidateMethod = "netmapCandidates" // default get network candidates method name + defaultNetMapMethod = "netmap" // default get network map method name + defaultNewEpochMethod = "newEpoch" // default new epoch method name + defaultSetConfigMethod = "setConfig" // default get config value method name + defaultSetInnerRingMethod = "updateInnerRing" // default set innerring method name + defaultSnapshotMethod = "snapshot" // default get network map snapshot method name + defaultUpdateStateMethod = "updateState" // default update state method name defaultEpochSnapshotMethod = "snapshotByEpoch" // default get network map snapshot by epoch method name ) func defaultConfig() *cfg { return &cfg{ - addPeerMethod: defaultAddPeerMethod, - newEpochMethod: defaultNewEpochMethod, - netMapMethod: defaultNetMapMethod, - snapshotMethod: defaultSnapshotMethod, - epochSnapshotMethod: defaultEpochSnapshotMethod, - updateStateMethod: defaultUpdateStateMethod, - epochMethod: defaultEpochMethod, - setConfigMethod: defaultSetConfigMethod, - configMethod: defaultConfigMethod, + addPeerMethod: defaultAddPeerMethod, + configMethod: defaultConfigMethod, + epochMethod: defaultEpochMethod, + netMapCandidatesMethod: defaultNetMapCandidateMethod, + netMapMethod: defaultNetMapMethod, + newEpochMethod: defaultNewEpochMethod, + setConfigMethod: defaultSetConfigMethod, + snapshotMethod: defaultSnapshotMethod, + updateStateMethod: defaultUpdateStateMethod, + epochSnapshotMethod: defaultEpochSnapshotMethod, } } diff --git a/pkg/morph/client/netmap/netmap.go b/pkg/morph/client/netmap/netmap.go index 1a0dd83920..4e7662da9f 100644 --- a/pkg/morph/client/netmap/netmap.go +++ b/pkg/morph/client/netmap/netmap.go @@ -36,7 +36,55 @@ type EpochSnapshotValues struct { *GetNetMapValues } -const nodeInfoFixedPrmNumber = 1 +// GetNetMapCandidatesArgs groups the arguments +// of get network map candidates test invoke call. +type GetNetMapCandidatesArgs struct { +} + +// GetNetMapCandidatesValues groups the stack parameters +// returned by get network map candidates test invoke. +type GetNetMapCandidatesValues struct { + netmapNodes []*PeerWithState +} + +func (g GetNetMapCandidatesValues) NetmapNodes() []*PeerWithState { + return g.netmapNodes +} + +// State is an enumeration of various states of the NeoFS node. +type State int64 + +const ( + // Undefined is unknown state. + Undefined State = iota + + // Online is network unavailable state. + Online + + // Offline is an active state in the network. + Offline +) + +// PeerWithState groups information about peer +// and its state in network map. +type PeerWithState struct { + peer []byte + state State +} + +func (ps PeerWithState) State() State { + return ps.state +} + +func (ps PeerWithState) Peer() []byte { + return ps.peer +} + +const ( + nodeInfoFixedPrmNumber = 1 + + peerWithStateFixedPrmNumber = 2 +) // SetDiff sets argument for snapshot method of // netmap contract. @@ -107,6 +155,85 @@ func (c *Client) EpochSnapshot(args EpochSnapshotArgs) (*EpochSnapshotValues, er }, nil } +func (c *Client) Candidates(_ GetNetMapCandidatesArgs) (*GetNetMapCandidatesValues, error) { + prms, err := c.client.TestInvoke( + c.netMapCandidatesMethod, + ) + if err != nil { + return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.netMapCandidatesMethod, err) + } + + candVals, err := peersWithStateFromStackItems(prms, c.netMapCandidatesMethod) + if err != nil { + return nil, fmt.Errorf("could not parse contract response: %w", err) + } + + return candVals, nil +} + +func peersWithStateFromStackItems(stack []stackitem.Item, method string) (*GetNetMapCandidatesValues, error) { + if ln := len(stack); ln != 1 { + return nil, fmt.Errorf("unexpected stack item count (%s): %d", method, ln) + } + + netmapNodes, err := client.ArrayFromStackItem(stack[0]) + if err != nil { + return nil, fmt.Errorf("could not get stack item array from stack item (%s): %w", method, err) + } + + res := &GetNetMapCandidatesValues{ + netmapNodes: make([]*PeerWithState, 0, len(netmapNodes)), + } + + for i := range netmapNodes { + node, err := peerWithStateFromStackItem(netmapNodes[i]) + if err != nil { + return nil, fmt.Errorf("could not parse stack item (Peer #%d): %w", i, err) + } + + res.netmapNodes = append(res.netmapNodes, node) + } + + return res, nil +} + +func peerWithStateFromStackItem(prm stackitem.Item) (*PeerWithState, error) { + prms, err := client.ArrayFromStackItem(prm) + if err != nil { + return nil, fmt.Errorf("could not get stack item array (PeerWithState): %w", err) + } else if ln := len(prms); ln != peerWithStateFixedPrmNumber { + return nil, fmt.Errorf( + "unexpected stack item count (PeerWithState): expected %d, has %d", + peerWithStateFixedPrmNumber, + ln, + ) + } + + var res PeerWithState + + // peer + if res.peer, err = peerInfoFromStackItem(prms[0]); err != nil { + return nil, fmt.Errorf("could not get bytes from 'node' field of PeerWithState: %w", err) + } + + // state + state, err := client.IntFromStackItem(prms[1]) + if err != nil { + return nil, fmt.Errorf("could not get int from 'state' field of PeerWithState: %w", err) + } + + switch state { + case 1: + res.state = Online + case 2: + res.state = Offline + default: + res.state = Undefined + } + + return &res, nil +} + func peersFromStackItems(stack []stackitem.Item, method string) (*GetNetMapValues, error) { if ln := len(stack); ln != 1 { return nil, fmt.Errorf("unexpected stack item count (%s): %d", From a2b622d62ecc85e405ed1942b70c3f56b69ede42 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 25 Jun 2021 18:58:05 +0300 Subject: [PATCH 137/219] [#647] pkg/morph/netmap/wrapper: `GetCandidates` method Signed-off-by: Pavel Karpy --- pkg/morph/client/netmap/wrapper/netmap.go | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/pkg/morph/client/netmap/wrapper/netmap.go b/pkg/morph/client/netmap/wrapper/netmap.go index a8e99ab181..4f3b51ec62 100644 --- a/pkg/morph/client/netmap/wrapper/netmap.go +++ b/pkg/morph/client/netmap/wrapper/netmap.go @@ -38,6 +38,20 @@ func (w Wrapper) GetNetMapByEpoch(epoch uint64) (*netmap.Netmap, error) { return unmarshalNetmap(vals.Peers()) } +// GetCandidates receives information list about candidates +// for the next epoch network map through the Netmap contract +// call, composes network map from them and returns it. +func (w Wrapper) GetCandidates() (*netmap.Netmap, error) { + args := client.GetNetMapCandidatesArgs{} + + vals, err := w.client.Candidates(args) + if err != nil { + return nil, err + } + + return unmarshalCandidates(vals.NetmapNodes()) +} + func unmarshalNetmap(rawPeers [][]byte) (*netmap.Netmap, error) { infos := make([]netmap.NodeInfo, 0, len(rawPeers)) @@ -54,3 +68,29 @@ func unmarshalNetmap(rawPeers [][]byte) (*netmap.Netmap, error) { return netmap.NewNetmap(nodes) } + +func unmarshalCandidates(rawCandidate []*client.PeerWithState) (*netmap.Netmap, error) { + candidates := make([]netmap.NodeInfo, 0, len(rawCandidate)) + + for _, candidate := range rawCandidate { + nodeInfo := netmap.NewNodeInfo() + if err := nodeInfo.Unmarshal(candidate.Peer()); err != nil { + return nil, fmt.Errorf("can't unmarshal peer info: %w", err) + } + + switch candidate.State() { + case client.Online: + nodeInfo.SetState(netmap.NodeStateOnline) + case client.Offline: + nodeInfo.SetState(netmap.NodeStateOffline) + default: + nodeInfo.SetState(0) + } + + candidates = append(candidates, *nodeInfo) + } + + nodes := netmap.NodesFromInfo(candidates) + + return netmap.NewNetmap(nodes) +} From 92451c08af84f1ea0f57b7d61acd6c41ed54fe3a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 1 Jul 2021 19:59:34 +0300 Subject: [PATCH 138/219] [#658] innerring: Do not use notary in audit client Audit client is used to send audit results and they should be signed by inner ring node itself on order to be saved in smart contract. Signed-off-by: Alex Vanin --- pkg/innerring/innerring.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 2b455d54f9..a7780724e0 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -390,7 +390,9 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error fee := server.feeConfig.SideChainFee() - server.auditClient, err = auditWrapper.NewFromMorph(server.morphClient, server.contracts.audit, fee, client.TryNotary()) + // do not use TryNotary() in audit wrapper + // audit operations do not require multisignatures + server.auditClient, err = auditWrapper.NewFromMorph(server.morphClient, server.contracts.audit, fee) if err != nil { return nil, err } From c0093b2b794c832e6f6e632ec9c0025bcadc32f1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 1 Jul 2021 20:00:30 +0300 Subject: [PATCH 139/219] [#658] morph/neofsid: Add TryNotary() option Signed-off-by: Alex Vanin --- pkg/innerring/innerring.go | 4 ++-- pkg/morph/client/neofsid/wrapper/client.go | 28 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index a7780724e0..82c3da69f4 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -30,7 +30,7 @@ import ( balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" cntWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" neofsWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs/wrapper" - neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" + neofsidWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" repWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -417,7 +417,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - neofsIDClient, err := neofsid.NewFromMorph(server.morphClient, server.contracts.neofsID, fee) + neofsIDClient, err := neofsidWrapper.NewFromMorph(server.morphClient, server.contracts.neofsID, fee, neofsidWrapper.TryNotary()) if err != nil { return nil, err } diff --git a/pkg/morph/client/neofsid/wrapper/client.go b/pkg/morph/client/neofsid/wrapper/client.go index 44a30e6c26..3deffbf215 100644 --- a/pkg/morph/client/neofsid/wrapper/client.go +++ b/pkg/morph/client/neofsid/wrapper/client.go @@ -16,9 +16,33 @@ import ( // Working ClientWrapper must be created via Wrap. type ClientWrapper neofsid.Client +// Option allows to set an optional +// parameter of ClientWrapper. +type Option func(*opts) + +type opts []client.StaticClientOption + +func defaultOpts() *opts { + return new(opts) +} + +// TryNotary returns option to enable +// notary invocation tries. +func TryNotary() Option { + return func(o *opts) { + *o = append(*o, client.TryNotary()) + } +} + // NewFromMorph wraps client to work with NeoFS ID contract. -func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*ClientWrapper, error) { - sc, err := client.NewStatic(cli, contract, fee, client.TryNotary()) +func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*ClientWrapper, error) { + o := defaultOpts() + + for i := range opts { + opts[i](o) + } + + sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...) if err != nil { return nil, fmt.Errorf("could not create client of NeoFS ID contract: %w", err) } From c90f054f35db2d74baf4ac5cd5aecf239180b9d7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 1 Jul 2021 20:00:47 +0300 Subject: [PATCH 140/219] [#658] morph/neofs: Add TryNotary() option Signed-off-by: Alex Vanin --- pkg/innerring/innerring.go | 2 +- pkg/morph/client/neofs/wrapper/client.go | 28 ++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 82c3da69f4..9c92c44172 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -423,7 +423,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error } neofsClient, err := neofsWrapper.NewFromMorph(server.mainnetClient, server.contracts.neofs, - server.feeConfig.MainChainFee()) + server.feeConfig.MainChainFee(), neofsWrapper.TryNotary()) if err != nil { return nil, err } diff --git a/pkg/morph/client/neofs/wrapper/client.go b/pkg/morph/client/neofs/wrapper/client.go index 2d647f57f9..8d038ab16f 100644 --- a/pkg/morph/client/neofs/wrapper/client.go +++ b/pkg/morph/client/neofs/wrapper/client.go @@ -16,9 +16,33 @@ import ( // Working ClientWrapper must be created via NewFromMorph. type ClientWrapper neofscontract.Client +// Option allows to set an optional +// parameter of ClientWrapper. +type Option func(*opts) + +type opts []client.StaticClientOption + +func defaultOpts() *opts { + return new(opts) +} + +// TryNotary returns option to enable +// notary invocation tries. +func TryNotary() Option { + return func(o *opts) { + *o = append(*o, client.TryNotary()) + } +} + // NewFromMorph wraps client to work with NeoFS contract. -func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*ClientWrapper, error) { - sc, err := client.NewStatic(cli, contract, fee, client.TryNotary()) +func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*ClientWrapper, error) { + o := defaultOpts() + + for i := range opts { + opts[i](o) + } + + sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...) if err != nil { return nil, fmt.Errorf("could not create client of NeoFS contract: %w", err) } From 69826ebd905f999852b412425e0f3cdc1c207d30 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 08:41:45 +0300 Subject: [PATCH 141/219] [#660] core: Implement function to check protocol version adequacy Create `version` package and implement `IsValid` function which checks if version is not earlier than the genesis one. Signed-off-by: Leonard Lyubich --- pkg/core/version/version.go | 17 +++++++++++++++++ pkg/core/version/version_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pkg/core/version/version.go create mode 100644 pkg/core/version/version_test.go diff --git a/pkg/core/version/version.go b/pkg/core/version/version.go new file mode 100644 index 0000000000..8371ab5701 --- /dev/null +++ b/pkg/core/version/version.go @@ -0,0 +1,17 @@ +package version + +import ( + "github.com/nspcc-dev/neofs-api-go/pkg" +) + +// IsValid checks if Version is not earlier than the genesis version of the NeoFS. +func IsValid(v pkg.Version) bool { + const ( + startMajor = 2 + startMinor = 7 + ) + + mjr := v.Major() + + return mjr > startMajor || mjr == startMajor && v.Minor() >= startMinor +} diff --git a/pkg/core/version/version_test.go b/pkg/core/version/version_test.go new file mode 100644 index 0000000000..572448ac45 --- /dev/null +++ b/pkg/core/version/version_test.go @@ -0,0 +1,30 @@ +package version_test + +import ( + "testing" + + "github.com/nspcc-dev/neofs-api-go/pkg" + "github.com/nspcc-dev/neofs-node/pkg/core/version" + "github.com/stretchr/testify/require" +) + +func TestIsValid(t *testing.T) { + require.True(t, version.IsValid(*pkg.SDKVersion())) + + var v pkg.Version + + for _, item := range []struct { + mjr, mnr uint32 + valid bool + }{ + {mjr: 0, mnr: 0, valid: false}, + {mjr: 2, mnr: 6, valid: false}, + {mjr: 2, mnr: 7, valid: true}, + {mjr: 3, mnr: 0, valid: true}, + } { + v.SetMajor(item.mjr) + v.SetMinor(item.mnr) + + require.Equal(t, item.valid, version.IsValid(v), item) + } +} From d610346a7b1d83829e33108db3b65b26fbeb281d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 08:47:00 +0300 Subject: [PATCH 142/219] [#660] cli/container: Use version.IsValid in parseEACL Extended ACL input can have version later than CLI one, and it should not be downgraded. But the version should be still adequate. Set `pkg.SDKVersion` on false return of `version.IsValid`. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/container.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 55ddcd9c00..95152af06b 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -23,6 +23,7 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/session" + "github.com/nspcc-dev/neofs-node/pkg/core/version" "github.com/nspcc-dev/neofs-sdk-go/pkg/policy" "github.com/spf13/cobra" ) @@ -845,8 +846,8 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { table := eacl.NewTable() if err = table.UnmarshalJSON(data); err == nil { - version := table.Version() - if err := pkg.IsSupportedVersion(&version); err != nil { + v := table.Version() + if !version.IsValid(v) { table.SetVersion(*pkg.SDKVersion()) } From 8192933313a729d2c861bb017cf39d4a967907ae Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 08:49:06 +0300 Subject: [PATCH 143/219] [#660] services/netmap: Don't call IsSupportedVersion in LocalNodeInfo Clients can have version later than the server. The server should not deny these clients. Signed-off-by: Leonard Lyubich --- pkg/services/netmap/executor.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/services/netmap/executor.go b/pkg/services/netmap/executor.go index 12b3ffd4e1..5d748aa401 100644 --- a/pkg/services/netmap/executor.go +++ b/pkg/services/netmap/executor.go @@ -47,9 +47,6 @@ func (s *executorSvc) LocalNodeInfo( _ context.Context, req *netmap.LocalNodeInfoRequest) (*netmap.LocalNodeInfoResponse, error) { ver := pkg.NewVersionFromV2(req.GetMetaHeader().GetVersion()) - if err := pkg.IsSupportedVersion(ver); err != nil { - return nil, err - } ni, err := s.state.LocalNodeInfo() if err != nil { From 54d6f3de55da044e0ff5446d7ef98d9bee5a2515 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 08:54:07 +0300 Subject: [PATCH 144/219] [#660] core/container: Use version.IsValid in CheckFormat Container can have version later than the current lib version, and it should not be considered as invalid. But it should still have adequate version. Signed-off-by: Leonard Lyubich --- pkg/core/container/fmt.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/core/container/fmt.go b/pkg/core/container/fmt.go index e63673e5e7..024d085dd6 100644 --- a/pkg/core/container/fmt.go +++ b/pkg/core/container/fmt.go @@ -4,9 +4,9 @@ import ( "errors" "fmt" - "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-node/pkg/core/version" ) var ( @@ -24,8 +24,8 @@ func CheckFormat(c *container.Container) error { return errNilPolicy } - if err := pkg.IsSupportedVersion(c.Version()); err != nil { - return fmt.Errorf("incorrect version: %w", err) + if v := c.Version(); v == nil || !version.IsValid(*v) { + return fmt.Errorf("incorrect version %s", v) } if ln := len(c.OwnerID().ToV2().GetValue()); ln != owner.NEO3WalletSize { From 7c1432aa57ab54900193ab940dec265d3c480db5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 08:59:02 +0300 Subject: [PATCH 145/219] [#660] services/container: Don't check container format in Put Storage node should only reflect container Put requests to sidechain w/o any validation. All verification steps are performed by IR. Signed-off-by: Leonard Lyubich --- pkg/services/container/morph/executor.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/services/container/morph/executor.go b/pkg/services/container/morph/executor.go index 5f072c7a0b..9a8c15f2ab 100644 --- a/pkg/services/container/morph/executor.go +++ b/pkg/services/container/morph/executor.go @@ -2,7 +2,6 @@ package container import ( "context" - "fmt" "github.com/nspcc-dev/neofs-api-go/pkg" eaclSDK "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" @@ -28,10 +27,7 @@ func NewExecutor(w *wrapper.Wrapper) containerSvc.ServiceExecutor { } func (s *morphExecutor) Put(ctx containerSvc.ContextWithToken, body *container.PutRequestBody) (*container.PutResponseBody, error) { - cnr, err := containerSDK.NewVerifiedFromV2(body.GetContainer()) - if err != nil { - return nil, fmt.Errorf("invalid format of the container structure: %w", err) - } + cnr := containerSDK.NewContainerFromV2(body.GetContainer()) cnr.SetSignature( pkg.NewSignatureFromV2(body.GetSignature()), From a2bb59adb851e59ab9257cec8115be4aacbcb8e6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 2 Jul 2021 09:00:05 +0300 Subject: [PATCH 146/219] Update API Go library to v1.28.1 Signed-off-by: Leonard Lyubich --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3818934942..4f425f086c 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.3 - github.com/nspcc-dev/neofs-api-go v1.28.0 + github.com/nspcc-dev/neofs-api-go v1.28.1 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 49a09f73d2..108514ce2c 100644 --- a/go.sum +++ b/go.sum @@ -370,8 +370,8 @@ github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6A github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-api-go v1.28.0 h1:q3FNNz0as4XDqm/AJlAIWMX8YH0nLNbi+G9bONhnKnU= -github.com/nspcc-dev/neofs-api-go v1.28.0/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= +github.com/nspcc-dev/neofs-api-go v1.28.1 h1:u+JbrisfLCXICamU3ie+UNPLwpjFdf14P2M+yEKnblw= +github.com/nspcc-dev/neofs-api-go v1.28.1/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From b848c9bd9fe8de197e2110763e7c771e037ba946 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 2 Jul 2021 21:07:36 +0300 Subject: [PATCH 147/219] [#662] Add All-In-One NeoFS Docker image We need All-In-One Docker image to simplify NeoFS deployment in development and testing environments. Signed-off-by: Stanislav Bogatyrev --- Dockerfile.aio | 24 ++++++++++++++++++++++++ Makefile | 12 +++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.aio diff --git a/Dockerfile.aio b/Dockerfile.aio new file mode 100644 index 0000000000..8bca1a8173 --- /dev/null +++ b/Dockerfile.aio @@ -0,0 +1,24 @@ + +ARG HUB_IMAGE=nspccdev/neofs +ARG HUB_TAG=latest + +FROM ${HUB_IMAGE}-cli:${HUB_TAG} as neofs-cli +FROM ${HUB_IMAGE}-ir:${HUB_TAG} as neofs-ir +FROM ${HUB_IMAGE}-storage:${HUB_TAG} as neofs-storage + +# Executable image +FROM alpine AS neofs-aio +RUN apk add --no-cache \ + bash \ + ca-certificates \ + jq \ + expect \ + iputils + +WORKDIR / + +COPY --from=neofs-cli /bin/neofs-cli /bin/neofs-cli +COPY --from=neofs-ir /bin/neofs-ir /bin/neofs-ir +COPY --from=neofs-storage /bin/neofs-node /bin/neofs-node + +CMD ["neofs-cli"] diff --git a/Makefile b/Makefile index 39c39f55c0..630451736a 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,17 @@ protoc: done rm -rf vendor -# Build NeoFS Storage Node docker image +# Build all-in-one NeoFS docker image +image-aio: images + @echo "⇒ Build NeoFS All-In-One Docker image " + @docker build \ + --build-arg HUB_IMAGE=$(HUB_IMAGE) \ + --build-arg HUB_TAG=$(HUB_TAG) \ + --rm \ + -f Dockerfile.aio \ + -t $(HUB_IMAGE)-aio:$(HUB_TAG) . + +# Build NeoFS component's docker image image-%: @echo "⇒ Build NeoFS $* docker image " @docker build \ From eadc3a4de94cfdfd621bdf61daeccdcfbd4505c1 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Jul 2021 16:20:11 +0300 Subject: [PATCH 148/219] [#667] ir: Make `--version` output same as in CLI Signed-off-by: Pavel Karpy --- cmd/neofs-ir/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-ir/main.go b/cmd/neofs-ir/main.go index aad9891990..07134bce20 100644 --- a/cmd/neofs-ir/main.go +++ b/cmd/neofs-ir/main.go @@ -42,8 +42,13 @@ func main() { flag.Parse() if *versionFlag { - fmt.Println("neofs-ir", misc.Version) - fmt.Println("debug:", misc.Debug) + fmt.Printf( + "Version: %s \nBuild: %s \nDebug: %s\n", + misc.Version, + misc.Build, + misc.Debug, + ) + os.Exit(SuccessReturnCode) } From 75632a7d83eff41748c23c62e485d13ada5c2cd3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Jul 2021 16:24:18 +0300 Subject: [PATCH 149/219] [#667] node: Add `--version` flag support Signed-off-by: Pavel Karpy --- cmd/neofs-node/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index d311857f9a..6ec40e43b8 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -5,6 +5,7 @@ import ( "flag" "fmt" "log" + "os" "os/signal" "syscall" @@ -13,6 +14,11 @@ import ( "go.uber.org/zap" ) +const ( + // SuccessReturnCode returns when application closed without panic + SuccessReturnCode = 0 +) + // prints err to standard logger and calls os.Exit(1). func fatalOnErr(err error) { if err != nil { @@ -29,8 +35,20 @@ func fatalOnErrDetails(details string, err error) { func main() { configFile := flag.String("config", "", "path to config") + versionFlag := flag.Bool("version", false, "neofs-ir node version") flag.Parse() + if *versionFlag { + fmt.Printf( + "Version: %s \nBuild: %s \nDebug: %s\n", + misc.Version, + misc.Build, + misc.Debug, + ) + + os.Exit(SuccessReturnCode) + } + c := initCfg(*configFile) initApp(c) From 8965e70463142f8951cb9011dec4f38118dc7832 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Jul 2021 13:25:31 +0300 Subject: [PATCH 150/219] [#665] cli/util: Add exit code utils Add `errf`, `exitOnErr` and `exitOnErrCode` functions that works with errors and exits with non-zero exit codes on non-nil errors. Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/util.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index 64aa148d77..f560aaa7c2 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -508,3 +508,28 @@ func keyerParseFile(filename string, d *keyer.Dashboard) error { return d.ParseBinary(data) } + +// errf returns formatted error in errFmt format +// if err is not nil. +func errf(errFmt string, err error) error { + if err == nil { + return nil + } + + return fmt.Errorf(errFmt, err) +} + +// exitOnErr calls exitOnErrCode with code 1. +func exitOnErr(cmd *cobra.Command, err error) { + exitOnErrCode(cmd, err, 1) +} + +// exitOnErrCode prints error via cmd and calls +// os.Exit with passed exit code. Does nothing +// if err is nil. +func exitOnErrCode(cmd *cobra.Command, err error, code int) { + if err != nil { + cmd.PrintErrln(err) + os.Exit(code) + } +} From 3a7d7bdecd08d13876a05136ef2f38ffd7d55175 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Jul 2021 15:27:54 +0300 Subject: [PATCH 151/219] [#665] cli: Set non-zero exit codes in `err` cases Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/accounting.go | 25 +-- cmd/neofs-cli/modules/container.go | 244 ++++++-------------------- cmd/neofs-cli/modules/control.go | 171 +++++++----------- cmd/neofs-cli/modules/netmap.go | 46 +---- cmd/neofs-cli/modules/object.go | 242 ++++++------------------- cmd/neofs-cli/modules/root.go | 10 +- cmd/neofs-cli/modules/storagegroup.go | 140 ++++----------- cmd/neofs-cli/modules/util.go | 109 +++--------- 8 files changed, 245 insertions(+), 742 deletions(-) diff --git a/cmd/neofs-cli/modules/accounting.go b/cmd/neofs-cli/modules/accounting.go index eb5448982d..ba88d8a761 100644 --- a/cmd/neofs-cli/modules/accounting.go +++ b/cmd/neofs-cli/modules/accounting.go @@ -34,38 +34,23 @@ var accountingBalanceCmd = &cobra.Command{ ) key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) if balanceOwner == "" { wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) oid = owner.NewIDFromNeo3Wallet(wallet) } else { oid, err = ownerFromString(balanceOwner) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) } response, err = cli.GetBalance(ctx, oid, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) // print to stdout prettyPrintDecimal(cmd, response) diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 95152af06b..eb23611e79 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -67,6 +67,12 @@ var ( eaclPathFrom string ) +var ( + errDeleteTimeout = errors.New("timeout: container has not been removed from sidechain") + errCreateTimeout = errors.New("timeout: container has not been persisted on sidechain") + errSetEACLTimeout = errors.New("timeout: EACL has not been persisted on sidechain") +) + // containerCmd represents the container command var containerCmd = &cobra.Command{ Use: "container", @@ -87,38 +93,23 @@ var listContainersCmd = &cobra.Command{ ) key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) if containerOwner == "" { wallet, err := owner.NEO3WalletFromPublicKey(&key.PublicKey) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) oid = owner.NewIDFromNeo3Wallet(wallet) } else { oid, err = ownerFromString(containerOwner) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) } response, err = cli.ListContainers(ctx, oid, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) // print to stdout prettyPrintContainerList(cmd, response) @@ -134,46 +125,25 @@ It will be stored in sidechain when inner ring will accepts it.`, ctx := context.Background() key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) placementPolicy, err := parseContainerPolicy(containerPolicy) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) attributes, err := parseAttributes(containerAttributes) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) basicACL, err := parseBasicACL(containerACL) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) nonce, err := parseNonce(containerNonce) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) tok, err := getSessionToken(sessionTokenPath) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cnr := container.New() cnr.SetPlacementPolicy(placementPolicy) @@ -184,10 +154,7 @@ It will be stored in sidechain when inner ring will accepts it.`, cnr.SetOwnerID(tok.OwnerID()) id, err := cli.PutContainer(ctx, cnr, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) cmd.Println("container ID:", id) @@ -204,7 +171,7 @@ It will be stored in sidechain when inner ring will accepts it.`, } } - cmd.PrintErrln("timeout: container has not been persisted on sidechain") + exitOnErr(cmd, errCreateTimeout) } }, } @@ -218,28 +185,16 @@ Only owner of the container has a permission to remove container.`, ctx := context.Background() key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := parseContainerID(containerID) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) tok, err := getSessionToken(sessionTokenPath) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) callOpts := globalCallOptions() @@ -248,10 +203,7 @@ Only owner of the container has a permission to remove container.`, } err = cli.DeleteContainer(ctx, id, callOpts...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) cmd.Println("container delete method invoked") @@ -268,7 +220,7 @@ Only owner of the container has a permission to remove container.`, } } - cmd.PrintErrln("timeout: container has not been removed from sidechain") + exitOnErr(cmd, errDeleteTimeout) } }, } @@ -281,28 +233,16 @@ var listContainerObjectsCmd = &cobra.Command{ ctx := context.Background() key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := parseContainerID(containerID) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sessionToken, err := cli.CreateSession(ctx, math.MaxUint64) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't create session token: %w", err)) - return - } + exitOnErr(cmd, errf("can't create session token: %w", err)) filters := new(object.SearchFilters) filters.AddRootFilter() // search only user created objects @@ -316,10 +256,7 @@ var listContainerObjectsCmd = &cobra.Command{ client.WithSession(sessionToken), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) for i := range objectIDs { cmd.Println(objectIDs[i]) @@ -340,40 +277,23 @@ var getContainerInfoCmd = &cobra.Command{ if containerPathFrom != "" { data, err := os.ReadFile(containerPathFrom) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't read file: %w", err)) - return - } + exitOnErr(cmd, errf("can't read file: %w", err)) cnr = container.New() - if err := cnr.Unmarshal(data); err != nil { - cmd.PrintErrln(fmt.Errorf("can't unmarshal container: %w", err)) - return - } + err = cnr.Unmarshal(data) + exitOnErr(cmd, errf("can't unmarshal container: %w", err)) } else { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := parseContainerID(containerID) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cnr, err = cli.GetContainer(ctx, id, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) } prettyPrintContainer(cmd, cnr, containerJSON) @@ -386,23 +306,14 @@ var getContainerInfoCmd = &cobra.Command{ if containerJSON { data, err = cnr.MarshalJSON() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't JSON encode container: %w", err)) - return - } + exitOnErr(cmd, errf("can't JSON encode container: %w", err)) } else { data, err = cnr.Marshal() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't binary encode container: %w", err)) - return - } + exitOnErr(cmd, errf("can't binary encode container: %w", err)) } err = os.WriteFile(containerPathTo, data, 0644) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't write container to file: %w", err)) - return - } + exitOnErr(cmd, errf("can't write container to file: %w", err)) } }, } @@ -415,28 +326,16 @@ var getExtendedACLCmd = &cobra.Command{ ctx := context.Background() key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := parseContainerID(containerID) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) res, err := cli.GetEACL(ctx, id, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) eaclTable := res.EACL() sig := eaclTable.Signature() @@ -455,16 +354,10 @@ var getExtendedACLCmd = &cobra.Command{ if containerJSON { data, err = eaclTable.MarshalJSON() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't enode to JSON: %w", err)) - return - } + exitOnErr(cmd, errf("can't enode to JSON: %w", err)) } else { data, err = eaclTable.Marshal() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't enode to binary: %w", err)) - return - } + exitOnErr(cmd, errf("can't enode to binary: %w", err)) } cmd.Println("dumping data to file:", containerPathTo) @@ -472,9 +365,8 @@ var getExtendedACLCmd = &cobra.Command{ cmd.Println("Signature:") printJSONMarshaler(cmd, sig, "signature") - if err = os.WriteFile(containerPathTo, data, 0644); err != nil { - cmd.PrintErrln(err) - } + err = os.WriteFile(containerPathTo, data, 0644) + exitOnErr(cmd, err) }, } @@ -487,50 +379,29 @@ Container ID in EACL table will be substituted with ID from the CLI.`, ctx := context.Background() key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := parseContainerID(containerID) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) eaclTable, err := parseEACL(eaclPathFrom) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) tok, err := getSessionToken(sessionTokenPath) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) eaclTable.SetCID(id) eaclTable.SetSessionToken(tok) err = cli.SetEACL(ctx, eaclTable, globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) if containerAwait { exp, err := eaclTable.Marshal() - if err != nil { - cmd.PrintErrln("broken EACL table") - return - } + exitOnErr(cmd, errf("broken EACL table: %w", err)) cmd.Println("awaiting...") @@ -552,8 +423,7 @@ Container ID in EACL table will be substituted with ID from the CLI.`, } } - cmd.PrintErrln("timeout: EACL has not been persisted on sidechain") - return + exitOnErr(cmd, errSetEACLTimeout) } }, } diff --git a/cmd/neofs-cli/modules/control.go b/cmd/neofs-cli/modules/control.go index 692c275ab8..46b726e470 100644 --- a/cmd/neofs-cli/modules/control.go +++ b/cmd/neofs-cli/modules/control.go @@ -85,16 +85,10 @@ func init() { func healthCheck(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) if healthCheckIRVar { healthCheckIR(cmd, key, cli) @@ -105,25 +99,21 @@ func healthCheck(cmd *cobra.Command, _ []string) { req.SetBody(new(control.HealthCheckRequest_Body)) - if err := controlSvc.SignMessage(key, req); err != nil { - cmd.PrintErrln(err) - return - } + err = controlSvc.SignMessage(key, req) + exitOnErr(cmd, err) resp, err := control.HealthCheck(cli.Raw(), req) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sign := resp.GetSignature() - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(err) - return - } + err = signature.VerifyDataWithSource( + resp, + func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }, + ) + exitOnErr(cmd, err) cmd.Printf("Network status: %s\n", resp.GetBody().GetNetmapStatus()) cmd.Printf("Health status: %s\n", resp.GetBody().GetHealthStatus()) @@ -134,42 +124,34 @@ func healthCheckIR(cmd *cobra.Command, key *ecdsa.PrivateKey, c client.Client) { req.SetBody(new(ircontrol.HealthCheckRequest_Body)) - if err := ircontrolsrv.SignMessage(key, req); err != nil { - cmd.PrintErrln(fmt.Errorf("could not sign request: %w", err)) - return - } + err := ircontrolsrv.SignMessage(key, req) + exitOnErr(cmd, errf("could not sign request: %w", err)) resp, err := ircontrol.HealthCheck(c.Raw(), req) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc failure: %w", err)) - return - } + exitOnErr(cmd, errf("rpc failure: %w", err)) sign := resp.GetSignature() - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(fmt.Errorf("invalid response signature: %w", err)) - return - } + err = signature.VerifyDataWithSource( + resp, + func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }, + ) + exitOnErr(cmd, errf("invalid response signature: %w", err)) cmd.Printf("Health status: %s\n", resp.GetBody().GetHealthStatus()) } func setNetmapStatus(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) var status control.NetmapStatus switch netmapStatus { default: - cmd.PrintErrln(fmt.Errorf("unsupported status %s", netmapStatus)) - return + exitOnErr(cmd, fmt.Errorf("unsupported status %s", netmapStatus)) case netmapStatusOnline: status = control.NetmapStatus_ONLINE case netmapStatusOffline: @@ -183,31 +165,24 @@ func setNetmapStatus(cmd *cobra.Command, _ []string) { body.SetStatus(status) - if err := controlSvc.SignMessage(key, req); err != nil { - cmd.PrintErrln(err) - return - } + err = controlSvc.SignMessage(key, req) + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) resp, err := control.SetNetmapStatus(cli.Raw(), req) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sign := resp.GetSignature() - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(err) - return - } + err = signature.VerifyDataWithSource( + resp, + func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }, + ) + exitOnErr(cmd, err) cmd.Println("Network status update request successfully sent.") } @@ -222,10 +197,7 @@ var dropObjectsCmd = &cobra.Command{ Long: "Drop objects from the node's local storage", Run: func(cmd *cobra.Command, args []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) binAddrList := make([][]byte, 0, len(dropObjectsList)) @@ -234,15 +206,11 @@ var dropObjectsCmd = &cobra.Command{ err := a.Parse(dropObjectsList[i]) if err != nil { - cmd.PrintErrln(fmt.Errorf("could not parse address #%d: %w", i, err)) - return + exitOnErr(cmd, fmt.Errorf("could not parse address #%d: %w", i, err)) } binAddr, err := a.Marshal() - if err != nil { - cmd.PrintErrln(fmt.Errorf("could not marshal the address: %w", err)) - return - } + exitOnErr(cmd, errf("could not marshal the address: %w", err)) binAddrList = append(binAddrList, binAddr) } @@ -254,31 +222,24 @@ var dropObjectsCmd = &cobra.Command{ body.SetAddressList(binAddrList) - if err := controlSvc.SignMessage(key, req); err != nil { - cmd.PrintErrln(err) - return - } + err = controlSvc.SignMessage(key, req) + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) resp, err := control.DropObjects(cli.Raw(), req) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sign := resp.GetSignature() - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(err) - return - } + err = signature.VerifyDataWithSource( + resp, + func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }, + ) + exitOnErr(cmd, err) cmd.Println("Objects were successfully marked to be removed.") }, @@ -290,39 +251,29 @@ var snapshotCmd = &cobra.Command{ Long: "Get network map snapshot", Run: func(cmd *cobra.Command, args []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) req := new(control.NetmapSnapshotRequest) req.SetBody(new(control.NetmapSnapshotRequest_Body)) - if err := controlSvc.SignMessage(key, req); err != nil { - cmd.PrintErrln(err) - return - } + err = controlSvc.SignMessage(key, req) + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) resp, err := control.NetmapSnapshot(cli.Raw(), req) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sign := resp.GetSignature() - if err := signature.VerifyDataWithSource(resp, func() ([]byte, []byte) { - return sign.GetKey(), sign.GetSign() - }); err != nil { - cmd.PrintErrln(err) - return - } + err = signature.VerifyDataWithSource( + resp, + func() ([]byte, []byte) { + return sign.GetKey(), sign.GetSign() + }, + ) + exitOnErr(cmd, err) prettyPrintNetmap(cmd, resp.GetBody().GetNetmap(), netmapSnapshotJSON) }, diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 1ec9d8be50..1be83c6a96 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -3,7 +3,6 @@ package cmd import ( "context" "encoding/hex" - "fmt" "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/config/netmode" @@ -43,22 +42,13 @@ var getEpochCmd = &cobra.Command{ Long: "Get current epoch number", Run: func(cmd *cobra.Command, args []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) netInfo, err := cli.NetworkInfo(context.Background(), globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) cmd.Println(netInfo.CurrentEpoch()) }, @@ -70,22 +60,13 @@ var localNodeInfoCmd = &cobra.Command{ Long: `Get local node info`, Run: func(cmd *cobra.Command, args []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) nodeInfo, err := cli.EndpointInfo(context.Background(), globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) prettyPrintNodeInfo(cmd, nodeInfo.NodeInfo(), nodeInfoJSON) }, @@ -97,22 +78,13 @@ var netInfoCmd = &cobra.Command{ Long: "Get information about NeoFS network", Run: func(cmd *cobra.Command, args []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cli, err := getSDKClient(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) netInfo, err := cli.NetworkInfo(context.Background(), globalCallOptions()...) - if err != nil { - cmd.PrintErrln(fmt.Errorf("rpc error: %w", err)) - return - } + exitOnErr(cmd, errf("rpc error: %w", err)) cmd.Printf("Epoch: %d\n", netInfo.CurrentEpoch()) diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index d020f5ed6f..8ad1e0ff20 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -208,34 +208,21 @@ func initSession(ctx context.Context, key *ecdsa.PrivateKey) (client.Client, *se func putObject(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) ownerID, err := getOwnerID(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) filename := cmd.Flag("file").Value.String() f, err := os.OpenFile(filename, os.O_RDONLY, os.ModePerm) if err != nil { - cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) - return + exitOnErr(cmd, fmt.Errorf("can't open file '%s': %w", filename, err)) } attrs, err := parseObjectAttrs(cmd) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't parse object attributes: %w", err)) - return - } + exitOnErr(cmd, errf("can't parse object attributes: %w", err)) expiresOn, _ := cmd.Flags().GetUint64(putExpiresOnFlag) if expiresOn > 0 { @@ -264,15 +251,9 @@ func putObject(cmd *cobra.Command, _ []string) { ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) oid, err := cli.PutObject(ctx, new(client.PutObjectParams). WithObject(obj.Object()). @@ -282,10 +263,7 @@ func putObject(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't put object: %w", err)) - return - } + exitOnErr(cmd, errf("can't put object: %w", err)) cmd.Printf("[%s] Object successfully stored\n", filename) cmd.Printf(" ID: %s\n CID: %s\n", oid, cid) @@ -293,28 +271,16 @@ func putObject(cmd *cobra.Command, _ []string) { func deleteObject(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) objAddr, err := getObjectAddress(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) tombstoneAddr, err := client.DeleteObject(ctx, cli, new(client.DeleteObjectParams).WithAddress(objAddr), @@ -323,10 +289,7 @@ func deleteObject(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cmd.Println("Object removed successfully.") cmd.Printf(" ID: %s\n CID: %s\n", tombstoneAddr.ObjectID(), tombstoneAddr.ContainerID()) @@ -334,16 +297,10 @@ func deleteObject(cmd *cobra.Command, _ []string) { func getObject(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) objAddr, err := getObjectAddress(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) var out io.Writer filename := cmd.Flag("file").Value.String() @@ -352,24 +309,19 @@ func getObject(cmd *cobra.Command, _ []string) { } else { f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, os.ModePerm) if err != nil { - cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) - return + exitOnErr(cmd, fmt.Errorf("can't open file '%s': %w", filename, err)) } + defer f.Close() + out = f } ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) raw, _ := cmd.Flags().GetBool(rawFlag) @@ -388,8 +340,7 @@ func getObject(cmd *cobra.Command, _ []string) { return } - cmd.PrintErrln(fmt.Errorf("can't get object: %w", err)) - return + exitOnErr(cmd, fmt.Errorf("can't get object: %w", err)) } if filename != "" { @@ -399,37 +350,23 @@ func getObject(cmd *cobra.Command, _ []string) { // Print header only if file is not streamed to stdout. hdrFile := cmd.Flag("header").Value.String() if filename != "" || hdrFile != "" { - if err = saveAndPrintHeader(cmd, obj, hdrFile); err != nil { - cmd.PrintErrln(err) - return - } + err = saveAndPrintHeader(cmd, obj, hdrFile) + exitOnErr(cmd, err) } } func getObjectHeader(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) objAddr, err := getObjectAddress(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ps := new(client.ObjectHeaderParams).WithAddress(objAddr) if ok, _ := cmd.Flags().GetBool("main-only"); ok { ps = ps.WithMainFields() @@ -449,46 +386,28 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { return } - cmd.PrintErrln(fmt.Errorf("can't get object header: %w", err)) - return + exitOnErr(cmd, fmt.Errorf("can't get object header: %w", err)) } - if err = saveAndPrintHeader(cmd, obj, cmd.Flag("file").Value.String()); err != nil { - cmd.PrintErrln(err) - return - } + err = saveAndPrintHeader(cmd, obj, cmd.Flag("file").Value.String()) + exitOnErr(cmd, err) } func searchObject(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sf, err := parseSearchFilters(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ps := new(client.SearchObjectParams).WithContainerID(cid).WithSearchFilters(sf) ids, err := cli.SearchObject(ctx, ps, append(globalCallOptions(), @@ -496,10 +415,7 @@ func searchObject(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't search object: %w", err)) - return - } + exitOnErr(cmd, errf("can't search object: %w", err)) cmd.Printf("Found %d objects.\n", len(ids)) for _, id := range ids { cmd.Println(id) @@ -508,46 +424,25 @@ func searchObject(cmd *cobra.Command, _ []string) { func getObjectHash(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) objAddr, err := getObjectAddress(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ranges, err := getRangeList(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) typ, err := getHashType(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) strSalt := strings.TrimPrefix(cmd.Flag(getRangeHashSaltFlag).Value.String(), "0x") salt, err := hex.DecodeString(strSalt) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) btok, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) if len(ranges) == 0 { // hash of full payload obj, err := cli.GetObjectHeader(ctx, new(client.ObjectHeaderParams).WithAddress(objAddr), @@ -556,10 +451,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't get object header: %w", err)) - return - } + exitOnErr(cmd, errf("can't get object header: %w", err)) switch typ { case hashSha256: cmd.Println(hex.EncodeToString(obj.PayloadChecksum().Sum())) @@ -582,10 +474,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) for i := range res { cmd.Printf("Offset=%d (Length=%d)\t: %s\n", ranges[i].GetOffset(), ranges[i].GetLength(), hex.EncodeToString(res[i][:])) @@ -597,10 +486,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) { client.WithBearer(btok), )..., ) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) for i := range res { cmd.Printf("Offset=%d (Length=%d)\t: %s\n", ranges[i].GetOffset(), ranges[i].GetLength(), hex.EncodeToString(res[i][:])) @@ -926,24 +812,16 @@ func getBearerToken(cmd *cobra.Command, flagname string) (*token.BearerToken, er func getObjectRange(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) objAddr, err := getObjectAddress(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ranges, err := getRangeList(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } else if len(ranges) != 1 { - cmd.PrintErrln(err) - return + exitOnErr(cmd, err) + + if len(ranges) != 1 { + exitOnErr(cmd, fmt.Errorf("exactly one range must be specified, got: %d", len(ranges))) } var out io.Writer @@ -954,8 +832,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) { } else { f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, os.ModePerm) if err != nil { - cmd.PrintErrln(fmt.Errorf("can't open file '%s': %w", filename, err)) - return + exitOnErr(cmd, fmt.Errorf("can't open file '%s': %w", filename, err)) } defer f.Close() @@ -966,16 +843,10 @@ func getObjectRange(cmd *cobra.Command, _ []string) { ctx := context.Background() c, sessionToken, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) bearerToken, err := getBearerToken(cmd, "bearer") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) raw, _ := cmd.Flags().GetBool(rawFlag) @@ -995,8 +866,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) { return } - cmd.PrintErrln(fmt.Errorf("can't get object payload range: %w", err)) - return + exitOnErr(cmd, fmt.Errorf("can't get object payload range: %w", err)) } if filename != "" { diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 2fcaeb866d..60a95b1ff2 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -63,9 +63,8 @@ var ( // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { - if err := rootCmd.Execute(); err != nil { - os.Exit(1) - } + err := rootCmd.Execute() + exitOnErr(rootCmd, err) } func init() { @@ -136,10 +135,7 @@ func initConfig() { } else { // Find home directory. home, err := homedir.Dir() - if err != nil { - fmt.Println(err) - os.Exit(1) - } + exitOnErr(rootCmd, err) // Search config in `$HOME/.config/neofs-cli/` with name "config.yaml" viper.AddConfigPath(filepath.Join(home, ".config", "neofs-cli")) diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index b1aae78698..2b283a517a 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -3,7 +3,6 @@ package cmd import ( "context" "errors" - "fmt" "github.com/nspcc-dev/neofs-api-go/pkg/client" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" @@ -129,48 +128,32 @@ func sgBearerToken(cmd *cobra.Command) (*token.BearerToken, error) { func putSG(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) ownerID, err := getOwnerID(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) members := make([]*objectSDK.ID, 0, len(sgMembers)) for i := range sgMembers { id := objectSDK.NewID() - if err := id.Parse(sgMembers[i]); err != nil { - cmd.PrintErrln(err) - return - } + + err = id.Parse(sgMembers[i]) + exitOnErr(cmd, err) members = append(members, id) } bearerToken, err := sgBearerToken(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sg, err := storagegroup.CollectMembers(&sgHeadReceiver{ ctx: ctx, @@ -178,16 +161,10 @@ func putSG(cmd *cobra.Command, _ []string) { c: cli, bearerToken: bearerToken, }, cid, members) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) sgContent, err := sg.Marshal() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) obj := objectSDK.NewRaw() obj.SetContainerID(cid) @@ -203,10 +180,7 @@ func putSG(cmd *cobra.Command, _ []string) { client.WithBearer(bearerToken), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't put storage group: %w", err)) - return - } + exitOnErr(cmd, errf("can't put storage group: %w", err)) cmd.Println("Storage group successfully stored") cmd.Printf(" ID: %s\n CID: %s\n", oid, cid) @@ -221,28 +195,16 @@ func getSGID() (*objectSDK.ID, error) { func getSG(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := getSGID() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) bearerToken, err := sgBearerToken(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) addr := objectSDK.NewAddress() addr.SetContainerID(cid) @@ -251,10 +213,7 @@ func getSG(cmd *cobra.Command, _ []string) { ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) obj, err := cli.GetObject(ctx, new(client.GetObjectParams). @@ -264,16 +223,12 @@ func getSG(cmd *cobra.Command, _ []string) { client.WithBearer(bearerToken), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't get storage group: %w", err)) - return - } + exitOnErr(cmd, errf("can't get storage group: %w", err)) sg := storagegroupAPI.New() - if err := sg.Unmarshal(obj.Payload()); err != nil { - cmd.PrintErrln(err) - return - } + + err = sg.Unmarshal(obj.Payload()) + exitOnErr(cmd, err) cmd.Printf("Expiration epoch: %d\n", sg.ExpirationEpoch()) cmd.Printf("Group size: %d\n", sg.ValidationDataSize()) @@ -290,30 +245,18 @@ func getSG(cmd *cobra.Command, _ []string) { func listSG(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) bearerToken, err := sgBearerToken(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ids, err := cli.SearchObject(ctx, new(client.SearchObjectParams). @@ -324,10 +267,7 @@ func listSG(cmd *cobra.Command, _ []string) { client.WithBearer(bearerToken), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't search storage groups: %w", err)) - return - } + exitOnErr(cmd, errf("can't search storage groups: %w", err)) cmd.Printf("Found %d storage groups.\n", len(ids)) @@ -338,36 +278,21 @@ func listSG(cmd *cobra.Command, _ []string) { func delSG(cmd *cobra.Command, _ []string) { key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't fetch private key: %w", err)) - return - } + exitOnErr(cmd, errf("can't fetch private key: %w", err)) cid, err := getCID(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) id, err := getSGID() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) bearerToken, err := sgBearerToken(cmd) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) ctx := context.Background() cli, tok, err := initSession(ctx, key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) addr := objectSDK.NewAddress() addr.SetContainerID(cid) @@ -381,10 +306,7 @@ func delSG(cmd *cobra.Command, _ []string) { client.WithBearer(bearerToken), )..., ) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't get storage group: %w", err)) - return - } + exitOnErr(cmd, errf("can't get storage group: %w", err)) cmd.Println("Storage group removed successfully.") cmd.Printf(" Tombstone: %s\n", tombstone.ObjectID()) diff --git a/cmd/neofs-cli/modules/util.go b/cmd/neofs-cli/modules/util.go index f560aaa7c2..1464790247 100644 --- a/cmd/neofs-cli/modules/util.go +++ b/cmd/neofs-cli/modules/util.go @@ -118,10 +118,7 @@ var ( }) err := targetDB.Open() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) defer targetDB.Close() @@ -131,10 +128,7 @@ var ( } err = locodedb.FillDatabase(locodeDB, airportDB, continentsDB, names, targetDB) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) }, } ) @@ -157,18 +151,12 @@ var ( }) err := targetDB.Open() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) defer targetDB.Close() record, err := locodedb.LocodeRecord(targetDB, locodeInfoCode) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) cmd.Printf("Country: %s\n", record.CountryName()) cmd.Printf("Location: %s\n", record.LocationName()) @@ -255,28 +243,16 @@ func init() { func signBearerToken(cmd *cobra.Command, _ []string) { btok, err := getBearerToken(cmd, "from") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) key, err := getKey() - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) err = completeBearerToken(btok) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) err = btok.SignToken(key) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) to := cmd.Flag("to").Value.String() jsonFlag, _ := cmd.Flags().GetBool("json") @@ -284,16 +260,10 @@ func signBearerToken(cmd *cobra.Command, _ []string) { var data []byte if jsonFlag || len(to) == 0 { data, err = btok.MarshalJSON() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't JSON encode bearer token: %w", err)) - return - } + exitOnErr(cmd, errf("can't JSON encode bearer token: %w", err)) } else { data, err = btok.Marshal() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't binary encode bearer token: %w", err)) - return - } + exitOnErr(cmd, errf("can't binary encode bearer token: %w", err)) } if len(to) == 0 { @@ -303,44 +273,28 @@ func signBearerToken(cmd *cobra.Command, _ []string) { } err = os.WriteFile(to, data, 0644) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't write signed bearer token to file: %w", err)) - return - } + exitOnErr(cmd, errf("can't write signed bearer token to file: %w", err)) cmd.Printf("signed bearer token was successfully dumped to %s\n", to) } func signSessionToken(cmd *cobra.Command, _ []string) { path, err := cmd.Flags().GetString("from") - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) stok, err := getSessionToken(path) if err != nil { - cmd.PrintErrln(fmt.Errorf("can't read session token from %s: %w", path, err)) - return + exitOnErr(cmd, fmt.Errorf("can't read session token from %s: %w", path, err)) } key, err := getKey() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't get private key, make sure it is provided: %w", err)) - return - } + exitOnErr(cmd, errf("can't get private key, make sure it is provided: %w", err)) err = stok.Sign(key) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't sign token: %w", err)) - return - } + exitOnErr(cmd, errf("can't sign token: %w", err)) data, err := stok.MarshalJSON() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't encode session token: %w", err)) - return - } + exitOnErr(cmd, errf("can't encode session token: %w", err)) to := cmd.Flag("to").Value.String() if len(to) == 0 { @@ -350,8 +304,7 @@ func signSessionToken(cmd *cobra.Command, _ []string) { err = os.WriteFile(to, data, 0644) if err != nil { - cmd.PrintErrln(fmt.Errorf("can't write signed session token to %s: %w", to, err)) - return + exitOnErr(cmd, fmt.Errorf("can't write signed session token to %s: %w", to, err)) } cmd.Printf("signed session token saved in %s\n", to) @@ -363,24 +316,15 @@ func convertEACLTable(cmd *cobra.Command, _ []string) { jsonFlag, _ := cmd.Flags().GetBool("json") table, err := parseEACL(pathFrom) - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) var data []byte if jsonFlag || len(to) == 0 { data, err = table.MarshalJSON() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't JSON encode extended ACL table: %w", err)) - return - } + exitOnErr(cmd, errf("can't JSON encode extended ACL table: %w", err)) } else { data, err = table.Marshal() - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't binary encode extended ACL table: %w", err)) - return - } + exitOnErr(cmd, errf("can't binary encode extended ACL table: %w", err)) } if len(to) == 0 { @@ -389,10 +333,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) { } err = os.WriteFile(to, data, 0644) - if err != nil { - cmd.PrintErrln(fmt.Errorf("can't write exteded ACL table to file: %w", err)) - return - } + exitOnErr(cmd, errf("can't write exteded ACL table to file: %w", err)) cmd.Printf("extended ACL table was successfully dumped to %s\n", to) } @@ -412,8 +353,7 @@ func processKeyer(cmd *cobra.Command, args []string) { err = result.ParseMultiSig(args) } else { if len(args) > 1 { - cmd.PrintErrln(errKeyerSingleArgument) - return + exitOnErr(cmd, errKeyerSingleArgument) } var argument string @@ -431,10 +371,7 @@ func processKeyer(cmd *cobra.Command, args []string) { } } - if err != nil { - cmd.PrintErrln(err) - return - } + exitOnErr(cmd, err) result.PrettyPrint(uncompressed, useHex) } From 0bcc5056828d8cc00bc921953ca5f8a682e22183 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 6 Jul 2021 21:12:10 +0300 Subject: [PATCH 152/219] [#668] pkg/audit: Skip audit for containers without SG Signed-off-by: Pavel Karpy --- pkg/innerring/processors/audit/process.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index c9957aca1d..933b86a077 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -86,6 +86,12 @@ func (ap *Processor) processStartAudit(epoch uint64) { zap.Stringer("cid", containers[i]), zap.Int("amount", len(storageGroups))) + // skip audit for containers + // without storage groups + if len(storageGroups) == 0 { + continue + } + auditTask := new(audit.Task). WithReporter(&epochAuditReporter{ epoch: epoch, From 5a20df8e913007a8340565d52833bebf5c57f607 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 11:40:45 +0300 Subject: [PATCH 153/219] Update API Go library to v1.28.2 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4f425f086c..058550fff5 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.3 - github.com/nspcc-dev/neofs-api-go v1.28.1 + github.com/nspcc-dev/neofs-api-go v1.28.2 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 108514ce2c..1f5f253de2 100644 --- a/go.sum +++ b/go.sum @@ -370,8 +370,8 @@ github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6A github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-api-go v1.28.1 h1:u+JbrisfLCXICamU3ie+UNPLwpjFdf14P2M+yEKnblw= -github.com/nspcc-dev/neofs-api-go v1.28.1/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= +github.com/nspcc-dev/neofs-api-go v1.28.2 h1:T74HsOcDANc8LXbhNHI+k3KksSA/dK6VHKtYDmDE6PM= +github.com/nspcc-dev/neofs-api-go v1.28.2/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From 8fcf68c2a19fcd6e26fb7643a40bd10d3aa63498 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 11:40:55 +0300 Subject: [PATCH 154/219] Update changelog for v0.22.1 release Signed-off-by: Pavel Karpy --- CHANGELOG.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15c67bc808..18805f6c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,24 @@ Changelog for NeoFS Node ## [Unreleased] +## [0.21.1] - 2021-07-07 + +### Added +- `GetCandidates` method to morph client wrapper ([#647](https://github.com/nspcc-dev/neofs-node/pull/647)). +- All-in-One Docker image that contains all NeoFS related binaries ([#662](https://github.com/nspcc-dev/neofs-node/pull/662)). +- `--version` flag to Storage Node binary ([#664](https://github.com/nspcc-dev/neofs-node/issues/664)). + +### Changed +- Do not check NeoFS version in `LocalNodeInfo` requests and `Put` container operations; `v2.7.0` is genesis version of NeoFS ([#660](https://github.com/nspcc-dev/neofs-node/pull/660)). +- All error calls of CLI return `1` exit code ([#657](https://github.com/nspcc-dev/neofs-node/issues/657)). + +### Fixed +- Do not use multisignature for audit operations ([#658](https://github.com/nspcc-dev/neofs-node/pull/658)). +- Skip audit for containers without Storage Groups ([#659](https://github.com/nspcc-dev/neofs-node/issues/659)). + +### Updated +- NeoFS API Go: [v1.28.2](https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.28.2). + ## [0.22.0] - 2021-06-29 - Muuido (무의도, 舞衣島) Storage nodes with a group of network endpoints. @@ -452,7 +470,8 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. -[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...master +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.1...master +[0.22.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...v0.22.1 [0.22.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.1...v0.22.0 [0.21.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.0...v0.21.1 [0.21.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.20.0...v0.21.0 From ffa5de4963363c6a30f7a7ac5b10b895895ca46a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 15:29:15 +0300 Subject: [PATCH 155/219] Fix link in changelog for v0.22.1 release Signed-off-by: Pavel Karpy --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18805f6c2e..fa27bc1a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Changelog for NeoFS Node ## [Unreleased] -## [0.21.1] - 2021-07-07 +## [0.22.1] - 2021-07-07 ### Added - `GetCandidates` method to morph client wrapper ([#647](https://github.com/nspcc-dev/neofs-node/pull/647)). From 937210a2d34016f2324e2a6cef81b9a27b384b46 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 15:30:00 +0300 Subject: [PATCH 156/219] Update API Go library to v1.28.3 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 058550fff5..87b820d49b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.95.3 - github.com/nspcc-dev/neofs-api-go v1.28.2 + github.com/nspcc-dev/neofs-api-go v1.28.3 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 diff --git a/go.sum b/go.sum index 1f5f253de2..cb9407488e 100644 --- a/go.sum +++ b/go.sum @@ -370,8 +370,8 @@ github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6A github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= -github.com/nspcc-dev/neofs-api-go v1.28.2 h1:T74HsOcDANc8LXbhNHI+k3KksSA/dK6VHKtYDmDE6PM= -github.com/nspcc-dev/neofs-api-go v1.28.2/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= +github.com/nspcc-dev/neofs-api-go v1.28.3 h1:53Ec3hv3LtI3uuG1H8Yp2OKOIdsAqQVfUOyClhnhc9g= +github.com/nspcc-dev/neofs-api-go v1.28.3/go.mod h1:YRIzUqBj/lGbmFm8mmCh54ZOzcJKkEIhv2s7ZvSLv3M= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= From d34149a67e565d256fb54cf36be13aa5c19f5d65 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 15:35:33 +0300 Subject: [PATCH 157/219] Update changelog for v0.22.2 release Signed-off-by: Pavel Karpy --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa27bc1a56..b96b45bc43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ Changelog for NeoFS Node ## [Unreleased] +## [0.22.2] - 2021-07-07 + +Updated broken version of NeoFS API Go. + +### Updated +- NeoFS API Go: [v1.28.3](https://github.com/nspcc-dev/neofs-api-go/releases/tag/v1.28.3). + ## [0.22.1] - 2021-07-07 ### Added @@ -470,7 +477,8 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. -[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.1...master +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.2...master +[0.22.2]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.1...v0.22.2 [0.22.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...v0.22.1 [0.22.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.1...v0.22.0 [0.21.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.0...v0.21.1 From 48c3573e0c981c0e18ebafa6b62410d45c3b4e85 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 7 Jul 2021 15:54:02 +0300 Subject: [PATCH 158/219] [#671] config/testnet: Update NeoFS storage version Signed-off-by: Pavel Karpy --- config/testnet/README.md | 2 +- config/testnet/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/testnet/README.md b/config/testnet/README.md index 16892cdc94..af92191e20 100644 --- a/config/testnet/README.md +++ b/config/testnet/README.md @@ -14,7 +14,7 @@ However, if you need to rebuild it for some reason, run $ make image-storage-testnet ... Successfully built ab0557117b02 -Successfully tagged nspccdev/neofs-storage-testnet:0.21.1 +Successfully tagged nspccdev/neofs-storage-testnet:0.22.2 ``` ## Deploy node diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index b3af5f6f19..4ff3742593 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -3,7 +3,7 @@ version: "2.4" services: storage01: - image: nspccdev/neofs-storage-testnet:0.21.1 + image: nspccdev/neofs-storage-testnet:0.22.2 container_name: neofs-testnet env_file: node_config.env network_mode: host From 24d1725cc82b01bcaede188068365a8b0078fba7 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 6 Jul 2021 14:27:07 +0300 Subject: [PATCH 159/219] [#666] innerring: Make GlagoliticLetter enum public for re-use Signed-off-by: Alex Vanin --- pkg/innerring/alphabet.go | 16 ++++++++-------- pkg/innerring/innerring.go | 6 +++--- pkg/innerring/state.go | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/innerring/alphabet.go b/pkg/innerring/alphabet.go index c649090eeb..b5f2c2a1c6 100644 --- a/pkg/innerring/alphabet.go +++ b/pkg/innerring/alphabet.go @@ -2,10 +2,10 @@ package innerring import "github.com/nspcc-dev/neo-go/pkg/util" -type glagoliticLetter int8 +type GlagoliticLetter int8 const ( - _ glagoliticLetter = iota - 1 + _ GlagoliticLetter = iota - 1 az buky @@ -53,7 +53,7 @@ const ( ) // returns string in config-compatible format -func (l glagoliticLetter) configString() string { +func (l GlagoliticLetter) String() string { switch l { default: return "unknown" @@ -142,10 +142,10 @@ func (l glagoliticLetter) configString() string { } } -type alphabetContracts map[glagoliticLetter]util.Uint160 +type alphabetContracts map[GlagoliticLetter]util.Uint160 func newAlphabetContracts() alphabetContracts { - return make(map[glagoliticLetter]util.Uint160, lastLetterNum) + return make(map[GlagoliticLetter]util.Uint160, lastLetterNum) } func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) { @@ -153,7 +153,7 @@ func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) { return util.Uint160{}, false } - contract, ok := a[glagoliticLetter(ind)] + contract, ok := a[GlagoliticLetter(ind)] return contract, ok } @@ -162,12 +162,12 @@ func (a alphabetContracts) indexOutOfRange(ind int) bool { return ind < 0 && ind >= len(a) } -func (a alphabetContracts) iterate(f func(glagoliticLetter, util.Uint160)) { +func (a alphabetContracts) iterate(f func(GlagoliticLetter, util.Uint160)) { for letter, contract := range a { f(letter, contract) } } -func (a *alphabetContracts) set(l glagoliticLetter, h util.Uint160) { +func (a *alphabetContracts) set(l GlagoliticLetter, h util.Uint160) { (*a)[l] = h } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 9c92c44172..5a945a9101 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -921,7 +921,7 @@ func ParsePublicKeysFromStrings(pubKeys []string) (keys.PublicKeys, error) { } func parseAlphabetContracts(cfg *viper.Viper) (alphabetContracts, error) { - num := glagoliticLetter(cfg.GetUint("contracts.alphabet.amount")) + num := GlagoliticLetter(cfg.GetUint("contracts.alphabet.amount")) alpha := newAlphabetContracts() if num > lastLetterNum { @@ -929,11 +929,11 @@ func parseAlphabetContracts(cfg *viper.Viper) (alphabetContracts, error) { } for letter := az; letter < num; letter++ { - contractStr := cfg.GetString("contracts.alphabet." + letter.configString()) + contractStr := cfg.GetString("contracts.alphabet." + letter.String()) contractHash, err := util.Uint160DecodeStringLE(contractStr) if err != nil { - return nil, fmt.Errorf("invalid alphabet %s contract: %s: %w", letter.configString(), contractStr, err) + return nil, fmt.Errorf("invalid alphabet %s contract: %s: %w", letter.String(), contractStr, err) } alpha.set(letter, contractHash) diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index abe90cb5b4..e74ccd327e 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -85,7 +85,7 @@ func (s *Server) voteForSidechainValidator(validators keys.PublicKeys) error { epoch := s.EpochCounter() - s.contracts.alphabet.iterate(func(letter glagoliticLetter, contract util.Uint160) { + s.contracts.alphabet.iterate(func(letter GlagoliticLetter, contract util.Uint160) { err := s.morphClient.NotaryInvoke(contract, s.feeConfig.SideChainFee(), voteMethod, int64(epoch), validators) if err != nil { s.log.Warn("can't invoke vote method in alphabet contract", From d189d6092562d896c5dc9ed060930efb4530df8c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 6 Jul 2021 14:27:54 +0300 Subject: [PATCH 160/219] [#666] cmd/neofs-adm: Initial app structure with `config init` command Signed-off-by: Alex Vanin --- .../internal/modules/config/config.go | 124 ++++++++++++++++++ .../internal/modules/config/config_test.go | 40 ++++++ cmd/neofs-adm/internal/modules/config/root.go | 29 ++++ cmd/neofs-adm/internal/modules/root.go | 63 +++++++++ cmd/neofs-adm/main.go | 13 ++ 5 files changed, 269 insertions(+) create mode 100644 cmd/neofs-adm/internal/modules/config/config.go create mode 100644 cmd/neofs-adm/internal/modules/config/config_test.go create mode 100644 cmd/neofs-adm/internal/modules/config/root.go create mode 100644 cmd/neofs-adm/internal/modules/root.go create mode 100644 cmd/neofs-adm/main.go diff --git a/cmd/neofs-adm/internal/modules/config/config.go b/cmd/neofs-adm/internal/modules/config/config.go new file mode 100644 index 0000000000..1d21c227be --- /dev/null +++ b/cmd/neofs-adm/internal/modules/config/config.go @@ -0,0 +1,124 @@ +package config + +import ( + "bytes" + "fmt" + "os" + "path" + "path/filepath" + "text/template" + + "github.com/nspcc-dev/neofs-node/pkg/innerring" + "github.com/spf13/cobra" +) + +type configTemplate struct { + Endpoint string + AlphabetDir string + MaxObjectSize int + EpochDuration int + Glagolitics []string +} + +const configTxtTemplate = `rpc-endpoint: {{ .Endpoint}} +alphabet-wallets: {{ .AlphabetDir}} +network: + max_object_size: {{ .MaxObjectSize}} + epoch_duration: {{ .EpochDuration}} +# if credentials section is omitted, then neofs-adm will require manual password input +credentials:{{ range.Glagolitics}} + {{.}}: password{{end}} +` + +func initConfig(cmd *cobra.Command, args []string) error { + configPath, err := readConfigPathFromArgs(cmd) + if err != nil { + return nil + } + + pathDir := path.Dir(configPath) + err = os.MkdirAll(pathDir, 0700) + if err != nil { + return fmt.Errorf("create dir %s: %w", pathDir, err) + } + + f, err := os.OpenFile(configPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_SYNC, 0600) + if err != nil { + return fmt.Errorf("open %s: %w", configPath, err) + } + defer f.Close() + + configText, err := generateConfigExample(pathDir, 7) + if err != nil { + return err + } + + _, err = f.WriteString(configText) + if err != nil { + return fmt.Errorf("writing to %s: %w", configPath, err) + } + + cmd.Printf("Initial config file saved to %s\n", configPath) + + return nil +} + +func readConfigPathFromArgs(cmd *cobra.Command) (string, error) { + configPath, err := cmd.Flags().GetString(configPathFlag) + if err != nil { + return "", err + } + + if configPath != "" { + return configPath, nil + } + + return defaultConfigPath() +} + +func defaultConfigPath() (string, error) { + home, err := os.UserHomeDir() + if err != nil { + return "", fmt.Errorf("getting home dir path: %w", err) + } + + return path.Join(home, ".neofs", "adm", "config.yml"), nil +} + +// generateConfigExample builds .yml representation of the config file. It is +// easier to build it manually with template instead of using viper, because we +// want to order records in specific order in file and, probably, provide +// some comments as well. +func generateConfigExample(appDir string, credSize int) (string, error) { + input := configTemplate{ + Endpoint: "https://neo.rpc.node:30333", + MaxObjectSize: 67108864, // 64 MiB + EpochDuration: 240, // 1 hour with 15s per block + Glagolitics: make([]string, 0, credSize), + } + + appDir, err := filepath.Abs(appDir) + if err != nil { + return "", fmt.Errorf("making absolute path for %s: %w", appDir, err) + } + input.AlphabetDir = path.Join(appDir, "alphabet-wallets") + + var i innerring.GlagoliticLetter + for i = 0; i < innerring.GlagoliticLetter(credSize); i++ { + input.Glagolitics = append(input.Glagolitics, i.String()) + } + + t, err := template.New("config.yml").Parse(configTxtTemplate) + if err != nil { + return "", fmt.Errorf("parsing config template: %w", err) + } + + buf := bytes.NewBuffer(nil) + + err = t.Execute(buf, input) + if err != nil { + return "", fmt.Errorf("generating config from tempalte: %w", err) + } + + return buf.String(), nil +} diff --git a/cmd/neofs-adm/internal/modules/config/config_test.go b/cmd/neofs-adm/internal/modules/config/config_test.go new file mode 100644 index 0000000000..3e284d9718 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/config/config_test.go @@ -0,0 +1,40 @@ +package config + +import ( + "bytes" + "path" + "testing" + + "github.com/nspcc-dev/neofs-node/pkg/innerring" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" +) + +func TestGenerateConfigExample(t *testing.T) { + const ( + n = 10 + appDir = "/home/example/.neofs" + ) + + configText, err := generateConfigExample(appDir, n) + require.NoError(t, err) + + v := viper.New() + v.SetConfigType("yml") + + require.NoError(t, v.ReadConfig(bytes.NewBufferString(configText))) + + require.Equal(t, "https://neo.rpc.node:30333", v.GetString("rpc-endpoint")) + require.Equal(t, path.Join(appDir, "alphabet-wallets"), v.GetString("alphabet-wallets")) + require.Equal(t, 67108864, v.GetInt("network.max_object_size")) + require.Equal(t, 240, v.GetInt("network.epoch_duration")) + + var i innerring.GlagoliticLetter + for i = 0; i < innerring.GlagoliticLetter(n); i++ { + key := "credentials." + i.String() + require.Equal(t, "password", v.GetString(key)) + } + + key := "credentials." + i.String() + require.Equal(t, "", v.GetString(key)) +} diff --git a/cmd/neofs-adm/internal/modules/config/root.go b/cmd/neofs-adm/internal/modules/config/root.go new file mode 100644 index 0000000000..0f445cb2f7 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/config/root.go @@ -0,0 +1,29 @@ +package config + +import ( + "github.com/spf13/cobra" +) + +const configPathFlag = "path" + +var ( + // RootCmd is a root command of config section. + RootCmd = &cobra.Command{ + Use: "config", + Short: "Section for neofs-adm config related commands.", + } + + initCmd = &cobra.Command{ + Use: "init", + Short: "Initialize basic neofs-adm configuration file.", + Example: `neofs-adm config init +neofs-adm config init --path .config/neofs-adm.yml`, + RunE: initConfig, + } +) + +func init() { + RootCmd.AddCommand(initCmd) + + initCmd.Flags().String(configPathFlag, "", "path to config (default ~/.neofs/adm/config.yml)") +} diff --git a/cmd/neofs-adm/internal/modules/root.go b/cmd/neofs-adm/internal/modules/root.go new file mode 100644 index 0000000000..58e97d64d0 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/root.go @@ -0,0 +1,63 @@ +package modules + +import ( + "fmt" + + "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config" + "github.com/nspcc-dev/neofs-node/misc" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var ( + rootCmd = &cobra.Command{ + Use: "neofs-adm", + Short: "NeoFS Administrative Tool", + Long: `NeoFS Administrative Tool provides functions to setup and +manage NeoFS network deployment.`, + RunE: entryPoint, + SilenceUsage: true, + } + + configFlag = "config" +) + +func init() { + cobra.OnInitialize(func() { initConfig(rootCmd) }) + // we need to init viper config to bind viper and cobra configurations for + // rpc endpoint, alphabet wallet dir, key credentials, etc. + + rootCmd.PersistentFlags().StringP(configFlag, "c", "", "config file") + rootCmd.Flags().Bool("version", false, "application version") + + rootCmd.AddCommand(config.RootCmd) +} + +func Execute() error { + return rootCmd.Execute() +} + +func entryPoint(cmd *cobra.Command, args []string) error { + printVersion, err := cmd.Flags().GetBool("version") + if err == nil && printVersion { + fmt.Printf("Version: %s \nBuild: %s \nDebug: %s\n", + misc.Version, + misc.Build, + misc.Debug, + ) + return nil + } + + return cmd.Usage() +} + +func initConfig(cmd *cobra.Command) { + configFile, err := cmd.Flags().GetString(configFlag) + if err != nil || configFile == "" { + return + } + + viper.SetConfigType("yml") + viper.SetConfigFile(configFile) + _ = viper.ReadInConfig() // if config file is set but unavailable, ignore it +} diff --git a/cmd/neofs-adm/main.go b/cmd/neofs-adm/main.go new file mode 100644 index 0000000000..be009dc0d0 --- /dev/null +++ b/cmd/neofs-adm/main.go @@ -0,0 +1,13 @@ +package main + +import ( + "os" + + "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules" +) + +func main() { + if err := modules.Execute(); err != nil { + os.Exit(1) + } +} From cf8f640726a09cdd0b4d6213db4ff57c9d408c69 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 8 Jul 2021 20:16:14 +0300 Subject: [PATCH 161/219] [#675] cli/container: Support binary eACL format Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/container.go | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index eb23611e79..0cd5c64948 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -68,9 +68,10 @@ var ( ) var ( - errDeleteTimeout = errors.New("timeout: container has not been removed from sidechain") - errCreateTimeout = errors.New("timeout: container has not been persisted on sidechain") - errSetEACLTimeout = errors.New("timeout: EACL has not been persisted on sidechain") + errDeleteTimeout = errors.New("timeout: container has not been removed from sidechain") + errCreateTimeout = errors.New("timeout: container has not been persisted on sidechain") + errSetEACLTimeout = errors.New("timeout: EACL has not been persisted on sidechain") + errUnsupportedEACLFormat = errors.New("unsupported eACL format") ) // containerCmd represents the container command @@ -715,17 +716,27 @@ func parseEACL(eaclPath string) (*eacl.Table, error) { } table := eacl.NewTable() - if err = table.UnmarshalJSON(data); err == nil { - v := table.Version() - if !version.IsValid(v) { - table.SetVersion(*pkg.SDKVersion()) - } + if err = table.UnmarshalJSON(data); err == nil { + validateAndFixEACLVersion(table) printVerbose("Parsed JSON encoded EACL table") return table, nil } - return nil, fmt.Errorf("can't parse EACL table: %w", err) + if err = table.Unmarshal(data); err == nil { + validateAndFixEACLVersion(table) + printVerbose("Parsed binary encoded EACL table") + return table, nil + } + + return nil, errUnsupportedEACLFormat +} + +func validateAndFixEACLVersion(table *eacl.Table) { + v := table.Version() + if !version.IsValid(v) { + table.SetVersion(*pkg.SDKVersion()) + } } func prettyPrintEACL(cmd *cobra.Command, table *eacl.Table) { From 45cd851c467f3e3cb51425a676d76f79d8b27b25 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 9 Jul 2021 13:40:18 +0300 Subject: [PATCH 162/219] [#666] Add Docker images for neofs-adm Signed-off-by: Stanislav Bogatyrev --- Dockerfile.adm | 22 ++++++++++++++++++++++ Dockerfile.aio | 2 ++ Dockerfile.dirty-adm | 8 ++++++++ Makefile | 4 ++-- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.adm create mode 100644 Dockerfile.dirty-adm diff --git a/Dockerfile.adm b/Dockerfile.adm new file mode 100644 index 0000000000..79734e526d --- /dev/null +++ b/Dockerfile.adm @@ -0,0 +1,22 @@ +FROM golang:1.16-alpine as basebuilder +RUN apk add --update make bash + +FROM basebuilder as builder +ARG BUILD=now +ARG VERSION=dev +ARG REPO=repository +WORKDIR /src +COPY . /src + +RUN make bin/neofs-adm + +# Executable image +FROM alpine AS neofs-adm +RUN apk add --no-cache bash + +WORKDIR / + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /src/bin/neofs-adm /bin/neofs-adm + +CMD ["neofs-adm"] diff --git a/Dockerfile.aio b/Dockerfile.aio index 8bca1a8173..73cb0ae5e5 100644 --- a/Dockerfile.aio +++ b/Dockerfile.aio @@ -5,6 +5,7 @@ ARG HUB_TAG=latest FROM ${HUB_IMAGE}-cli:${HUB_TAG} as neofs-cli FROM ${HUB_IMAGE}-ir:${HUB_TAG} as neofs-ir FROM ${HUB_IMAGE}-storage:${HUB_TAG} as neofs-storage +FROM ${HUB_IMAGE}-adm:${HUB_TAG} as neofs-adm # Executable image FROM alpine AS neofs-aio @@ -20,5 +21,6 @@ WORKDIR / COPY --from=neofs-cli /bin/neofs-cli /bin/neofs-cli COPY --from=neofs-ir /bin/neofs-ir /bin/neofs-ir COPY --from=neofs-storage /bin/neofs-node /bin/neofs-node +COPY --from=neofs-adm /bin/neofs-adm /bin/neofs-adm CMD ["neofs-cli"] diff --git a/Dockerfile.dirty-adm b/Dockerfile.dirty-adm new file mode 100644 index 0000000000..13a6c55f39 --- /dev/null +++ b/Dockerfile.dirty-adm @@ -0,0 +1,8 @@ +FROM alpine +RUN apk add --no-cache bash ca-certificates + +WORKDIR / + +COPY bin/neofs-adm /bin/neofs-adm + +CMD ["neofs-adm"] diff --git a/Makefile b/Makefile index 630451736a..c48acdf6e7 100644 --- a/Makefile +++ b/Makefile @@ -83,10 +83,10 @@ image-%: -t $(HUB_IMAGE)-$*:$(HUB_TAG) . # Build all Docker images -images: image-storage image-ir image-cli +images: image-storage image-ir image-cli image-adm # Build dirty local Docker images -dirty-images: image-dirty-storage image-dirty-ir image-dirty-cli +dirty-images: image-dirty-storage image-dirty-ir image-dirty-cli image-dirty-adm # Run all code formatters fmts: fmt imports From af412f787469edb9d0f28a2a3b07443f08d8dda5 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Fri, 9 Jul 2021 16:29:52 +0300 Subject: [PATCH 163/219] Move Docker files into a separate directory Dock docker files in .docker directory Signed-off-by: Stanislav Bogatyrev --- Dockerfile.adm => .docker/Dockerfile.adm | 0 Dockerfile.aio => .docker/Dockerfile.aio | 0 Dockerfile.cli => .docker/Dockerfile.cli | 0 Dockerfile.dirty-adm => .docker/Dockerfile.dirty-adm | 0 Dockerfile.dirty-cli => .docker/Dockerfile.dirty-cli | 0 Dockerfile.dirty-ir => .docker/Dockerfile.dirty-ir | 0 Dockerfile.dirty-storage => .docker/Dockerfile.dirty-storage | 0 Dockerfile.ir => .docker/Dockerfile.ir | 0 Dockerfile.storage => .docker/Dockerfile.storage | 0 .../Dockerfile.storage-testnet | 0 Makefile | 4 ++-- 11 files changed, 2 insertions(+), 2 deletions(-) rename Dockerfile.adm => .docker/Dockerfile.adm (100%) rename Dockerfile.aio => .docker/Dockerfile.aio (100%) rename Dockerfile.cli => .docker/Dockerfile.cli (100%) rename Dockerfile.dirty-adm => .docker/Dockerfile.dirty-adm (100%) rename Dockerfile.dirty-cli => .docker/Dockerfile.dirty-cli (100%) rename Dockerfile.dirty-ir => .docker/Dockerfile.dirty-ir (100%) rename Dockerfile.dirty-storage => .docker/Dockerfile.dirty-storage (100%) rename Dockerfile.ir => .docker/Dockerfile.ir (100%) rename Dockerfile.storage => .docker/Dockerfile.storage (100%) rename Dockerfile.storage-testnet => .docker/Dockerfile.storage-testnet (100%) diff --git a/Dockerfile.adm b/.docker/Dockerfile.adm similarity index 100% rename from Dockerfile.adm rename to .docker/Dockerfile.adm diff --git a/Dockerfile.aio b/.docker/Dockerfile.aio similarity index 100% rename from Dockerfile.aio rename to .docker/Dockerfile.aio diff --git a/Dockerfile.cli b/.docker/Dockerfile.cli similarity index 100% rename from Dockerfile.cli rename to .docker/Dockerfile.cli diff --git a/Dockerfile.dirty-adm b/.docker/Dockerfile.dirty-adm similarity index 100% rename from Dockerfile.dirty-adm rename to .docker/Dockerfile.dirty-adm diff --git a/Dockerfile.dirty-cli b/.docker/Dockerfile.dirty-cli similarity index 100% rename from Dockerfile.dirty-cli rename to .docker/Dockerfile.dirty-cli diff --git a/Dockerfile.dirty-ir b/.docker/Dockerfile.dirty-ir similarity index 100% rename from Dockerfile.dirty-ir rename to .docker/Dockerfile.dirty-ir diff --git a/Dockerfile.dirty-storage b/.docker/Dockerfile.dirty-storage similarity index 100% rename from Dockerfile.dirty-storage rename to .docker/Dockerfile.dirty-storage diff --git a/Dockerfile.ir b/.docker/Dockerfile.ir similarity index 100% rename from Dockerfile.ir rename to .docker/Dockerfile.ir diff --git a/Dockerfile.storage b/.docker/Dockerfile.storage similarity index 100% rename from Dockerfile.storage rename to .docker/Dockerfile.storage diff --git a/Dockerfile.storage-testnet b/.docker/Dockerfile.storage-testnet similarity index 100% rename from Dockerfile.storage-testnet rename to .docker/Dockerfile.storage-testnet diff --git a/Makefile b/Makefile index c48acdf6e7..1391177020 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ image-aio: images --build-arg HUB_IMAGE=$(HUB_IMAGE) \ --build-arg HUB_TAG=$(HUB_TAG) \ --rm \ - -f Dockerfile.aio \ + -f .docker/Dockerfile.aio \ -t $(HUB_IMAGE)-aio:$(HUB_TAG) . # Build NeoFS component's docker image @@ -79,7 +79,7 @@ image-%: --build-arg REPO=$(REPO) \ --build-arg VERSION=$(VERSION) \ --rm \ - -f Dockerfile.$* \ + -f .docker/Dockerfile.$* \ -t $(HUB_IMAGE)-$*:$(HUB_TAG) . # Build all Docker images From 9da777ac8ce5a7a5fbcb9e39b11f27e4dad7b8c4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 9 Jul 2021 14:33:11 +0300 Subject: [PATCH 164/219] [#681] ir: Do not require MainNet attributes If `WITHOUT_MAINNET` environmental variable is `true`: - Do not read `NeoFS` and `processing` script-hashes from envs; - Do not init Governance processor; - Do not init NeoFS processor. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 3 + pkg/innerring/innerring.go | 112 +++++++++++++++++++------------------ 2 files changed, 60 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96b45bc43..3b9512c6de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Changelog for NeoFS Node ## [Unreleased] +### Fixed +- Do not require MainNet attributes in "Without MainNet" mode ([#663](https://github.com/nspcc-dev/neofs-node/issues/663)). + ## [0.22.2] - 2021-07-07 Updated broken version of NeoFS API Go. diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 5a945a9101..e6d328f9ee 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -305,8 +305,10 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error fmt.Println(hex.EncodeToString(server.key.PublicKey().Bytes())) + withoutMainNet := cfg.GetBool("without_mainnet") + // get all script hashes of contracts - server.contracts, err = parseContracts(cfg) + server.contracts, err = parseContracts(cfg, withoutMainNet) if err != nil { return nil, err } @@ -342,8 +344,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - withoutMainNet := cfg.GetBool("without_mainnet") - if withoutMainNet { // This works as long as event Listener starts listening loop once, // otherwise Server.Start will run two similar routines. @@ -525,22 +525,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - // create governance processor - governanceProcessor, err := governance.New(&governance.Params{ - Log: log, - NeoFSClient: neofsClient, - NetmapClient: server.netmapClient, - AlphabetState: server, - EpochState: server, - Voter: server, - MorphClient: server.morphClient, - MainnetClient: server.mainnetClient, - NotaryDisabled: server.sideNotaryConfig.disabled, - }) - if err != nil { - return nil, err - } - var alphaSync event.Handler if withoutMainNet { @@ -548,6 +532,22 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error log.Debug("alphabet keys sync is disabled") } } else { + // create governance processor + governanceProcessor, err := governance.New(&governance.Params{ + Log: log, + NeoFSClient: neofsClient, + NetmapClient: server.netmapClient, + AlphabetState: server, + EpochState: server, + Voter: server, + MorphClient: server.morphClient, + MainnetClient: server.mainnetClient, + NotaryDisabled: server.sideNotaryConfig.disabled, + }) + if err != nil { + return nil, err + } + alphaSync = governanceProcessor.HandleAlphabetSync err = bindMainnetProcessor(governanceProcessor, server) if err != nil { @@ -625,30 +625,32 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - // create mainnnet neofs processor - neofsProcessor, err := neofs.New(&neofs.Params{ - Log: log, - PoolSize: cfg.GetInt("workers.neofs"), - NeoFSContract: server.contracts.neofs, - NeoFSIDClient: neofsIDClient, - BalanceClient: server.balanceClient, - NetmapClient: server.netmapClient, - MorphClient: server.morphClient, - EpochState: server, - AlphabetState: server, - Converter: &server.precision, - MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), - MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"), - MintEmitValue: fixedn.Fixed8(cfg.GetInt64("emit.mint.value")), - GasBalanceThreshold: cfg.GetInt64("emit.gas.balance_threshold"), - }) - if err != nil { - return nil, err - } + if !withoutMainNet { + // create mainnnet neofs processor + neofsProcessor, err := neofs.New(&neofs.Params{ + Log: log, + PoolSize: cfg.GetInt("workers.neofs"), + NeoFSContract: server.contracts.neofs, + NeoFSIDClient: neofsIDClient, + BalanceClient: server.balanceClient, + NetmapClient: server.netmapClient, + MorphClient: server.morphClient, + EpochState: server, + AlphabetState: server, + Converter: &server.precision, + MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), + MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"), + MintEmitValue: fixedn.Fixed8(cfg.GetInt64("emit.mint.value")), + GasBalanceThreshold: cfg.GetInt64("emit.gas.balance_threshold"), + }) + if err != nil { + return nil, err + } - err = bindMainnetProcessor(neofsProcessor, server) - if err != nil { - return nil, err + err = bindMainnetProcessor(neofsProcessor, server) + if err != nil { + return nil, err + } } // create alphabet processor @@ -828,19 +830,29 @@ func createClient(ctx context.Context, p *chainParams, notaryOpts ...client.Nota ) } -func parseContracts(cfg *viper.Viper) (*contracts, error) { +func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { var ( result = new(contracts) err error ) + if !withoutMainNet { + result.neofs, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.neofs")) + if err != nil { + return nil, fmt.Errorf("ir: can't read neofs script-hash: %w", err) + } + + result.processing, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.processing")) + if err != nil { + return nil, fmt.Errorf("ir: can't read processing script-hash: %w", err) + } + } + netmapContractStr := cfg.GetString("contracts.netmap") - neofsContractStr := cfg.GetString("contracts.neofs") balanceContractStr := cfg.GetString("contracts.balance") containerContractStr := cfg.GetString("contracts.container") auditContractStr := cfg.GetString("contracts.audit") proxyContractStr := cfg.GetString("contracts.proxy") - processingContractStr := cfg.GetString("contracts.processing") reputationContractStr := cfg.GetString("contracts.reputation") neofsIDContractStr := cfg.GetString("contracts.neofsid") @@ -849,11 +861,6 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { return nil, fmt.Errorf("ir: can't read netmap script-hash: %w", err) } - result.neofs, err = util.Uint160DecodeStringLE(neofsContractStr) - if err != nil { - return nil, fmt.Errorf("ir: can't read neofs script-hash: %w", err) - } - result.balance, err = util.Uint160DecodeStringLE(balanceContractStr) if err != nil { return nil, fmt.Errorf("ir: can't read balance script-hash: %w", err) @@ -874,11 +881,6 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) } - result.processing, err = util.Uint160DecodeStringLE(processingContractStr) - if err != nil { - return nil, fmt.Errorf("ir: can't read processing script-hash: %w", err) - } - result.reputation, err = util.Uint160DecodeStringLE(reputationContractStr) if err != nil { return nil, fmt.Errorf("ir: can't read reputation script-hash: %w", err) From e56a9611dbc1aa6e624044bddbd3a9db9c577391 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 9 Jul 2021 14:49:26 +0300 Subject: [PATCH 165/219] [#681] docs: Clarify creating tag in release instruction Signed-off-by: Pavel Karpy --- docs/release-instruction.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-instruction.md b/docs/release-instruction.md index 71f0623581..65eb1521ba 100644 --- a/docs/release-instruction.md +++ b/docs/release-instruction.md @@ -23,7 +23,8 @@ changes between releases. ## Tag the release Use `vX.Y.Z` tag for releases and `vX.Y.Z-rc.N` for release candidates -following the [semantic versioning](https://semver.org/) standard. +following the [semantic versioning](https://semver.org/) standard. Tag must be +created from the latest commit of the master branch. ## Push changes and release tag to github From 361bff216a3e5ec0e49d045c7684a7a867b2fc6f Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 12 Jul 2021 17:22:39 +0300 Subject: [PATCH 166/219] [#688] pkg/ir/governance: Check err type in tests Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/list_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/innerring/processors/governance/list_test.go b/pkg/innerring/processors/governance/list_test.go index 2b67e0bed8..06c3c84fa8 100644 --- a/pkg/innerring/processors/governance/list_test.go +++ b/pkg/innerring/processors/governance/list_test.go @@ -16,7 +16,7 @@ func TestNewAlphabetList(t *testing.T) { t.Run("no sidechain keys", func(t *testing.T) { _, err := newAlphabetList(nil, orig) - require.Error(t, err) + require.ErrorIs(t, err, errEmptySidechain) }) t.Run("same keys", func(t *testing.T) { @@ -27,7 +27,7 @@ func TestNewAlphabetList(t *testing.T) { t.Run("not enough mainnet keys", func(t *testing.T) { _, err := newAlphabetList(orig, orig[:len(orig)-1]) - require.Error(t, err) + require.ErrorIs(t, err, errNotEnoughKeys) }) t.Run("less than third new keys", func(t *testing.T) { @@ -91,7 +91,7 @@ func TestUpdateInnerRing(t *testing.T) { after := k[4:5] _, err = updateInnerRing(ir, before, after) - require.Error(t, err) + require.ErrorIs(t, err, errNotEqualLen) }) t.Run("new list", func(t *testing.T) { From bb3f16d487a86e89a863c0ab21b667969c0e3ae4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 12 Jul 2021 18:17:17 +0300 Subject: [PATCH 167/219] [#688] pkg/ir/governance: Add public key sorting Add sorting of passed public keys in `newAlphabetList` function before Alphabet list merge to make returned results more expected. Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/list.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/innerring/processors/governance/list.go b/pkg/innerring/processors/governance/list.go index b5d10ead97..6a76a08267 100644 --- a/pkg/innerring/processors/governance/list.go +++ b/pkg/innerring/processors/governance/list.go @@ -19,7 +19,12 @@ var ( // sidechain list is empty. Function returns `errNotEnoughKeys` if mainnet // list contains less keys than sidechain list. Function returns (nil, nil) if // mainnet list contains all keys from sidechain list. +// +// Sorts passed slices. func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error) { + sort.Sort(sidechain) + sort.Sort(mainnet) + ln := len(sidechain) if ln == 0 { return nil, errEmptySidechain From c20eb15bd52574fdbc49c04d6daa7d173778c7a9 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 12 Jul 2021 18:17:39 +0300 Subject: [PATCH 168/219] [#688] pkg/ir/governance: Add `unsorted` test case Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/list_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/innerring/processors/governance/list_test.go b/pkg/innerring/processors/governance/list_test.go index 06c3c84fa8..3b41372042 100644 --- a/pkg/innerring/processors/governance/list_test.go +++ b/pkg/innerring/processors/governance/list_test.go @@ -55,6 +55,19 @@ func TestNewAlphabetList(t *testing.T) { require.True(t, equalPublicKeyLists(list, rounds[i])) } }) + + t.Run("unsorted keys", func(t *testing.T) { + orig := keys.PublicKeys{k[1], k[2], k[3], k[4]} + main := keys.PublicKeys{k[1], k[2], k[5], k[4]} + + exp := make(keys.PublicKeys, len(main)) + copy(exp, main) + sort.Sort(exp) + + got, err := newAlphabetList(orig, main) + require.NoError(t, err) + require.True(t, equalPublicKeyLists(exp, got)) // expect {1, 2, 4, 5}, not {1, 2, 3, 5} + }) } func TestUpdateInnerRing(t *testing.T) { From 6bf01a0a2219f106b7f369afda9f8e72e8bcf5de Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 9 Jul 2021 12:53:10 +0300 Subject: [PATCH 169/219] [#683] cmd/neofs-adm: Add CLI flags for morph commands Signed-off-by: Alex Vanin --- .../internal/modules/config/config.go | 13 +++ cmd/neofs-adm/internal/modules/morph/epoch.go | 13 +++ .../internal/modules/morph/generate.go | 45 ++++++++++ .../internal/modules/morph/initialize.go | 22 +++++ cmd/neofs-adm/internal/modules/morph/root.go | 90 +++++++++++++++++++ cmd/neofs-adm/internal/modules/root.go | 2 + 6 files changed, 185 insertions(+) create mode 100644 cmd/neofs-adm/internal/modules/morph/epoch.go create mode 100644 cmd/neofs-adm/internal/modules/morph/generate.go create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize.go create mode 100644 cmd/neofs-adm/internal/modules/morph/root.go diff --git a/cmd/neofs-adm/internal/modules/config/config.go b/cmd/neofs-adm/internal/modules/config/config.go index 1d21c227be..9eb313952f 100644 --- a/cmd/neofs-adm/internal/modules/config/config.go +++ b/cmd/neofs-adm/internal/modules/config/config.go @@ -8,8 +8,10 @@ import ( "path/filepath" "text/template" + "github.com/nspcc-dev/neo-go/cli/input" "github.com/nspcc-dev/neofs-node/pkg/innerring" "github.com/spf13/cobra" + "github.com/spf13/viper" ) type configTemplate struct { @@ -122,3 +124,14 @@ func generateConfigExample(appDir string, credSize int) (string, error) { return buf.String(), nil } + +func AlphabetPassword(v *viper.Viper, index int) (string, error) { + letter := innerring.GlagoliticLetter(index) + key := "credentials." + letter.String() + if v.IsSet(key) { + return v.GetString(key), nil + } + + prompt := "Password for " + letter.String() + " wallet > " + return input.ReadPassword(prompt) +} diff --git a/cmd/neofs-adm/internal/modules/morph/epoch.go b/cmd/neofs-adm/internal/modules/morph/epoch.go new file mode 100644 index 0000000000..8879addf48 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/epoch.go @@ -0,0 +1,13 @@ +package morph + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func forceNewEpochCmd(cmd *cobra.Command, args []string) error { + cmd.Println("endpoint:", viper.GetString(endpointFlag)) + cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) + + return nil +} diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go new file mode 100644 index 0000000000..6c027e05ac --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -0,0 +1,45 @@ +package morph + +import ( + "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func generateAlphabetCreds(cmd *cobra.Command, args []string) error { + // alphabet size is not part of the config + size, err := cmd.Flags().GetUint(alphabetSizeFlag) + if err != nil { + return err + } + + pwds := make([]string, size) + for i := 0; i < int(size); i++ { + pwds[i], err = config.AlphabetPassword(viper.GetViper(), i) + if err != nil { + return err + } + } + + cmd.Println("size:", size) + cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) + for i := range pwds { + cmd.Printf("wallet[%d]: %s\n", i, pwds[i]) + } + + return nil +} + +func generateStorageCreds(cmd *cobra.Command, args []string) error { + // storage wallet path is not part of the config + storageWalletPath, err := cmd.Flags().GetString(storageWalletFlag) + if err != nil { + return err + } + + cmd.Println("endpoint:", viper.GetString(endpointFlag)) + cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) + cmd.Println("storage-wallet:", storageWalletPath) + + return nil +} diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go new file mode 100644 index 0000000000..18a0da04f3 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -0,0 +1,22 @@ +package morph + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func initializeSideChainCmd(cmd *cobra.Command, args []string) error { + // contract path is not part of the config + contractsPath, err := cmd.Flags().GetString(contractsInitFlag) + if err != nil { + return err + } + + cmd.Println("endpoint:", viper.GetString(endpointFlag)) + cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) + cmd.Println("contracts:", contractsPath) + cmd.Println("epoch-duration:", viper.GetUint(epochDurationInitFlag)) + cmd.Println("max-object-size:", viper.GetUint(maxObjectSizeInitFlag)) + + return nil +} diff --git a/cmd/neofs-adm/internal/modules/morph/root.go b/cmd/neofs-adm/internal/modules/morph/root.go new file mode 100644 index 0000000000..0911a33851 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/root.go @@ -0,0 +1,90 @@ +package morph + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +const ( + alphabetWalletsFlag = "alphabet-wallets" + alphabetSizeFlag = "size" + endpointFlag = "rpc-endpoint" + storageWalletFlag = "storage-wallet" + contractsInitFlag = "contracts" + maxObjectSizeInitFlag = "network.max_object_size" + maxObjectSizeCLIFlag = "max-object-size" + epochDurationInitFlag = "network.epoch_duration" + epochDurationCLIFlag = "epoch-duration" +) + +var ( + // RootCmd is a root command of config section. + RootCmd = &cobra.Command{ + Use: "morph", + Short: "Section for morph network configuration commands.", + } + + generateAlphabetCmd = &cobra.Command{ + Use: "generate-alphabet", + Short: "Generate alphabet wallets for consensus nodes of the morph network", + PreRun: func(cmd *cobra.Command, _ []string) { + // PreRun fixes https://github.com/spf13/viper/issues/233 + _ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag)) + }, + RunE: generateAlphabetCreds, + } + + initCmd = &cobra.Command{ + Use: "init", + Short: "Initialize side chain network with smart-contracts and network settings", + PreRun: func(cmd *cobra.Command, _ []string) { + _ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag)) + _ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag)) + _ = viper.BindPFlag(epochDurationInitFlag, cmd.Flags().Lookup(epochDurationCLIFlag)) + _ = viper.BindPFlag(maxObjectSizeInitFlag, cmd.Flags().Lookup(maxObjectSizeCLIFlag)) + }, + RunE: initializeSideChainCmd, + } + + generateStorageCmd = &cobra.Command{ + Use: "generate-storage-wallet", + Short: "Generate storage node wallet for the morph network", + PreRun: func(cmd *cobra.Command, _ []string) { + _ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag)) + _ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag)) + }, + RunE: generateStorageCreds, + } + + forceNewEpoch = &cobra.Command{ + Use: "force-new-epoch", + Short: "Create new NeoFS epoch event in the side chain", + PreRun: func(cmd *cobra.Command, _ []string) { + _ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag)) + _ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag)) + }, + RunE: forceNewEpochCmd, + } +) + +func init() { + RootCmd.AddCommand(generateAlphabetCmd) + generateAlphabetCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir") + generateAlphabetCmd.Flags().Uint(alphabetSizeFlag, 7, "amount of alphabet wallets to generate") + + RootCmd.AddCommand(initCmd) + initCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir") + initCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") + initCmd.Flags().String(contractsInitFlag, "", "path to archive with compiled NeoFS contracts (default fetched from latest github release)") + initCmd.Flags().Uint(epochDurationCLIFlag, 240, "amount of side chain blocks in one NeoFS epoch") + initCmd.Flags().Uint(maxObjectSizeCLIFlag, 67108864, "max single object size in bytes") + + RootCmd.AddCommand(generateStorageCmd) + generateStorageCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir") + generateStorageCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") + generateStorageCmd.Flags().String(storageWalletFlag, "", "path to new storage node wallet") + + RootCmd.AddCommand(forceNewEpoch) + forceNewEpoch.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir") + forceNewEpoch.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") +} diff --git a/cmd/neofs-adm/internal/modules/root.go b/cmd/neofs-adm/internal/modules/root.go index 58e97d64d0..1efd4f85f6 100644 --- a/cmd/neofs-adm/internal/modules/root.go +++ b/cmd/neofs-adm/internal/modules/root.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config" + "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph" "github.com/nspcc-dev/neofs-node/misc" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -31,6 +32,7 @@ func init() { rootCmd.Flags().Bool("version", false, "application version") rootCmd.AddCommand(config.RootCmd) + rootCmd.AddCommand(morph.RootCmd) } func Execute() error { From 8112f73023e61228dd6f82fe93bfb643f68b70a6 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 09:26:21 +0300 Subject: [PATCH 170/219] [#689] innerring: Remove debug output Signed-off-by: Alex Vanin --- pkg/innerring/innerring.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index e6d328f9ee..64107c32d1 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -303,8 +303,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error server.key = acc.PrivateKey() - fmt.Println(hex.EncodeToString(server.key.PublicKey().Bytes())) - withoutMainNet := cfg.GetBool("without_mainnet") // get all script hashes of contracts From e0500d3158bf43d794c6fe20a884468fce151d48 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 09:33:43 +0300 Subject: [PATCH 171/219] [#689] Update unreleased changelog Signed-off-by: Alex Vanin --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b9512c6de..1c0d1d8336 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,19 @@ Changelog for NeoFS Node ## [Unreleased] +### Added +- Support binary eACL format in container CLI command ([#650](https://github.com/nspcc-dev/neofs-node/issues/650)). +- Dockerfile for neofs-adm utility ([#680](https://github.com/nspcc-dev/neofs-node/pull/680)). + +### Changed +- All docker files moved to `.docker` dir ([#682](https://github.com/nspcc-dev/neofs-node/pull/682)). + ### Fixed - Do not require MainNet attributes in "Without MainNet" mode ([#663](https://github.com/nspcc-dev/neofs-node/issues/663)). +- Stable alphabet list merge in Inner Ring governance ([#670](https://github.com/nspcc-dev/neofs-node/issues/670)). + +### Removed +- Debug output of public key in Inner Ring log ([#689](https://github.com/nspcc-dev/neofs-node/pull/689)). ## [0.22.2] - 2021-07-07 From e2f7b3f1ccdd359a41e7bfdfd5b9ef723af2caea Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 11:43:51 +0300 Subject: [PATCH 172/219] [#690] cmd/neofs-node: Fallback to wallet section if node key is not set Some users want to specify only wallet section in the SN. It is not possible if `Key` throws panic on empty value. Instead it should fallback to wallet section. Panic is suitable if node's key is provided but invalid. Signed-off-by: Alex Vanin --- CHANGELOG.md | 1 + cmd/neofs-node/config/node/config.go | 13 +++++++------ cmd/neofs-node/config/node/config_test.go | 3 +-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c0d1d8336..89f6014a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Changelog for NeoFS Node ### Fixed - Do not require MainNet attributes in "Without MainNet" mode ([#663](https://github.com/nspcc-dev/neofs-node/issues/663)). - Stable alphabet list merge in Inner Ring governance ([#670](https://github.com/nspcc-dev/neofs-node/issues/670)). +- User can specify only wallet section without node key ([#690](https://github.com/nspcc-dev/neofs-node/pull/690)). ### Removed - Debug output of public key in Inner Ring log ([#689](https://github.com/nspcc-dev/neofs-node/pull/689)). diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index 2aad548b50..c7f12771cb 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -1,7 +1,6 @@ package nodeconfig import ( - "errors" "fmt" "os" "strconv" @@ -18,16 +17,16 @@ const ( attributePrefix = "attribute" ) -var errKeyNotSet = errors.New("empty/not set key address, see `node.key` section") - // Key returns value of "key" config parameter // from "node" section. // -// Panics if value is not a non-empty string. +// If value is not set, fallbacks to Wallet section. +// +// Panics if value is incorrect filename of binary encoded private key. func Key(c *config.Config) *keys.PrivateKey { v := config.StringSafe(c.Sub(subsection), "key") if v == "" { - panic(errKeyNotSet) + return Wallet(c) } var ( @@ -40,13 +39,15 @@ func Key(c *config.Config) *keys.PrivateKey { } if err != nil { - return Wallet(c) + panic(fmt.Errorf("invalid private key in node section: %w", err)) } return key } // Wallet returns value of node private key from "node" section. +// +// Panics if section contains invalid values. func Wallet(c *config.Config) *keys.PrivateKey { v := c.Sub(subsection).Sub("wallet") acc, err := utilConfig.LoadAccount( diff --git a/cmd/neofs-node/config/node/config_test.go b/cmd/neofs-node/config/node/config_test.go index 6e49a85545..54ced7d941 100644 --- a/cmd/neofs-node/config/node/config_test.go +++ b/cmd/neofs-node/config/node/config_test.go @@ -14,9 +14,8 @@ func TestNodeSection(t *testing.T) { t.Run("defaults", func(t *testing.T) { empty := configtest.EmptyConfig() - require.PanicsWithError( + require.Panics( t, - errKeyNotSet.Error(), func() { Key(empty) }, From 53391f057e8b38c535425cc58cd5372f2ecb8753 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 13 Jul 2021 12:39:54 +0300 Subject: [PATCH 173/219] [#693] node/reputation: Log keys in hex format Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + cmd/neofs-node/reputation/intermediate/storage.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f6014a0a..8b91533976 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Changelog for NeoFS Node - Do not require MainNet attributes in "Without MainNet" mode ([#663](https://github.com/nspcc-dev/neofs-node/issues/663)). - Stable alphabet list merge in Inner Ring governance ([#670](https://github.com/nspcc-dev/neofs-node/issues/670)). - User can specify only wallet section without node key ([#690](https://github.com/nspcc-dev/neofs-node/pull/690)). +- Log keys in hex format in reputation errors ([#693](https://github.com/nspcc-dev/neofs-node/pull/693)). ### Removed - Debug output of public key in Inner Ring log ([#689](https://github.com/nspcc-dev/neofs-node/pull/689)). diff --git a/cmd/neofs-node/reputation/intermediate/storage.go b/cmd/neofs-node/reputation/intermediate/storage.go index 2a7fb3d724..304de34019 100644 --- a/cmd/neofs-node/reputation/intermediate/storage.go +++ b/cmd/neofs-node/reputation/intermediate/storage.go @@ -1,6 +1,7 @@ package intermediate import ( + "encoding/hex" "fmt" "github.com/nspcc-dev/neofs-node/pkg/services/reputation" @@ -24,7 +25,7 @@ type ErrNoData struct { func (e *ErrNoData) Error() string { if e.hasDaughter { - return fmt.Sprintf("no data in %d epoch for peer: %s", e.epoch, string(e.daughter.Bytes())) + return fmt.Sprintf("no data in %d epoch for peer: %s", e.epoch, hex.EncodeToString(e.daughter.Bytes())) } return fmt.Sprintf("no daughter data in %d epoch", e.epoch) From 38afb8292641066fb9f434b4dbadc067cbdf7a2a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 14:02:24 +0300 Subject: [PATCH 174/219] [#694] pkg/network: Use client cache in raw client getter Every raw client getter invocation produced new connection, that lead to connection leak. Signed-off-by: Alex Vanin --- pkg/network/cache/multi.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index 5d3fed4607..d17e60ef05 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -324,9 +324,14 @@ func (x *multiClient) Close() error { func (x *multiClient) RawForAddress(addr network.Address) *rawclient.Client { x.mtx.Lock() - c := x.createForAddress(addr).Raw() + strAddr := addr.String() + + c, cached := x.clients[strAddr] + if !cached { + c = x.createForAddress(addr) + } x.mtx.Unlock() - return c + return c.Raw() } From fd24a995339668e11dfc84eb277e296625ee9555 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 14:12:23 +0300 Subject: [PATCH 175/219] [#694] cmd/neofs-node: Reuse single instance of client cache in all components This will reduce amount of open connections up to 3 times. Signed-off-by: Alex Vanin --- cmd/neofs-node/config.go | 10 ++++++++++ cmd/neofs-node/container.go | 7 +------ cmd/neofs-node/object.go | 9 +-------- cmd/neofs-node/reputation.go | 9 ++------- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index c3d72a38f4..d17b2848e1 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -11,9 +11,11 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg" + apiclient "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" netmapV2 "github.com/nspcc-dev/neofs-api-go/v2/netmap" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" + apiclientconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/apiclient" contractsconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/contracts" engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine" shardconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard" @@ -36,6 +38,7 @@ import ( netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" "github.com/nspcc-dev/neofs-node/pkg/morph/timer" "github.com/nspcc-dev/neofs-node/pkg/network" + "github.com/nspcc-dev/neofs-node/pkg/network/cache" "github.com/nspcc-dev/neofs-node/pkg/services/control" trustcontroller "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/controller" truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage" @@ -108,6 +111,8 @@ type cfg struct { cfgReputation cfgReputation mainChainClient *client.Client + + clientCache *cache.ClientCache } type cfgGRPC struct { @@ -271,12 +276,17 @@ func initCfg(path string) *cfg { scriptHash: contractsconfig.Reputation(appCfg), workerPool: reputationWorkerPool, }, + clientCache: cache.NewSDKClientCache( + apiclient.WithDialTimeout(apiclientconfig.DialTimeout(appCfg)), + ), } if metricsconfig.Address(c.appCfg) != "" { c.metricsCollector = metrics.NewStorageMetrics() } + c.onShutdown(c.clientCache.CloseAll) // clean up connections + initLocalStorage(c) return c diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 63f0cc140b..0216cd12a2 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -21,7 +21,6 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/event" containerEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/container" "github.com/nspcc-dev/neofs-node/pkg/network" - "github.com/nspcc-dev/neofs-node/pkg/network/cache" containerTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/container/grpc" containerService "github.com/nspcc-dev/neofs-node/pkg/services/container" loadcontroller "github.com/nspcc-dev/neofs-node/pkg/services/container/announcement/load/controller" @@ -72,15 +71,13 @@ func initContainerService(c *cfg) { PlacementBuilder: loadPlacementBuilder, }) - clientCache := cache.NewSDKClientCache() // FIXME: use shared cache - loadRouter := loadroute.New( loadroute.Prm{ LocalServerInfo: c, RemoteWriterProvider: &remoteLoadAnnounceProvider{ key: &c.key.PrivateKey, loadAddrSrc: c, - clientCache: clientCache, + clientCache: c.clientCache, deadEndProvider: loadcontroller.SimpleWriterProvider(loadAccumulator), }, Builder: routeBuilder, @@ -88,8 +85,6 @@ func initContainerService(c *cfg) { loadroute.WithLogger(c.log), ) - c.onShutdown(clientCache.CloseAll) - ctrl := loadcontroller.New( loadcontroller.Prm{ LocalMetrics: loadcontroller.SimpleIteratorProvider(localMetrics), diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index c9c9a44296..5d13cef934 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -14,7 +14,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/util/signature" "github.com/nspcc-dev/neofs-api-go/v2/object" objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc" - apiclientconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/apiclient" policerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/policer" replicatorconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/replicator" coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client" @@ -25,7 +24,6 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/network" - "github.com/nspcc-dev/neofs-node/pkg/network/cache" objectTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/object/grpc" objectService "github.com/nspcc-dev/neofs-node/pkg/services/object" "github.com/nspcc-dev/neofs-node/pkg/services/object/acl" @@ -168,17 +166,12 @@ func initObjectService(c *cfg) { nodeOwner.SetNeo3Wallet(neo3Wallet) - clientCache := cache.NewSDKClientCache( - client.WithDialTimeout(apiclientconfig.DialTimeout(c.appCfg))) - - c.onShutdown(clientCache.CloseAll) - clientConstructor := &reputationClientConstructor{ log: c.log, nmSrc: c.cfgObject.netMapStorage, netState: c.cfgNetmap.state, trustStorage: c.cfgReputation.localTrustStorage, - basicConstructor: clientCache, + basicConstructor: c.clientCache, } coreConstructor := (*coreClientConstructor)(clientConstructor) diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index b6f3784f13..18f7d60721 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -14,7 +14,6 @@ import ( rtpwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" - "github.com/nspcc-dev/neofs-node/pkg/network/cache" grpcreputation "github.com/nspcc-dev/neofs-node/pkg/network/transport/reputation/grpc" "github.com/nspcc-dev/neofs-node/pkg/services/reputation" reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common" @@ -87,15 +86,11 @@ func initReputationService(c *cfg) { }, ) - apiClientCache := cache.NewSDKClientCache() - - c.onShutdown(apiClientCache.CloseAll) - remoteLocalTrustProvider := common.NewRemoteTrustProvider( common.RemoteProviderPrm{ LocalAddrSrc: c, DeadEndProvider: daughterStorageWriterProvider, - ClientCache: apiClientCache, + ClientCache: c.clientCache, WriterProvider: localreputation.NewRemoteProvider( localreputation.RemoteProviderPrm{ Key: &c.key.PrivateKey, @@ -108,7 +103,7 @@ func initReputationService(c *cfg) { common.RemoteProviderPrm{ LocalAddrSrc: c, DeadEndProvider: consumerStorageWriterProvider, - ClientCache: apiClientCache, + ClientCache: c.clientCache, WriterProvider: intermediatereputation.NewRemoteProvider( intermediatereputation.RemoteProviderPrm{ Key: &c.key.PrivateKey, From 2c022617094730fb7c38f93be7d4d878d3d460c1 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 14:29:38 +0300 Subject: [PATCH 176/219] [#694] Update changelog Signed-off-by: Alex Vanin --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b91533976..489887a910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Changelog for NeoFS Node - Stable alphabet list merge in Inner Ring governance ([#670](https://github.com/nspcc-dev/neofs-node/issues/670)). - User can specify only wallet section without node key ([#690](https://github.com/nspcc-dev/neofs-node/pull/690)). - Log keys in hex format in reputation errors ([#693](https://github.com/nspcc-dev/neofs-node/pull/693)). +- Connections leak and reduced amount of connection overall ([#692](https://github.com/nspcc-dev/neofs-node/issues/692)). ### Removed - Debug output of public key in Inner Ring log ([#689](https://github.com/nspcc-dev/neofs-node/pull/689)). From aed76f6b5a5f65fb78313cf6289134bde08c189f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 14:58:26 +0300 Subject: [PATCH 177/219] [#694] pkg/network: Use single function to get or create client instance Signed-off-by: Alex Vanin --- pkg/network/cache/multi.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index d17e60ef05..c3d9a94ec4 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -61,18 +61,9 @@ func (x *multiClient) iterateClients(f func(client.Client) error) error { var firstErr error x.addr.IterateAddresses(func(addr network.Address) bool { - x.mtx.Lock() - - strAddr := addr.String() - var err error - c, cached := x.clients[strAddr] - if !cached { - c = x.createForAddress(addr) - } - - x.mtx.Unlock() + c := x.client(addr) err = f(c) @@ -322,6 +313,10 @@ func (x *multiClient) Close() error { } func (x *multiClient) RawForAddress(addr network.Address) *rawclient.Client { + return x.client(addr).Raw() +} + +func (x *multiClient) client(addr network.Address) client.Client { x.mtx.Lock() strAddr := addr.String() @@ -333,5 +328,5 @@ func (x *multiClient) RawForAddress(addr network.Address) *rawclient.Client { x.mtx.Unlock() - return c.Raw() + return c } From d94f21d3c4af35347704fa08351c1b54aabaadb2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 15:57:43 +0300 Subject: [PATCH 178/219] config/testnet: Update NeoFS Storage node version Signed-off-by: Alex Vanin --- config/testnet/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index 4ff3742593..8242c6976a 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -3,7 +3,7 @@ version: "2.4" services: storage01: - image: nspccdev/neofs-storage-testnet:0.22.2 + image: nspccdev/neofs-storage-testnet:0.22.3 container_name: neofs-testnet env_file: node_config.env network_mode: host From 0212f33743fef7ff115a4547bc68c0f4503f320b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 13 Jul 2021 15:58:11 +0300 Subject: [PATCH 179/219] Update changelog for v0.22.3 release Signed-off-by: Alex Vanin --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 489887a910..0768d27b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Changelog for NeoFS Node ## [Unreleased] +## [0.22.3] - 2021-07-13 + ### Added - Support binary eACL format in container CLI command ([#650](https://github.com/nspcc-dev/neofs-node/issues/650)). - Dockerfile for neofs-adm utility ([#680](https://github.com/nspcc-dev/neofs-node/pull/680)). @@ -494,7 +496,8 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. -[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.2...master +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.3...master +[0.22.3]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.2...v0.22.3 [0.22.2]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.1...v0.22.2 [0.22.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...v0.22.1 [0.22.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.21.1...v0.22.0 From 96da7ceb4fc9a2bd245d8ed804f516f284417482 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 14 Jul 2021 12:43:59 +0300 Subject: [PATCH 180/219] [#697] governance: Make best effort traversing main chain list of keys We should go through every key in main chain list to merget lists as fast as possible. Previously we drop main chain traversing as soon as we have no more new keys to add. Instead we should try to go for old keys in the list and add it as more as we can. Signed-off-by: Alex Vanin --- pkg/innerring/processors/governance/list.go | 13 +++++++++---- pkg/innerring/processors/governance/list_test.go | 9 +++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pkg/innerring/processors/governance/list.go b/pkg/innerring/processors/governance/list.go index 6a76a08267..c85a764c26 100644 --- a/pkg/innerring/processors/governance/list.go +++ b/pkg/innerring/processors/governance/list.go @@ -44,19 +44,24 @@ func newAlphabetList(sidechain, mainnet keys.PublicKeys) (keys.PublicKeys, error newNodes := 0 newNodeLimit := (ln - 1) / 3 - for i := 0; i < ln; i++ { - if newNodes == newNodeLimit { + for _, node := range mainnet { + if len(result) == ln { break } - mainnetAddr := mainnet[i].Address() + limitReached := newNodes == newNodeLimit + + mainnetAddr := node.Address() if _, ok := hmap[mainnetAddr]; !ok { + if limitReached { + continue + } newNodes++ } else { hmap[mainnetAddr] = true } - result = append(result, mainnet[i]) + result = append(result, node) } if newNodes == 0 { diff --git a/pkg/innerring/processors/governance/list_test.go b/pkg/innerring/processors/governance/list_test.go index 3b41372042..e0121ab625 100644 --- a/pkg/innerring/processors/governance/list_test.go +++ b/pkg/innerring/processors/governance/list_test.go @@ -68,6 +68,15 @@ func TestNewAlphabetList(t *testing.T) { require.NoError(t, err) require.True(t, equalPublicKeyLists(exp, got)) // expect {1, 2, 4, 5}, not {1, 2, 3, 5} }) + + t.Run("new keys in the middle", func(t *testing.T) { + orig := keys.PublicKeys{k[0], k[1], k[2], k[6], k[7], k[8], k[9]} + // `exp` should contain maximum amount of new keys (2) in the middle + exp := keys.PublicKeys{k[0], k[3], k[4], k[6], k[7], k[8], k[9]} + got, err := newAlphabetList(orig, exp) + require.NoError(t, err) + require.True(t, equalPublicKeyLists(exp, got)) + }) } func TestUpdateInnerRing(t *testing.T) { From 4ebc6f796f7a23b586938ecb5b24fbcc863b4b44 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 17 Jul 2021 15:09:23 +0300 Subject: [PATCH 181/219] [#684] neofs-adm: generate consensus wallets Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/generate.go | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go index 6c027e05ac..2614e483e3 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate.go +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -1,7 +1,14 @@ package morph import ( + "fmt" + "path" + + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/smartcontract" + "github.com/nspcc-dev/neo-go/pkg/wallet" "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config" + "github.com/nspcc-dev/neofs-node/pkg/innerring" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -21,8 +28,13 @@ func generateAlphabetCreds(cmd *cobra.Command, args []string) error { } } + walletDir := viper.GetString(alphabetWalletsFlag) + if err := initializeWallets(walletDir, pwds); err != nil { + return err + } + cmd.Println("size:", size) - cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) + cmd.Println("alphabet-wallets:", walletDir) for i := range pwds { cmd.Printf("wallet[%d]: %s\n", i, pwds[i]) } @@ -30,6 +42,64 @@ func generateAlphabetCreds(cmd *cobra.Command, args []string) error { return nil } +func initializeWallets(walletDir string, passwords []string) error { + size := len(passwords) + wallets := make([]*wallet.Wallet, size) + pubs := make(keys.PublicKeys, size) + + for i := range wallets { + p := path.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json") + // TODO(@fyrchik): file is created with 0666 permissions, consider changing. + w, err := wallet.NewWallet(p) + if err != nil { + return fmt.Errorf("can't create wallet: %w", err) + } + if err := w.CreateAccount("single", passwords[i]); err != nil { + return fmt.Errorf("can't create account: %w", err) + } + + wallets[i] = w + pubs[i] = w.Accounts[0].PrivateKey().PublicKey() + } + + // Create committee account with N/2+1 multi-signature. + majCount := smartcontract.GetMajorityHonestNodeCount(size) + for i, w := range wallets { + if err := addMultisigAccount(w, majCount, passwords[i], pubs); err != nil { + return fmt.Errorf("can't create committee account: %w", err) + } + } + + // Create consensus account with 2*N/3+1 multi-signature. + bftCount := smartcontract.GetDefaultHonestNodeCount(size) + for i, w := range wallets { + if err := addMultisigAccount(w, bftCount, passwords[i], pubs); err != nil { + return fmt.Errorf("can't create consensus account: %w", err) + } + } + + for _, w := range wallets { + if err := w.Save(); err != nil { + return fmt.Errorf("can't save wallet: %w", err) + } + w.Close() + } + + return nil +} + +func addMultisigAccount(w *wallet.Wallet, m int, password string, pubs keys.PublicKeys) error { + acc := wallet.NewAccountFromPrivateKey(w.Accounts[0].PrivateKey()) + if err := acc.ConvertMultisig(m, pubs); err != nil { + return err + } + if err := acc.Encrypt(password, keys.NEP2ScryptParams()); err != nil { + return err + } + w.AddAccount(acc) + return nil +} + func generateStorageCreds(cmd *cobra.Command, args []string) error { // storage wallet path is not part of the config storageWalletPath, err := cmd.Flags().GetString(storageWalletFlag) From 5ca5d9ccf9121746ba3fde1e439698dcf0695fc8 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 17 Jul 2021 15:17:23 +0300 Subject: [PATCH 182/219] [#684] neofs-adm: create wallet right after password input It is pretty annoying to get an error about non-existent directory after entering 7 passwords. Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/generate.go | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go index 2614e483e3..0bc0a19bd7 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate.go +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -20,16 +20,9 @@ func generateAlphabetCreds(cmd *cobra.Command, args []string) error { return err } - pwds := make([]string, size) - for i := 0; i < int(size); i++ { - pwds[i], err = config.AlphabetPassword(viper.GetViper(), i) - if err != nil { - return err - } - } - walletDir := viper.GetString(alphabetWalletsFlag) - if err := initializeWallets(walletDir, pwds); err != nil { + pwds, err := initializeWallets(walletDir, int(size)) + if err != nil { return err } @@ -42,22 +35,28 @@ func generateAlphabetCreds(cmd *cobra.Command, args []string) error { return nil } -func initializeWallets(walletDir string, passwords []string) error { - size := len(passwords) +func initializeWallets(walletDir string, size int) ([]string, error) { wallets := make([]*wallet.Wallet, size) pubs := make(keys.PublicKeys, size) + passwords := make([]string, size) for i := range wallets { + password, err := config.AlphabetPassword(viper.GetViper(), i) + if err != nil { + return nil, fmt.Errorf("can't fetch password: %w", err) + } + p := path.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json") // TODO(@fyrchik): file is created with 0666 permissions, consider changing. w, err := wallet.NewWallet(p) if err != nil { - return fmt.Errorf("can't create wallet: %w", err) + return nil, fmt.Errorf("can't create wallet: %w", err) } - if err := w.CreateAccount("single", passwords[i]); err != nil { - return fmt.Errorf("can't create account: %w", err) + if err := w.CreateAccount("single", password); err != nil { + return nil, fmt.Errorf("can't create account: %w", err) } + passwords[i] = password wallets[i] = w pubs[i] = w.Accounts[0].PrivateKey().PublicKey() } @@ -66,7 +65,7 @@ func initializeWallets(walletDir string, passwords []string) error { majCount := smartcontract.GetMajorityHonestNodeCount(size) for i, w := range wallets { if err := addMultisigAccount(w, majCount, passwords[i], pubs); err != nil { - return fmt.Errorf("can't create committee account: %w", err) + return nil, fmt.Errorf("can't create committee account: %w", err) } } @@ -74,18 +73,18 @@ func initializeWallets(walletDir string, passwords []string) error { bftCount := smartcontract.GetDefaultHonestNodeCount(size) for i, w := range wallets { if err := addMultisigAccount(w, bftCount, passwords[i], pubs); err != nil { - return fmt.Errorf("can't create consensus account: %w", err) + return nil, fmt.Errorf("can't create consensus account: %w", err) } } for _, w := range wallets { if err := w.Save(); err != nil { - return fmt.Errorf("can't save wallet: %w", err) + return nil, fmt.Errorf("can't save wallet: %w", err) } w.Close() } - return nil + return passwords, nil } func addMultisigAccount(w *wallet.Wallet, m int, password string, pubs keys.PublicKeys) error { From 459fe4075828eea6cd4740b670e487647560ff78 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 17 Jul 2021 15:49:24 +0300 Subject: [PATCH 183/219] [#684] neofs-adm: add tests for `generate-alphabet` Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/generate_test.go | 85 +++++++++++++++++++ go.mod | 1 + 2 files changed, 86 insertions(+) create mode 100644 cmd/neofs-adm/internal/modules/morph/generate_test.go diff --git a/cmd/neofs-adm/internal/modules/morph/generate_test.go b/cmd/neofs-adm/internal/modules/morph/generate_test.go new file mode 100644 index 0000000000..dbfcda2cde --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/generate_test.go @@ -0,0 +1,85 @@ +package morph + +import ( + "bytes" + "io/ioutil" + "math/rand" + "os" + "path" + "strconv" + "testing" + + "github.com/nspcc-dev/neo-go/cli/input" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/wallet" + "github.com/nspcc-dev/neofs-node/pkg/innerring" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" + "golang.org/x/term" +) + +func TestGenerateAlphabet(t *testing.T) { + const size = 4 + + walletDir := newTempDir(t) + buf := setupTestTerminal(t) + + cmd := generateAlphabetCmd + v := viper.GetViper() + + t.Run("no password provided", func(t *testing.T) { + buf.Reset() + v.Set(alphabetWalletsFlag, walletDir) + require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "1")) + require.Error(t, generateAlphabetCreds(cmd, nil)) + }) + t.Run("missing directory", func(t *testing.T) { + buf.Reset() + dir := path.Join(os.TempDir(), "notexist."+strconv.FormatUint(rand.Uint64(), 10)) + v.Set(alphabetWalletsFlag, dir) + require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "1")) + buf.WriteString("pass\r") + require.Error(t, generateAlphabetCreds(cmd, nil)) + }) + + buf.Reset() + v.Set(alphabetWalletsFlag, walletDir) + require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, strconv.FormatUint(size, 10))) + for i := uint64(0); i < size; i++ { + buf.WriteString(strconv.FormatUint(i, 10) + "\r") + } + + require.NoError(t, generateAlphabetCreds(cmd, nil)) + + for i := uint64(0); i < size; i++ { + p := path.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json") + w, err := wallet.NewWalletFromFile(p) + require.NoError(t, err, "wallet doesn't exist") + require.Equal(t, 3, len(w.Accounts), "not all accounts were created") + for _, a := range w.Accounts { + err := a.Decrypt(strconv.FormatUint(i, 10), keys.NEP2ScryptParams()) + require.NoError(t, err, "can't decrypt account") + } + } +} + +func setupTestTerminal(t *testing.T) *bytes.Buffer { + in := bytes.NewBuffer(nil) + input.Terminal = term.NewTerminal(input.ReadWriter{ + Reader: in, + Writer: ioutil.Discard, + }, "") + + t.Cleanup(func() { input.Terminal = nil }) + + return in +} + +func newTempDir(t *testing.T) string { + dir := path.Join(os.TempDir(), "neofs-adm.test."+strconv.FormatUint(rand.Uint64(), 10)) + require.NoError(t, os.Mkdir(dir, os.ModePerm)) + t.Cleanup(func() { + require.NoError(t, os.RemoveAll(dir)) + }) + return dir +} diff --git a/go.mod b/go.mod index 87b820d49b..363fd0c20f 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( go.etcd.io/bbolt v1.3.5 go.uber.org/atomic v1.8.0 go.uber.org/zap v1.17.0 + golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) From be6b8ca179fea33903f9ff9d50ec374b58ba2bcb Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 17 Jul 2021 15:51:43 +0300 Subject: [PATCH 184/219] [#684] neofs-adm: add size validation to `generate-alphabet` Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/generate.go | 4 ++++ cmd/neofs-adm/internal/modules/morph/generate_test.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go index 0bc0a19bd7..56b2efc223 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate.go +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -1,6 +1,7 @@ package morph import ( + "errors" "fmt" "path" @@ -19,6 +20,9 @@ func generateAlphabetCreds(cmd *cobra.Command, args []string) error { if err != nil { return err } + if size == 0 { + return errors.New("size must be > 0") + } walletDir := viper.GetString(alphabetWalletsFlag) pwds, err := initializeWallets(walletDir, int(size)) diff --git a/cmd/neofs-adm/internal/modules/morph/generate_test.go b/cmd/neofs-adm/internal/modules/morph/generate_test.go index dbfcda2cde..774415f68d 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate_test.go +++ b/cmd/neofs-adm/internal/modules/morph/generate_test.go @@ -27,6 +27,13 @@ func TestGenerateAlphabet(t *testing.T) { cmd := generateAlphabetCmd v := viper.GetViper() + t.Run("zero size", func(t *testing.T) { + buf.Reset() + v.Set(alphabetWalletsFlag, walletDir) + require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "0")) + buf.WriteString("pass\r") + require.Error(t, generateAlphabetCreds(cmd, nil)) + }) t.Run("no password provided", func(t *testing.T) { buf.Reset() v.Set(alphabetWalletsFlag, walletDir) From a2cb9cbc495be911568ae61adb1779ee88bca027 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Sat, 17 Jul 2021 16:00:22 +0300 Subject: [PATCH 185/219] [#684] neofs-adm: add labels to multisig accounts Also check that correct multisig is generated. Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/generate.go | 16 ++++++++++++---- .../internal/modules/morph/generate_test.go | 8 ++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go index 56b2efc223..09b5d25518 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate.go +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -14,6 +14,12 @@ import ( "github.com/spf13/viper" ) +const ( + singleAccountName = "single" + committeeAccountName = "committee" + consensusAccountName = "consensus" +) + func generateAlphabetCreds(cmd *cobra.Command, args []string) error { // alphabet size is not part of the config size, err := cmd.Flags().GetUint(alphabetSizeFlag) @@ -56,7 +62,7 @@ func initializeWallets(walletDir string, size int) ([]string, error) { if err != nil { return nil, fmt.Errorf("can't create wallet: %w", err) } - if err := w.CreateAccount("single", password); err != nil { + if err := w.CreateAccount(singleAccountName, password); err != nil { return nil, fmt.Errorf("can't create account: %w", err) } @@ -68,7 +74,7 @@ func initializeWallets(walletDir string, size int) ([]string, error) { // Create committee account with N/2+1 multi-signature. majCount := smartcontract.GetMajorityHonestNodeCount(size) for i, w := range wallets { - if err := addMultisigAccount(w, majCount, passwords[i], pubs); err != nil { + if err := addMultisigAccount(w, majCount, committeeAccountName, passwords[i], pubs); err != nil { return nil, fmt.Errorf("can't create committee account: %w", err) } } @@ -76,7 +82,7 @@ func initializeWallets(walletDir string, size int) ([]string, error) { // Create consensus account with 2*N/3+1 multi-signature. bftCount := smartcontract.GetDefaultHonestNodeCount(size) for i, w := range wallets { - if err := addMultisigAccount(w, bftCount, passwords[i], pubs); err != nil { + if err := addMultisigAccount(w, bftCount, consensusAccountName, passwords[i], pubs); err != nil { return nil, fmt.Errorf("can't create consensus account: %w", err) } } @@ -91,8 +97,10 @@ func initializeWallets(walletDir string, size int) ([]string, error) { return passwords, nil } -func addMultisigAccount(w *wallet.Wallet, m int, password string, pubs keys.PublicKeys) error { +func addMultisigAccount(w *wallet.Wallet, m int, name, password string, pubs keys.PublicKeys) error { acc := wallet.NewAccountFromPrivateKey(w.Accounts[0].PrivateKey()) + acc.Label = name + if err := acc.ConvertMultisig(m, pubs); err != nil { return err } diff --git a/cmd/neofs-adm/internal/modules/morph/generate_test.go b/cmd/neofs-adm/internal/modules/morph/generate_test.go index 774415f68d..e24dc8cb76 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate_test.go +++ b/cmd/neofs-adm/internal/modules/morph/generate_test.go @@ -66,6 +66,14 @@ func TestGenerateAlphabet(t *testing.T) { for _, a := range w.Accounts { err := a.Decrypt(strconv.FormatUint(i, 10), keys.NEP2ScryptParams()) require.NoError(t, err, "can't decrypt account") + switch a.Label { + case consensusAccountName: + require.Equal(t, size/2+1, len(a.Contract.Parameters)) + case committeeAccountName: + require.Equal(t, size*2/3+1, len(a.Contract.Parameters)) + default: + require.Equal(t, singleAccountName, a.Label) + } } } } From 795c49d16ba5b51fd8641f0894cebe392c742d44 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jul 2021 15:21:20 +0300 Subject: [PATCH 186/219] [#706] ir: Do not require `proxy` hash in notary disabled mode Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 64107c32d1..5be3fdcbe5 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -306,7 +306,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error withoutMainNet := cfg.GetBool("without_mainnet") // get all script hashes of contracts - server.contracts, err = parseContracts(cfg, withoutMainNet) + server.contracts, err = parseContracts(cfg, withoutMainNet, server.sideNotaryConfig.disabled) if err != nil { return nil, err } @@ -828,7 +828,7 @@ func createClient(ctx context.Context, p *chainParams, notaryOpts ...client.Nota ) } -func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { +func parseContracts(cfg *viper.Viper, withoutMainNet, withoutNotary bool) (*contracts, error) { var ( result = new(contracts) err error @@ -846,11 +846,17 @@ func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { } } + if !withoutNotary { + result.proxy, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.proxy")) + if err != nil { + return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) + } + } + netmapContractStr := cfg.GetString("contracts.netmap") balanceContractStr := cfg.GetString("contracts.balance") containerContractStr := cfg.GetString("contracts.container") auditContractStr := cfg.GetString("contracts.audit") - proxyContractStr := cfg.GetString("contracts.proxy") reputationContractStr := cfg.GetString("contracts.reputation") neofsIDContractStr := cfg.GetString("contracts.neofsid") @@ -874,11 +880,6 @@ func parseContracts(cfg *viper.Viper, withoutMainNet bool) (*contracts, error) { return nil, fmt.Errorf("ir: can't read audit script-hash: %w", err) } - result.proxy, err = util.Uint160DecodeStringLE(proxyContractStr) - if err != nil { - return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) - } - result.reputation, err = util.Uint160DecodeStringLE(reputationContractStr) if err != nil { return nil, fmt.Errorf("ir: can't read reputation script-hash: %w", err) From 46a66a21eca24185cfd4a289617ffb7c1365ba59 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 13 Jul 2021 15:13:59 +0300 Subject: [PATCH 187/219] [#705] pkg/util: Fix commentary error Signed-off-by: Pavel Karpy --- pkg/util/http/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/http/server.go b/pkg/util/http/server.go index 797f8a5c8a..7cd3b6cbf2 100644 --- a/pkg/util/http/server.go +++ b/pkg/util/http/server.go @@ -53,7 +53,7 @@ func panicOnValue(t, n string, v interface{}) { // // Panics if at least one value of the parameters is invalid. // -// Panics if at least one of next optinal parameters is invalid: +// Panics if at least one of next optional parameters is invalid: // * shutdown timeout is non-positive. // // The created Server does not require additional From 00b487e3c3a9029d0a4dff080acdfe907e7bc4da Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 16 Jul 2021 16:53:23 +0300 Subject: [PATCH 188/219] [#705] morph/notary: Add `ProbeNotary` method to Client `ProbeNotary` method checks if native `Notary` contract is presented on chain. Signed-off-by: Pavel Karpy --- pkg/morph/client/notary.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index f4355ec477..bec2b28cf1 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -102,6 +102,12 @@ func (c *Client) NotaryEnabled() bool { return c.notary != nil } +// ProbeNotary checks if native `Notary` contract is presented on chain. +func (c *Client) ProbeNotary() bool { + _, err := c.client.GetNativeContractHash(nativenames.Notary) + return err == nil +} + // DepositNotary calls notary deposit method. Deposit is required to operate // with notary contract. It used by notary contract in to produce fallback tx // if main tx failed to create. Deposit isn't last forever, so it should From b3c81116b97f70edc88dbfbc046fa84ae8895b60 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 19 Jul 2021 20:15:41 +0300 Subject: [PATCH 189/219] [#705] pkg/morph/netmap: Add `innerRingList` method Add `innerRingList` method to `netmap` client wrapper. Method parses current IR nodes list. Signed-off-by: Pavel Karpy --- pkg/morph/client/netmap/client.go | 3 ++ pkg/morph/client/netmap/innerring.go | 66 +++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index 805e5b1f45..96bf2a9edf 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -33,6 +33,7 @@ type Option func(*cfg) type cfg struct { addPeerMethod, // add peer method name for invocation newEpochMethod, // new epoch method name for invocation + innerRingList, // get innerring list method name for invocation netMapMethod, // get network map method name netMapCandidatesMethod, // get network candidates method name snapshotMethod, // get network map snapshot method name @@ -48,6 +49,7 @@ const ( defaultAddPeerMethod = "addPeer" // default add peer method name defaultConfigMethod = "config" // default get config value method name defaultEpochMethod = "epoch" // default get epoch number method name + defaultInnerRingListMethod = "innerRingList" // default get innerring list method name defaultNetMapCandidateMethod = "netmapCandidates" // default get network candidates method name defaultNetMapMethod = "netmap" // default get network map method name defaultNewEpochMethod = "newEpoch" // default new epoch method name @@ -64,6 +66,7 @@ func defaultConfig() *cfg { addPeerMethod: defaultAddPeerMethod, configMethod: defaultConfigMethod, epochMethod: defaultEpochMethod, + innerRingList: defaultInnerRingListMethod, netMapCandidatesMethod: defaultNetMapCandidateMethod, netMapMethod: defaultNetMapMethod, newEpochMethod: defaultNewEpochMethod, diff --git a/pkg/morph/client/netmap/innerring.go b/pkg/morph/client/netmap/innerring.go index b82ef2a668..2acc90a0b8 100644 --- a/pkg/morph/client/netmap/innerring.go +++ b/pkg/morph/client/netmap/innerring.go @@ -1,6 +1,13 @@ package netmap -import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" +import ( + "crypto/elliptic" + "fmt" + + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" + "github.com/nspcc-dev/neofs-node/pkg/morph/client" +) // SetInnerRing updates inner ring members in netmap contract. func (c *Client) SetInnerRing(keys keys.PublicKeys) error { @@ -11,3 +18,60 @@ func (c *Client) SetInnerRing(keys keys.PublicKeys) error { return c.client.Invoke(c.setInnerRing, args) } + +// InnerRingList returns public keys of inner ring members in +// netmap contract. +func (c *Client) InnerRingList() (keys.PublicKeys, error) { + prms, err := c.client.TestInvoke( + c.innerRingList, + ) + if err != nil { + return nil, fmt.Errorf("could not perform test invocation (%s): %w", c.innerRingList, err) + } + + return irKeysFromStackItem(prms, c.innerRingList) +} + +func irKeysFromStackItem(stack []stackitem.Item, method string) (keys.PublicKeys, error) { + if ln := len(stack); ln != 1 { + return nil, fmt.Errorf("unexpected stack item count (%s): %d", method, ln) + } + + irs, err := client.ArrayFromStackItem(stack[0]) + if err != nil { + return nil, fmt.Errorf("could not get stack item array from stack item (%s): %w", method, err) + } + + irKeys := make(keys.PublicKeys, len(irs)) + + for i := range irs { + irKeys[i], err = irKeyFromStackItem(irs[i]) + if err != nil { + return nil, err + } + } + + return irKeys, nil +} + +const irNodeFixedPrmNumber = 1 + +func irKeyFromStackItem(prm stackitem.Item) (*keys.PublicKey, error) { + prms, err := client.ArrayFromStackItem(prm) + if err != nil { + return nil, fmt.Errorf("could not get stack item array (IRNode): %w", err) + } else if ln := len(prms); ln != irNodeFixedPrmNumber { + return nil, fmt.Errorf( + "unexpected stack item count (IRNode): expected %d, has %d", + irNodeFixedPrmNumber, + ln, + ) + } + + byteKey, err := client.BytesFromStackItem(prms[0]) + if err != nil { + return nil, fmt.Errorf("could not parse bytes from stack item (IRNode): %w", err) + } + + return keys.NewPublicKeyFromBytes(byteKey, elliptic.P256()) +} From 84361beadae24850ddc114f65a0de7012b028503 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 20 Jul 2021 23:43:54 +0300 Subject: [PATCH 190/219] [#705] pkg/morph/netmap/wrapper: Add `GetInnerRingList` method Signed-off-by: Pavel Karpy --- pkg/morph/client/netmap/wrapper/innerring.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/morph/client/netmap/wrapper/innerring.go b/pkg/morph/client/netmap/wrapper/innerring.go index c8007b8543..9ecfa4037a 100644 --- a/pkg/morph/client/netmap/wrapper/innerring.go +++ b/pkg/morph/client/netmap/wrapper/innerring.go @@ -6,3 +6,8 @@ import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" func (w *Wrapper) SetInnerRing(keys keys.PublicKeys) error { return w.client.SetInnerRing(keys) } + +// GetInnerRingList return current IR list. +func (w *Wrapper) GetInnerRingList() (keys.PublicKeys, error) { + return w.client.InnerRingList() +} From 863633e6a5320dc1f1d74da0c2c7f111262aace3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 20 Jul 2021 23:59:39 +0300 Subject: [PATCH 191/219] [#705] cmd/neofs-node/object: Add fetcher without Notary Depending on having notary contract in sidechain get IR list either from NeoFSAlphabet role either from netmap contract. Signed-off-by: Pavel Karpy --- cmd/neofs-node/object.go | 43 ++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 5d13cef934..cbdbea9abf 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -21,7 +21,8 @@ import ( objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" morphClient "github.com/nspcc-dev/neofs-node/pkg/morph/client" - "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" + cntrwrp "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" + nmwrp "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/network" objectTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/object/grpc" @@ -127,14 +128,32 @@ func (i *delNetInfo) TombstoneLifetime() (uint64, error) { return i.tsLifetime, nil } -type innerRingFetcher struct { +type innerRingFetcherWithNotary struct { sidechain *morphClient.Client } -func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) { - keys, err := n.sidechain.NeoFSAlphabetList() +func (fn *innerRingFetcherWithNotary) InnerRingKeys() ([][]byte, error) { + keys, err := fn.sidechain.NeoFSAlphabetList() if err != nil { - return nil, fmt.Errorf("can't get inner ring keys: %w", err) + return nil, fmt.Errorf("can't get inner ring keys from alphabet role: %w", err) + } + + result := make([][]byte, 0, len(keys)) + for i := range keys { + result = append(result, keys[i].Bytes()) + } + + return result, nil +} + +type innerRingFetcherWithoutNotary struct { + nm *nmwrp.Wrapper +} + +func (f *innerRingFetcherWithoutNotary) InnerRingKeys() ([][]byte, error) { + keys, err := f.nm.GetInnerRingList() + if err != nil { + return nil, fmt.Errorf("can't get inner ring keys from netmap contract: %w", err) } result := make([][]byte, 0, len(keys)) @@ -176,8 +195,16 @@ func initObjectService(c *cfg) { coreConstructor := (*coreClientConstructor)(clientConstructor) - irFetcher := &innerRingFetcher{ - sidechain: c.cfgMorph.client, + var irFetcher acl.InnerRingFetcher + + if c.cfgMorph.client.ProbeNotary() { + irFetcher = &innerRingFetcherWithNotary{ + sidechain: c.cfgMorph.client, + } + } else { + irFetcher = &innerRingFetcherWithoutNotary{ + nm: c.cfgNetmap.wrapper, + } } objInhumer := &localObjectInhumer{ @@ -372,7 +399,7 @@ func initObjectService(c *cfg) { } type morphEACLStorage struct { - w *wrapper.Wrapper + w *cntrwrp.Wrapper } type signedEACLTable eaclSDK.Table From 8ea5744326a06a8657183a0a21cd786ad5a0818b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jul 2021 12:24:14 +0300 Subject: [PATCH 192/219] [#705] pkg/morph/netmap: Fix `updateInnerRing` method Add initialization of `updateInnerRing` method name in config on startup. Rename var `setInnerRing` => `updateInnerRing`. Rename method `SetInnerRing` => `UpdateInnerRing` Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/process_update.go | 2 +- pkg/morph/client/netmap/client.go | 5 +++-- pkg/morph/client/netmap/innerring.go | 6 +++--- pkg/morph/client/netmap/wrapper/innerring.go | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 9aa25ab3d1..4f9213cf3c 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -67,7 +67,7 @@ func (gp *Processor) processAlphabetSync() { sort.Sort(newInnerRing) if gp.notaryDisabled { - err = gp.netmapClient.SetInnerRing(newInnerRing) + err = gp.netmapClient.UpdateInnerRing(newInnerRing) } else { err = gp.morphClient.UpdateNeoFSAlphabetList(newInnerRing) } diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index 96bf2a9edf..2819b62e65 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -40,7 +40,7 @@ type cfg struct { epochSnapshotMethod, // get network map snapshot by epoch method name updateStateMethod, // update state method name for invocation epochMethod, // get epoch number method name - setInnerRing, // set inner ring method name + updateInnerRing, // update innerring method name setConfigMethod, // set config method name configMethod string // get config value method name } @@ -54,7 +54,7 @@ const ( defaultNetMapMethod = "netmap" // default get network map method name defaultNewEpochMethod = "newEpoch" // default new epoch method name defaultSetConfigMethod = "setConfig" // default get config value method name - defaultSetInnerRingMethod = "updateInnerRing" // default set innerring method name + defaultUpdateInnerRingMethod = "updateInnerRing" // default update innerring method name defaultSnapshotMethod = "snapshot" // default get network map snapshot method name defaultUpdateStateMethod = "updateState" // default update state method name @@ -73,6 +73,7 @@ func defaultConfig() *cfg { setConfigMethod: defaultSetConfigMethod, snapshotMethod: defaultSnapshotMethod, updateStateMethod: defaultUpdateStateMethod, + updateInnerRing: defaultUpdateInnerRingMethod, epochSnapshotMethod: defaultEpochSnapshotMethod, } } diff --git a/pkg/morph/client/netmap/innerring.go b/pkg/morph/client/netmap/innerring.go index 2acc90a0b8..622c2a6649 100644 --- a/pkg/morph/client/netmap/innerring.go +++ b/pkg/morph/client/netmap/innerring.go @@ -9,14 +9,14 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) -// SetInnerRing updates inner ring members in netmap contract. -func (c *Client) SetInnerRing(keys keys.PublicKeys) error { +// UpdateInnerRing updates inner ring members in netmap contract. +func (c *Client) UpdateInnerRing(keys keys.PublicKeys) error { args := make([][]byte, len(keys)) for i := range args { args[i] = keys[i].Bytes() } - return c.client.Invoke(c.setInnerRing, args) + return c.client.Invoke(c.updateInnerRing, args) } // InnerRingList returns public keys of inner ring members in diff --git a/pkg/morph/client/netmap/wrapper/innerring.go b/pkg/morph/client/netmap/wrapper/innerring.go index 9ecfa4037a..6efc5a9b36 100644 --- a/pkg/morph/client/netmap/wrapper/innerring.go +++ b/pkg/morph/client/netmap/wrapper/innerring.go @@ -2,9 +2,9 @@ package wrapper import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" -// SetInnerRing updates inner ring keys. -func (w *Wrapper) SetInnerRing(keys keys.PublicKeys) error { - return w.client.SetInnerRing(keys) +// UpdateInnerRing updates inner ring keys. +func (w *Wrapper) UpdateInnerRing(keys keys.PublicKeys) error { + return w.client.UpdateInnerRing(keys) } // GetInnerRingList return current IR list. From 8e66c67a74f8a006c2840526f06cda9e38de5168 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 12:40:06 +0300 Subject: [PATCH 193/219] [#705] pkg/innerring: Add IR keys fetchers Add `IrFetcherWithNotary` and `IrFetcherWithoutNotary` that can fetch IR keys with and without usage of notary contract. Both can be hidden behind `InnerRingKeys() (keys.PublicKeys, error)` interface. Signed-off-by: Pavel Karpy --- pkg/innerring/fetcher.go | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 pkg/innerring/fetcher.go diff --git a/pkg/innerring/fetcher.go b/pkg/innerring/fetcher.go new file mode 100644 index 0000000000..3d2fc6af3e --- /dev/null +++ b/pkg/innerring/fetcher.go @@ -0,0 +1,58 @@ +package innerring + +import ( + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neofs-node/pkg/morph/client" + nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" +) + +// NewIRFetcherWithNotary creates IrFetcherWithNotary. +// +// IrFetcherWithNotary can be used to obtain innerring key list if +// network that client is connected to supports notary contract. +// +// Passed client is required. Panics if nil. +func NewIRFetcherWithNotary(cli *client.Client) *IrFetcherWithNotary { + if cli == nil { + panic("could not init IRFetcher with notary: client must not be nil") + } + return &IrFetcherWithNotary{cli: cli} +} + +// NewIRFetcherWithoutNotary creates IrFetcherWithoutNotary. +// +// IrFetcherWithoutNotary must be used to obtain innerring key list if +// network that netmap wrapper is connected to does not support notary +// contract. +// +// Passed netmap wrapper is required. Panics if nil. +func NewIRFetcherWithoutNotary(nm *nmWrapper.Wrapper) *IrFetcherWithoutNotary { + if nm == nil { + panic("could not init IRFetcher without notary: netmap wrapper must not be nil") + } + return &IrFetcherWithoutNotary{nm: nm} +} + +// IrFetcherWithNotary fetches keys using notary contract. Must be created +// with NewIRFetcherWithNotary. +type IrFetcherWithNotary struct { + cli *client.Client +} + +// IrFetcherWithoutNotary fetches keys using netmap contract. Must be created +// with NewIRFetcherWithoutNotary. +type IrFetcherWithoutNotary struct { + nm *nmWrapper.Wrapper +} + +// InnerRingKeys fetches list of innerring keys from NeoFSAlphabet +// role in side chain. +func (fN IrFetcherWithNotary) InnerRingKeys() (keys.PublicKeys, error) { + return fN.cli.NeoFSAlphabetList() +} + +// InnerRingKeys fetches list of innerring keys from netmap contract +// in side chain. +func (f IrFetcherWithoutNotary) InnerRingKeys() (keys.PublicKeys, error) { + return f.nm.GetInnerRingList() +} From 73ba35b379302b4a79a23bf146cf121cdcb64f69 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 12:45:25 +0300 Subject: [PATCH 194/219] [#705] pkg/innerring: Fix disable notary mode Get innerring list and committee in innerring indexer from interfaces, not from structs. Passing IR fetcher to indexer constructor depends on having Notary contract in sidechain(use NeoFS role or netmap contract). Signed-off-by: Pavel Karpy --- pkg/innerring/indexer.go | 29 +++++++++++++++++++---------- pkg/innerring/innerring.go | 21 +++++++++++++++------ 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/pkg/innerring/indexer.go b/pkg/innerring/indexer.go index ae644d0b1a..ac5fb93efb 100644 --- a/pkg/innerring/indexer.go +++ b/pkg/innerring/indexer.go @@ -7,16 +7,24 @@ import ( "time" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" ) type ( + irFetcher interface { + InnerRingKeys() (keys.PublicKeys, error) + } + + committeeFetcher interface { + Committee() (keys.PublicKeys, error) + } + innerRingIndexer struct { sync.RWMutex - cli *client.Client - key *keys.PublicKey - timeout time.Duration + irFetcher irFetcher + commFetcher committeeFetcher + key *keys.PublicKey + timeout time.Duration ind indexes @@ -29,11 +37,12 @@ type ( } ) -func newInnerRingIndexer(cli *client.Client, key *keys.PublicKey, to time.Duration) *innerRingIndexer { +func newInnerRingIndexer(comf committeeFetcher, irf irFetcher, key *keys.PublicKey, to time.Duration) *innerRingIndexer { return &innerRingIndexer{ - cli: cli, - key: key, - timeout: to, + irFetcher: irf, + commFetcher: comf, + key: key, + timeout: to, } } @@ -54,7 +63,7 @@ func (s *innerRingIndexer) update() (ind indexes, err error) { return s.ind, nil } - innerRing, err := s.cli.NeoFSAlphabetList() + innerRing, err := s.irFetcher.InnerRingKeys() if err != nil { return indexes{}, err } @@ -62,7 +71,7 @@ func (s *innerRingIndexer) update() (ind indexes, err error) { s.ind.innerRingIndex = keyPosition(s.key, innerRing) s.ind.innerRingSize = int32(len(innerRing)) - alphabet, err := s.cli.Committee() + alphabet, err := s.commFetcher.Committee() if err != nil { return indexes{}, err } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 5be3fdcbe5..43cea11d6f 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -375,12 +375,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error server.pubKey = server.key.PublicKey().Bytes() - server.statusIndex = newInnerRingIndexer( - server.morphClient, - server.key.PublicKey(), - cfg.GetDuration("indexer.cache_timeout"), - ) - auditPool, err := ants.NewPool(cfg.GetInt("audit.task.exec_pool_size")) if err != nil { return nil, err @@ -426,6 +420,21 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } + var irf irFetcher + + if server.morphClient.ProbeNotary() { + irf = NewIRFetcherWithNotary(server.morphClient) + } else { + irf = NewIRFetcherWithoutNotary(server.netmapClient) + } + + server.statusIndex = newInnerRingIndexer( + server.morphClient, + irf, + server.key.PublicKey(), + cfg.GetDuration("indexer.cache_timeout"), + ) + // create global runtime config reader globalConfig := config.NewGlobalConfigReader(cfg, server.netmapClient) From c8d58d56b97a4a56e1840af7da1ca0b66caea6d8 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 13:04:37 +0300 Subject: [PATCH 195/219] [#705] innerring/governance: Hide fetching ir keys behind interface Add to governance processor IRFetcher interface. Implementation must deduct if notary enabled or not. Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 1 + .../processors/governance/process_update.go | 2 +- pkg/innerring/processors/governance/processor.go | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 43cea11d6f..ec166b4f30 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -547,6 +547,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error AlphabetState: server, EpochState: server, Voter: server, + IRFetcher: irf, MorphClient: server.morphClient, MainnetClient: server.mainnetClient, NotaryDisabled: server.sideNotaryConfig.disabled, diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 4f9213cf3c..442bddbfc3 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -54,7 +54,7 @@ func (gp *Processor) processAlphabetSync() { } // 2. Update NeoFSAlphabet role in side chain. - innerRing, err := gp.morphClient.NeoFSAlphabetList() + innerRing, err := gp.irFetcher.InnerRingKeys() if err != nil { gp.log.Error("can't fetch inner ring list from side chain", zap.String("error", err.Error())) diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index 588403ad13..a7d2ede61b 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -21,7 +21,7 @@ import ( const ProcessorPoolSize = 1 type ( - // AlphabetState is a callback interface for inner ring global state. + // AlphabetState is a callback interface for innerring global state. AlphabetState interface { IsAlphabet() bool } @@ -31,11 +31,18 @@ type ( VoteForSidechainValidator(keys keys.PublicKeys) error } - // EpochState is a callback interface for inner ring global state. + // EpochState is a callback interface for innerring global state. EpochState interface { EpochCounter() uint64 } + // IRFetcher is a callback interface for innerring keys. + // Implementation must take into account availability of + // the notary contract. + IRFetcher interface { + InnerRingKeys() (keys.PublicKeys, error) + } + // Processor of events related to governance in the network. Processor struct { log *zap.Logger @@ -46,6 +53,7 @@ type ( alphabetState AlphabetState epochState EpochState voter Voter + irFetcher IRFetcher mainnetClient *client.Client morphClient *client.Client @@ -60,6 +68,7 @@ type ( AlphabetState AlphabetState EpochState EpochState Voter Voter + IRFetcher IRFetcher MorphClient *client.Client MainnetClient *client.Client @@ -85,6 +94,8 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/governance: global state is not set") case p.Voter == nil: return nil, errors.New("ir/governance: global state is not set") + case p.IRFetcher == nil: + return nil, errors.New("ir/governance: innerring keys fetcher is not set") } pool, err := ants.NewPool(ProcessorPoolSize, ants.WithNonblocking(true)) @@ -100,6 +111,7 @@ func New(p *Params) (*Processor, error) { alphabetState: p.AlphabetState, epochState: p.EpochState, voter: p.Voter, + irFetcher: p.IRFetcher, mainnetClient: p.MainnetClient, morphClient: p.MorphClient, notaryDisabled: p.NotaryDisabled, From dfbde0004e2caec5e9002fa9fad4d58103fa7340 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jul 2021 12:38:19 +0300 Subject: [PATCH 196/219] [#705] innerring/governance: Delete useless sort Do not sort slice that is already sorted. Signed-off-by: Pavel Karpy --- pkg/innerring/processors/governance/process_update.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/innerring/processors/governance/process_update.go b/pkg/innerring/processors/governance/process_update.go index 442bddbfc3..7d54a642cf 100644 --- a/pkg/innerring/processors/governance/process_update.go +++ b/pkg/innerring/processors/governance/process_update.go @@ -44,7 +44,6 @@ func (gp *Processor) processAlphabetSync() { } gp.log.Info("alphabet list has been changed, starting update") - sort.Sort(newAlphabet) // 1. Vote to side chain committee via alphabet contracts. err = gp.voter.VoteForSidechainValidator(newAlphabet) From 7e43af3de3c3881738f3667620c3d5adaa1a04c2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Jul 2021 18:12:19 +0300 Subject: [PATCH 197/219] [#708] morph/client: Add BlockCount method Signed-off-by: Alex Vanin --- pkg/morph/client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 6c686b4c28..46c8d639be 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -315,3 +315,9 @@ func toStackParameter(value interface{}) (sc.Parameter, error) { func (c *Client) MagicNumber() uint64 { return uint64(c.client.GetNetwork()) } + +// BlockCount returns block count of the network +// to which the underlying RPC node client is connected. +func (c *Client) BlockCount() (uint32, error) { + return c.client.GetBlockCount() +} From 7146afcd28dc3f18ad80d69ff0317195dcc7a190 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Jul 2021 15:55:05 +0300 Subject: [PATCH 198/219] [#708] morph/client: Add epoch block getter from netmap Signed-off-by: Alex Vanin --- pkg/morph/client/netmap/client.go | 3 ++ pkg/morph/client/netmap/epoch.go | 41 ++++++++++++++++++++++++ pkg/morph/client/netmap/wrapper/epoch.go | 13 ++++++++ 3 files changed, 57 insertions(+) diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index 2819b62e65..b41fca2abe 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -40,6 +40,7 @@ type cfg struct { epochSnapshotMethod, // get network map snapshot by epoch method name updateStateMethod, // update state method name for invocation epochMethod, // get epoch number method name + epochBlockMethod, // get epoch number method name updateInnerRing, // update innerring method name setConfigMethod, // set config method name configMethod string // get config value method name @@ -49,6 +50,7 @@ const ( defaultAddPeerMethod = "addPeer" // default add peer method name defaultConfigMethod = "config" // default get config value method name defaultEpochMethod = "epoch" // default get epoch number method name + defaultEpochBlockMethod = "epochBlock" // default get epoch block number method name defaultInnerRingListMethod = "innerRingList" // default get innerring list method name defaultNetMapCandidateMethod = "netmapCandidates" // default get network candidates method name defaultNetMapMethod = "netmap" // default get network map method name @@ -66,6 +68,7 @@ func defaultConfig() *cfg { addPeerMethod: defaultAddPeerMethod, configMethod: defaultConfigMethod, epochMethod: defaultEpochMethod, + epochBlockMethod: defaultEpochBlockMethod, innerRingList: defaultInnerRingListMethod, netMapCandidatesMethod: defaultNetMapCandidateMethod, netMapMethod: defaultNetMapMethod, diff --git a/pkg/morph/client/netmap/epoch.go b/pkg/morph/client/netmap/epoch.go index aee1244989..02e00ca77b 100644 --- a/pkg/morph/client/netmap/epoch.go +++ b/pkg/morph/client/netmap/epoch.go @@ -22,6 +22,22 @@ func (e EpochValues) Number() int64 { return e.num } +// EpochBlockArgs groups the arguments of +// get epoch block number test invoke call. +type EpochBlockArgs struct { +} + +// EpochBlockValues groups the stack parameters +// returned by get epoch block number test invoke. +type EpochBlockValues struct { + block int64 +} + +// Block return the block number of NeoFS epoch. +func (e EpochBlockValues) Block() int64 { + return e.block +} + // Epoch performs the test invoke of get epoch number // method of NeoFS Netmap contract. func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) { @@ -47,3 +63,28 @@ func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) { num: num, }, nil } + +// LastEpochBlock performs the test invoke of get epoch block number +// method of NeoFS Netmap contract. +func (c *Client) LastEpochBlock(_ EpochBlockArgs) (*EpochBlockValues, error) { + items, err := c.client.TestInvoke(c.epochBlockMethod) + if err != nil { + return nil, fmt.Errorf("could not perform test invocation (%s): %w", + c.epochBlockMethod, err) + } + + if ln := len(items); ln != 1 { + return nil, fmt.Errorf("unexpected stack item count (%s): %d", + c.epochBlockMethod, ln) + } + + block, err := client.IntFromStackItem(items[0]) + if err != nil { + return nil, fmt.Errorf("could not get number from stack item (%s): %w", + c.epochBlockMethod, err) + } + + return &EpochBlockValues{ + block: block, + }, nil +} diff --git a/pkg/morph/client/netmap/wrapper/epoch.go b/pkg/morph/client/netmap/wrapper/epoch.go index 9f30d852ab..ba3ff0f3d5 100644 --- a/pkg/morph/client/netmap/wrapper/epoch.go +++ b/pkg/morph/client/netmap/wrapper/epoch.go @@ -18,3 +18,16 @@ func (w *Wrapper) Epoch() (uint64, error) { return uint64(vals.Number()), nil } + +// LastEpochBlock receives block number of current NeoFS epoch +// through the Netmap contract call. +func (w *Wrapper) LastEpochBlock() (uint32, error) { + args := netmap.EpochBlockArgs{} + + vals, err := w.client.LastEpochBlock(args) + if err != nil { + return 0, fmt.Errorf("(%T) could not get epoch block number: %w", w, err) + } + + return uint32(vals.Block()), nil +} From 67b368234804b4d4b8f8db4c69270f9a8a2c6549 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Jul 2021 17:28:59 +0300 Subject: [PATCH 199/219] [#708] morph/timer: Add single tick timer Signed-off-by: Alex Vanin --- pkg/morph/timer/block.go | 31 ++++++++++++++++----- pkg/morph/timer/block_test.go | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 6 deletions(-) diff --git a/pkg/morph/timer/block.go b/pkg/morph/timer/block.go index 043347ff93..c3fea906ff 100644 --- a/pkg/morph/timer/block.go +++ b/pkg/morph/timer/block.go @@ -31,6 +31,8 @@ type BlockTimer struct { ps []BlockTimer + once bool + deltaCfg } @@ -72,6 +74,20 @@ func NewBlockTimer(dur BlockMeter, h BlockTickHandler) *BlockTimer { } } +// NewOneTickTimer creates a new BlockTimer that ticks only once. +// +// Do not use delta handlers with pulse in this timer. +func NewOneTickTimer(dur BlockMeter, h BlockTickHandler) *BlockTimer { + return &BlockTimer{ + mtx: new(sync.Mutex), + dur: dur, + mul: 1, + div: 1, + h: h, + once: true, + } +} + // OnDelta registers handler which is executed on (mul / div * BlockMeter()) block // after basic interval reset. // @@ -87,9 +103,10 @@ func (t *BlockTimer) OnDelta(mul, div uint32, h BlockTickHandler, opts ...DeltaO } t.ps = append(t.ps, BlockTimer{ - mul: mul, - div: div, - h: h, + mul: mul, + div: div, + h: h, + once: t.once, deltaCfg: c, }) @@ -157,9 +174,11 @@ func (t *BlockTimer) tick() { // 2. call t.tickH(h) t.h() - t.cur = 0 - t.rolledBack = true - t.reset() + if !t.once { + t.cur = 0 + t.rolledBack = true + t.reset() + } } for i := range t.ps { diff --git a/pkg/morph/timer/block_test.go b/pkg/morph/timer/block_test.go index 03e4ec38e7..c5d6525f52 100644 --- a/pkg/morph/timer/block_test.go +++ b/pkg/morph/timer/block_test.go @@ -108,3 +108,54 @@ func TestDeltaReset(t *testing.T) { require.Equal(t, 2, detlaCallCounter) } + +func TestNewOneTickTimer(t *testing.T) { + blockDur := uint32(1) + baseCallCounter := 0 + + bt := timer.NewOneTickTimer(timer.StaticBlockMeter(blockDur), func() { + baseCallCounter++ + }) + require.NoError(t, bt.Reset()) + + tickN(bt, 10) + require.Equal(t, 1, baseCallCounter) // happens once no matter what + + t.Run("zero duration", func(t *testing.T) { + blockDur = uint32(0) + baseCallCounter = 0 + + bt = timer.NewOneTickTimer(timer.StaticBlockMeter(blockDur), func() { + baseCallCounter++ + }) + require.NoError(t, bt.Reset()) + + tickN(bt, 10) + require.Equal(t, 1, baseCallCounter) + }) + + t.Run("delta without pulse", func(t *testing.T) { + blockDur = uint32(10) + baseCallCounter = 0 + + bt = timer.NewOneTickTimer(timer.StaticBlockMeter(blockDur), func() { + baseCallCounter++ + }) + + detlaCallCounter := 0 + + bt.OnDelta(1, 10, func() { + detlaCallCounter++ + }) + + require.NoError(t, bt.Reset()) + + tickN(bt, 10) + require.Equal(t, 1, baseCallCounter) + require.Equal(t, 1, detlaCallCounter) + + tickN(bt, 10) // 10 more ticks must not affect counters + require.Equal(t, 1, baseCallCounter) + require.Equal(t, 1, detlaCallCounter) + }) +} From 62efa3f098177407faf1cc92ce7b078789cf3358 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Jul 2021 18:15:56 +0300 Subject: [PATCH 200/219] [#708] innerring: Synchronize initial epoch tick When Inner Ring node starts, it should sync nearest epoch tick event based on the block of the latest epoch. Otherwise epoch ticking can be stopped, because ballots or notary transactions are valid for limited period of time. Signed-off-by: Alex Vanin --- pkg/innerring/innerring.go | 58 +++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index ec166b4f30..907038c9b5 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -25,6 +25,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/reputation" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement" auditSettlement "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/audit" + timerEvent "github.com/nspcc-dev/neofs-node/pkg/innerring/timers" "github.com/nspcc-dev/neofs-node/pkg/morph/client" auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" @@ -79,10 +80,14 @@ type ( sideNotaryConfig *notaryConfig // internal variables - key *keys.PrivateKey - pubKey []byte - contracts *contracts - predefinedValidators keys.PublicKeys + key *keys.PrivateKey + pubKey []byte + contracts *contracts + predefinedValidators keys.PublicKeys + initialEpochTickDelta uint32 + + // runtime processors + netmapProcessor *netmap.Processor workers []func(context.Context) @@ -201,6 +206,14 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { zap.String("error", err.Error())) } + // tick initial epoch + initialEpochTicker := timer.NewOneTickTimer( + timer.StaticBlockMeter(s.initialEpochTickDelta), + func() { + s.netmapProcessor.HandleNewEpochTick(timerEvent.NewEpochTick{}) + }) + s.addBlockTimer(initialEpochTicker) + morphErr := make(chan error) mainnnetErr := make(chan error) @@ -564,7 +577,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error } // create netmap processor - netmapProcessor, err := netmap.New(&netmap.Params{ + server.netmapProcessor, err = netmap.New(&netmap.Params{ Log: log, PoolSize: cfg.GetInt("workers.netmap"), NetmapContract: server.contracts.netmap, @@ -591,7 +604,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - err = bindMorphProcessor(netmapProcessor, server) + err = bindMorphProcessor(server.netmapProcessor, server) if err != nil { return nil, err } @@ -708,7 +721,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error // initialize epoch timers server.epochTimer = newEpochTimer(&epochTimerArgs{ l: server.log, - nm: netmapProcessor, + nm: server.netmapProcessor, cnrWrapper: cnrClient, epoch: server, epochDuration: globalConfig.EpochDuration, @@ -966,6 +979,12 @@ func (s *Server) initConfigFromBlockchain() error { return fmt.Errorf("can't read balance contract precision: %w", err) } + // get next epoch delta tick + s.initialEpochTickDelta, err = s.nextEpochBlockDelta() + if err != nil { + return err + } + s.epochCounter.Store(epoch) s.precision.SetBalancePrecision(balancePrecision) @@ -974,11 +993,36 @@ func (s *Server) initConfigFromBlockchain() error { zap.Bool("alphabet", s.IsAlphabet()), zap.Uint64("epoch", epoch), zap.Uint32("precision", balancePrecision), + zap.Uint32("init_epoch_tick_delta", s.initialEpochTickDelta), ) return nil } +func (s *Server) nextEpochBlockDelta() (uint32, error) { + epochBlock, err := s.netmapClient.LastEpochBlock() + if err != nil { + return 0, fmt.Errorf("can't read last epoch block: %w", err) + } + + blockHeight, err := s.morphClient.BlockCount() + if err != nil { + return 0, fmt.Errorf("can't get side chain height: %w", err) + } + + epochDuration, err := s.netmapClient.EpochDuration() + if err != nil { + return 0, fmt.Errorf("can't get epoch duration: %w", err) + } + + delta := uint32(epochDuration) + epochBlock + if delta < blockHeight { + return 0, nil + } + + return delta - blockHeight, nil +} + // onlyActiveHandler wrapper around event handler that executes it // only if inner ring node state is active. func (s *Server) onlyActiveEventHandler(f event.Handler) event.Handler { From 9aa6ab4fc9efeb9dd75f88aeb9f3fa6c5b1798ac Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 13:56:02 +0300 Subject: [PATCH 201/219] [#710] cli: Make `--address` flag optional If `--address` was not presented use default wallet address and do not require it. Signed-off-by: Pavel Karpy --- cmd/neofs-cli/modules/root.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 60a95b1ff2..9ac8d515a0 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -13,6 +13,7 @@ import ( "github.com/nspcc-dev/neo-go/cli/flags" "github.com/nspcc-dev/neo-go/cli/input" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/wallet" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -220,15 +221,20 @@ func getKeyFromNEP2(encryptedWif string) (*ecdsa.PrivateKey, error) { } func getKeyFromWallet(w *wallet.Wallet, addrStr string) (*ecdsa.PrivateKey, error) { - if addrStr == "" { - printVerbose("Address is empty") - return nil, errInvalidAddress - } + var ( + addr util.Uint160 + err error + ) - addr, err := flags.ParseAddress(addrStr) - if err != nil { - printVerbose("Can't parse address: %s", addrStr) - return nil, errInvalidAddress + if addrStr == "" { + printVerbose("Using default wallet address") + addr = w.GetChangeAddress() + } else { + addr, err = flags.ParseAddress(addrStr) + if err != nil { + printVerbose("Can't parse address: %s", addrStr) + return nil, errInvalidAddress + } } acc := w.GetAccount(addr) From 3561cf5873e079d853e8c714df2e8e28c7cc1d00 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 22 Jul 2021 15:36:40 +0300 Subject: [PATCH 202/219] [#712] moprh/client: Log VUB in notary invocations For easier debug when notary transaction didn't execute. Signed-off-by: Alex Vanin --- pkg/morph/client/notary.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index bec2b28cf1..27495b6013 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -317,6 +317,8 @@ func (c *Client) notaryInvoke(committee bool, contract util.Uint160, method stri c.logger.Debug("notary request invoked", zap.String("method", method), + zap.Uint32("valid_until_block", until), + zap.Uint32("fallback_valid_for", c.notary.fallbackTime), zap.Stringer("tx_hash", resp.Hash().Reverse())) return nil From bba470570fd07301ee227fa586e7bd591665dea2 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 22 Jul 2021 19:58:28 +0300 Subject: [PATCH 203/219] [#708] morph/client: Update last epoch block method name Signed-off-by: Alex Vanin --- pkg/morph/client/netmap/client.go | 6 +++--- pkg/morph/client/netmap/epoch.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/morph/client/netmap/client.go b/pkg/morph/client/netmap/client.go index b41fca2abe..e1e2a1aab5 100644 --- a/pkg/morph/client/netmap/client.go +++ b/pkg/morph/client/netmap/client.go @@ -40,7 +40,7 @@ type cfg struct { epochSnapshotMethod, // get network map snapshot by epoch method name updateStateMethod, // update state method name for invocation epochMethod, // get epoch number method name - epochBlockMethod, // get epoch number method name + lastEpochBlockMethod, // get last epoch number method name updateInnerRing, // update innerring method name setConfigMethod, // set config method name configMethod string // get config value method name @@ -50,7 +50,7 @@ const ( defaultAddPeerMethod = "addPeer" // default add peer method name defaultConfigMethod = "config" // default get config value method name defaultEpochMethod = "epoch" // default get epoch number method name - defaultEpochBlockMethod = "epochBlock" // default get epoch block number method name + defaultLastEpochBlockMethod = "lastEpochBlock" // default get last epoch block number method name defaultInnerRingListMethod = "innerRingList" // default get innerring list method name defaultNetMapCandidateMethod = "netmapCandidates" // default get network candidates method name defaultNetMapMethod = "netmap" // default get network map method name @@ -68,7 +68,7 @@ func defaultConfig() *cfg { addPeerMethod: defaultAddPeerMethod, configMethod: defaultConfigMethod, epochMethod: defaultEpochMethod, - epochBlockMethod: defaultEpochBlockMethod, + lastEpochBlockMethod: defaultLastEpochBlockMethod, innerRingList: defaultInnerRingListMethod, netMapCandidatesMethod: defaultNetMapCandidateMethod, netMapMethod: defaultNetMapMethod, diff --git a/pkg/morph/client/netmap/epoch.go b/pkg/morph/client/netmap/epoch.go index 02e00ca77b..0aad4192d0 100644 --- a/pkg/morph/client/netmap/epoch.go +++ b/pkg/morph/client/netmap/epoch.go @@ -67,21 +67,21 @@ func (c *Client) Epoch(_ EpochArgs) (*EpochValues, error) { // LastEpochBlock performs the test invoke of get epoch block number // method of NeoFS Netmap contract. func (c *Client) LastEpochBlock(_ EpochBlockArgs) (*EpochBlockValues, error) { - items, err := c.client.TestInvoke(c.epochBlockMethod) + items, err := c.client.TestInvoke(c.lastEpochBlockMethod) if err != nil { return nil, fmt.Errorf("could not perform test invocation (%s): %w", - c.epochBlockMethod, err) + c.lastEpochBlockMethod, err) } if ln := len(items); ln != 1 { return nil, fmt.Errorf("unexpected stack item count (%s): %d", - c.epochBlockMethod, ln) + c.lastEpochBlockMethod, ln) } block, err := client.IntFromStackItem(items[0]) if err != nil { return nil, fmt.Errorf("could not get number from stack item (%s): %w", - c.epochBlockMethod, err) + c.lastEpochBlockMethod, err) } return &EpochBlockValues{ From e753eebaee252c3de15046c87f512c9cf634660a Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 21:20:20 +0300 Subject: [PATCH 204/219] Update Neo-Go library to v0.96.0 Signed-off-by: Pavel Karpy --- go.mod | 2 +- go.sum | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 363fd0c20f..d04e278bfd 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.95.3 + github.com/nspcc-dev/neo-go v0.96.0 github.com/nspcc-dev/neofs-api-go v1.28.3 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 diff --git a/go.sum b/go.sum index cb9407488e..2bb0e2bf7a 100644 --- a/go.sum +++ b/go.sum @@ -365,8 +365,9 @@ github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1: github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= -github.com/nspcc-dev/neo-go v0.95.3 h1:RxBKcmmatbSM2cETGhv3ritmrkU0gUnWItNZvtrBtI0= github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= +github.com/nspcc-dev/neo-go v0.96.0 h1:CNzAfs8VXezolnAcgQ7d7LfsNKVP+hFJM2WwmQdb6VA= +github.com/nspcc-dev/neo-go v0.96.0/go.mod h1:Mj6P7K9+1FDquUGXZ9LKGqS9vFKesvkV+Ad4zI84of8= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= @@ -489,9 +490,12 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk= +github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -639,6 +643,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From c41ec2e2e914c2ad74bb5548d5dbde70464cec63 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 21:33:10 +0300 Subject: [PATCH 205/219] [#718] ir: Do not require `processing` hash in main notary disabled mode Signed-off-by: Pavel Karpy --- pkg/innerring/innerring.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 907038c9b5..77aac0cd63 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -319,7 +319,12 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error withoutMainNet := cfg.GetBool("without_mainnet") // get all script hashes of contracts - server.contracts, err = parseContracts(cfg, withoutMainNet, server.sideNotaryConfig.disabled) + server.contracts, err = parseContracts( + cfg, + withoutMainNet, + server.mainNotaryConfig.disabled, + server.sideNotaryConfig.disabled, + ) if err != nil { return nil, err } @@ -851,7 +856,7 @@ func createClient(ctx context.Context, p *chainParams, notaryOpts ...client.Nota ) } -func parseContracts(cfg *viper.Viper, withoutMainNet, withoutNotary bool) (*contracts, error) { +func parseContracts(cfg *viper.Viper, withoutMainNet, withoutMainNotary, withoutSideNotary bool) (*contracts, error) { var ( result = new(contracts) err error @@ -863,13 +868,15 @@ func parseContracts(cfg *viper.Viper, withoutMainNet, withoutNotary bool) (*cont return nil, fmt.Errorf("ir: can't read neofs script-hash: %w", err) } - result.processing, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.processing")) - if err != nil { - return nil, fmt.Errorf("ir: can't read processing script-hash: %w", err) + if !withoutMainNotary { + result.processing, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.processing")) + if err != nil { + return nil, fmt.Errorf("ir: can't read processing script-hash: %w", err) + } } } - if !withoutNotary { + if !withoutSideNotary { result.proxy, err = util.Uint160DecodeStringLE(cfg.GetString("contracts.proxy")) if err != nil { return nil, fmt.Errorf("ir: can't read proxy script-hash: %w", err) From da516c67548dd447551604797cda4d78f57d7718 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 16:10:45 +0300 Subject: [PATCH 206/219] [#711] node/config/example: Make config examples usable Signed-off-by: Pavel Karpy Signed-off-by: Pavel Karpy --- config/example/node.env | 62 +++++++++++++++++++++------------------- config/example/node.json | 60 +++++++++++++++++++------------------- config/example/node.yaml | 60 +++++++++++++++++++------------------- 3 files changed, 92 insertions(+), 90 deletions(-) diff --git a/config/example/node.env b/config/example/node.env index 1a62c8641b..d3944d1e1f 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -67,54 +67,56 @@ NEOFS_STORAGE_SHARD_NUM=2 ### Write cache config NEOFS_STORAGE_SHARD_0_USE_WRITE_CACHE=false NEOFS_STORAGE_SHARD_0_WRITECACHE_PATH=tmp/0/cache -NEOFS_STORAGE_SHARD_0_WRITECACHE_MEM_SIZE=111 -NEOFS_STORAGE_SHARD_0_WRITECACHE_DB_SIZE=222 -NEOFS_STORAGE_SHARD_0_WRITECACHE_SMALL_SIZE=333 -NEOFS_STORAGE_SHARD_0_WRITECACHE_MAX_SIZE=444 -NEOFS_STORAGE_SHARD_0_WRITECACHE_WORKERS_NUMBER=555 +NEOFS_STORAGE_SHARD_0_WRITECACHE_MEM_SIZE=2147483648 +NEOFS_STORAGE_SHARD_0_WRITECACHE_DB_SIZE=2147483648 +NEOFS_STORAGE_SHARD_0_WRITECACHE_SMALL_SIZE=16384 +NEOFS_STORAGE_SHARD_0_WRITECACHE_MAX_SIZE=134217728 +NEOFS_STORAGE_SHARD_0_WRITECACHE_WORKERS_NUMBER=30 ### Metabase config NEOFS_STORAGE_SHARD_0_METABASE_PATH=tmp/0/meta -NEOFS_STORAGE_SHARD_0_METABASE_PERM=0700 +NEOFS_STORAGE_SHARD_0_METABASE_PERM=0644 ### Blobstor config NEOFS_STORAGE_SHARD_0_BLOBSTOR_PATH=tmp/0/blob -NEOFS_STORAGE_SHARD_0_BLOBSTOR_PERM=0666 -NEOFS_STORAGE_SHARD_0_BLOBSTOR_SHALLOW_DEPTH=5 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_PERM=0644 NEOFS_STORAGE_SHARD_0_BLOBSTOR_COMPRESS=true -NEOFS_STORAGE_SHARD_0_BLOBSTOR_SMALL_SIZE_LIMIT=77 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_SHALLOW_DEPTH=5 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_SMALL_SIZE_LIMIT=102400 ### Blobovnicza config -NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SIZE=1024 -NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SHALLOW_DEPTH=10 -NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SHALLOW_WIDTH=20 -NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_OPENED_CACHE_SIZE=88 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SIZE=4194304 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SHALLOW_DEPTH=1 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_SHALLOW_WIDTH=4 +NEOFS_STORAGE_SHARD_0_BLOBSTOR_BLOBOVNICZA_OPENED_CACHE_SIZE=50 ### GC config #### Limit of the single data remover's batching operation in number of objects -NEOFS_STORAGE_SHARD_0_GC_REMOVER_BATCH_SIZE=123 +NEOFS_STORAGE_SHARD_0_GC_REMOVER_BATCH_SIZE=150 #### Sleep interval between data remover tacts -NEOFS_STORAGE_SHARD_0_GC_REMOVER_SLEEP_INTERVAL=3h +NEOFS_STORAGE_SHARD_0_GC_REMOVER_SLEEP_INTERVAL=2m ## 1 shard ### Write cache config NEOFS_STORAGE_SHARD_1_USE_WRITE_CACHE=true NEOFS_STORAGE_SHARD_1_WRITECACHE_PATH=tmp/1/cache -NEOFS_STORAGE_SHARD_1_WRITECACHE_MEM_SIZE=112 -NEOFS_STORAGE_SHARD_1_WRITECACHE_DB_SIZE=223 -NEOFS_STORAGE_SHARD_1_WRITECACHE_SMALL_SIZE=334 -NEOFS_STORAGE_SHARD_1_WRITECACHE_MAX_SIZE=445 -NEOFS_STORAGE_SHARD_1_WRITECACHE_WORKERS_NUMBER=556 +NEOFS_STORAGE_SHARD_1_WRITECACHE_MEM_SIZE=2147483648 +NEOFS_STORAGE_SHARD_1_WRITECACHE_DB_SIZE=2147483648 +NEOFS_STORAGE_SHARD_1_WRITECACHE_SMALL_SIZE=16384 +NEOFS_STORAGE_SHARD_1_WRITECACHE_MAX_SIZE=134217728 +NEOFS_STORAGE_SHARD_1_WRITECACHE_WORKERS_NUMBER=30 ### Metabase config NEOFS_STORAGE_SHARD_1_METABASE_PATH=tmp/1/meta -NEOFS_STORAGE_SHARD_1_METABASE_PERM=0701 +NEOFS_STORAGE_SHARD_1_METABASE_PERM=0644 ### Blobstor config NEOFS_STORAGE_SHARD_1_BLOBSTOR_PATH=tmp/1/blob -NEOFS_STORAGE_SHARD_1_BLOBSTOR_PERM=0667 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_PERM=0644 NEOFS_STORAGE_SHARD_1_BLOBSTOR_COMPRESS=false -NEOFS_STORAGE_SHARD_1_BLOBSTOR_SHALLOW_DEPTH=6 -NEOFS_STORAGE_SHARD_1_BLOBSTOR_SMALL_SIZE_LIMIT=78 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_SHALLOW_DEPTH=5 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_SMALL_SIZE_LIMIT=102400 ### Blobovnicza config -NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SIZE=1025 -NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SHALLOW_DEPTH=11 -NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SHALLOW_WIDTH=21 -NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_OPENED_CACHE_SIZE=89 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SIZE=4194304 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SHALLOW_DEPTH=1 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_SHALLOW_WIDTH=4 +NEOFS_STORAGE_SHARD_1_BLOBSTOR_BLOBOVNICZA_OPENED_CACHE_SIZE=50 ### GC config -NEOFS_STORAGE_SHARD_1_GC_REMOVER_BATCH_SIZE=124 -NEOFS_STORAGE_SHARD_1_GC_REMOVER_SLEEP_INTERVAL=3h1s +#### Limit of the single data remover's batching operation in number of objects +NEOFS_STORAGE_SHARD_1_GC_REMOVER_BATCH_SIZE=200 +#### Sleep interval between data remover tacts +NEOFS_STORAGE_SHARD_1_GC_REMOVER_SLEEP_INTERVAL=5m diff --git a/config/example/node.json b/config/example/node.json index abea66e9d8..e8ef365864 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -98,64 +98,64 @@ "use_write_cache": false, "writecache": { "path": "tmp/0/cache", - "mem_size": 111, - "db_size": 222, - "small_size": 333, - "max_size": 444, - "workers_number": 555 + "mem_size": 2147483648, + "db_size": 2147483648, + "small_size": 16384, + "max_size": 134217728, + "workers_number": 30 }, "metabase": { "path": "tmp/0/meta", - "perm": "0700" + "perm": "0644" }, "blobstor": { "path": "tmp/0/blob", - "perm": "0666", - "shallow_depth": 5, + "perm": "0644", "compress": true, - "small_size_limit": 77, + "shallow_depth": 5, + "small_size_limit": 102400, "blobovnicza": { - "size": 1024, - "shallow_depth": 10, - "shallow_width": 20, - "opened_cache_size": 88 + "size": 4194304, + "shallow_depth": 1, + "shallow_width": 4, + "opened_cache_size": 50 } }, "gc": { - "remover_batch_size": 123, - "remover_sleep_interval": "3h" + "remover_batch_size": 150, + "remover_sleep_interval": "2m" } }, "1": { "use_write_cache": true, "writecache": { "path": "tmp/1/cache", - "mem_size": 112, - "db_size": 223, - "small_size": 334, - "max_size": 445, - "workers_number": 556 + "mem_size": 2147483648, + "db_size": 2147483648, + "small_size": 16384, + "max_size": 134217728, + "workers_number": 30 }, "metabase": { "path": "tmp/1/meta", - "perm": "0701" + "perm": "0644" }, "blobstor": { "path": "tmp/1/blob", - "perm": "0667", - "shallow_depth": 6, + "perm": "0644", "compress": false, - "small_size_limit": 78, + "shallow_depth": 5, + "small_size_limit": 102400, "blobovnicza": { - "size": 1025, - "shallow_depth": 11, - "shallow_width": 21, - "opened_cache_size": 89 + "size": 4194304, + "shallow_depth": 1, + "shallow_width": 4, + "opened_cache_size": 50 } }, "gc": { - "remover_batch_size": 124, - "remover_sleep_interval": "3h1s" + "remover_batch_size": 200, + "remover_sleep_interval": "5m" } } } diff --git a/config/example/node.yaml b/config/example/node.yaml index f3dccb8bfe..31f2911ed4 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -87,61 +87,61 @@ storage: writecache: path: tmp/0/cache - mem_size: 111 - db_size: 222 - small_size: 333 - max_size: 444 - workers_number: 555 + mem_size: 2147483648 + db_size: 2147483648 + small_size: 16384 + max_size: 134217728 + workers_number: 30 metabase: path: tmp/0/meta - perm: 0700 + perm: 0644 blobstor: path: tmp/0/blob - perm: 0666 - shallow_depth: 5 + perm: 0644 compress: true - small_size_limit: 77 + shallow_depth: 5 + small_size_limit: 102400 blobovnicza: - size: 1024 - shallow_depth: 10 - shallow_width: 20 - opened_cache_size: 88 + size: 4194304 + shallow_depth: 1 + shallow_width: 4 + opened_cache_size: 50 gc: - remover_batch_size: 123 - remover_sleep_interval: 3h + remover_batch_size: 150 + remover_sleep_interval: 2m 1: use_write_cache: true writecache: path: tmp/1/cache - mem_size: 112 - db_size: 223 - small_size: 334 - max_size: 445 - workers_number: 556 + mem_size: 2147483648 + db_size: 2147483648 + small_size: 16384 + max_size: 134217728 + workers_number: 30 metabase: path: tmp/1/meta - perm: 0701 + perm: 0644 blobstor: path: tmp/1/blob - perm: 0667 - shallow_depth: 6 + perm: 0644 compress: false - small_size_limit: 78 + shallow_depth: 5 + small_size_limit: 102400 blobovnicza: - size: 1025 - shallow_depth: 11 - shallow_width: 21 - opened_cache_size: 89 + size: 4194304 + shallow_depth: 1 + shallow_width: 4 + opened_cache_size: 50 gc: - remover_batch_size: 124 - remover_sleep_interval: 3h1s + remover_batch_size: 200 + remover_sleep_interval: 5m From 6638136d11c8a2aa3050b1cea6f53bcca1e7b9da Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 22 Jul 2021 16:10:51 +0300 Subject: [PATCH 207/219] [#711] node/config/test: Adapt test to new config examples Signed-off-by: Pavel Karpy --- cmd/neofs-node/config/engine/config_test.go | 60 ++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/cmd/neofs-node/config/engine/config_test.go b/cmd/neofs-node/config/engine/config_test.go index d540b9a70c..408faa2841 100644 --- a/cmd/neofs-node/config/engine/config_test.go +++ b/cmd/neofs-node/config/engine/config_test.go @@ -40,54 +40,54 @@ func TestEngineSection(t *testing.T) { require.Equal(t, false, sc.UseWriteCache()) require.Equal(t, "tmp/0/cache", wc.Path()) - require.EqualValues(t, 111, wc.MemSize()) - require.EqualValues(t, 222, wc.MaxDBSize()) - require.EqualValues(t, 333, wc.SmallObjectSize()) - require.EqualValues(t, 444, wc.MaxObjectSize()) - require.EqualValues(t, 555, wc.WorkersNumber()) + require.EqualValues(t, 2147483648, wc.MemSize()) + require.EqualValues(t, 2147483648, wc.MaxDBSize()) + require.EqualValues(t, 16384, wc.SmallObjectSize()) + require.EqualValues(t, 134217728, wc.MaxObjectSize()) + require.EqualValues(t, 30, wc.WorkersNumber()) require.Equal(t, "tmp/0/meta", meta.Path()) - require.Equal(t, fs.FileMode(0700), meta.Perm()) + require.Equal(t, fs.FileMode(0644), meta.Perm()) require.Equal(t, "tmp/0/blob", blob.Path()) - require.EqualValues(t, 0666, blob.Perm()) - require.EqualValues(t, 5, blob.ShallowDepth()) + require.EqualValues(t, 0644, blob.Perm()) require.Equal(t, true, blob.Compress()) - require.EqualValues(t, 77, blob.SmallSizeLimit()) + require.EqualValues(t, 5, blob.ShallowDepth()) + require.EqualValues(t, 102400, blob.SmallSizeLimit()) - require.EqualValues(t, 1024, blz.Size()) - require.EqualValues(t, 10, blz.ShallowDepth()) - require.EqualValues(t, 20, blz.ShallowWidth()) - require.EqualValues(t, 88, blz.OpenedCacheSize()) + require.EqualValues(t, 4194304, blz.Size()) + require.EqualValues(t, 1, blz.ShallowDepth()) + require.EqualValues(t, 4, blz.ShallowWidth()) + require.EqualValues(t, 50, blz.OpenedCacheSize()) - require.EqualValues(t, 123, gc.RemoverBatchSize()) - require.Equal(t, 3*time.Hour, gc.RemoverSleepInterval()) + require.EqualValues(t, 150, gc.RemoverBatchSize()) + require.Equal(t, 2*time.Minute, gc.RemoverSleepInterval()) case 1: require.Equal(t, true, sc.UseWriteCache()) require.Equal(t, "tmp/1/cache", wc.Path()) - require.EqualValues(t, 112, wc.MemSize()) - require.EqualValues(t, 223, wc.MaxDBSize()) - require.EqualValues(t, 334, wc.SmallObjectSize()) - require.EqualValues(t, 445, wc.MaxObjectSize()) - require.EqualValues(t, 556, wc.WorkersNumber()) + require.EqualValues(t, 2147483648, wc.MemSize()) + require.EqualValues(t, 2147483648, wc.MaxDBSize()) + require.EqualValues(t, 16384, wc.SmallObjectSize()) + require.EqualValues(t, 134217728, wc.MaxObjectSize()) + require.EqualValues(t, 30, wc.WorkersNumber()) require.Equal(t, "tmp/1/meta", meta.Path()) - require.Equal(t, fs.FileMode(0701), meta.Perm()) + require.Equal(t, fs.FileMode(0644), meta.Perm()) require.Equal(t, "tmp/1/blob", blob.Path()) - require.EqualValues(t, 0667, blob.Perm()) - require.EqualValues(t, 6, blob.ShallowDepth()) + require.EqualValues(t, 0644, blob.Perm()) require.Equal(t, false, blob.Compress()) - require.EqualValues(t, 78, blob.SmallSizeLimit()) + require.EqualValues(t, 5, blob.ShallowDepth()) + require.EqualValues(t, 102400, blob.SmallSizeLimit()) - require.EqualValues(t, 1025, blz.Size()) - require.EqualValues(t, 11, blz.ShallowDepth()) - require.EqualValues(t, 21, blz.ShallowWidth()) - require.EqualValues(t, 89, blz.OpenedCacheSize()) + require.EqualValues(t, 4194304, blz.Size()) + require.EqualValues(t, 1, blz.ShallowDepth()) + require.EqualValues(t, 4, blz.ShallowWidth()) + require.EqualValues(t, 50, blz.OpenedCacheSize()) - require.EqualValues(t, 124, gc.RemoverBatchSize()) - require.Equal(t, 3*time.Hour+time.Second, gc.RemoverSleepInterval()) + require.EqualValues(t, 200, gc.RemoverBatchSize()) + require.Equal(t, 5*time.Minute, gc.RemoverSleepInterval()) } }) From 62d3eeea6e2c2771a86f3e279fc6a91e3e6d7e0e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 23 Jul 2021 14:47:14 +0300 Subject: [PATCH 208/219] [#719] Update neo-go to v0.96.1 Signed-off-by: Alex Vanin --- go.mod | 10 +++--- go.sum | 102 ++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 84 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index d04e278bfd..da2164f625 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.3.2 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.96.0 + github.com/nspcc-dev/neo-go v0.96.1 github.com/nspcc-dev/neofs-api-go v1.28.3 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/tzhash v1.4.0 @@ -22,10 +22,10 @@ require ( github.com/spf13/cobra v1.1.3 github.com/spf13/viper v1.8.1 github.com/stretchr/testify v1.7.0 - go.etcd.io/bbolt v1.3.5 - go.uber.org/atomic v1.8.0 - go.uber.org/zap v1.17.0 - golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf + go.etcd.io/bbolt v1.3.6 + go.uber.org/atomic v1.9.0 + go.uber.org/zap v1.18.1 + golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4 google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 2bb0e2bf7a..4fe20aa029 100644 --- a/go.sum +++ b/go.sum @@ -47,9 +47,11 @@ github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo= github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= +github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg= +github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs= github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/alecthomas/participle v0.7.1 h1:2bN7reTw//5f0cugJcTOnY/NYZcWQOaajW+BwZB5xWs= @@ -60,15 +62,20 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 h1:45bxf7AZMwWcqkLzDAQugVEwedisr5nRJ1r+7LYnv0U= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= +github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/alicebob/miniredis/v2 v2.15.1 h1:Fw+ixAJPmKhCLBqDwHlTDqxUxp0xjEwXczEpt1B6r7k= +github.com/alicebob/miniredis/v2 v2.15.1/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -76,13 +83,17 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -107,12 +118,16 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger/v2 v2.0.3 h1:inzdf6VF/NZ+tJ8RwwYMjJMvsOALTHYdozn0qSl6XJI= github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM= github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3 h1:MQLRM35Pp0yAyBYksjbj1nZI/w6eyRY/mWoM1sFf4kU= @@ -132,6 +147,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -147,8 +163,9 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-redis/redis v6.10.2+incompatible h1:SLbqrO/Ik1nhXA5/cbEs1P5MUBo1Qq4ihlNfGnnipPw= github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= +github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -190,7 +207,6 @@ github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8l github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -259,7 +275,6 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -268,6 +283,7 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= @@ -305,10 +321,12 @@ github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPK github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= @@ -359,6 +377,7 @@ github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxx github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ= github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E= github.com/nspcc-dev/dbft v0.0.0-20210302103605-cc75991b7cfb/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y= +github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y= github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= @@ -366,8 +385,8 @@ github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5 github.com/nspcc-dev/neo-go v0.95.0/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c= github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY= -github.com/nspcc-dev/neo-go v0.96.0 h1:CNzAfs8VXezolnAcgQ7d7LfsNKVP+hFJM2WwmQdb6VA= -github.com/nspcc-dev/neo-go v0.96.0/go.mod h1:Mj6P7K9+1FDquUGXZ9LKGqS9vFKesvkV+Ad4zI84of8= +github.com/nspcc-dev/neo-go v0.96.1 h1:JaKWvM/vvQ48bq2ADNj7zH/6Ek38Iqxo22hdu2lhxmY= +github.com/nspcc-dev/neo-go v0.96.1/go.mod h1:yguwQBpWMTHx07INKoElJT8Gga1LUdTSi0gT75ywJ68= github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8= github.com/nspcc-dev/neofs-api-go v1.26.1/go.mod h1:SHuH1Ba3U/h3j+8HHbb3Cns1LfMlEb88guWog9Qi68Y= github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE= @@ -384,15 +403,21 @@ github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYv github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/tzhash v1.4.0 h1:RVIR+mxOBHl58CE99+DXtE31ylD5PEkZSoWqoj4fVjg= github.com/nspcc-dev/tzhash v1.4.0/go.mod h1:Z8gp/VZbyWgPhaMp/KTmeoW5UTynp/N60g0jTtSzBws= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/panjf2000/ants/v2 v2.4.0 h1:embKPQeNWMRbnrRKURv4TXJwjQRWMEAfqZT6Pe5hZNc= github.com/panjf2000/ants/v2 v2.4.0/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -402,7 +427,9 @@ github.com/paulmach/protoscan v0.2.1-0.20210522164731-4e53c6875432/go.mod h1:2sV github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -441,10 +468,13 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -487,14 +517,18 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73 h1:I2drr5K0tykBofr74ZEGliE/Hf6fNkEbcPyFvsy7wZk= github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk= github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= @@ -505,13 +539,14 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7 h1:Y17pEjKgx2X0A69WQPGa8hx/Myzu+4NdUxlkZpbAYio= github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg= +github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= @@ -524,14 +559,17 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= -go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.18.1 h1:CSUJ2mjFszzEWt4CdKISEuChVIXGBn3lAPwkRGyVrc4= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -543,8 +581,11 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -568,6 +609,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -580,6 +622,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -608,9 +651,11 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -666,14 +711,17 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -684,11 +732,14 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -702,19 +753,22 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4 h1:UPou2i3GzKgi6igR+/0C5XyHKBngHxBp/CL5CQ0p3Zk= +golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -736,6 +790,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -764,12 +819,14 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -888,7 +945,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= From 70bb96a3d5b3917912b49adaaaec9fcd2fddabb3 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 23 Jul 2021 15:38:43 +0300 Subject: [PATCH 209/219] [#719] config/testnet: Update for RC4(Testnet) launch Signed-off-by: Alex Vanin --- config/testnet/config.yml | 36 +++++++++++++++---------------- config/testnet/docker-compose.yml | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/config/testnet/config.yml b/config/testnet/config.yml index 4685bd6df3..ad12175740 100644 --- a/config/testnet/config.yml +++ b/config/testnet/config.yml @@ -3,28 +3,28 @@ logger: morph: rpc_endpoint: - - https://rpc1.morph.fs.neo.org:40341 - - https://rpc2.morph.fs.neo.org:40341 - - https://rpc3.morph.fs.neo.org:40341 - - https://rpc4.morph.fs.neo.org:40341 - - https://rpc5.morph.fs.neo.org:40341 - - https://rpc6.morph.fs.neo.org:40341 - - https://rpc7.morph.fs.neo.org:40341 + - https://rpc01.morph.testnet.fs.neo.org:50331 + - https://rpc02.morph.testnet.fs.neo.org:50331 + - https://rpc03.morph.testnet.fs.neo.org:50331 + - https://rpc04.morph.testnet.fs.neo.org:50331 + - https://rpc05.morph.testnet.fs.neo.org:50331 + - https://rpc06.morph.testnet.fs.neo.org:50331 + - https://rpc07.morph.testnet.fs.neo.org:50331 notification_endpoint: - - wss://rpc1.morph.fs.neo.org:40341/ws - - wss://rpc2.morph.fs.neo.org:40341/ws - - wss://rpc3.morph.fs.neo.org:40341/ws - - wss://rpc4.morph.fs.neo.org:40341/ws - - wss://rpc5.morph.fs.neo.org:40341/ws - - wss://rpc6.morph.fs.neo.org:40341/ws - - wss://rpc7.morph.fs.neo.org:40341/ws + - wss://rpc01.morph.testnet.fs.neo.org:50331/ws + - wss://rpc02.morph.testnet.fs.neo.org:50331/ws + - wss://rpc03.morph.testnet.fs.neo.org:50331/ws + - wss://rpc04.morph.testnet.fs.neo.org:50331/ws + - wss://rpc05.morph.testnet.fs.neo.org:50331/ws + - wss://rpc06.morph.testnet.fs.neo.org:50331/ws + - wss://rpc07.morph.testnet.fs.neo.org:50331/ws dial_timeout: 20s contracts: - balance: 0fc02c693d59a7cde9926c7fc4bec6af310bda65 - container: 16d1dd8b2eaf3bed5c6f469a8748de95a10ee1ed - netmap: 5283a843ee68f8fa9ee664df6b495054be5738d4 - reputation: 3a5e05bae28049d8c1b8f218b0324e63816713c9 + balance: 4f5b98a079e61cfb33cf2b9da8fd2dcaedb71d82 + container: 8c555fa20e13bed708fe635492647c595d35e430 + netmap: 86f589459b0b0ae47d31f3b9b340d6d431358954 + reputation: 8d9ddd707af12c0d41f5da8f3d56386b39d871e0 node: key: /node.key diff --git a/config/testnet/docker-compose.yml b/config/testnet/docker-compose.yml index 8242c6976a..b76d79b216 100644 --- a/config/testnet/docker-compose.yml +++ b/config/testnet/docker-compose.yml @@ -3,7 +3,7 @@ version: "2.4" services: storage01: - image: nspccdev/neofs-storage-testnet:0.22.3 + image: nspccdev/neofs-storage-testnet:0.23.0 container_name: neofs-testnet env_file: node_config.env network_mode: host From 311eb3e95a584debc50cec5c251c91c9f808a577 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 23 Jul 2021 14:59:43 +0300 Subject: [PATCH 210/219] [#719] Update contributors list Signed-off-by: Alex Vanin --- CREDITS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CREDITS.md b/CREDITS.md index aeb08c6b8d..23ce9a750d 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -18,6 +18,10 @@ In alphabetical order: In chronological order: - Pavel Karpy +- Zhang Tao +- Angira Kekteeva +- Sergio Nemirowski +- Tivizi Jing # Special Thanks From 6f07710693990bae6976799d8fe0cbcce841471b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 23 Jul 2021 15:25:54 +0300 Subject: [PATCH 211/219] =?UTF-8?q?Release=20v0.23.0=20-=20Wando=20(?= =?UTF-8?q?=EC=99=84=EB=8F=84,=20=E8=8E=9E=E5=B3=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Vanin --- CHANGELOG.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0768d27b13..304fea26b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,32 @@ Changelog for NeoFS Node ## [Unreleased] +## [0.23.0] - 2021-07-23 - Wando (완도, 莞島) + +Improved stability for notary disabled environment. + +### Added +- Alphabet wallets generation command in neofs-adm (#684) +- Initial epoch timer tick synchronization at Inner Ring node startup (#679) + +### Changed +- `--address` flag is optional in NeoFS CLI (#656) +- Notary subsystem now logs `ValidUntilBlock` (#677) +- Updated neo-go to v0.96.1 +- Storage Node configuration example contains usable parameters (#699) + +### Fixed +- Do not use side chain RoleManagement contract as source of Inner Ring list + when notary disabled in side chain (#672) +- Alphabet list transition is even more effective (#697) +- Inner Ring node does not require proxy and processing contracts if notary + disabled (#701, #714) + +### Upgrading from v0.22.3 +To upgrade Storage node or Inner Ring node from v0.22.3, you don't need to +change configuration files. Make sure, that NEO RPC nodes, specified in config, +are connected to N3 RC4 (Testnet) network. + ## [0.22.3] - 2021-07-13 ### Added @@ -496,7 +522,8 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. -[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.3...master +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.23.0...master +[0.23.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.3...v0.23.0 [0.22.3]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.2...v0.22.3 [0.22.2]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.1...v0.22.2 [0.22.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.22.0...v0.22.1 From 425c1db5c0a31608f85c3a10266cbec3a569b68c Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 19 Jul 2021 14:04:19 +0300 Subject: [PATCH 212/219] [#687] neofs-adm: transfer funds to consensus wallets This is the first stage requiring running blockchain. Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 148 ++++++++++++++++++ .../modules/morph/initialize_transfer.go | 124 +++++++++++++++ .../internal/modules/morph/n3client.go | 21 +++ 3 files changed, 293 insertions(+) create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize_transfer.go create mode 100644 cmd/neofs-adm/internal/modules/morph/n3client.go diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 18a0da04f3..3431ecee04 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -1,10 +1,35 @@ package morph import ( + "errors" + "fmt" + "io/ioutil" + "path" + "time" + + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/rpc/client" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neo-go/pkg/wallet" + "github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config" + "github.com/nspcc-dev/neofs-node/pkg/innerring" "github.com/spf13/cobra" "github.com/spf13/viper" ) +type initializeContext struct { + Client *client.Client + // CommitteeAcc is used for retrieving committee address and verification script. + CommitteeAcc *wallet.Account + // ConsensusAcc is used for retrieving committee address and verification script. + ConsensusAcc *wallet.Account + Wallets []*wallet.Wallet + Hashes []util.Uint256 + WaitDuration time.Duration + PollInterval time.Duration +} + func initializeSideChainCmd(cmd *cobra.Command, args []string) error { // contract path is not part of the config contractsPath, err := cmd.Flags().GetString(contractsInitFlag) @@ -12,6 +37,23 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } + initCtx, err := newInitializeContext(viper.GetViper()) + if err != nil { + return fmt.Errorf("initialization error: %w", err) + } + + // 1. Transfer funds to committee accounts. + cmd.Println("Stage 1: transfer GAS to alphabet nodes.") + if err := initCtx.transferFunds(); err != nil { + return err + } + + // TODO 2. Setup notary and alphabet nodes in designate contract. + // TODO 3. Deploy NNS contract with ID=0. + // TODO 4. Deploy NeoFS contracts. + // TODO 5. Setup NeoFS contracts addresses in NNS. + // TODO 6. Register candidates and call alphabet.Vote. + cmd.Println("endpoint:", viper.GetString(endpointFlag)) cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) cmd.Println("contracts:", contractsPath) @@ -20,3 +62,109 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return nil } + +func newInitializeContext(v *viper.Viper) (*initializeContext, error) { + walletDir := v.GetString(alphabetWalletsFlag) + wallets, err := openAlphabetWallets(walletDir) + if err != nil { + return nil, err + } + + c, err := getN3Client(v) + if err != nil { + return nil, fmt.Errorf("can't create N3 client: %w", err) + } + + committeeAcc, err := getWalletAccount(wallets[0], committeeAccountName) + if err != nil { + return nil, fmt.Errorf("can't find committee account: %w", err) + } + + consensusAcc, err := getWalletAccount(wallets[0], consensusAccountName) + if err != nil { + return nil, fmt.Errorf("can't find consensus account: %w", err) + } + + initCtx := &initializeContext{ + Client: c, + ConsensusAcc: consensusAcc, + CommitteeAcc: committeeAcc, + Wallets: wallets, + WaitDuration: time.Second * 30, + PollInterval: time.Second, + } + + return initCtx, nil +} + +func openAlphabetWallets(walletDir string) ([]*wallet.Wallet, error) { + walletFiles, err := ioutil.ReadDir(walletDir) + if err != nil { + return nil, fmt.Errorf("can't read alphabet wallets dir: %w", err) + } + + size := len(walletFiles) + if size == 0 { + return nil, errors.New("alphabet wallets dir is empty (run `generate-alphabet` command first)") + } + + wallets := make([]*wallet.Wallet, size) + for i := 0; i < size; i++ { + p := path.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json") + w, err := wallet.NewWalletFromFile(p) + if err != nil { + return nil, fmt.Errorf("can't open wallet: %w", err) + } + + password, err := config.AlphabetPassword(viper.GetViper(), i) + if err != nil { + return nil, fmt.Errorf("can't fetch password: %w", err) + } + + for i := range w.Accounts { + if err := w.Accounts[i].Decrypt(password, keys.NEP2ScryptParams()); err != nil { + return nil, fmt.Errorf("can't unlock wallet: %w", err) + } + } + + wallets[i] = w + } + + return wallets, nil +} + +func (c *initializeContext) awaitTx() error { + tick := time.NewTicker(c.PollInterval) + defer tick.Stop() + + timer := time.NewTimer(c.WaitDuration) + defer timer.Stop() + + at := trigger.Application + +loop: + for i := range c.Hashes { + for { + select { + case <-tick.C: + _, err := c.Client.GetApplicationLog(c.Hashes[i], &at) + if err == nil { + continue loop + } + case <-timer.C: + return errors.New("timeout while waiting for transaction to persist") + } + } + } + + return nil +} + +func getWalletAccount(w *wallet.Wallet, typ string) (*wallet.Account, error) { + for i := range w.Accounts { + if w.Accounts[i].Label == typ { + return w.Accounts[i], nil + } + } + return nil, fmt.Errorf("account for '%s' not found", typ) +} diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go new file mode 100644 index 0000000000..563abd2f8a --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go @@ -0,0 +1,124 @@ +package morph + +import ( + "fmt" + + "github.com/nspcc-dev/neo-go/pkg/core/native" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/transaction" + "github.com/nspcc-dev/neo-go/pkg/rpc/client" + scContext "github.com/nspcc-dev/neo-go/pkg/smartcontract/context" +) + +const ( + gasInitialTotalSupply = 30000000 * native.GASFactor + // initialAlphabetGASAmount represents amount of GAS given to each alphabet node. + initialAlphabetGASAmount = 10_000 * native.GASFactor +) + +func (c *initializeContext) transferFunds() error { + gasHash, err := c.Client.GetNativeContractHash(nativenames.Gas) + if err != nil { + return fmt.Errorf("can't fetch %s hash: %w", nativenames.Gas, err) + } + neoHash, err := c.Client.GetNativeContractHash(nativenames.Neo) + if err != nil { + return fmt.Errorf("can't fetch %s hash: %w", nativenames.Neo, err) + } + + var transfers []client.TransferTarget + for _, w := range c.Wallets { + acc, err := getWalletAccount(w, singleAccountName) + if err != nil { + return err + } + + to := acc.Contract.ScriptHash() + transfers = append(transfers, + client.TransferTarget{ + Token: gasHash, + Address: to, + Amount: initialAlphabetGASAmount, + }, + ) + } + + // It is convenient to have all funds at the committee account. + transfers = append(transfers, + client.TransferTarget{ + Token: gasHash, + Address: c.CommitteeAcc.Contract.ScriptHash(), + Amount: gasInitialTotalSupply - initialAlphabetGASAmount*int64(len(c.Wallets)), + }, + client.TransferTarget{ + Token: neoHash, + Address: c.CommitteeAcc.Contract.ScriptHash(), + Amount: native.NEOTotalSupply, + }, + ) + + tx, err := c.Client.CreateNEP17MultiTransferTx(c.ConsensusAcc, 0, transfers, []client.SignerAccount{{ + Signer: transaction.Signer{ + Account: c.ConsensusAcc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + }, + Account: c.ConsensusAcc, + }}) + if err != nil { + return fmt.Errorf("can't create transfer transaction: %w", err) + } + + if err := c.multiSignAndSend(tx, consensusAccountName); err != nil { + return fmt.Errorf("can't send transfer transaction: %w", err) + } + + return c.awaitTx() +} + +func (c *initializeContext) multiSignAndSend(tx *transaction.Transaction, accType string) error { + if err := c.multiSign(tx, accType); err != nil { + return err + } + + h, err := c.Client.SendRawTransaction(tx) + if err != nil { + return err + } + + c.Hashes = append(c.Hashes, h) + return nil +} + +func (c *initializeContext) multiSign(tx *transaction.Transaction, accType string) error { + network := c.Client.GetNetwork() + + // Use parameter context to avoid dealing with signature order. + pc := scContext.NewParameterContext("", network, tx) + h := c.CommitteeAcc.Contract.ScriptHash() + if accType == consensusAccountName { + h = c.ConsensusAcc.Contract.ScriptHash() + } + for _, w := range c.Wallets { + acc, err := getWalletAccount(w, accType) + if err != nil { + return fmt.Errorf("can't find %s wallet account: %w", accType, err) + } + + priv := acc.PrivateKey() + sign := priv.SignHashable(uint32(network), tx) + if err := pc.AddSignature(h, acc.Contract, priv.PublicKey(), sign); err != nil { + return fmt.Errorf("can't add signature: %w", err) + } + if len(pc.Items[h].Signatures) == len(acc.Contract.Parameters) { + break + } + } + + w, err := pc.GetWitness(tx.Signers[0].Account) + if err != nil { + return fmt.Errorf("incomplete signature: %w", err) + } + tx.Scripts = append(tx.Scripts, *w) + + return nil +} diff --git a/cmd/neofs-adm/internal/modules/morph/n3client.go b/cmd/neofs-adm/internal/modules/morph/n3client.go new file mode 100644 index 0000000000..f3e4c15415 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/n3client.go @@ -0,0 +1,21 @@ +package morph + +import ( + "context" + + "github.com/nspcc-dev/neo-go/pkg/rpc/client" + "github.com/spf13/viper" +) + +func getN3Client(v *viper.Viper) (*client.Client, error) { + ctx := context.Background() // FIXME(@fyrchik): timeout context + endpoint := v.GetString(endpointFlag) + c, err := client.New(ctx, endpoint, client.Options{}) + if err != nil { + return nil, err + } + if err := c.Init(); err != nil { + return nil, err + } + return c, nil +} From c3f7ccaee6a720c19448b1fa4ae4b68ddf18e559 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 20 Jul 2021 15:08:47 +0300 Subject: [PATCH 213/219] [#687] neofs-adm: set alphabet and notary nodes Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 22 +++++++++- .../modules/morph/initialize_roles.go | 40 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize_roles.go diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 3431ecee04..a2266ac284 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -7,6 +7,7 @@ import ( "path" "time" + "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" @@ -48,7 +49,11 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } - // TODO 2. Setup notary and alphabet nodes in designate contract. + cmd.Println("Stage 2: set notary and alphabet nodes in designate contract.") + if err := initCtx.setNotaryAndAlphabetNodes(); err != nil { + return err + } + // TODO 3. Deploy NNS contract with ID=0. // TODO 4. Deploy NeoFS contracts. // TODO 5. Setup NeoFS contracts addresses in NNS. @@ -160,6 +165,21 @@ loop: return nil } +func (c *initializeContext) sendCommitteeTx(script []byte, sysFee int64) error { + tx, err := c.Client.CreateTxFromScript(script, c.CommitteeAcc, sysFee, 0, []client.SignerAccount{{ + Signer: transaction.Signer{ + Account: c.CommitteeAcc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + }, + Account: c.CommitteeAcc, + }}) + if err != nil { + return fmt.Errorf("can't create tx: %w", err) + } + + return c.multiSignAndSend(tx, committeeAccountName) +} + func getWalletAccount(w *wallet.Wallet, typ string) (*wallet.Account, error) { for i := range w.Accounts { if w.Accounts[i].Label == typ { diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_roles.go b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go new file mode 100644 index 0000000000..dbb587cf30 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go @@ -0,0 +1,40 @@ +package morph + +import ( + "fmt" + + "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" + "github.com/nspcc-dev/neo-go/pkg/io" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" + "github.com/nspcc-dev/neo-go/pkg/vm/emit" +) + +func (c *initializeContext) setNotaryAndAlphabetNodes() error { + designateHash, err := c.Client.GetNativeContractHash(nativenames.Designation) + if err != nil { + return fmt.Errorf("can't fetch %s hash: %w", nativenames.Designation, err) + } + + var pubs []interface{} + for _, w := range c.Wallets { + acc, err := getWalletAccount(w, singleAccountName) + if err != nil { + return err + } + + pubs = append(pubs, acc.PrivateKey().PublicKey().Bytes()) + } + + w := io.NewBufBinWriter() + emit.AppCall(w.BinWriter, designateHash, "designateAsRole", + callflag.States|callflag.AllowNotify, int64(noderoles.P2PNotary), pubs) + emit.AppCall(w.BinWriter, designateHash, "designateAsRole", + callflag.States|callflag.AllowNotify, int64(noderoles.NeoFSAlphabet), pubs) + + if err := c.sendCommitteeTx(w.Bytes(), -1); err != nil { + return err + } + + return c.awaitTx() +} From 8ea67ec565f0595a5aad2fef9f4aa983e5d9d053 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 20 Jul 2021 17:51:45 +0300 Subject: [PATCH 214/219] [#687] neofs-adm: check for initialization stage completion Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 12 +++++++-- .../modules/morph/initialize_roles.go | 17 +++++++++++++ .../modules/morph/initialize_transfer.go | 25 ++++++++++++++++++- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index a2266ac284..c16ebd398a 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -29,6 +29,7 @@ type initializeContext struct { Hashes []util.Uint256 WaitDuration time.Duration PollInterval time.Duration + Command *cobra.Command } func initializeSideChainCmd(cmd *cobra.Command, args []string) error { @@ -38,7 +39,7 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } - initCtx, err := newInitializeContext(viper.GetViper()) + initCtx, err := newInitializeContext(cmd, viper.GetViper()) if err != nil { return fmt.Errorf("initialization error: %w", err) } @@ -68,7 +69,7 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return nil } -func newInitializeContext(v *viper.Viper) (*initializeContext, error) { +func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContext, error) { walletDir := v.GetString(alphabetWalletsFlag) wallets, err := openAlphabetWallets(walletDir) if err != nil { @@ -97,6 +98,7 @@ func newInitializeContext(v *viper.Viper) (*initializeContext, error) { Wallets: wallets, WaitDuration: time.Second * 30, PollInterval: time.Second, + Command: cmd, } return initCtx, nil @@ -139,6 +141,8 @@ func openAlphabetWallets(walletDir string) ([]*wallet.Wallet, error) { } func (c *initializeContext) awaitTx() error { + c.Command.Println("Waiting for transactions to persist...") + tick := time.NewTicker(c.PollInterval) defer tick.Stop() @@ -149,6 +153,10 @@ func (c *initializeContext) awaitTx() error { loop: for i := range c.Hashes { + _, err := c.Client.GetApplicationLog(c.Hashes[i], &at) + if err == nil { + continue loop + } for { select { case <-tick.C: diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_roles.go b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go index dbb587cf30..232d957017 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_roles.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_roles.go @@ -11,6 +11,13 @@ import ( ) func (c *initializeContext) setNotaryAndAlphabetNodes() error { + if ok, err := c.setRolesFinished(); ok || err != nil { + if err == nil { + c.Command.Println("Stage 2: already performed.") + } + return err + } + designateHash, err := c.Client.GetNativeContractHash(nativenames.Designation) if err != nil { return fmt.Errorf("can't fetch %s hash: %w", nativenames.Designation, err) @@ -38,3 +45,13 @@ func (c *initializeContext) setNotaryAndAlphabetNodes() error { return c.awaitTx() } + +func (c *initializeContext) setRolesFinished() (bool, error) { + height, err := c.Client.GetBlockCount() + if err != nil { + return false, err + } + + pubs, err := c.Client.GetDesignatedByRole(noderoles.NeoFSAlphabet, height) + return len(pubs) == len(c.Wallets), err +} diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go index 563abd2f8a..e5407b8114 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go @@ -17,6 +17,14 @@ const ( ) func (c *initializeContext) transferFunds() error { + ok, err := c.transferFundsFinished() + if ok || err != nil { + if err == nil { + c.Command.Println("Stage 1: already performed.") + } + return err + } + gasHash, err := c.Client.GetNativeContractHash(nativenames.Gas) if err != nil { return fmt.Errorf("can't fetch %s hash: %w", nativenames.Gas, err) @@ -48,7 +56,7 @@ func (c *initializeContext) transferFunds() error { client.TransferTarget{ Token: gasHash, Address: c.CommitteeAcc.Contract.ScriptHash(), - Amount: gasInitialTotalSupply - initialAlphabetGASAmount*int64(len(c.Wallets)), + Amount: (gasInitialTotalSupply - initialAlphabetGASAmount*int64(len(c.Wallets))) / 2, }, client.TransferTarget{ Token: neoHash, @@ -75,6 +83,21 @@ func (c *initializeContext) transferFunds() error { return c.awaitTx() } +func (c *initializeContext) transferFundsFinished() (bool, error) { + gasHash, err := c.Client.GetNativeContractHash(nativenames.Gas) + if err != nil { + return false, err + } + + acc, err := getWalletAccount(c.Wallets[0], singleAccountName) + if err != nil { + return false, err + } + + res, err := c.Client.NEP17BalanceOf(gasHash, acc.Contract.ScriptHash()) + return res > initialAlphabetGASAmount/2, err +} + func (c *initializeContext) multiSignAndSend(tx *transaction.Transaction, accType string) error { if err := c.multiSign(tx, accType); err != nil { return err From 7c3c1e9183e9cd540aa498dc0cd96de1ccbbfc70 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 22 Jul 2021 12:50:34 +0300 Subject: [PATCH 215/219] [#687] *: update neo-go version Signed-off-by: Evgenii Stratonikov --- go.sum | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go.sum b/go.sum index 4fe20aa029..2b4ac4df16 100644 --- a/go.sum +++ b/go.sum @@ -65,8 +65,11 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/alicebob/miniredis/v2 v2.15.1 h1:Fw+ixAJPmKhCLBqDwHlTDqxUxp0xjEwXczEpt1B6r7k= github.com/alicebob/miniredis/v2 v2.15.1/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -561,6 +564,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -584,6 +588,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= From 0efc7b7fee6e43b8d8780e9b68a6bc6936e0cc30 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 21 Jul 2021 13:09:59 +0300 Subject: [PATCH 216/219] [#687] neofs-adm: deploy NeoFS contracts Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 16 +- .../modules/morph/initialize_deploy.go | 293 ++++++++++++++++++ 2 files changed, 307 insertions(+), 2 deletions(-) create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize_deploy.go diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index c16ebd398a..045d1d4be6 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -29,6 +29,7 @@ type initializeContext struct { Hashes []util.Uint256 WaitDuration time.Duration PollInterval time.Duration + Contracts map[string]*contractState Command *cobra.Command } @@ -55,8 +56,18 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } - // TODO 3. Deploy NNS contract with ID=0. - // TODO 4. Deploy NeoFS contracts. + // 3. Deploy NNS contract. + cmd.Println("Stage 3: deploy NNS contract.") + if err := initCtx.deployNNS(); err != nil { + return err + } + + // 4. Deploy NeoFS contracts. + cmd.Println("Stage 4: deploy NeoFS contracts.") + if err := initCtx.deployContracts(); err != nil { + return err + } + // TODO 5. Setup NeoFS contracts addresses in NNS. // TODO 6. Register candidates and call alphabet.Vote. @@ -99,6 +110,7 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex WaitDuration: time.Second * 30, PollInterval: time.Second, Command: cmd, + Contracts: make(map[string]*contractState), } return initCtx, nil diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go new file mode 100644 index 0000000000..4020fba444 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -0,0 +1,293 @@ +package morph + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "path" + + "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/transaction" + "github.com/nspcc-dev/neo-go/pkg/rpc/client" + "github.com/nspcc-dev/neo-go/pkg/smartcontract" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/nef" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neofs-node/pkg/innerring" +) + +const ( + nnsContract = "nns" + neofsContract = "neofs" // not deployed in side-chain. + processingContract = "processing" // not deployed in side-chain. + alphabetContract = "alphabet" + auditContract = "audit" + balanceContract = "balance" + containerContract = "container" + neofsIDContract = "neofsid" + netmapContract = "netmap" + proxyContract = "proxy" + reputationContract = "reputation" +) + +var contractList = []string{ + alphabetContract, + auditContract, + balanceContract, + containerContract, + neofsIDContract, + netmapContract, + proxyContract, + reputationContract, +} + +type contractState struct { + NEF *nef.File + RawNEF []byte + Manifest *manifest.Manifest + RawManifest []byte + Hash util.Uint160 +} + +func (c *initializeContext) deployNNS() error { + ctrPath, err := c.Command.Flags().GetString(contractsInitFlag) + if err != nil { + return fmt.Errorf("missing contracts path: %w", err) + } + + cs, err := c.readContract(ctrPath, nnsContract) + if err != nil { + return err + } + + h := state.CreateContractHash(c.CommitteeAcc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + if _, err := c.Client.GetContractStateByHash(h); err == nil { + return nil + } + + params := getContractDeployParameters(cs.RawNEF, cs.RawManifest, nil) + signer := transaction.Signer{ + Account: c.CommitteeAcc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + } + + mgmtHash, _ := c.Client.GetNativeContractHash(nativenames.Management) + res, err := c.Client.InvokeFunction(mgmtHash, "deploy", params, []transaction.Signer{signer}) + if err != nil { + return fmt.Errorf("can't deploy contract: %w", err) + } + + tx, err := c.Client.CreateTxFromScript(res.Script, c.CommitteeAcc, res.GasConsumed, 0, []client.SignerAccount{{ + Signer: signer, + Account: c.CommitteeAcc, + }}) + if err != nil { + return fmt.Errorf("failed to create deploy tx for %s: %w", nnsContract, err) + } + + if err := c.multiSignAndSend(tx, committeeAccountName); err != nil { + return fmt.Errorf("can't send deploy transaction: %w", err) + } + + return c.awaitTx() +} + +func (c *initializeContext) deployContracts() error { + ctrPath, err := c.Command.Flags().GetString(contractsInitFlag) + if err != nil { + return fmt.Errorf("missing contracts path: %w", err) + } + + mgmtHash, _ := c.Client.GetNativeContractHash(nativenames.Management) + sender := c.CommitteeAcc.Contract.ScriptHash() + for _, ctrName := range contractList { + cs, err := c.readContract(ctrPath, ctrName) + if err != nil { + return err + } + cs.Hash = state.CreateContractHash(sender, cs.NEF.Checksum, cs.Manifest.Name) + } + + var keysParam []smartcontract.Parameter + + // alphabet contracts should be deployed by individual nodes to get different hashes. + for i, w := range c.Wallets { + acc, err := getWalletAccount(w, singleAccountName) + if err != nil { + return err + } + + cs := c.Contracts[alphabetContract] + ctrHash := state.CreateContractHash(acc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + if _, err := c.Client.GetContractStateByHash(ctrHash); err == nil { + c.Command.Printf("Stage 4: alphabet contract #%d is already deployed.\n", i) + continue + } + + keysParam = append(keysParam, smartcontract.Parameter{ + Type: smartcontract.PublicKeyType, + Value: acc.PrivateKey().PublicKey().Bytes(), + }) + + params := getContractDeployParameters(cs.RawNEF, cs.RawManifest, + c.getAlphabetDeployParameters(i, len(c.Wallets))) + signer := transaction.Signer{ + Account: acc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + } + res, err := c.Client.InvokeFunction(mgmtHash, "deploy", params, []transaction.Signer{signer}) + if err != nil { + return fmt.Errorf("can't deploy contract: %w", err) + } + h, err := c.Client.SignAndPushInvocationTx(res.Script, acc, -1, 0, []client.SignerAccount{{ + Signer: signer, + Account: acc, + }}) + if err != nil { + return fmt.Errorf("can't push deploy transaction: %w", err) + } + + c.Hashes = append(c.Hashes, h) + } + + for _, ctrName := range contractList { + if ctrName == alphabetContract { + continue + } + + cs := c.Contracts[ctrName] + if _, err := c.Client.GetContractStateByHash(cs.Hash); err == nil { + c.Command.Printf("Stage 4: %s contract is already deployed.\n", ctrName) + continue + } + + params := getContractDeployParameters(cs.RawNEF, cs.RawManifest, + c.getContractDeployData(ctrName, keysParam)) + signer := transaction.Signer{ + Account: c.CommitteeAcc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + } + + res, err := c.Client.InvokeFunction(mgmtHash, "deploy", params, []transaction.Signer{signer}) + if err != nil { + return fmt.Errorf("can't deploy contract: %w", err) + } + + if err := c.sendCommitteeTx(res.Script, res.GasConsumed); err != nil { + return err + } + } + + return c.awaitTx() +} + +func (c *initializeContext) readContract(ctrPath, ctrName string) (*contractState, error) { + if cs, ok := c.Contracts[ctrName]; ok { + return cs, nil + } + + rawNef, err := ioutil.ReadFile(path.Join(ctrPath, ctrName, ctrName+"_contract.nef")) + if err != nil { + return nil, fmt.Errorf("can't read NEF file: %w", err) + } + nf, err := nef.FileFromBytes(rawNef) + if err != nil { + return nil, fmt.Errorf("can't parse NEF file: %w", err) + } + rawManif, err := ioutil.ReadFile(path.Join(ctrPath, ctrName, "config.json")) + if err != nil { + return nil, fmt.Errorf("can't read manifest file: %w", err) + } + m := new(manifest.Manifest) + if err := json.Unmarshal(rawManif, m); err != nil { + return nil, fmt.Errorf("can't parse manifest file: %w", err) + } + + c.Contracts[ctrName] = &contractState{ + NEF: &nf, + RawNEF: rawNef, + Manifest: m, + RawManifest: rawManif, + } + return c.Contracts[ctrName], nil +} + +func getContractDeployParameters(rawNef, rawManif []byte, deployData []smartcontract.Parameter) []smartcontract.Parameter { + return []smartcontract.Parameter{ + { + Type: smartcontract.ByteArrayType, + Value: rawNef, + }, + { + Type: smartcontract.ByteArrayType, + Value: rawManif, + }, + { + Type: smartcontract.ArrayType, + Value: deployData, + }, + } +} + +func (c *initializeContext) getContractDeployData(ctrName string, keysParam []smartcontract.Parameter) []smartcontract.Parameter { + items := make([]smartcontract.Parameter, 2, 7) + items[0] = newContractParameter(smartcontract.BoolType, false) // notaryDisabled is false + items[1] = newContractParameter(smartcontract.Hash160Type, c.CommitteeAcc.Contract.ScriptHash()) // owner is committee + + switch ctrName { + case neofsContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[processingContract].Hash), + newContractParameter(smartcontract.ArrayType, keysParam)) + case processingContract: + items = append(items, newContractParameter(smartcontract.Hash160Type, c.Contracts[neofsContract].Hash)) + return items[1:] // no notary info + case auditContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash)) + case balanceContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[containerContract].Hash)) + case containerContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[balanceContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[neofsIDContract].Hash)) + case neofsIDContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[containerContract].Hash)) + case netmapContract: + items = append(items, + newContractParameter(smartcontract.Hash160Type, c.Contracts[balanceContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[containerContract].Hash), + newContractParameter(smartcontract.ArrayType, keysParam)) + case proxyContract: + items = append(items, newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash)) + case reputationContract: + default: + panic(fmt.Sprintf("invalid contract name: %s", ctrName)) + } + return items +} + +func (c *initializeContext) getAlphabetDeployParameters(i, n int) []smartcontract.Parameter { + return []smartcontract.Parameter{ + newContractParameter(smartcontract.BoolType, false), + newContractParameter(smartcontract.Hash160Type, c.CommitteeAcc.Contract.ScriptHash()), + newContractParameter(smartcontract.Hash160Type, c.Contracts[netmapContract].Hash), + newContractParameter(smartcontract.Hash160Type, c.Contracts[proxyContract].Hash), + newContractParameter(smartcontract.StringType, innerring.GlagoliticLetter(i).String()), + newContractParameter(smartcontract.IntegerType, int64(i)), + newContractParameter(smartcontract.IntegerType, int64(n)), + } +} + +func newContractParameter(typ smartcontract.ParamType, value interface{}) smartcontract.Parameter { + return smartcontract.Parameter{ + Type: typ, + Value: value, + } +} From df1b26c70824d92a5679f73dbeb9334739365f78 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 22 Jul 2021 10:57:11 +0300 Subject: [PATCH 217/219] [#687] neofs-adm: register candidates Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 11 +- .../modules/morph/initialize_register.go | 119 ++++++++++++++++++ 2 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize_register.go diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 045d1d4be6..1d3575375b 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -68,8 +68,15 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } - // TODO 5. Setup NeoFS contracts addresses in NNS. - // TODO 6. Register candidates and call alphabet.Vote. + cmd.Println("Stage 5: register candidates.") + if err := initCtx.registerCandidates(); err != nil { + return err + } + + cmd.Println("Stage 6: transfer NEO to alphabet contracts.") + if err := initCtx.transferNEOToAlphabetContracts(); err != nil { + return err + } cmd.Println("endpoint:", viper.GetString(endpointFlag)) cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_register.go b/cmd/neofs-adm/internal/modules/morph/initialize_register.go new file mode 100644 index 0000000000..1a53c38122 --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize_register.go @@ -0,0 +1,119 @@ +package morph + +import ( + "fmt" + + "github.com/nspcc-dev/neo-go/pkg/core/native" + "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/core/transaction" + "github.com/nspcc-dev/neo-go/pkg/io" + "github.com/nspcc-dev/neo-go/pkg/rpc/client" + "github.com/nspcc-dev/neo-go/pkg/smartcontract" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neo-go/pkg/vm" + "github.com/nspcc-dev/neo-go/pkg/vm/emit" + "github.com/nspcc-dev/neo-go/pkg/vm/opcode" + "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" +) + +// initialAlphabetNEOAmount represents total amount of GAS distributed between alphabet nodes. +const initialAlphabetNEOAmount = native.NEOTotalSupply + +func (c *initializeContext) registerCandidates() error { + neoHash, err := c.Client.GetNativeContractHash(nativenames.Neo) + if err != nil { + return err + } + + res, err := c.Client.InvokeFunction(neoHash, "getCandidates", []smartcontract.Parameter{}, nil) + if err != nil { + return err + } + if res.State == vm.HaltState.String() && len(res.Stack) > 0 { + arr, ok := res.Stack[0].Value().([]stackitem.Item) + if ok && len(arr) > 0 { + return nil + } + } + + regPrice, err := c.Client.GetCandidateRegisterPrice() + if err != nil { + return fmt.Errorf("can't fetch registration price: %w", err) + } + + sysGas := regPrice + native.GASFactor // + 1 GAS + for _, w := range c.Wallets { + acc, err := getWalletAccount(w, singleAccountName) + if err != nil { + return err + } + + w := io.NewBufBinWriter() + emit.AppCall(w.BinWriter, neoHash, "registerCandidate", callflag.States, acc.PrivateKey().PublicKey().Bytes()) + emit.Opcodes(w.BinWriter, opcode.ASSERT) + + h, err := c.Client.SignAndPushInvocationTx(w.Bytes(), acc, sysGas, 0, []client.SignerAccount{{ + Signer: transaction.Signer{ + Account: acc.Contract.ScriptHash(), + Scopes: transaction.CalledByEntry, + }, + Account: acc, + }}) + if err != nil { + return err + } + + c.Hashes = append(c.Hashes, h) + } + + return c.awaitTx() +} + +func (c *initializeContext) transferNEOToAlphabetContracts() error { + neoHash, err := c.Client.GetNativeContractHash(nativenames.Neo) + if err != nil { + return err + } + + ok, err := c.transferNEOFinished(neoHash) + if ok || err != nil { + return err + } + + ctrPath, err := c.Command.Flags().GetString(contractsInitFlag) + if err != nil { + return fmt.Errorf("missing contracts path: %w", err) + } + + cs, err := c.readContract(ctrPath, alphabetContract) + if err != nil { + return fmt.Errorf("can't read alphabet contract: %w", err) + } + + amount := initialAlphabetNEOAmount / len(c.Wallets) + + bw := io.NewBufBinWriter() + for _, w := range c.Wallets { + acc, err := getWalletAccount(w, singleAccountName) + if err != nil { + return err + } + + h := state.CreateContractHash(acc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + emit.AppCall(bw.BinWriter, neoHash, "transfer", callflag.All, + c.CommitteeAcc.Contract.ScriptHash(), h, int64(amount), nil) + } + + if err := c.sendCommitteeTx(bw.Bytes(), -1); err != nil { + return err + } + + return c.awaitTx() +} + +func (c *initializeContext) transferNEOFinished(neoHash util.Uint160) (bool, error) { + bal, err := c.Client.NEP17BalanceOf(neoHash, c.CommitteeAcc.Contract.ScriptHash()) + return bal < native.NEOTotalSupply, err +} From c78350846af8f93671ee249590e02bb90d4c2066 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 22 Jul 2021 12:52:44 +0300 Subject: [PATCH 218/219] [#687] neofs-adm: set aliases for contract hashes in NNS Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 5 + .../internal/modules/morph/initialize_nns.go | 100 ++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 cmd/neofs-adm/internal/modules/morph/initialize_nns.go diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index 1d3575375b..c11b63cadb 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -78,6 +78,11 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } + cmd.Println("Stage 7: set addresses in NNS.") + if err := initCtx.setNNS(); err != nil { + return err + } + cmd.Println("endpoint:", viper.GetString(endpointFlag)) cmd.Println("alphabet-wallets:", viper.GetString(alphabetWalletsFlag)) cmd.Println("contracts:", contractsPath) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_nns.go b/cmd/neofs-adm/internal/modules/morph/initialize_nns.go new file mode 100644 index 0000000000..13f41b179d --- /dev/null +++ b/cmd/neofs-adm/internal/modules/morph/initialize_nns.go @@ -0,0 +1,100 @@ +package morph + +import ( + "fmt" + + nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" + "github.com/nspcc-dev/neo-go/pkg/core/native" + "github.com/nspcc-dev/neo-go/pkg/core/state" + "github.com/nspcc-dev/neo-go/pkg/io" + "github.com/nspcc-dev/neo-go/pkg/smartcontract" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neo-go/pkg/vm" + "github.com/nspcc-dev/neo-go/pkg/vm/emit" + "github.com/nspcc-dev/neo-go/pkg/vm/opcode" +) + +const defaultNameServiceDomainPrice = 10_0000_0000 +const defaultNameServiceSysfee = 4000_0000 +const defaultRegisterSysfee = 10_0000_0000 + defaultNameServiceDomainPrice + +func (c *initializeContext) setNNS() error { + ctrPath, err := c.Command.Flags().GetString(contractsInitFlag) + if err != nil { + return fmt.Errorf("missing contracts path: %w", err) + } + + cs, err := c.readContract(ctrPath, nnsContract) + if err != nil { + return err + } + + h := state.CreateContractHash(c.CommitteeAcc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + ok, err := c.nnsRootRegistered(h) + if err != nil { + return err + } else if !ok { + bw := io.NewBufBinWriter() + emit.AppCall(bw.BinWriter, h, "addRoot", callflag.All, "neofs") + if err := c.sendCommitteeTx(bw.Bytes(), -1); err != nil { + return fmt.Errorf("can't add domain root to NNS: %w", err) + } + if err := c.awaitTx(); err != nil { + return err + } + } + + for _, ctrName := range contractList { + cs, err := c.readContract(ctrPath, ctrName) + if err != nil { + return err + } + cs.Hash = state.CreateContractHash(c.CommitteeAcc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + + domain := ctrName + ".neofs" + if ok, err := c.nnsDomainAvailable(h, domain); err != nil { + return err + } else if !ok { + continue + } + + bw := io.NewBufBinWriter() + emit.AppCall(bw.BinWriter, h, "register", callflag.All, + domain, c.CommitteeAcc.Contract.ScriptHash()) + emit.Opcodes(bw.BinWriter, opcode.ASSERT) + emit.AppCall(bw.BinWriter, h, "setRecord", callflag.All, + domain, int64(nns.TXT), cs.Hash.StringLE()) + + sysFee := int64(defaultRegisterSysfee + native.GASFactor) + if err := c.sendCommitteeTx(bw.Bytes(), sysFee); err != nil { + return err + } + } + + return c.awaitTx() +} + +func (c *initializeContext) nnsRootRegistered(nnsHash util.Uint160) (bool, error) { + params := []smartcontract.Parameter{{Type: smartcontract.StringType, Value: "name.neofs"}} + res, err := c.Client.InvokeFunction(nnsHash, "isAvailable", params, nil) + if err != nil { + return false, err + } + return res.State == vm.HaltState.String(), nil +} + +func (c *initializeContext) nnsDomainAvailable(nnsHash util.Uint160, domain string) (bool, error) { + params := []smartcontract.Parameter{{Type: smartcontract.StringType, Value: domain}} + res, err := c.Client.InvokeFunction(nnsHash, "isAvailable", params, nil) + if err != nil { + return false, err + } + if len(res.Stack) == 0 { + return true, nil + } + if ok, err := res.Stack[0].TryBool(); err == nil { + return ok, nil + } + return true, nil +} From cf5f8a8f7867c0022861124a0419533c608f7b0b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 23 Jul 2021 15:07:44 +0300 Subject: [PATCH 219/219] [#684] neofs-adm: transfer gas to the proxy contract Signed-off-by: Evgenii Stratonikov --- .../internal/modules/morph/initialize.go | 5 +++ .../modules/morph/initialize_deploy.go | 2 +- .../modules/morph/initialize_transfer.go | 37 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-adm/internal/modules/morph/initialize.go b/cmd/neofs-adm/internal/modules/morph/initialize.go index c11b63cadb..f3e5bdcef2 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize.go @@ -68,6 +68,11 @@ func initializeSideChainCmd(cmd *cobra.Command, args []string) error { return err } + cmd.Println("Stage 4.1: Transfer GAS to proxy contract.") + if err := initCtx.transferGASToProxy(); err != nil { + return err + } + cmd.Println("Stage 5: register candidates.") if err := initCtx.registerCandidates(); err != nil { return err diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go index 4020fba444..bbcad0659a 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_deploy.go @@ -138,7 +138,7 @@ func (c *initializeContext) deployContracts() error { } res, err := c.Client.InvokeFunction(mgmtHash, "deploy", params, []transaction.Signer{signer}) if err != nil { - return fmt.Errorf("can't deploy contract: %w", err) + return fmt.Errorf("can't deploy alphabet #%d contract: %w", i, err) } h, err := c.Client.SignAndPushInvocationTx(res.Script, acc, -1, 0, []client.SignerAccount{{ Signer: signer, diff --git a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go index e5407b8114..51d0cd1369 100644 --- a/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go +++ b/cmd/neofs-adm/internal/modules/morph/initialize_transfer.go @@ -5,6 +5,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" + "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/rpc/client" scContext "github.com/nspcc-dev/neo-go/pkg/smartcontract/context" @@ -14,6 +15,8 @@ const ( gasInitialTotalSupply = 30000000 * native.GASFactor // initialAlphabetGASAmount represents amount of GAS given to each alphabet node. initialAlphabetGASAmount = 10_000 * native.GASFactor + // initialProxyGASAmount represents amount of GAS given to proxy contract. + initialProxyGASAmount = 50_000 * native.GASFactor ) func (c *initializeContext) transferFunds() error { @@ -145,3 +148,37 @@ func (c *initializeContext) multiSign(tx *transaction.Transaction, accType strin return nil } + +func (c *initializeContext) transferGASToProxy() error { + gasHash, err := c.Client.GetNativeContractHash(nativenames.Gas) + if err != nil { + return fmt.Errorf("can't fetch %s hash: %w", nativenames.Gas, err) + } + + ctrPath, err := c.Command.Flags().GetString(contractsInitFlag) + if err != nil { + return fmt.Errorf("missing contracts path: %w", err) + } + + cs, err := c.readContract(ctrPath, proxyContract) + if err != nil { + return err + } + + h := state.CreateContractHash(c.CommitteeAcc.Contract.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) + bal, err := c.Client.NEP17BalanceOf(gasHash, h) + if err != nil || bal > 0 { + return err + } + + tx, err := c.Client.CreateNEP17TransferTx(c.CommitteeAcc, h, gasHash, initialProxyGASAmount, 0, nil, nil) + if err != nil { + return err + } + + if err := c.multiSignAndSend(tx, committeeAccountName); err != nil { + return err + } + + return c.awaitTx() +}