From 8ea5744326a06a8657183a0a21cd786ad5a0818b Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 21 Jul 2021 12:24:14 +0300 Subject: [PATCH] [#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 9aa25ab3d..4f9213cf3 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 96bf2a9ed..2819b62e6 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 2acc90a0b..622c2a664 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 9ecfa4037..6efc5a9b3 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.