From fdf1338d65ce63c7ff03a2433415534839760a23 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 10 Feb 2022 19:47:26 +0300 Subject: [PATCH] [#1170] config: Delete notification endpoints Also, change `http` to `ws` in examples. Signed-off-by: Pavel Karpy --- cmd/neofs-ir/defaults.go | 4 ---- cmd/neofs-node/config/morph/config.go | 24 ---------------------- cmd/neofs-node/config/morph/config_test.go | 9 -------- config/example/node.env | 4 +--- config/example/node.json | 7 +------ config/example/node.yaml | 4 ---- pkg/innerring/innerring.go | 6 ------ 7 files changed, 2 insertions(+), 56 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 28b305326..74926b0c0 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -48,13 +48,9 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("node.persistent_state.path", ".neofs-ir-state") cfg.SetDefault("morph.endpoint.client", "") - cfg.SetDefault("morph.endpoint.notification", "") - cfg.SetDefault("morph.dial_timeout", "10s") cfg.SetDefault("morph.validators", []string{}) cfg.SetDefault("mainnet.endpoint.client", "") - cfg.SetDefault("mainnet.endpoint.notification", "") - cfg.SetDefault("mainnet.dial_timeout", "10s") cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet cfg.SetDefault("wallet.address", "") // account address diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index 8cbd9ac74..2a177b66f 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -37,19 +37,6 @@ func RPCEndpoint(c *config.Config) []string { return v } -// NotificationEndpoint returns list of values of "notification_endpoint" config -// parameter from "morph" section. -// -// Throws panic if list is empty. -func NotificationEndpoint(c *config.Config) []string { - v := config.StringSliceSafe(c.Sub(subsection), "notification_endpoint") - if len(v) == 0 { - panic(fmt.Errorf("no morph chain notification endpoints, see `morph.notification_endpoint` section")) - } - - return v -} - // DialTimeout returns value of "dial_timeout" config parameter // from "morph" section. // @@ -68,14 +55,3 @@ func DialTimeout(c *config.Config) time.Duration { func DisableCache(c *config.Config) bool { return config.BoolSafe(c.Sub(subsection), "disable_cache") } - -// MaxConnPerHost return value of "max_connections_per_host" config -// parameter from "morph" section. -func MaxConnPerHost(c *config.Config) int { - v := config.Uint32Safe(c.Sub(subsection), "max_connections_per_host") - if v > 0 { - return int(v) - } - - return MaxConnPerHostDefault -} diff --git a/cmd/neofs-node/config/morph/config_test.go b/cmd/neofs-node/config/morph/config_test.go index 3fef69a4b..204fc7a5d 100644 --- a/cmd/neofs-node/config/morph/config_test.go +++ b/cmd/neofs-node/config/morph/config_test.go @@ -15,21 +15,14 @@ func TestMorphSection(t *testing.T) { empty := configtest.EmptyConfig() require.Panics(t, func() { morphconfig.RPCEndpoint(empty) }) - 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, 10, morphconfig.MaxConnPerHost(empty)) }) const path = "../../../../config/example/node" var ( rpcs = []string{ - "https://rpc1.morph.fs.neo.org:40341", - "https://rpc2.morph.fs.neo.org:40341", - } - - wss = []string{ "wss://rpc1.morph.fs.neo.org:40341/ws", "wss://rpc2.morph.fs.neo.org:40341/ws", } @@ -37,10 +30,8 @@ func TestMorphSection(t *testing.T) { var fileConfigTest = func(c *config.Config) { require.Equal(t, rpcs, morphconfig.RPCEndpoint(c)) - 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, 11, morphconfig.MaxConnPerHost(c)) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/config/example/node.env b/config/example/node.env index f6b80ec62..4a89fdf09 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -55,9 +55,7 @@ NEOFS_CONTRACTS_PROXY=ad7c6b55b737b696e5c82c85445040964a03e97f # Morph chain section 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_MAX_CONNECTIONS_PER_HOST=11 +NEOFS_MORPH_RPC_ENDPOINT="wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws" # Main chain section (optional) NEOFS_MAINCHAIN_DIAL_TIMEOUT=30s diff --git a/config/example/node.json b/config/example/node.json index 2ff17e937..de515fd93 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -94,14 +94,9 @@ "dial_timeout": "30s", "disable_cache": true, "rpc_endpoint": [ - "https://rpc1.morph.fs.neo.org:40341", - "https://rpc2.morph.fs.neo.org:40341" - ], - "notification_endpoint": [ "wss://rpc1.morph.fs.neo.org:40341/ws", "wss://rpc2.morph.fs.neo.org:40341/ws" - ], - "max_connections_per_host": 11 + ] }, "mainchain": { "dial_timeout": "30s", diff --git a/config/example/node.yaml b/config/example/node.yaml index a0f2a74b0..676dba950 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -79,12 +79,8 @@ morph: dial_timeout: 30s # timeout for side chain NEO RPC client connection disable_cache: true # do not use TTL cache for side chain GET operations rpc_endpoint: # side chain NEO RPC endpoints; are shuffled and used one by one until the first success - - https://rpc1.morph.fs.neo.org:40341 - - https://rpc2.morph.fs.neo.org:40341 - 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 - max_connections_per_host: 11 # maximum of open connections per one host mainchain: # DEPRECATED section, is not used and not read dial_timeout: 30s # timeout for main chain NEO RPC client connection diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 21945185a..9d11b6565 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -921,12 +921,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error } func createListener(ctx context.Context, cli *client.Client, p *chainParams) (event.Listener, error) { - // config name left unchanged for compatibility, may be its better to rename it to "endpoints" - endpoints := p.cfg.GetStringSlice(p.name + ".endpoint.notification") - if len(endpoints) == 0 { - return nil, errors.New("missing morph notification endpoints") - } - var ( sub subscriber.Subscriber err error