Skip to content

Commit

Permalink
sequencer: Use higher sequencer drift for Celo (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlb authored Oct 7, 2024
1 parent 3e1813b commit d3e06af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion op-node/rollup/chain_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const (
// ChainSpec instead of reading the rollup configuration field directly.
const maxSequencerDriftFjord = 1800

// Normal OP chains wait for five confirmations while Celo waits for finalization, which can take
// up to 3 * 32 blocks. So we should allow for more drift to compensate.
// 3 * 32 - 5 = 91 blocks
// 91 * 12s block time = 1092
const maxSequencerDriftCelo = maxSequencerDriftFjord + 1092

type ForkName string

const (
Expand Down Expand Up @@ -105,7 +111,11 @@ func (s *ChainSpec) IsFeatMaxSequencerDriftConstant(t uint64) bool {
// should always be queried via the ChainSpec.
func (s *ChainSpec) MaxSequencerDrift(t uint64) uint64 {
if s.IsFeatMaxSequencerDriftConstant(t) {
return maxSequencerDriftFjord
if s.config.IsCel2(t) {
return maxSequencerDriftCelo
} else {
return maxSequencerDriftFjord
}
}
return s.config.MaxSequencerDrift
}
Expand Down
4 changes: 4 additions & 0 deletions op-node/rollup/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ func (c *Config) IsInterop(timestamp uint64) bool {
return c.InteropTime != nil && timestamp >= *c.InteropTime
}

func (c *Config) IsCel2(timestamp uint64) bool {
return c.Cel2Time != nil && timestamp >= *c.Cel2Time
}

func (c *Config) IsRegolithActivationBlock(l2BlockTime uint64) bool {
return c.IsRegolith(l2BlockTime) &&
l2BlockTime >= c.BlockTime &&
Expand Down

0 comments on commit d3e06af

Please sign in to comment.