From fce1dad08f3e04ba5bb2f4ebe2b816ad9c1312a9 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Fri, 10 Oct 2025 01:33:43 +0300 Subject: [PATCH 1/6] ir: set config defaults directly Don't use viper's `SetDefault`, because it triggers configs `Set` and then we cannot determine whether this value was in the configuration or not. Signed-off-by: Andrey Butusov --- cmd/neofs-ir/defaults.go | 145 +++++++++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 45 deletions(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index bacbf868cc..81a43ee10e 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -5,6 +5,7 @@ import ( "strings" "time" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/internal/configutil" irconfig "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/spf13/viper" @@ -22,8 +23,6 @@ func newConfig(path string) (*irconfig.Config, error) { v.AutomaticEnv() v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) - defaultConfiguration(v) - if path != "" { v.SetConfigFile(path) if strings.HasSuffix(path, ".json") { @@ -43,61 +42,117 @@ func newConfig(path string) (*irconfig.Config, error) { return nil, fmt.Errorf("unable to decode config: %w", err) } + applyDefaults(&cfg) + return &cfg, nil } -func defaultConfiguration(cfg *viper.Viper) { - cfg.SetDefault("logger.level", "info") - cfg.SetDefault("logger.encoding", "console") - - cfg.SetDefault("pprof.address", "localhost:6060") - cfg.SetDefault("pprof.shutdown_timeout", "30s") - - cfg.SetDefault("prometheus.address", "localhost:9090") - cfg.SetDefault("prometheus.shutdown_timeout", "30s") - - cfg.SetDefault("without_mainnet", false) - - cfg.SetDefault("node.persistent_state.path", ".neofs-ir-state") +func applyDefaults(cfg *irconfig.Config) { + // Logger defaults + if cfg.Logger.Level == "" { + cfg.Logger.Level = "info" + } + if cfg.Logger.Encoding == "" { + cfg.Logger.Encoding = "console" + } - cfg.SetDefault("fschain.dial_timeout", time.Minute) - cfg.SetDefault("fschain.reconnections_number", 5) - cfg.SetDefault("fschain.reconnections_delay", 5*time.Second) - cfg.SetDefault("fschain.validators", []string{}) + // Pprof defaults + if cfg.Pprof.Address == "" { + cfg.Pprof.Address = "localhost:6060" + } + if cfg.Pprof.ShutdownTimeout == 0 { + cfg.Pprof.ShutdownTimeout = 30 * time.Second + } - cfg.SetDefault("mainnet.dial_timeout", time.Minute) - cfg.SetDefault("mainnet.reconnections_number", 5) - cfg.SetDefault("mainnet.reconnections_delay", 5*time.Second) + // Prometheus defaults + if cfg.Prometheus.Address == "" { + cfg.Prometheus.Address = "localhost:9090" + } + if cfg.Prometheus.ShutdownTimeout == 0 { + cfg.Prometheus.ShutdownTimeout = 30 * time.Second + } - cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet - cfg.SetDefault("wallet.address", "") // account address - cfg.SetDefault("wallet.password", "") // password + // Node defaults + if cfg.Node.PersistentState.Path == "" { + cfg.Node.PersistentState.Path = ".neofs-ir-state" + } - cfg.SetDefault("timers.collect_basic_income.mul", 1) - cfg.SetDefault("timers.collect_basic_income.div", 2) + // FSChain defaults + if cfg.FSChain.DialTimeout == 0 { + cfg.FSChain.DialTimeout = time.Minute + } + if cfg.FSChain.ReconnectionsNumber == 0 { + cfg.FSChain.ReconnectionsNumber = 5 + } + if cfg.FSChain.ReconnectionsDelay == 0 { + cfg.FSChain.ReconnectionsDelay = 5 * time.Second + } + if cfg.FSChain.Validators == nil { + cfg.FSChain.Validators = keys.PublicKeys{} + } - cfg.SetDefault("workers.netmap", "10") - cfg.SetDefault("workers.balance", "10") - cfg.SetDefault("workers.neofs", "10") - cfg.SetDefault("workers.container", "10") - cfg.SetDefault("workers.alphabet", "10") - cfg.SetDefault("workers.reputation", "10") + // Mainnet defaults + if cfg.Mainnet.DialTimeout == 0 { + cfg.Mainnet.DialTimeout = time.Minute + } + if cfg.Mainnet.ReconnectionsNumber == 0 { + cfg.Mainnet.ReconnectionsNumber = 5 + } + if cfg.Mainnet.ReconnectionsDelay == 0 { + cfg.Mainnet.ReconnectionsDelay = 5 * time.Second + } - cfg.SetDefault("emit.storage.amount", 0) - cfg.SetDefault("emit.mint.cache_size", 1000) - cfg.SetDefault("emit.mint.threshold", 1) - cfg.SetDefault("emit.mint.value", 20000000) // 0.2 Fixed8 - cfg.SetDefault("emit.gas.balance_threshold", 0) + // Timers defaults + if cfg.Timers.CollectBasicIncome.Mul == 0 { + cfg.Timers.CollectBasicIncome.Mul = 1 + } + if cfg.Timers.CollectBasicIncome.Div == 0 { + cfg.Timers.CollectBasicIncome.Div = 2 + } - cfg.SetDefault("settlement.basic_income_rate", 0) + // Workers defaults + if cfg.Workers.Netmap == 0 { + cfg.Workers.Netmap = 10 + } + if cfg.Workers.Balance == 0 { + cfg.Workers.Balance = 10 + } + if cfg.Workers.NeoFS == 0 { + cfg.Workers.NeoFS = 10 + } + if cfg.Workers.Container == 0 { + cfg.Workers.Container = 10 + } + if cfg.Workers.Alphabet == 0 { + cfg.Workers.Alphabet = 10 + } + if cfg.Workers.Reputation == 0 { + cfg.Workers.Reputation = 10 + } - cfg.SetDefault("indexer.cache_timeout", 15*time.Second) + // Emit defaults + if cfg.Emit.Mint.CacheSize == 0 { + cfg.Emit.Mint.CacheSize = 1000 + } + if cfg.Emit.Mint.Threshold == 0 { + cfg.Emit.Mint.Threshold = 1 + } + if cfg.Emit.Mint.Value == 0 { + cfg.Emit.Mint.Value = 20000000 // 0.2 Fixed8 + } - // extra fee values for working mode without notary contract - cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8 + // Indexer defaults + if cfg.Indexer.CacheTimeout == 0 { + cfg.Indexer.CacheTimeout = 15 * time.Second + } - cfg.SetDefault("control.authorized_keys", []string{}) - cfg.SetDefault("control.grpc.endpoint", "") + // Fee defaults + if cfg.Fee.MainChain == 0 { + cfg.Fee.MainChain = 5000_0000 // 0.5 Fixed8 + } - cfg.SetDefault("governance.disable", false) + // Control defaults + if cfg.Control.AuthorizedKeys == nil { + cfg.Control.AuthorizedKeys = keys.PublicKeys{} + } } From f3b4e347ceef2a08ac80fbd40c5cbf5ae1e3bf9b Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Fri, 3 Oct 2025 16:22:11 +0300 Subject: [PATCH 2/6] ir: move `fschain_autodeploy` out of top level New `fschain.disable_autodeploy` IR configuration, which inverts the value of the `fschain_autodeploy` option. Make `fschain_autodeploy` default to `true`, support it for one more release. Closes #3361. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 5 +++++ cmd/neofs-ir/defaults_test.go | 6 +++--- cmd/neofs-ir/validate_test.go | 4 ++-- config/example/ir.env | 1 + config/example/ir.yaml | 4 ++-- pkg/innerring/config/fschain.go | 7 ++++--- pkg/innerring/innerring.go | 15 ++++++++++++--- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8b75d4fee..1e48dab754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,17 @@ Changelog for NeoFS Node ### Fixed ### Changed +- Move `fschain_autodeploy` into `fschain.disable_autodeploy` in IR config (#3619) ### Removed ### Updated ### Updating from v0.49.0 +Use IR configuration option: +- `fschain.disable_autodeploy` instead of deprecated `fschain_autodeploy` with reverted value, +by default autodeploy is enabled now; +Old option is still supported but will be removed in future releases. ## [0.49.0] - 2025-10-06 - Dochodo diff --git a/cmd/neofs-ir/defaults_test.go b/cmd/neofs-ir/defaults_test.go index 6c06d63fd2..04861a9725 100644 --- a/cmd/neofs-ir/defaults_test.go +++ b/cmd/neofs-ir/defaults_test.go @@ -26,10 +26,10 @@ func TestValidateDefaultConfig(t *testing.T) { ReconnectionsNumber: 5, ReconnectionsDelay: 5000000000, }, - Validators: keys.PublicKeys{}, + DisableAutodeploy: false, + Validators: keys.PublicKeys{}, }, - FSChainAutodeploy: false, - NNS: config.NNS{SystemEmail: ""}, + NNS: config.NNS{SystemEmail: ""}, Mainnet: config.BasicChain{ DialTimeout: 60000000000, ReconnectionsNumber: 5, diff --git a/cmd/neofs-ir/validate_test.go b/cmd/neofs-ir/validate_test.go index 98d24b9b1d..a796dc217a 100644 --- a/cmd/neofs-ir/validate_test.go +++ b/cmd/neofs-ir/validate_test.go @@ -192,7 +192,8 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { "wss://sidechain2.fs.neo.org:30333/ws", }, }, - Validators: validators, + DisableAutodeploy: true, + Validators: validators, Consensus: config.Consensus{ Magic: 15405, Committee: committee, @@ -248,7 +249,6 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { RemoveUntraceableBlocks: false, P2PNotaryRequestPayloadPoolSize: 100, }}, - FSChainAutodeploy: true, NNS: config.NNS{ SystemEmail: "usr@domain.io", }, diff --git a/config/example/ir.env b/config/example/ir.env index 091395adb1..458dc2b214 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -8,6 +8,7 @@ NEOFS_IR_WALLET_PASSWORD=secret NEOFS_IR_WITHOUT_MAINNET=false +NEOFS_IR_FSCHAIN_DISABLE_AUTODEPLOY=true NEOFS_IR_FSCHAIN_DIAL_TIMEOUT=1m NEOFS_IR_FSCHAIN_RECONNECTIONS_NUMBER=5 NEOFS_IR_FSCHAIN_RECONNECTIONS_DELAY=5s diff --git a/config/example/ir.yaml b/config/example/ir.yaml index 99d7191da2..d552b5758d 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -16,6 +16,7 @@ wallet: without_mainnet: false # Run application in single chain environment without mainchain fschain: + disable_autodeploy: true # Optional flag to disable auto-deployment procedure of the FS chain; defaults to 'false' dial_timeout: 1m # Timeout for RPC client connection to sidechain reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts @@ -109,8 +110,7 @@ fschain: p2p_notary_request_payload_pool_size: 100 # Optional size of the node's P2P Notary request payloads memory pool. # Defaults to 1000. Must be unsigned integer in range [1:2147483647]. -fschain_autodeploy: true # Optional flag to run auto-deployment procedure of the FS chain. By default, - # the chain is expected to be deployed/updated in the background (e.g. via NeoFS ADM tool). +fschain_autodeploy: false # Optional flag to run auto-deployment procedure of the FS chain. By default, 'true'. # If set, must be 'true' or 'false'. nns: # Optional configuration of the NNS domains processed during the FS chain deployment diff --git a/pkg/innerring/config/fschain.go b/pkg/innerring/config/fschain.go index 2e84a6a2f2..91f75192e1 100644 --- a/pkg/innerring/config/fschain.go +++ b/pkg/innerring/config/fschain.go @@ -8,9 +8,10 @@ import ( // Chain configures settings of FS chain. type Chain struct { - BasicChain `mapstructure:",squash"` - Validators keys.PublicKeys `mapstructure:"validators"` - Consensus Consensus `mapstructure:"consensus"` + BasicChain `mapstructure:",squash"` + Validators keys.PublicKeys `mapstructure:"validators"` + Consensus Consensus `mapstructure:"consensus"` + DisableAutodeploy bool `mapstructure:"disable_autodeploy"` } // Consensus configures Blockchain. All required fields must be set. Specified diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 9f03147817..9c73b6740b 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -418,6 +418,15 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< serveMetrics(server, cfg) + // TODO: remove deprecated 'fschain_autodeploy' config option in future release + if cfg.IsSet("fschain_autodeploy") { + log.Warn("configuration option 'fschain_autodeploy' is deprecated, use 'fschain.disable_autodeploy' with the opposite value instead") + if cfg.IsSet("fschain.disable_autodeploy") { + return nil, fmt.Errorf("'fschain_autodeploy' and 'fschain.disable_autodeploy' set simultaneously") + } + cfg.FSChain.DisableAutodeploy = !cfg.FSChainAutodeploy + } + var localWSClient *rpcclient.WSClient // set if isLocalConsensus only // create FS chain client @@ -472,7 +481,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< fsChainOpts[1] = client.WithLogger(log) fsChainOpts[2] = client.WithSingleClient(localWSClient) - if !cfg.FSChainAutodeploy { + if cfg.FSChain.DisableAutodeploy { fsChainOpts = append(fsChainOpts, client.WithAutoFSChainScope()) } @@ -488,7 +497,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< // fallback to the pure RPC architecture fsChainParams.key = server.key - fsChainParams.withAutoFSChainScope = !cfg.FSChainAutodeploy + fsChainParams.withAutoFSChainScope = cfg.FSChain.DisableAutodeploy server.fsChainClient, err = server.createClient(ctx, fsChainParams, errChan) if err != nil { @@ -496,7 +505,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< } } - if cfg.FSChainAutodeploy { + if !cfg.FSChain.DisableAutodeploy { log.Info("auto-deployment configured, initializing FS chain...") var fschain *fsChain From 8022633ca85f17779bfef05c21813897a1f95c43 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Tue, 7 Oct 2025 19:04:25 +0300 Subject: [PATCH 3/6] ir: move `without_mainnet` into `mainnet.enabled` `mainnet.enabled` IR configuration, which inverts the value of the `without_mainnet` option. By default, mainnet is disabled now. Ref #3362. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 7 +++++-- cmd/neofs-ir/defaults_test.go | 12 +++++++----- cmd/neofs-ir/validate_test.go | 17 ++++++++++------- config/example/ir.env | 1 + config/example/ir.yaml | 2 ++ pkg/innerring/config/config.go | 8 +++++++- pkg/innerring/innerring.go | 12 ++++++++++-- 7 files changed, 42 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e48dab754..11cb1d2a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,16 +9,19 @@ Changelog for NeoFS Node ### Changed - Move `fschain_autodeploy` into `fschain.disable_autodeploy` in IR config (#3619) +- Move `without_mainnet` into `mainnet.enabled` in IR config (#3619) ### Removed ### Updated ### Updating from v0.49.0 -Use IR configuration option: +Use IR configuration options: - `fschain.disable_autodeploy` instead of deprecated `fschain_autodeploy` with reverted value, by default autodeploy is enabled now; -Old option is still supported but will be removed in future releases. +- `mainnet.enabled` instead of deprecated `without_mainnet` with reverted value, +by default mainnet is disabled now; +Old options are still supported but will be removed in future releases. ## [0.49.0] - 2025-10-06 - Dochodo diff --git a/cmd/neofs-ir/defaults_test.go b/cmd/neofs-ir/defaults_test.go index 04861a9725..4cc519dc6e 100644 --- a/cmd/neofs-ir/defaults_test.go +++ b/cmd/neofs-ir/defaults_test.go @@ -30,10 +30,13 @@ func TestValidateDefaultConfig(t *testing.T) { Validators: keys.PublicKeys{}, }, NNS: config.NNS{SystemEmail: ""}, - Mainnet: config.BasicChain{ - DialTimeout: 60000000000, - ReconnectionsNumber: 5, - ReconnectionsDelay: 5000000000, + Mainnet: config.Mainnet{ + Enabled: false, + BasicChain: config.BasicChain{ + DialTimeout: 60000000000, + ReconnectionsNumber: 5, + ReconnectionsDelay: 5000000000, + }, }, Control: config.Control{ AuthorizedKeys: keys.PublicKeys{}, @@ -45,7 +48,6 @@ func TestValidateDefaultConfig(t *testing.T) { Path: ".neofs-ir-state", }, }, - Fee: config.Fee{MainChain: 50000000}, Timers: config.Timers{ CollectBasicIncome: config.BasicTimer{Mul: 1, Div: 2}, }, diff --git a/cmd/neofs-ir/validate_test.go b/cmd/neofs-ir/validate_test.go index a796dc217a..3ca423c46f 100644 --- a/cmd/neofs-ir/validate_test.go +++ b/cmd/neofs-ir/validate_test.go @@ -252,13 +252,16 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { NNS: config.NNS{ SystemEmail: "usr@domain.io", }, - Mainnet: config.BasicChain{ - DialTimeout: time.Minute, - ReconnectionsNumber: 5, - ReconnectionsDelay: 5 * time.Second, - Endpoints: []string{ - "wss://mainchain1.fs.neo.org:30333/ws", - "wss://mainchain.fs.neo.org:30333/ws", + Mainnet: config.Mainnet{ + Enabled: false, + BasicChain: config.BasicChain{ + DialTimeout: time.Minute, + ReconnectionsNumber: 5, + ReconnectionsDelay: 5 * time.Second, + Endpoints: []string{ + "wss://mainchain1.fs.neo.org:30333/ws", + "wss://mainchain.fs.neo.org:30333/ws", + }, }, }, Control: config.Control{ diff --git a/config/example/ir.env b/config/example/ir.env index 458dc2b214..b2eab5f9ff 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -15,6 +15,7 @@ NEOFS_IR_FSCHAIN_RECONNECTIONS_DELAY=5s NEOFS_IR_FSCHAIN_ENDPOINTS="wss://sidechain1.fs.neo.org:30333/ws wss://sidechain2.fs.neo.org:30333/ws" NEOFS_IR_FSCHAIN_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170" +NEOFS_IR_MAINNET_ENABLED=false NEOFS_IR_MAINNET_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 NEOFS_IR_MAINNET_RECONNECTIONS_DELAY=5s diff --git a/config/example/ir.yaml b/config/example/ir.yaml index d552b5758d..a5372202f5 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -118,6 +118,8 @@ nns: # Optional configuration of the NNS domains processed during the FS chain d # Defaults to 'nonexistent@nspcc.io' mainnet: + enabled: false # Enable connection to mainchain; by default, 'false', run application in single chain environment + # without mainchain; value revert deprecated 'without_mainnet' dial_timeout: 1m # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 3ff915c096..d787f42bb7 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -22,7 +22,7 @@ type Config struct { NNS NNS `mapstructure:"nns"` - Mainnet BasicChain `mapstructure:"mainnet"` + Mainnet Mainnet `mapstructure:"mainnet"` Control Control `mapstructure:"control"` @@ -131,6 +131,12 @@ type Experimental struct { ChainMetaData bool `mapstructure:"chain_meta_data"` } +// Mainnet configures mainnet chain settings. +type Mainnet struct { + Enabled bool `mapstructure:"enabled"` + BasicChain `mapstructure:",squash"` +} + // IsSet checks if the key is set in the config. func (c *Config) IsSet(key string) bool { _, ok := c.isSet[key] diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 9c73b6740b..b2d9a20524 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -582,7 +582,15 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< return nil, err } - server.withoutMainNet = cfg.WithoutMainnet + // TODO: remove deprecated 'without_mainnet' config option in future release + if cfg.IsSet("without_mainnet") { + log.Warn("configuration option 'without_mainnet' is deprecated, use 'mainnet.enabled' with the reverted value instead") + if cfg.IsSet("mainnet.enabled") { + return nil, fmt.Errorf("'without_mainnet' and 'mainnet.enabled' set simultaneously") + } + cfg.Mainnet.Enabled = !cfg.WithoutMainnet + } + server.withoutMainNet = !cfg.Mainnet.Enabled if server.withoutMainNet { // This works as long as event Listener starts listening loop once, @@ -594,7 +602,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< mainnetChain := fsChainParams mainnetChain.withAutoFSChainScope = false mainnetChain.name = mainnetPrefix - mainnetChain.cfg = &cfg.Mainnet + mainnetChain.cfg = &cfg.Mainnet.BasicChain mainnetChain.from, err = server.persistate.UInt32(persistateMainChainLastBlockKey) if err != nil { From a88693c39a72cf6a48f349304e1c77d774c8dfb4 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Tue, 7 Oct 2025 23:39:24 +0300 Subject: [PATCH 4/6] ir: move `governance.disable` into `mainnet.disable_governance_sync` Ref #3362. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 2 ++ cmd/neofs-ir/defaults_test.go | 4 +++- cmd/neofs-ir/validate_test.go | 3 ++- config/example/ir.env | 1 + config/example/ir.yaml | 2 ++ pkg/innerring/config/config.go | 5 +++-- pkg/innerring/innerring.go | 11 ++++++++++- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11cb1d2a51..81ef211e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog for NeoFS Node ### Changed - Move `fschain_autodeploy` into `fschain.disable_autodeploy` in IR config (#3619) - Move `without_mainnet` into `mainnet.enabled` in IR config (#3619) +- Move `governance.disable` into `mainnet.disable_governance_sync` in IR config (#3619) ### Removed @@ -21,6 +22,7 @@ Use IR configuration options: by default autodeploy is enabled now; - `mainnet.enabled` instead of deprecated `without_mainnet` with reverted value, by default mainnet is disabled now; +- `mainnet.disable_governance_sync` instead of deprecated `governance.disable`; Old options are still supported but will be removed in future releases. ## [0.49.0] - 2025-10-06 - Dochodo diff --git a/cmd/neofs-ir/defaults_test.go b/cmd/neofs-ir/defaults_test.go index 4cc519dc6e..795a6b92a2 100644 --- a/cmd/neofs-ir/defaults_test.go +++ b/cmd/neofs-ir/defaults_test.go @@ -31,7 +31,8 @@ func TestValidateDefaultConfig(t *testing.T) { }, NNS: config.NNS{SystemEmail: ""}, Mainnet: config.Mainnet{ - Enabled: false, + Enabled: false, + DisableGovernanceSync: false, BasicChain: config.BasicChain{ DialTimeout: 60000000000, ReconnectionsNumber: 5, @@ -48,6 +49,7 @@ func TestValidateDefaultConfig(t *testing.T) { Path: ".neofs-ir-state", }, }, + Fee: config.Fee{MainChain: 50000000}, Timers: config.Timers{ CollectBasicIncome: config.BasicTimer{Mul: 1, Div: 2}, }, diff --git a/cmd/neofs-ir/validate_test.go b/cmd/neofs-ir/validate_test.go index 3ca423c46f..9b763eb0b7 100644 --- a/cmd/neofs-ir/validate_test.go +++ b/cmd/neofs-ir/validate_test.go @@ -253,7 +253,8 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { SystemEmail: "usr@domain.io", }, Mainnet: config.Mainnet{ - Enabled: false, + Enabled: false, + DisableGovernanceSync: false, BasicChain: config.BasicChain{ DialTimeout: time.Minute, ReconnectionsNumber: 5, diff --git a/config/example/ir.env b/config/example/ir.env index b2eab5f9ff..b289dcde0c 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -16,6 +16,7 @@ NEOFS_IR_FSCHAIN_ENDPOINTS="wss://sidechain1.fs.neo.org:30333/ws wss://sidechain NEOFS_IR_FSCHAIN_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170" NEOFS_IR_MAINNET_ENABLED=false +NEOFS_IR_MAINNET_DISABLE_GOVERNANCE_SYNC=false NEOFS_IR_MAINNET_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 NEOFS_IR_MAINNET_RECONNECTIONS_DELAY=5s diff --git a/config/example/ir.yaml b/config/example/ir.yaml index a5372202f5..5a2d671236 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -120,6 +120,8 @@ nns: # Optional configuration of the NNS domains processed during the FS chain d mainnet: enabled: false # Enable connection to mainchain; by default, 'false', run application in single chain environment # without mainchain; value revert deprecated 'without_mainnet' + disable_governance_sync: false # Disable synchronization of sidechain committee and mainchain role management contract; + # ignore if mainchain is disabled; same as 'governance.disable' dial_timeout: 1m # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index d787f42bb7..8e52f206e7 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -133,8 +133,9 @@ type Experimental struct { // Mainnet configures mainnet chain settings. type Mainnet struct { - Enabled bool `mapstructure:"enabled"` - BasicChain `mapstructure:",squash"` + Enabled bool `mapstructure:"enabled"` + DisableGovernanceSync bool `mapstructure:"disable_governance_sync"` + BasicChain `mapstructure:",squash"` } // IsSet checks if the key is set in the config. diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index b2d9a20524..2089667462 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -730,7 +730,16 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< var alphaSync event.Handler - if server.withoutMainNet || cfg.Governance.Disable { + // TODO: remove deprecated 'governance.disable' config option in future release + if cfg.IsSet("governance.disable") { + log.Warn("configuration option 'governance.disable' is deprecated, use 'mainnet.disable_governance_sync' with the same value instead") + if cfg.IsSet("mainnet.disable_governance_sync") { + return nil, fmt.Errorf("'governance.disable' and 'mainnet.disable_governance_sync' set simultaneously") + } + cfg.Mainnet.DisableGovernanceSync = cfg.Governance.Disable + } + + if server.withoutMainNet || cfg.Mainnet.DisableGovernanceSync { alphaSync = func(event.Event) { log.Debug("alphabet keys sync is disabled") } From bd7eb070ae764a6b03c8bd14cff72226ebc8b0d9 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Tue, 7 Oct 2025 23:48:33 +0300 Subject: [PATCH 5/6] ir: move `fee.main_chain` into `mainnet.extra_fee` Ref #3362. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 2 ++ cmd/neofs-ir/defaults.go | 8 +++----- cmd/neofs-ir/defaults_test.go | 2 +- cmd/neofs-ir/validate_test.go | 1 + config/example/ir.env | 1 + config/example/ir.yaml | 2 ++ pkg/innerring/config/config.go | 5 +++-- pkg/innerring/innerring.go | 11 ++++++++++- 8 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81ef211e24..cee7b97997 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Changelog for NeoFS Node - Move `fschain_autodeploy` into `fschain.disable_autodeploy` in IR config (#3619) - Move `without_mainnet` into `mainnet.enabled` in IR config (#3619) - Move `governance.disable` into `mainnet.disable_governance_sync` in IR config (#3619) +- Move `fee.main_chain` into `mainnet.extra_fee` in IR config (#3619) ### Removed @@ -23,6 +24,7 @@ by default autodeploy is enabled now; - `mainnet.enabled` instead of deprecated `without_mainnet` with reverted value, by default mainnet is disabled now; - `mainnet.disable_governance_sync` instead of deprecated `governance.disable`; +- `mainnet.extra_fee` instead of deprecated `fee.main_chain`; Old options are still supported but will be removed in future releases. ## [0.49.0] - 2025-10-06 - Dochodo diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 81a43ee10e..5c08ab5597 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -92,6 +92,9 @@ func applyDefaults(cfg *irconfig.Config) { } // Mainnet defaults + if cfg.Mainnet.ExtraFee == 0 { + cfg.Mainnet.ExtraFee = 5000_0000 // 0.5 Fixed8 + } if cfg.Mainnet.DialTimeout == 0 { cfg.Mainnet.DialTimeout = time.Minute } @@ -146,11 +149,6 @@ func applyDefaults(cfg *irconfig.Config) { cfg.Indexer.CacheTimeout = 15 * time.Second } - // Fee defaults - if cfg.Fee.MainChain == 0 { - cfg.Fee.MainChain = 5000_0000 // 0.5 Fixed8 - } - // Control defaults if cfg.Control.AuthorizedKeys == nil { cfg.Control.AuthorizedKeys = keys.PublicKeys{} diff --git a/cmd/neofs-ir/defaults_test.go b/cmd/neofs-ir/defaults_test.go index 795a6b92a2..f60b3099fd 100644 --- a/cmd/neofs-ir/defaults_test.go +++ b/cmd/neofs-ir/defaults_test.go @@ -33,6 +33,7 @@ func TestValidateDefaultConfig(t *testing.T) { Mainnet: config.Mainnet{ Enabled: false, DisableGovernanceSync: false, + ExtraFee: 50000000, BasicChain: config.BasicChain{ DialTimeout: 60000000000, ReconnectionsNumber: 5, @@ -49,7 +50,6 @@ func TestValidateDefaultConfig(t *testing.T) { Path: ".neofs-ir-state", }, }, - Fee: config.Fee{MainChain: 50000000}, Timers: config.Timers{ CollectBasicIncome: config.BasicTimer{Mul: 1, Div: 2}, }, diff --git a/cmd/neofs-ir/validate_test.go b/cmd/neofs-ir/validate_test.go index 9b763eb0b7..eee9adcf14 100644 --- a/cmd/neofs-ir/validate_test.go +++ b/cmd/neofs-ir/validate_test.go @@ -255,6 +255,7 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { Mainnet: config.Mainnet{ Enabled: false, DisableGovernanceSync: false, + ExtraFee: 50000000, BasicChain: config.BasicChain{ DialTimeout: time.Minute, ReconnectionsNumber: 5, diff --git a/config/example/ir.env b/config/example/ir.env index b289dcde0c..97f3af07ba 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -17,6 +17,7 @@ NEOFS_IR_FSCHAIN_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7f NEOFS_IR_MAINNET_ENABLED=false NEOFS_IR_MAINNET_DISABLE_GOVERNANCE_SYNC=false +NEOFS_IR_MAINNET_EXTRA_FEE=50000000 NEOFS_IR_MAINNET_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 NEOFS_IR_MAINNET_RECONNECTIONS_DELAY=5s diff --git a/config/example/ir.yaml b/config/example/ir.yaml index 5a2d671236..bc274aa39f 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -122,6 +122,8 @@ mainnet: # without mainchain; value revert deprecated 'without_mainnet' disable_governance_sync: false # Disable synchronization of sidechain committee and mainchain role management contract; # ignore if mainchain is disabled; same as 'governance.disable' + extra_fee: 50000000 # Fixed8 value of extra GAS fee for mainchain contract invocation; ignore if notary is enabled in mainchain; + # same as 'fee.main_chain' dial_timeout: 1m # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 8e52f206e7..c3ac01f601 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -133,8 +133,9 @@ type Experimental struct { // Mainnet configures mainnet chain settings. type Mainnet struct { - Enabled bool `mapstructure:"enabled"` - DisableGovernanceSync bool `mapstructure:"disable_governance_sync"` + Enabled bool `mapstructure:"enabled"` + DisableGovernanceSync bool `mapstructure:"disable_governance_sync"` + ExtraFee int64 `mapstructure:"extra_fee"` BasicChain `mapstructure:",squash"` } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 2089667462..cb431c43e3 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -689,8 +689,17 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< return nil, err } + // TODO: remove deprecated 'fee.main_chain' config option in future release + if cfg.IsSet("fee.main_chain") { + log.Warn("configuration option 'fee.main_chain' is deprecated, use 'mainnet.extra_fee' with the same value instead") + if cfg.IsSet("mainnet.extra_fee") { + return nil, fmt.Errorf("'fee.main_chain' and 'mainnet.extra_fee' set simultaneously") + } + cfg.Mainnet.ExtraFee = cfg.Fee.MainChain + } + neofsCli, err := neofsClient.NewFromMorph(server.mainnetClient, server.contracts.neofs, - fixedn.Fixed8(cfg.Fee.MainChain), neofsClient.TryNotary(), neofsClient.AsAlphabet()) + fixedn.Fixed8(cfg.Mainnet.ExtraFee), neofsClient.TryNotary(), neofsClient.AsAlphabet()) if err != nil { return nil, err } From 0c9d9d1ec65020fdb75ac7630f00aa9d0528af48 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Tue, 7 Oct 2025 23:56:53 +0300 Subject: [PATCH 6/6] ir: move `contracts` into `mainnet.contracts` Closes #3362. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 2 ++ cmd/neofs-ir/defaults_test.go | 4 ++++ cmd/neofs-ir/validate_test.go | 4 ++++ config/example/ir.env | 2 ++ config/example/ir.yaml | 3 +++ pkg/innerring/config/config.go | 7 ++++--- pkg/innerring/innerring.go | 11 ++++++++++- 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee7b97997..2ef3c81b46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Changelog for NeoFS Node - Move `without_mainnet` into `mainnet.enabled` in IR config (#3619) - Move `governance.disable` into `mainnet.disable_governance_sync` in IR config (#3619) - Move `fee.main_chain` into `mainnet.extra_fee` in IR config (#3619) +- Move `contracts` into `mainnet.contracts` in IR config (#3619) ### Removed @@ -25,6 +26,7 @@ by default autodeploy is enabled now; by default mainnet is disabled now; - `mainnet.disable_governance_sync` instead of deprecated `governance.disable`; - `mainnet.extra_fee` instead of deprecated `fee.main_chain`; +- `mainnet.contracts` instead of deprecated `contracts`; Old options are still supported but will be removed in future releases. ## [0.49.0] - 2025-10-06 - Dochodo diff --git a/cmd/neofs-ir/defaults_test.go b/cmd/neofs-ir/defaults_test.go index f60b3099fd..6ee74c47d1 100644 --- a/cmd/neofs-ir/defaults_test.go +++ b/cmd/neofs-ir/defaults_test.go @@ -34,6 +34,10 @@ func TestValidateDefaultConfig(t *testing.T) { Enabled: false, DisableGovernanceSync: false, ExtraFee: 50000000, + Contracts: config.Contracts{ + NeoFS: "", + Processing: "", + }, BasicChain: config.BasicChain{ DialTimeout: 60000000000, ReconnectionsNumber: 5, diff --git a/cmd/neofs-ir/validate_test.go b/cmd/neofs-ir/validate_test.go index eee9adcf14..f92742d2a5 100644 --- a/cmd/neofs-ir/validate_test.go +++ b/cmd/neofs-ir/validate_test.go @@ -256,6 +256,10 @@ func TestCheckForUnknownFieldsExample(t *testing.T) { Enabled: false, DisableGovernanceSync: false, ExtraFee: 50000000, + Contracts: config.Contracts{ + NeoFS: "ee3dee6d05dc79c24a5b8f6985e10d68b7cacc62", + Processing: "597f5894867113a41e192801709c02497f611de8", + }, BasicChain: config.BasicChain{ DialTimeout: time.Minute, ReconnectionsNumber: 5, diff --git a/config/example/ir.env b/config/example/ir.env index 97f3af07ba..48bbae5b5c 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -18,6 +18,8 @@ NEOFS_IR_FSCHAIN_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7f NEOFS_IR_MAINNET_ENABLED=false NEOFS_IR_MAINNET_DISABLE_GOVERNANCE_SYNC=false NEOFS_IR_MAINNET_EXTRA_FEE=50000000 +NEOFS_IR_MAINNET_CONTRACTS_NEOFS=ee3dee6d05dc79c24a5b8f6985e10d68b7cacc62 +NEOFS_IR_MAINNET_CONTRACTS_PROCESSING=597f5894867113a41e192801709c02497f611de8MAINNET_ NEOFS_IR_MAINNET_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 NEOFS_IR_MAINNET_RECONNECTIONS_DELAY=5s diff --git a/config/example/ir.yaml b/config/example/ir.yaml index bc274aa39f..e2ac741786 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -124,6 +124,9 @@ mainnet: # ignore if mainchain is disabled; same as 'governance.disable' extra_fee: 50000000 # Fixed8 value of extra GAS fee for mainchain contract invocation; ignore if notary is enabled in mainchain; # same as 'fee.main_chain' + contracts: # same as 'contracts' + neofs: ee3dee6d05dc79c24a5b8f6985e10d68b7cacc62 # Address of NeoFS contract in mainchain; ignore if mainchain is disabled + processing: 597f5894867113a41e192801709c02497f611de8 # Address of processing contract in mainchain; ignore if mainchain is disabled dial_timeout: 1m # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index c3ac01f601..78042f8bd9 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -133,9 +133,10 @@ type Experimental struct { // Mainnet configures mainnet chain settings. type Mainnet struct { - Enabled bool `mapstructure:"enabled"` - DisableGovernanceSync bool `mapstructure:"disable_governance_sync"` - ExtraFee int64 `mapstructure:"extra_fee"` + Enabled bool `mapstructure:"enabled"` + DisableGovernanceSync bool `mapstructure:"disable_governance_sync"` + ExtraFee int64 `mapstructure:"extra_fee"` + Contracts Contracts `mapstructure:"contracts"` BasicChain `mapstructure:",squash"` } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index cb431c43e3..32057f2c5a 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -629,9 +629,18 @@ func New(ctx context.Context, log *zap.Logger, cfg *config.Config, errChan chan< zap.Bool("mainchain_enabled", !server.mainNotaryConfig.disabled), ) + // TODO: remove deprecated 'contracts' config option in future release + if cfg.IsSet("contracts") { + log.Warn("configuration option 'contracts' is deprecated, use 'mainnet.contracts' with the same values instead") + if cfg.IsSet("mainnet.contracts") { + return nil, fmt.Errorf("'contracts' and 'mainnet.contracts' set simultaneously") + } + cfg.Mainnet.Contracts = cfg.Contracts + } + // get all script hashes of contracts server.contracts, err = initContracts(ctx, log, - &cfg.Contracts, + &cfg.Mainnet.Contracts, server.fsChainClient, server.withoutMainNet, server.mainNotaryConfig.disabled,