From 2f2258733b80088ef08bd5a07ab2a31b806fc7e2 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 30 Sep 2021 22:14:02 +0300 Subject: [PATCH] [#873] node: Delete useless notary deposit `Amount`, `Duration` envs Signed-off-by: Pavel Karpy --- cmd/neofs-node/config/morph/config.go | 37 ---------------------- cmd/neofs-node/config/morph/config_test.go | 5 --- config/example/node.env | 2 -- config/example/node.json | 4 --- config/example/node.yaml | 3 -- 5 files changed, 51 deletions(-) diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index a77167cee..4c350efa7 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" ) @@ -66,39 +65,3 @@ func DialTimeout(c *config.Config) time.Duration { func DisableCache(c *config.Config) bool { return config.BoolSafe(c.Sub(subsection), "disable_cache") } - -// NotaryConfig is a wrapper over the config section -// which provides access to notary configurations -// of the side chain. -type NotaryConfig struct { - cfg *config.Config -} - -// Notary returns structure that provides access to "notary" -// subsection of "morph" section. -func Notary(c *config.Config) *NotaryConfig { - return &NotaryConfig{ - cfg: c.Sub(subsection).Sub(notarySubsection), - } -} - -// Amount returns value of "deposit_amount" config parameter. -// -// Returns NotaryDepositAmountDefault if value is not positive amount. -func (n NotaryConfig) Amount() fixedn.Fixed8 { - v := config.UintSafe(n.cfg, "deposit_amount") - if v > 0 { - return fixedn.Fixed8(v) - } - - return fixedn.Fixed8(NotaryDepositAmountDefault) -} - -func (n NotaryConfig) Duration() uint32 { - v := config.Uint32Safe(n.cfg, "deposit_duration") - if v > 0 { - return v - } - - return NotaryDepositDurationDefault -} diff --git a/cmd/neofs-node/config/morph/config_test.go b/cmd/neofs-node/config/morph/config_test.go index 5d78a8e12..3f9946be1 100644 --- a/cmd/neofs-node/config/morph/config_test.go +++ b/cmd/neofs-node/config/morph/config_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" morphconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/morph" configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" @@ -19,8 +18,6 @@ func TestMorphSection(t *testing.T) { require.Panics(t, func() { morphconfig.NotificationEndpoint(empty) }) require.Equal(t, morphconfig.DialTimeoutDefault, morphconfig.DialTimeout(empty)) require.Equal(t, false, morphconfig.DisableCache(empty)) - require.Equal(t, fixedn.Fixed8(morphconfig.NotaryDepositAmountDefault), morphconfig.Notary(empty).Amount()) - require.Equal(t, morphconfig.NotaryDepositDurationDefault, morphconfig.Notary(empty).Duration()) }) const path = "../../../../config/example/node" @@ -42,8 +39,6 @@ func TestMorphSection(t *testing.T) { require.Equal(t, wss, morphconfig.NotificationEndpoint(c)) require.Equal(t, 30*time.Second, morphconfig.DialTimeout(c)) require.Equal(t, true, morphconfig.DisableCache(c)) - require.Equal(t, fixedn.Fixed8(100000001), morphconfig.Notary(c).Amount()) - require.Equal(t, uint32(1001), morphconfig.Notary(c).Duration()) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/config/example/node.env b/config/example/node.env index d5ce00b40..ed83fa41d 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -47,8 +47,6 @@ NEOFS_MORPH_DIAL_TIMEOUT=30s NEOFS_MORPH_DISABLE_CACHE=true NEOFS_MORPH_RPC_ENDPOINT=https://rpc1.morph.fs.neo.org:40341 https://rpc2.morph.fs.neo.org:40341 NEOFS_MORPH_NOTIFICATION_ENDPOINT=wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws -NEOFS_MORPH_NOTARY_DEPOSIT_AMOUNT=100000001 -NEOFS_MORPH_NOTARY_DEPOSIT_DURATION=1001 # Main chain section (optional) NEOFS_MAINCHAIN_DIAL_TIMEOUT=30s diff --git a/config/example/node.json b/config/example/node.json index cc9cd24ea..8393743e7 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -74,10 +74,6 @@ "wss://rpc1.morph.fs.neo.org:40341/ws", "wss://rpc2.morph.fs.neo.org:40341/ws" ], - "notary": { - "deposit_amount": 100000001, - "deposit_duration": 1001 - } }, "mainchain": { "dial_timeout": "30s", diff --git a/config/example/node.yaml b/config/example/node.yaml index a6f14e964..1ed167060 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -63,9 +63,6 @@ morph: notification_endpoint: # side chain NEO RPC notification endpoints; are shuffled and used only the first non-error one - wss://rpc1.morph.fs.neo.org:40341/ws - wss://rpc2.morph.fs.neo.org:40341/ws - notary: - deposit_amount: 100000001 # notary deposit GAS amount - deposit_duration: 1001 # notary deposit period in blocks mainchain: # DEPRECATED section, is not used and not read dial_timeout: 30s # timeout for main chain NEO RPC client connection