diff --git a/CHANGELOG.md b/CHANGELOG.md index 149197963c..7f0ab12dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ attribute, which is used for container domain name in NNS contracts (#2954) - EACL is no longer considered for system role (#2972) - Deprecate peapod substorage (#3013) - Node does not stop trying to PUT an object if there are more PUT tasks than configured (#3027) +- `morph` configuration section renamed to `fschain` both in IR and SN (#3028) ### Removed - Support for node.key configuration (#2959) @@ -75,6 +76,10 @@ introduced in version 0.22.3 and support for binary keys was removed from other components in 0.33.0 and 0.37.0. Please migrate to wallets (see 0.37.0 notes) if you've not done it previously. +The section `morph` in the config has been renamed to `fschain`. This version +still supports the old section name, but this compatibility code will be removed +in the next release. Please rename `morph` to `fschain` in your configuration files. + To migrate data from Peapods to FSTree: ```shell $ peapod-to-fstree -config diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 9a1dfbefd8..7aec4fac50 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -61,6 +61,10 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("morph.reconnections_number", 5) cfg.SetDefault("morph.reconnections_delay", 5*time.Second) cfg.SetDefault("morph.validators", []string{}) + 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{}) cfg.SetDefault("mainnet.dial_timeout", time.Minute) cfg.SetDefault("mainnet.reconnections_number", 5) diff --git a/cmd/neofs-ir/internal/validate/config.go b/cmd/neofs-ir/internal/validate/config.go index e8dcb46bce..77438dd729 100644 --- a/cmd/neofs-ir/internal/validate/config.go +++ b/cmd/neofs-ir/internal/validate/config.go @@ -71,6 +71,61 @@ type validConfig struct { } `mapstructure:"consensus"` } `mapstructure:"morph"` + FSChain struct { + DialTimeout time.Duration `mapstructure:"dial_timeout"` + ReconnectionsNumber int `mapstructure:"reconnections_number"` + ReconnectionsDelay time.Duration `mapstructure:"reconnections_delay"` + Endpoints []string `mapstructure:"endpoints"` + Validators []string `mapstructure:"validators"` + Consensus struct { + Magic uint32 `mapstructure:"magic"` + Committee []string `mapstructure:"committee"` + + Storage struct { + Type string `mapstructure:"type"` + Path string `mapstructure:"path"` + } `mapstructure:"storage"` + + TimePerBlock time.Duration `mapstructure:"time_per_block"` + MaxTraceableBlocks uint32 `mapstructure:"max_traceable_blocks"` + SeedNodes []string `mapstructure:"seed_nodes"` + + Hardforks struct { + Name map[string]uint32 `mapstructure:",remain" prefix:""` + } `mapstructure:"hardforks"` + + ValidatorsHistory struct { + Height map[string]int `mapstructure:",remain" prefix:""` + } `mapstructure:"validators_history"` + + RPC struct { + Listen []string `mapstructure:"listen"` + TLS struct { + Enabled bool `mapstructure:"enabled"` + Listen []string `mapstructure:"listen"` + CertFile string `mapstructure:"cert_file"` + KeyFile string `mapstructure:"key_file"` + } `mapstructure:"tls"` + } `mapstructure:"rpc"` + + P2P struct { + DialTimeout time.Duration `mapstructure:"dial_timeout"` + ProtoTickInterval time.Duration `mapstructure:"proto_tick_interval"` + Listen []string `mapstructure:"listen"` + Peers struct { + Min int `mapstructure:"min"` + Max int `mapstructure:"max"` + Attempts int `mapstructure:"attempts"` + } `mapstructure:"peers"` + Ping struct { + Interval time.Duration `mapstructure:"interval"` + Timeout time.Duration `mapstructure:"timeout"` + } `mapstructure:"ping"` + } `mapstructure:"p2p"` + SetRolesInGenesis bool `mapstructure:"set_roles_in_genesis"` + } `mapstructure:"consensus"` + } `mapstructure:"fschain"` + FSChainAutodeploy bool `mapstructure:"fschain_autodeploy"` NNS struct { diff --git a/cmd/neofs-ir/internal/validate/validate_test.go b/cmd/neofs-ir/internal/validate/validate_test.go index 5bf95660f6..84e29958af 100644 --- a/cmd/neofs-ir/internal/validate/validate_test.go +++ b/cmd/neofs-ir/internal/validate/validate_test.go @@ -19,7 +19,7 @@ func TestCheckForUnknownFields(t *testing.T) { { name: "with all right fields", config: ` -morph: +fschain: dial_timeout: 1m reconnections_number: 5 reconnections_delay: 5s @@ -37,7 +37,7 @@ morph: - 02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62 storage: type: boltdb - path: ./db/morph.bolt + path: ./db/fschain.bolt time_per_block: 1s max_traceable_blocks: 11520 seed_nodes: @@ -78,9 +78,9 @@ morph: wantErr: false, }, { - name: "unknown morph.consensus.timeout", + name: "unknown fschain.consensus.timeout", config: ` -morph: +fschain: consensus: p2p: ping: @@ -91,20 +91,20 @@ morph: wantErr: true, }, { - name: "morph.consensus.storage.type expected type string", + name: "fschain.consensus.storage.type expected type string", config: ` -morph: +fschain: consensus: storage: type: - path: ./db/morph.bolt + path: ./db/fschain.bolt `, wantErr: true, }, { - name: "unknown field morph.attr", + name: "unknown field fschain.attr", config: ` -morph: +fschain: dial_timeout: 1m reconnections_number: 5 attr: 123 diff --git a/config/example/ir.env b/config/example/ir.env index 422a2dc05a..28b754362c 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -7,11 +7,11 @@ NEOFS_IR_WALLET_PASSWORD=secret NEOFS_IR_WITHOUT_MAINNET=false -NEOFS_IR_MORPH_DIAL_TIMEOUT=1m -NEOFS_IR_MORPH_RECONNECTIONS_NUMBER=5 -NEOFS_IR_MORPH_RECONNECTIONS_DELAY=5s -NEOFS_IR_MORPH_ENDPOINTS="wss://sidechain1.fs.neo.org:30333/ws wss://sidechain2.fs.neo.org:30333/ws" -NEOFS_IR_MORPH_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170" +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_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 diff --git a/config/example/ir.yaml b/config/example/ir.yaml index b729859203..2810970326 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -11,7 +11,7 @@ wallet: without_mainnet: false # Run application in single chain environment without mainchain -morph: +fschain: 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 diff --git a/pkg/innerring/config.go b/pkg/innerring/config.go index 1c23861486..0d4b7ba3c5 100644 --- a/pkg/innerring/config.go +++ b/pkg/innerring/config.go @@ -20,8 +20,8 @@ import ( ) // Various configuration paths. -const ( - cfgPathFSChain = "morph" +var ( + cfgPathFSChain = "fschain" cfgPathFSChainRPCEndpoints = cfgPathFSChain + ".endpoints" cfgPathFSChainLocalConsensus = cfgPathFSChain + ".consensus" cfgPathFSChainValidators = cfgPathFSChain + ".validators" @@ -69,15 +69,15 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co } c.NetworkMagic = netmode.Magic(_uint) - const storageSection = cfgPathFSChainLocalConsensus + ".storage" + var storageSection = cfgPathFSChainLocalConsensus + ".storage" if !v.IsSet(storageSection) { return c, fmt.Errorf("missing storage section '%s'", storageSection) } - const storageTypeKey = storageSection + ".type" + var storageTypeKey = storageSection + ".type" if !v.IsSet(storageTypeKey) { return c, fmt.Errorf("missing storage type '%s'", storageTypeKey) } - const storagePathKey = storageSection + ".path" + var storagePathKey = storageSection + ".path" switch typ := v.GetString(storageTypeKey); typ { default: return c, fmt.Errorf("unsupported storage type '%s': '%s'", storageTypeKey, typ) @@ -95,7 +95,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co c.Storage = blockchain.InMemory() } - const committeeKey = cfgPathFSChainLocalConsensus + ".committee" + var committeeKey = cfgPathFSChainLocalConsensus + ".committee" c.Committee, err = parseConfigPublicKeys(v, committeeKey, "committee members") if err != nil { return c, err @@ -119,7 +119,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co return c, err } - const hardForksKey = cfgPathFSChainLocalConsensus + ".hardforks" + var hardForksKey = cfgPathFSChainLocalConsensus + ".hardforks" if v.IsSet(hardForksKey) { c.HardForks, err = parseConfigMapUint32(v, hardForksKey, "hard forks", math.MaxUint32) if err != nil { @@ -127,7 +127,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co } } - const validatorsHistoryKey = cfgPathFSChainLocalConsensus + ".validators_history" + var validatorsHistoryKey = cfgPathFSChainLocalConsensus + ".validators_history" if v.IsSet(validatorsHistoryKey) { c.ValidatorsHistory = make(map[uint32]uint32) committeeSize := uint64(c.Committee.Len()) @@ -157,14 +157,14 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co } } - const rpcSection = cfgPathFSChainLocalConsensus + ".rpc" + var rpcSection = cfgPathFSChainLocalConsensus + ".rpc" if v.IsSet(rpcSection) { c.RPC.Addresses, err = parseConfigAddressesTCP(v, rpcSection+".listen", "network addresses to listen insecure Neo RPC on", rpcDefaultListenPort) if err != nil && !errors.Is(err, errMissingConfig) { return c, err } - const rpcTLSSection = rpcSection + ".tls" + var rpcTLSSection = rpcSection + ".tls" if v.GetBool(rpcTLSSection + ".enabled") { c.RPC.TLSConfig.Enabled = true @@ -173,13 +173,13 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co return c, err } - const certCfgKey = rpcTLSSection + ".cert_file" + var certCfgKey = rpcTLSSection + ".cert_file" c.RPC.TLSConfig.CertFile = v.GetString(certCfgKey) if strings.TrimSpace(c.RPC.TLSConfig.CertFile) == "" { return c, fmt.Errorf("RPC TLS setup is enabled but no certificate ('%s') is provided", certCfgKey) } - const keyCfgKey = rpcTLSSection + ".key_file" + var keyCfgKey = rpcTLSSection + ".key_file" c.RPC.TLSConfig.KeyFile = v.GetString(keyCfgKey) if strings.TrimSpace(c.RPC.TLSConfig.KeyFile) == "" { return c, fmt.Errorf("RPC TLS setup is enabled but no key ('%s') is provided", keyCfgKey) @@ -188,7 +188,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co } minPeersConfigured := false - const p2pSection = cfgPathFSChainLocalConsensus + ".p2p" + var p2pSection = cfgPathFSChainLocalConsensus + ".p2p" if v.IsSet(p2pSection) { c.P2P.DialTimeout, err = parseConfigDurationPositive(v, p2pSection+".dial_timeout", "P2P dial timeout") if err != nil && !errors.Is(err, errMissingConfig) { @@ -202,7 +202,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co if err != nil && !errors.Is(err, errMissingConfig) { return c, err } - const p2pPeersSection = p2pSection + ".peers" + var p2pPeersSection = p2pSection + ".peers" if v.IsSet(p2pPeersSection) { minPeers, err := parseConfigUint64Max(v, p2pPeersSection+".min", "minimum number of P2P peers", math.MaxInt32) if err != nil { @@ -226,7 +226,7 @@ func parseBlockchainConfig(v *viper.Viper, _logger *zap.Logger) (c blockchain.Co } c.P2P.AttemptConnPeers = uint(attemptConnPeers) } - const pingSection = p2pSection + ".ping" + var pingSection = p2pSection + ".ping" if v.IsSet(pingSection) { c.P2P.Ping.Interval, err = parseConfigDurationPositive(v, pingSection+".interval", "P2P ping interval") if err != nil { diff --git a/pkg/innerring/config_test.go b/pkg/innerring/config_test.go index cc494ceb59..d22272176f 100644 --- a/pkg/innerring/config_test.go +++ b/pkg/innerring/config_test.go @@ -17,7 +17,7 @@ import ( // YAML configuration of the IR consensus with all required fields. const validBlockchainConfigMinimal = ` -morph: +fschain: consensus: magic: 15405 committee: @@ -231,7 +231,7 @@ func TestParseBlockchainConfig(t *testing.T) { "storage.type", } { v := newValidBlockchainConfig(t, !fullConfig) - resetConfig(t, v, "morph.consensus."+requiredKey) + resetConfig(t, v, "fschain.consensus."+requiredKey) _, err := parseBlockchainConfig(v, _logger) require.Error(t, err, requiredKey) } @@ -239,7 +239,7 @@ func TestParseBlockchainConfig(t *testing.T) { t.Run("invalid", func(t *testing.T) { v := newValidBlockchainConfig(t, fullConfig) - resetConfig(t, v, "morph.consensus") + resetConfig(t, v, "fschain.consensus") _, err := parseBlockchainConfig(v, _logger) require.Error(t, err) @@ -311,7 +311,7 @@ func TestParseBlockchainConfig(t *testing.T) { key := kvPair.key val := kvPair.val - v.Set("morph.consensus."+key, val) + v.Set("fschain.consensus."+key, val) reportMsg = append(reportMsg, fmt.Sprintf("%s=%v", key, val)) } @@ -325,28 +325,28 @@ func TestParseBlockchainConfig(t *testing.T) { v := newValidBlockchainConfig(t, fullConfig) const path = "path/to/db" - v.Set("morph.consensus.storage.path", path) - v.Set("morph.consensus.storage.type", "boltdb") + v.Set("fschain.consensus.storage.path", path) + v.Set("fschain.consensus.storage.type", "boltdb") c, err := parseBlockchainConfig(v, _logger) require.NoError(t, err) require.Equal(t, blockchain.BoltDB(path), c.Storage) - resetConfig(t, v, "morph.consensus.storage.path") + resetConfig(t, v, "fschain.consensus.storage.path") _, err = parseBlockchainConfig(v, _logger) require.Error(t, err) - v.Set("morph.consensus.storage.path", path) - v.Set("morph.consensus.storage.type", "leveldb") + v.Set("fschain.consensus.storage.path", path) + v.Set("fschain.consensus.storage.type", "leveldb") c, err = parseBlockchainConfig(v, _logger) require.NoError(t, err) require.Equal(t, blockchain.LevelDB(path), c.Storage) - resetConfig(t, v, "morph.consensus.storage.path") + resetConfig(t, v, "fschain.consensus.storage.path") _, err = parseBlockchainConfig(v, _logger) require.Error(t, err) // no path needed - v.Set("morph.consensus.storage.type", "inmemory") + v.Set("fschain.consensus.storage.type", "inmemory") c, err = parseBlockchainConfig(v, _logger) require.NoError(t, err) require.Equal(t, blockchain.InMemory(), c.Storage) @@ -361,8 +361,8 @@ func TestIsLocalConsensusMode(t *testing.T) { v.SetEnvPrefix("neofs_ir") v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) - const envKeyEndpoints = "NEOFS_IR_MORPH_ENDPOINTS" - const envKeyConsensus = "NEOFS_IR_MORPH_CONSENSUS" + const envKeyEndpoints = "NEOFS_IR_FSCHAIN_ENDPOINTS" + const envKeyConsensus = "NEOFS_IR_FSCHAIN_CONSENSUS" var err error for _, tc := range []struct { @@ -425,9 +425,9 @@ func TestIsLocalConsensusMode(t *testing.T) { v := viper.New() v.SetConfigType("yaml") err := v.ReadConfig(strings.NewReader(` -morph: +fschain: endpoints: - - ws://morph-chain:30333/ws + - ws://fs-chain:30333/ws `)) require.NoError(t, err) @@ -435,12 +435,12 @@ morph: require.NoError(t, err) require.False(t, res) - resetConfig(t, v, "morph.endpoints") + resetConfig(t, v, "fschain.endpoints") _, err = isLocalConsensusMode(v) require.Error(t, err) - v.Set("morph.consensus", "any") + v.Set("fschain.consensus", "any") res, err = isLocalConsensusMode(v) require.NoError(t, err) @@ -596,19 +596,19 @@ func TestP2PMinPeers(t *testing.T) { } v := newValidBlockchainConfig(t, true) - v.Set("morph.consensus.p2p.peers.min", 123) + v.Set("fschain.consensus.p2p.peers.min", 123) assert(t, v, 123) t.Run("explicit zero", func(t *testing.T) { v := newValidBlockchainConfig(t, false) - v.Set("morph.consensus.p2p.peers.min", 0) + v.Set("fschain.consensus.p2p.peers.min", 0) assert(t, v, 0) }) t.Run("default", func(t *testing.T) { assertDefault := func(t testing.TB, v *viper.Viper) { setCommitteeN := func(n int) { - v.Set("morph.consensus.committee", commiteeN(t, n)) - resetConfig(t, v, "morph.consensus.validators_history") // checked against committee size + v.Set("fschain.consensus.committee", commiteeN(t, n)) + resetConfig(t, v, "fschain.consensus.validators_history") // checked against committee size } setCommitteeN(4) assert(t, v, 2) @@ -619,19 +619,19 @@ func TestP2PMinPeers(t *testing.T) { } t.Run("missing P2P section", func(t *testing.T) { v := newValidBlockchainConfig(t, true) - resetConfig(t, v, "morph.consensus.p2p") + resetConfig(t, v, "fschain.consensus.p2p") assertDefault(t, v) }) t.Run("missing peers section", func(t *testing.T) { v := newValidBlockchainConfig(t, true) - resetConfig(t, v, "morph.consensus.p2p.peers") - require.True(t, v.IsSet("morph.consensus.p2p")) + resetConfig(t, v, "fschain.consensus.p2p.peers") + require.True(t, v.IsSet("fschain.consensus.p2p")) assertDefault(t, v) }) t.Run("missing config itself", func(t *testing.T) { v := newValidBlockchainConfig(t, true) - resetConfig(t, v, "morph.consensus.p2p.peers.min") - require.True(t, v.IsSet("morph.consensus.p2p.peers")) + resetConfig(t, v, "fschain.consensus.p2p.peers.min") + require.True(t, v.IsSet("fschain.consensus.p2p.peers")) assertDefault(t, v) }) }) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 5de1b17b5e..51a7e014b5 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -146,8 +146,9 @@ type ( ) const ( - morphPrefix = "morph" - mainnetPrefix = "mainnet" + deprecatedMorphPrefix = "morph" + fsChainPrefix = "fschain" + mainnetPrefix = "mainnet" // extra blocks to overlap two deposits, we do that to make sure that // there won't be any blocks without deposited assets in notary contract; @@ -321,16 +322,46 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- } server.registerCloser(server.persistate.Close) + fromDeprectedSidechanBlock, err := server.persistate.UInt32(persistateDeprecatedSidechainLastBlockKey) + if err != nil { + fromDeprectedSidechanBlock = 0 + } fromFSChainBlock, err := server.persistate.UInt32(persistateFSChainLastBlockKey) if err != nil { fromFSChainBlock = 0 log.Warn("can't get last processed FS chain block number", zap.Error(err)) } - morphChain := chainParams{ + // migration for deprecated DB key + if fromFSChainBlock == 0 && fromDeprectedSidechanBlock != fromFSChainBlock { + fromFSChainBlock = fromDeprectedSidechanBlock + err = server.persistate.SetUInt32(persistateFSChainLastBlockKey, fromFSChainBlock) + if err != nil { + log.Warn("can't update persistent state", + zap.String("chain", "FS"), + zap.Uint32("block_index", fromFSChainBlock)) + } + + err = server.persistate.Delete(persistateDeprecatedSidechainLastBlockKey) + if err != nil { + log.Warn("can't delete deprecated persistent state", zap.Error(err)) + } + } + + if cfg.IsSet(deprecatedMorphPrefix+".endpoints") || cfg.IsSet(deprecatedMorphPrefix+".consensus") { + log.Warn("config section 'morph' is deprecated, use 'fschain'") + cfgPathFSChain = deprecatedMorphPrefix + } + if cfg.IsSet(fsChainPrefix+".endpoints") || cfg.IsSet(fsChainPrefix+".consensus") { + cfgPathFSChain = fsChainPrefix + } + cfgPathFSChainRPCEndpoints = cfgPathFSChain + ".endpoints" + cfgPathFSChainLocalConsensus = cfgPathFSChain + ".consensus" + cfgPathFSChainValidators = cfgPathFSChain + ".validators" + fsChainParams := chainParams{ log: log, cfg: cfg, - name: morphPrefix, + name: cfgPathFSChain, from: fromFSChainBlock, } @@ -458,7 +489,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- return nil, fmt.Errorf("build WS client on internal blockchain: %w", err) } - morphChain.key = server.key + fsChainParams.key = server.key fsChainOpts := make([]client.Option, 3, 4) fsChainOpts[0] = client.WithContext(ctx) fsChainOpts[1] = client.WithLogger(log) @@ -479,10 +510,10 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- // fallback to the pure RPC architecture - morphChain.key = server.key - morphChain.withAutoFSChainScope = !isAutoDeploy + fsChainParams.key = server.key + fsChainParams.withAutoFSChainScope = !isAutoDeploy - server.morphClient, err = server.createClient(ctx, morphChain, errChan) + server.morphClient, err = server.createClient(ctx, fsChainParams, errChan) if err != nil { return nil, err } @@ -510,11 +541,11 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- clnt, err = client.New(server.key, client.WithContext(ctx), client.WithLogger(log), - client.WithDialTimeout(cfg.GetDuration(morphChain.name+".dial_timeout")), + client.WithDialTimeout(cfg.GetDuration(fsChainParams.name+".dial_timeout")), client.WithEndpoints(endpoints), - client.WithReconnectionRetries(cfg.GetInt(morphChain.name+".reconnections_number")), - client.WithReconnectionsDelay(cfg.GetDuration(morphChain.name+".reconnections_delay")), - client.WithMinRequiredBlockHeight(morphChain.from), + client.WithReconnectionRetries(cfg.GetInt(fsChainParams.name+".reconnections_number")), + client.WithReconnectionsDelay(cfg.GetDuration(fsChainParams.name+".reconnections_delay")), + client.WithMinRequiredBlockHeight(fsChainParams.from), ) if err != nil { return nil, fmt.Errorf("create multi-endpoint client for FS chain deployment: %w", err) @@ -567,7 +598,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- } // create morph listener - server.morphListener, err = createListener(server.morphClient, morphChain) + server.morphListener, err = createListener(server.morphClient, fsChainParams) if err != nil { return nil, err } @@ -581,7 +612,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<- server.mainnetListener = server.morphListener server.mainnetClient = server.morphClient } else { - mainnetChain := morphChain + mainnetChain := fsChainParams mainnetChain.withAutoFSChainScope = false mainnetChain.name = mainnetPrefix @@ -1065,7 +1096,7 @@ func (s *Server) createClient(ctx context.Context, p chainParams, errChan chan<- client.WithConnSwitchCallback(func() { var err error - if p.name == morphPrefix { + if p.name == fsChainPrefix || p.name == deprecatedMorphPrefix { err = s.restartMorph() } else { err = s.restartMainChain() diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index cd1a9a2c9c..3e6d83c8ff 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -18,8 +18,9 @@ import ( const voteMethod = "vote" var ( - persistateMainChainLastBlockKey = []byte("main_chain_last_processed_block") - persistateFSChainLastBlockKey = []byte("fs_chain_last_processed_block") + persistateMainChainLastBlockKey = []byte("main_chain_last_processed_block") + persistateFSChainLastBlockKey = []byte("fs_chain_last_processed_block") + persistateDeprecatedSidechainLastBlockKey = []byte("side_chain_last_processed_block") ) // EpochCounter is a getter for a global epoch counter.