From 41eaa1e246737d15dd2a693d891194dc09c17592 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 26 Nov 2021 15:19:20 +0300 Subject: [PATCH] [#973] ir: Listen and process Put/Delete events of Subnet contract Define notification events, implement parsers. Add morph client of Subnet contract. Listen, verify and approve events in Inner Ring app. Signed-off-by: Leonard Lyubich --- cmd/neofs-ir/defaults.go | 1 + go.mod | 4 +- go.sum | Bin 93262 -> 93071 bytes pkg/innerring/innerring.go | 6 + pkg/innerring/processors/netmap/handlers.go | 4 +- pkg/innerring/processors/subnet/common.go | 22 ++ .../processors/subnet/common_test.go | 19 + pkg/innerring/processors/subnet/delete.go | 44 +++ .../processors/subnet/delete_test.go | 44 +++ pkg/innerring/processors/subnet/put.go | 82 +++++ pkg/innerring/processors/subnet/put_test.go | 115 ++++++ pkg/innerring/subnet.go | 332 ++++++++++++++++++ pkg/morph/client/subnet/client.go | 91 +++++ pkg/morph/client/subnet/delete.go | 40 +++ pkg/morph/client/subnet/get.go | 57 +++ pkg/morph/client/subnet/put.go | 50 +++ pkg/morph/event/subnet/delete.go | 109 ++++++ pkg/morph/event/subnet/delete_test.go | 42 +++ pkg/morph/event/subnet/put.go | 144 ++++++++ pkg/morph/event/subnet/put_test.go | 69 ++++ pkg/morph/event/subnet/remove_node.go | 2 +- pkg/morph/event/subnet/remove_node_test.go | 3 +- 22 files changed, 1274 insertions(+), 6 deletions(-) create mode 100644 pkg/innerring/processors/subnet/common.go create mode 100644 pkg/innerring/processors/subnet/common_test.go create mode 100644 pkg/innerring/processors/subnet/delete.go create mode 100644 pkg/innerring/processors/subnet/delete_test.go create mode 100644 pkg/innerring/processors/subnet/put.go create mode 100644 pkg/innerring/processors/subnet/put_test.go create mode 100644 pkg/innerring/subnet.go create mode 100644 pkg/morph/client/subnet/client.go create mode 100644 pkg/morph/client/subnet/delete.go create mode 100644 pkg/morph/client/subnet/get.go create mode 100644 pkg/morph/client/subnet/put.go create mode 100644 pkg/morph/event/subnet/delete.go create mode 100644 pkg/morph/event/subnet/delete_test.go create mode 100644 pkg/morph/event/subnet/put.go create mode 100644 pkg/morph/event/subnet/put_test.go diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 516192ba..1a466ab4 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -80,6 +80,7 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("workers.container", "10") cfg.SetDefault("workers.alphabet", "10") cfg.SetDefault("workers.reputation", "10") + cfg.SetDefault("workers.subnet", "10") cfg.SetDefault("netmap_cleaner.enabled", true) cfg.SetDefault("netmap_cleaner.threshold", 3) diff --git a/go.mod b/go.mod index 0806974a..9f262722 100644 --- a/go.mod +++ b/go.mod @@ -11,9 +11,9 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.4.0 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.97.4-pre.0.20211123163659-b25c3775e847 + github.com/nspcc-dev/neo-go v0.97.4-pre.0.20211126130906-87f5113c031b github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211124141318-d93828f46514 - github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211126123811-1dde267424aa + github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211126125208-279a5a1e0bfe github.com/nspcc-dev/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 diff --git a/go.sum b/go.sum index 014590ee12489de16856177ce86b6f9f96292fa0..d3e97d650c33f15614b0b59cf4e38e4cef3d9caa 100644 GIT binary patch delta 216 zcmX?igSG!U>xQSD&Sr+j29^e9x)$bXriO;b$p*%TNeUT;R*|kHp1EaV&UtC(#UT-1 z?kN@~sg}VNRX*;AJBA?ewUMfo1?>7FTuN$F)FjwwYU jC7IrnH+D)-w(pY`#4u;`gFbEZ%`wMvI5wM|mzWCx@r_05 delta 224 zcmeCb&U)?!>xQSD&c=pj#%89Lx=BW+$;Rg9rl}St<_Z~xR+h;@juE+$`Mwq58O~mL zIT;4YmL=syX8ML{i7w8j<^?JKWk!xp6@@;GjkIolf*=j6(!|4?%`3P2Fc~&d0u5cMPXrq6?uNiUQSttW*)_U`TnI*0bcqA o0s3XGU@H#vN{g5o8ey2V`9Yty`Q(D5yqk|7-N3P#^IY3p0Pt~38vp