diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index f3ab91414..000000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -golang 1.20 diff --git a/block/sequencers.go b/block/sequencers.go index 85513cfd1..ca3dff074 100644 --- a/block/sequencers.go +++ b/block/sequencers.go @@ -35,7 +35,7 @@ func (m *Manager) MonitorProposerRotation(ctx context.Context) { } func (m *Manager) MonitorSequencerSetUpdates(ctx context.Context) error { - ticker := time.NewTicker(3 * time.Minute) // TODO: make this configurable + ticker := time.NewTicker(m.Conf.SequencerSetUpdateInterval) defer ticker.Stop() for { diff --git a/block/submit_test.go b/block/submit_test.go index de2ddd071..6d1c8c748 100644 --- a/block/submit_test.go +++ b/block/submit_test.go @@ -245,11 +245,12 @@ func TestSubmissionByTime(t *testing.T) { // Init manager with empty blocks feature enabled managerConfig := config.BlockManagerConfig{ - BlockTime: blockTime, - MaxIdleTime: 0, - BatchSkew: 10, - BatchSubmitTime: submitTimeout, - BatchSubmitBytes: 1000, + BlockTime: blockTime, + MaxIdleTime: 0, + BatchSkew: 10, + BatchSubmitTime: submitTimeout, + BatchSubmitBytes: 1000, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, } manager, err := testutil.GetManager(managerConfig, nil, 1, 1, 0, proxyApp, nil) diff --git a/config/config.go b/config/config.go index bca5dace6..9c7a6e783 100644 --- a/config/config.go +++ b/config/config.go @@ -59,6 +59,8 @@ type BlockManagerConfig struct { BatchSkew uint64 `mapstructure:"max_batch_skew"` // The size of the batch of blocks and commits in Bytes. We'll write every batch to the DA and the settlement layer. BatchSubmitBytes uint64 `mapstructure:"batch_submit_bytes"` + // SequencerSetUpdateInterval defines the interval at which to fetch sequencer updates from the settlement layer + SequencerSetUpdateInterval time.Duration `mapstructure:"sequencer_update_interval"` } // GetViperConfig reads configuration parameters from Viper instance. @@ -163,6 +165,10 @@ func (c BlockManagerConfig) Validate() error { return fmt.Errorf("max_batch_skew must be positive") } + if c.SequencerSetUpdateInterval <= 0 { + return fmt.Errorf("sequencer_update_interval must be positive") + } + return nil } diff --git a/config/config_test.go b/config/config_test.go index f2eea6fd2..dd1bfaa3a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -183,12 +183,13 @@ func TestNodeConfig_Validate(t *testing.T) { func fullNodeConfig() config.NodeConfig { return config.NodeConfig{ BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - MaxIdleTime: 20 * time.Second, - MaxProofTime: 20 * time.Second, - BatchSubmitTime: 20 * time.Second, - BatchSkew: 10, - BatchSubmitBytes: 10000, + BlockTime: 1 * time.Second, + MaxIdleTime: 20 * time.Second, + MaxProofTime: 20 * time.Second, + BatchSubmitTime: 20 * time.Second, + BatchSkew: 10, + BatchSubmitBytes: 10000, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, DAConfig: "da-config", SettlementLayer: "dymension", diff --git a/config/defaults.go b/config/defaults.go index 4342be555..828994e1b 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -13,6 +13,8 @@ const ( DefaultListenAddress = "/ip4/0.0.0.0/tcp/26656" DefaultHomeDir = "sequencer_keys" + + DefaultSequencerSetUpdateInterval = 3 * time.Minute ) // DefaultNodeConfig keeps default values of NodeConfig @@ -22,12 +24,13 @@ var DefaultNodeConfig = *DefaultConfig("") func DefaultConfig(home string) *NodeConfig { cfg := &NodeConfig{ BlockManagerConfig: BlockManagerConfig{ - BlockTime: 200 * time.Millisecond, - MaxIdleTime: 3600 * time.Second, - MaxProofTime: 100 * time.Second, - BatchSubmitTime: 3600 * time.Second, - BatchSkew: 10, - BatchSubmitBytes: 500000, + BlockTime: 200 * time.Millisecond, + MaxIdleTime: 3600 * time.Second, + MaxProofTime: 100 * time.Second, + BatchSubmitTime: 3600 * time.Second, + BatchSkew: 10, + BatchSubmitBytes: 500000, + SequencerSetUpdateInterval: DefaultSequencerSetUpdateInterval, }, SettlementLayer: "mock", Instrumentation: &InstrumentationConfig{ diff --git a/node/node_test.go b/node/node_test.go index 57aecf762..1be75f1e3 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -75,10 +75,11 @@ func TestMempoolDirectly(t *testing.T) { RPC: config.RPCConfig{}, MempoolConfig: *tmcfg.DefaultMempoolConfig(), BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 100000, - BatchSkew: 10, + BlockTime: 1 * time.Second, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 100000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, DAConfig: "", SettlementLayer: "mock", diff --git a/rpc/client/client_test.go b/rpc/client/client_test.go index afb1a915c..34d4b69ff 100644 --- a/rpc/client/client_test.go +++ b/rpc/client/client_test.go @@ -105,10 +105,11 @@ func TestGenesisChunked(t *testing.T) { }, RPC: config.RPCConfig{}, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, DAConfig: "", SettlementLayer: "mock", @@ -853,10 +854,11 @@ func TestValidatorSetHandling(t *testing.T) { BlockSyncRequestIntervalTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 10 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 10 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPubKeyBytes), @@ -1015,10 +1017,11 @@ func getRPCInternal(t *testing.T, sequencer bool) (*tmmocks.MockApplication, *cl RPC: config.RPCConfig{}, MempoolConfig: *tmcfg.DefaultMempoolConfig(), BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, DAConfig: "", SettlementLayer: "mock", @@ -1121,10 +1124,11 @@ func TestMempool2Nodes(t *testing.T) { BlockSyncRequestIntervalTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, MempoolConfig: *tmcfg.DefaultMempoolConfig(), }, key1, signingKey1, proxy.NewLocalClientCreator(app), genesis, "", log.TestingLogger(), mempool.NopMetrics()) @@ -1137,10 +1141,11 @@ func TestMempool2Nodes(t *testing.T) { ProposerPubKey: hex.EncodeToString(proposerPK), }, BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, P2PConfig: config.P2PConfig{ ListenAddress: "/ip4/127.0.0.1/tcp/9002", diff --git a/rpc/json/service_test.go b/rpc/json/service_test.go index 24115951b..7f0243bca 100644 --- a/rpc/json/service_test.go +++ b/rpc/json/service_test.go @@ -314,11 +314,12 @@ func getRPC(t *testing.T) (*tmmocks.MockApplication, *client.Client) { config := config.NodeConfig{ SettlementLayer: "mock", BlockManagerConfig: config.BlockManagerConfig{ - BlockTime: 1 * time.Second, - MaxIdleTime: 0, - BatchSkew: 10, - BatchSubmitTime: 30 * time.Minute, - BatchSubmitBytes: 1000, + BlockTime: 1 * time.Second, + MaxIdleTime: 0, + BatchSkew: 10, + BatchSubmitTime: 30 * time.Minute, + BatchSubmitBytes: 1000, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, }, SettlementConfig: settlement.Config{ ProposerPubKey: hex.EncodeToString(proposerPubKeyBytes), diff --git a/testutil/block.go b/testutil/block.go index db3eddf3a..df4e9922e 100644 --- a/testutil/block.go +++ b/testutil/block.go @@ -172,10 +172,11 @@ func initSettlementLayerMock(rollappId string, settlementlc settlement.ClientI, func GetManagerConfig() config.BlockManagerConfig { return config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitBytes: 1000000, - BatchSubmitTime: 30 * time.Minute, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitBytes: 1000000, + BatchSubmitTime: 30 * time.Minute, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, } } diff --git a/testutil/node.go b/testutil/node.go index 2c8d88d0c..49bd4a820 100644 --- a/testutil/node.go +++ b/testutil/node.go @@ -53,10 +53,11 @@ func CreateNode(isSequencer bool, blockManagerConfig *config.BlockManagerConfig, if blockManagerConfig == nil { blockManagerConfig = &config.BlockManagerConfig{ - BlockTime: 100 * time.Millisecond, - BatchSubmitTime: 60 * time.Second, - BatchSubmitBytes: 1000, - BatchSkew: 10, + BlockTime: 100 * time.Millisecond, + BatchSubmitTime: 60 * time.Second, + BatchSubmitBytes: 1000, + BatchSkew: 10, + SequencerSetUpdateInterval: config.DefaultSequencerSetUpdateInterval, } } nodeConfig.BlockManagerConfig = *blockManagerConfig