Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,26 @@ Changelog for NeoFS Node
### Fixed

### 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)
- Move `fee.main_chain` into `mainnet.extra_fee` in IR config (#3619)
- Move `contracts` into `mainnet.contracts` in IR config (#3619)

### Removed

### Updated

### Updating from v0.49.0
Use IR configuration options:
- `fschain.disable_autodeploy` instead of deprecated `fschain_autodeploy` with reverted value,
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`;
- `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

Expand Down
145 changes: 99 additions & 46 deletions cmd/neofs-ir/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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") {
Expand All @@ -43,61 +42,115 @@ 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")

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{})
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("mainnet.dial_timeout", time.Minute)
cfg.SetDefault("mainnet.reconnections_number", 5)
cfg.SetDefault("mainnet.reconnections_delay", 5*time.Second)
// Pprof defaults
if cfg.Pprof.Address == "" {
cfg.Pprof.Address = "localhost:6060"
}
if cfg.Pprof.ShutdownTimeout == 0 {
cfg.Pprof.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
// Prometheus defaults
if cfg.Prometheus.Address == "" {
cfg.Prometheus.Address = "localhost:9090"
}
if cfg.Prometheus.ShutdownTimeout == 0 {
cfg.Prometheus.ShutdownTimeout = 30 * time.Second
}

cfg.SetDefault("timers.collect_basic_income.mul", 1)
cfg.SetDefault("timers.collect_basic_income.div", 2)
// Node defaults
if cfg.Node.PersistentState.Path == "" {
cfg.Node.PersistentState.Path = ".neofs-ir-state"
}

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")
// 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("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)
// 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
}
if cfg.Mainnet.ReconnectionsNumber == 0 {
cfg.Mainnet.ReconnectionsNumber = 5
}
if cfg.Mainnet.ReconnectionsDelay == 0 {
cfg.Mainnet.ReconnectionsDelay = 5 * time.Second
}

cfg.SetDefault("settlement.basic_income_rate", 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("indexer.cache_timeout", 15*time.Second)
// 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
}

// extra fee values for working mode without notary contract
cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8
// 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
}

cfg.SetDefault("control.authorized_keys", []string{})
cfg.SetDefault("control.grpc.endpoint", "")
// Indexer defaults
if cfg.Indexer.CacheTimeout == 0 {
cfg.Indexer.CacheTimeout = 15 * time.Second
}

cfg.SetDefault("governance.disable", false)
// Control defaults
if cfg.Control.AuthorizedKeys == nil {
cfg.Control.AuthorizedKeys = keys.PublicKeys{}
}
}
24 changes: 16 additions & 8 deletions cmd/neofs-ir/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ func TestValidateDefaultConfig(t *testing.T) {
ReconnectionsNumber: 5,
ReconnectionsDelay: 5000000000,
},
Validators: keys.PublicKeys{},
DisableAutodeploy: false,
Validators: keys.PublicKeys{},
},
FSChainAutodeploy: false,
NNS: config.NNS{SystemEmail: ""},
Mainnet: config.BasicChain{
DialTimeout: 60000000000,
ReconnectionsNumber: 5,
ReconnectionsDelay: 5000000000,
NNS: config.NNS{SystemEmail: ""},
Mainnet: config.Mainnet{
Enabled: false,
DisableGovernanceSync: false,
ExtraFee: 50000000,
Contracts: config.Contracts{
NeoFS: "",
Processing: "",
},
BasicChain: config.BasicChain{
DialTimeout: 60000000000,
ReconnectionsNumber: 5,
ReconnectionsDelay: 5000000000,
},
},
Control: config.Control{
AuthorizedKeys: keys.PublicKeys{},
Expand All @@ -45,7 +54,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},
},
Expand Down
27 changes: 18 additions & 9 deletions cmd/neofs-ir/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -248,17 +249,25 @@ func TestCheckForUnknownFieldsExample(t *testing.T) {
RemoveUntraceableBlocks: false,
P2PNotaryRequestPayloadPoolSize: 100,
}},
FSChainAutodeploy: true,
NNS: config.NNS{
SystemEmail: "[email protected]",
},
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,
DisableGovernanceSync: false,
ExtraFee: 50000000,
Contracts: config.Contracts{
NeoFS: "ee3dee6d05dc79c24a5b8f6985e10d68b7cacc62",
Processing: "597f5894867113a41e192801709c02497f611de8",
},
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{
Expand Down
6 changes: 6 additions & 0 deletions config/example/ir.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ 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
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_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
Expand Down
13 changes: 11 additions & 2 deletions config/example/ir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -109,15 +110,23 @@ 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
system_email: [email protected] # Optional e-mail to be assigned to the registered NNS domains.
# Defaults to '[email protected]'

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'
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
Expand Down
11 changes: 10 additions & 1 deletion pkg/innerring/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Config struct {

NNS NNS `mapstructure:"nns"`

Mainnet BasicChain `mapstructure:"mainnet"`
Mainnet Mainnet `mapstructure:"mainnet"`

Control Control `mapstructure:"control"`

Expand Down Expand Up @@ -131,6 +131,15 @@ type Experimental struct {
ChainMetaData bool `mapstructure:"chain_meta_data"`
}

// Mainnet configures mainnet chain settings.
type Mainnet struct {
Enabled bool `mapstructure:"enabled"`
DisableGovernanceSync bool `mapstructure:"disable_governance_sync"`
ExtraFee int64 `mapstructure:"extra_fee"`
Contracts Contracts `mapstructure:"contracts"`
BasicChain `mapstructure:",squash"`
}

// IsSet checks if the key is set in the config.
func (c *Config) IsSet(key string) bool {
_, ok := c.isSet[key]
Expand Down
7 changes: 4 additions & 3 deletions pkg/innerring/config/fschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading