Skip to content

Commit

Permalink
op-node: remove MaxSequencerDrift hardcode (#11459)
Browse files Browse the repository at this point in the history
* go: update superchain import

* op-node: read MaxSequencerDrift from superchain configs

* go: update superchain import to point to main commit
  • Loading branch information
bitwiseguy authored Aug 13, 2024
1 parent ec8fc7e commit db21f4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/crate-crypto/go-kzg-4844 v1.0.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240812010938-34a43d577f74
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f
github.com/ethereum/go-ethereum v1.14.7
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a h1:OK3wB7HbdhCneSowC1XZusHaLIVdXoRLuCWgXp5Tjuc=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a/go.mod h1:9pT+bF20XwCBE7WkjfRSsCg6RN6Njdbr924DtQ3+geY=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240812010938-34a43d577f74 h1:HQZQalpPUXs9qnJgDmEDzpPO70Z1p8Le2l0bZ9eJjCk=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240812010938-34a43d577f74/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f h1:JTnVOiaYVQcXc+zgsSjnTQ18k3uOLOpch8SiPjO1eTo=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240813170044-d5be5587e58f/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
Expand Down
10 changes: 1 addition & 9 deletions op-node/rollup/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import (

var OPStackSupport = params.ProtocolVersionV0{Build: [8]byte{}, Major: 7, Minor: 0, Patch: 0, PreRelease: 0}.Encode()

const (
pgnSepolia = 58008
)

// LoadOPStackRollupConfig loads the rollup configuration of the requested chain ID from the superchain-registry.
// Some chains may require a SystemConfigProvider to retrieve any values not part of the registry.
func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
Expand Down Expand Up @@ -76,7 +72,7 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
// Note: hardcoded values are not yet represented in the registry but should be
// soon, then will be read and set in the same fashion.
BlockTime: chConfig.BlockTime,
MaxSequencerDrift: 600,
MaxSequencerDrift: chConfig.MaxSequencerDrift,
SeqWindowSize: chConfig.SequencerWindowSize,
ChannelTimeoutBedrock: 300,
ChannelTimeoutGranite: 50,
Expand All @@ -97,9 +93,5 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
if superChain.Config.ProtocolVersionsAddr != nil { // Set optional protocol versions address
cfg.ProtocolVersionsAddress = common.Address(*superChain.Config.ProtocolVersionsAddr)
}
if chainID == pgnSepolia {
cfg.MaxSequencerDrift = 1000
cfg.SeqWindowSize = 7200
}
return cfg, nil
}
4 changes: 4 additions & 0 deletions op-node/rollup/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
ErrMissingChannelTimeout = errors.New("channel timeout must be set, this should cover at least a L1 block time")
ErrInvalidGraniteChannelTimeout = errors.New("channel timeout granite must be less than channel timeout")
ErrInvalidSeqWindowSize = errors.New("sequencing window size must at least be 2")
ErrInvalidMaxSeqDrift = errors.New("maximum sequencer drift must be greater than 0")
ErrMissingGenesisL1Hash = errors.New("genesis L1 hash cannot be empty")
ErrMissingGenesisL2Hash = errors.New("genesis L2 hash cannot be empty")
ErrGenesisHashesSame = errors.New("achievement get! rollup inception: L1 and L2 genesis cannot be the same")
Expand Down Expand Up @@ -282,6 +283,9 @@ func (cfg *Config) Check() error {
if cfg.SeqWindowSize < 2 {
return ErrInvalidSeqWindowSize
}
if cfg.MaxSequencerDrift == 0 {
return ErrInvalidMaxSeqDrift
}
if cfg.Genesis.L1.Hash == (common.Hash{}) {
return ErrMissingGenesisL1Hash
}
Expand Down

0 comments on commit db21f4a

Please sign in to comment.