From 999ad5e1c035c067266e74049a37f5000e0848eb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 24 Mar 2021 17:39:59 +0300 Subject: [PATCH] [#447] innerring: Do not handle or call InnerRingUpdate method This method has been removed from netmap contract. Corresponding event from neofs contract renamed to AlphabetUpdate and should not be processed, because alphabet updated from `RoleManagement` contract. Signed-off-by: Alex Vanin --- pkg/innerring/invoke/netmap.go | 15 ------------ pkg/innerring/processors/neofs/handlers.go | 16 ------------- .../processors/neofs/process_update.go | 23 ------------------- pkg/innerring/processors/neofs/processor.go | 15 ------------ 4 files changed, 69 deletions(-) delete mode 100644 pkg/innerring/processors/neofs/process_update.go diff --git a/pkg/innerring/invoke/netmap.go b/pkg/innerring/invoke/netmap.go index fc7b7e1ae..3573831a3 100644 --- a/pkg/innerring/invoke/netmap.go +++ b/pkg/innerring/invoke/netmap.go @@ -28,7 +28,6 @@ const ( approvePeerMethod = "addPeer" updatePeerStateMethod = "updateState" setConfigMethod = "setConfigMethod" - updateInnerRingMethod = "updateInnerRingMethod" getNetmapSnapshotMethod = "netmap" ) @@ -94,20 +93,6 @@ func SetConfig(cli *client.Client, con util.Uint160, args *SetConfigArgs) error ) } -// UpdateInnerRing invokes updateInnerRing method. -func UpdateInnerRing(cli *client.Client, con util.Uint160, list []*keys.PublicKey) error { - if cli == nil { - return client.ErrNilClient - } - - rawKeys := make([][]byte, 0, len(list)) - for i := range list { - rawKeys = append(rawKeys, list[i].Bytes()) - } - - return cli.NotaryInvoke(con, updateInnerRingMethod, rawKeys) -} - // NetmapSnapshot returns current netmap node infos. // Consider using pkg/morph/client/netmap for this. func NetmapSnapshot(cli *client.Client, con util.Uint160) (*netmap.Netmap, error) { diff --git a/pkg/innerring/processors/neofs/handlers.go b/pkg/innerring/processors/neofs/handlers.go index deed87850..486a54250 100644 --- a/pkg/innerring/processors/neofs/handlers.go +++ b/pkg/innerring/processors/neofs/handlers.go @@ -72,19 +72,3 @@ func (np *Processor) handleConfig(ev event.Event) { zap.Int("capacity", np.pool.Cap())) } } - -func (np *Processor) handleUpdateInnerRing(ev event.Event) { - updIR := ev.(neofsEvent.UpdateInnerRing) - np.log.Info("notification", - zap.String("type", "update inner ring"), - ) - - // send event to the worker pool - - err := np.pool.Submit(func() { np.processUpdateInnerRing(&updIR) }) - if err != nil { - // there system can be moved into controlled degradation stage - np.log.Warn("neofs processor worker pool drained", - zap.Int("capacity", np.pool.Cap())) - } -} diff --git a/pkg/innerring/processors/neofs/process_update.go b/pkg/innerring/processors/neofs/process_update.go deleted file mode 100644 index e4f72cab3..000000000 --- a/pkg/innerring/processors/neofs/process_update.go +++ /dev/null @@ -1,23 +0,0 @@ -package neofs - -import ( - "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" - neofsEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/neofs" - "go.uber.org/zap" -) - -// Process update inner ring event by setting inner ring list value from -// main chain in side chain. -func (np *Processor) processUpdateInnerRing(list *neofsEvent.UpdateInnerRing) { - if !np.alphabetState.IsAlphabet() { - np.log.Info("non alphabet mode, ignore inner ring update") - return - } - - err := invoke.UpdateInnerRing(np.morphClient, np.netmapContract, - list.Keys(), - ) - if err != nil { - np.log.Error("can't relay update inner ring event", zap.Error(err)) - } -} diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index 3481d4522..d15497d79 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -71,7 +71,6 @@ const ( withdrawNotification = "Withdraw" chequeNotification = "Cheque" configNotification = "SetConfig" - updateIRNotification = "InnerRingUpdate" ) // New creates neofs mainnet contract processor instance. @@ -151,13 +150,6 @@ func (np *Processor) ListenerParsers() []event.ParserInfo { config.SetParser(neofsEvent.ParseConfig) parsers = append(parsers, config) - // update inner ring event - updateIR := event.ParserInfo{} - updateIR.SetType(updateIRNotification) - updateIR.SetScriptHash(np.neofsContract) - updateIR.SetParser(neofsEvent.ParseUpdateInnerRing) - parsers = append(parsers, updateIR) - return parsers } @@ -193,13 +185,6 @@ func (np *Processor) ListenerHandlers() []event.HandlerInfo { config.SetHandler(np.handleConfig) handlers = append(handlers, config) - // updateIR handler - updateIR := event.HandlerInfo{} - updateIR.SetType(updateIRNotification) - updateIR.SetScriptHash(np.neofsContract) - updateIR.SetHandler(np.handleUpdateInnerRing) - handlers = append(handlers, updateIR) - return handlers }