Skip to content

Commit

Permalink
fix: fixed configuration validation, to support empty_blocks=0s (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin authored Aug 15, 2023
1 parent c25b4e1 commit 5aa1f5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,22 @@ func (c BlockManagerConfig) Validate() error {
return fmt.Errorf("empty_blocks_max_time must be positive or zero to disable")
}

if c.EmptyBlocksMaxTime <= c.BlockTime {
return fmt.Errorf("empty_blocks_max_time must be greater than block_time")
}

if c.BatchSubmitMaxTime <= 0 {
return fmt.Errorf("batch_submit_max_time must be positive")
}

if c.BatchSubmitMaxTime <= c.EmptyBlocksMaxTime {
if c.EmptyBlocksMaxTime != 0 && c.EmptyBlocksMaxTime <= c.BlockTime {
return fmt.Errorf("empty_blocks_max_time must be greater than block_time")
}

if c.EmptyBlocksMaxTime != 0 && c.BatchSubmitMaxTime < c.EmptyBlocksMaxTime {
return fmt.Errorf("batch_submit_max_time must be greater than empty_blocks_max_time")
}

if c.BatchSubmitMaxTime < c.BlockTime {
return fmt.Errorf("batch_submit_max_time must be greater than block_time")
}

if c.BlockBatchSize <= 0 {
return fmt.Errorf("block_batch_size must be positive")
}
Expand Down
2 changes: 1 addition & 1 deletion config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ aggregator = "{{ .Aggregator }}"
# block production interval
block_time = "{{ .BlockManagerConfig.BlockTime }}"
# block time for empty blocks (block time in case of no transactions)
# block production interval in case of no transactions ("0s" produces empty blocks)
empty_blocks_max_time = "{{ .BlockManagerConfig.EmptyBlocksMaxTime }}"
# triggers to submit batch to DA and settlement (both required)
Expand Down

0 comments on commit 5aa1f5f

Please sign in to comment.