Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sequencers): make sequencer set updates interval configurable #1243

Merged
2 changes: 1 addition & 1 deletion block/sequencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down
13 changes: 7 additions & 6 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 9 additions & 6 deletions config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{
Expand Down
9 changes: 5 additions & 4 deletions testutil/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
9 changes: 5 additions & 4 deletions testutil/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading