Skip to content

Commit

Permalink
Reduce ChannelTimeout to 50 in Granite (ethereum-optimism#11343)
Browse files Browse the repository at this point in the history
* Reduce ChannelTimeout to 50 in Granite

* Capture granite genesis files.

* Update snapshots.

* Update op-geth dependency and resolve TODOs.

* update op-geth dependency to rc.1

* fix TestGetRollupConfig

---------

Co-authored-by: Adrian Sutton <[email protected]>
  • Loading branch information
Inphi and ajsutton authored Aug 5, 2024
1 parent 5e31737 commit e4c17d3
Show file tree
Hide file tree
Showing 31 changed files with 285 additions and 131 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,26 @@ jobs:
- ".devnet/allocs-l2-delta.json"
- ".devnet/allocs-l2-ecotone.json"
- ".devnet/allocs-l2-fjord.json"
- ".devnet/allocs-l2-granite.json"
- ".devnet/addresses.json"
- ".devnet-l2oo/allocs-l1.json"
- ".devnet-l2oo/addresses.json"
- ".devnet-l2oo/allocs-l2-delta.json"
- ".devnet-l2oo/allocs-l2-ecotone.json"
- ".devnet-l2oo/allocs-l2-fjord.json"
- ".devnet-l2oo/allocs-l2-granite.json"
- ".devnet-plasma/allocs-l1.json"
- ".devnet-plasma/addresses.json"
- ".devnet-plasma/allocs-l2-delta.json"
- ".devnet-plasma/allocs-l2-ecotone.json"
- ".devnet-plasma/allocs-l2-fjord.json"
- ".devnet-plasma/allocs-l2-granite.json"
- ".devnet-plasma-generic/allocs-l1.json"
- ".devnet-plasma-generic/addresses.json"
- ".devnet-plasma-generic/allocs-l2-delta.json"
- ".devnet-plasma-generic/allocs-l2-ecotone.json"
- ".devnet-plasma-generic/allocs-l2-fjord.json"
- ".devnet-plasma-generic/allocs-l2-granite.json"
- "packages/contracts-bedrock/deploy-config/devnetL1.json"
- "packages/contracts-bedrock/deployments/devnetL1"
- notify-failures-on-develop
Expand Down Expand Up @@ -891,6 +895,7 @@ jobs:
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-delta.json .devnet/allocs-l2-delta.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-ecotone.json .devnet/allocs-l2-ecotone.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-fjord.json .devnet/allocs-l2-fjord.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l2-granite.json .devnet/allocs-l2-granite.json
cp /tmp/workspace/.devnet<<parameters.variant>>/allocs-l1.json .devnet/allocs-l1.json
cp /tmp/workspace/.devnet<<parameters.variant>>/addresses.json .devnet/addresses.json
cp /tmp/workspace/packages/contracts-bedrock/deploy-config/devnetL1.json packages/contracts-bedrock/deploy-config/devnetL1.json
Expand Down Expand Up @@ -1078,6 +1083,7 @@ jobs:
- ".devnet/allocs-l2-delta.json"
- ".devnet/allocs-l2-ecotone.json"
- ".devnet/allocs-l2-fjord.json"
- ".devnet/allocs-l2-granite.json"
- ".devnet/allocs-l1.json"
- ".devnet/addresses.json"
- "packages/contracts-bedrock/deploy-config/devnetL1.json"
Expand Down
2 changes: 1 addition & 1 deletion bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
log = logging.getLogger()

# Global constants
FORKS = ["delta", "ecotone", "fjord"]
FORKS = ["delta", "ecotone", "fjord", "granite"]

# Global environment variables
DEVNET_NO_BUILD = os.getenv('DEVNET_NO_BUILD') == "true"
Expand Down
8 changes: 6 additions & 2 deletions 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 v0.7.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-20240801182704-4810f97b7ee9
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240803025447-c92ef420eec2
github.com/ethereum/go-ethereum v1.13.15
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
Expand Down Expand Up @@ -228,11 +228,15 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101315.3-rc.1
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101316.0-rc.1

//replace github.com/ethereum/go-ethereum v1.13.9 => ../op-geth

// replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain-registry/superchain

// This release keeps breaking Go builds. Stop that.
exclude github.com/kataras/iris/v12 v12.2.0-beta5

exclude github.com/kataras/iris/v12 v12.2.0

exclude github.com/kataras/iris/v12 v12.2.11
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/
github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101315.3-rc.1 h1:Q/B0FBdtglzsFtqurvUsiNfH8isCOFFF/pf9ss0L4eY=
github.com/ethereum-optimism/op-geth v1.101315.3-rc.1/go.mod h1:h5C5tP+7gkMrlUGENuiV5ddlwJ4RxLdmdapRuTAGlnw=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240801182704-4810f97b7ee9 h1:Yqi7oOCWRN3SMl3rL5zGYSHIw2MyuTJ1nqokSi7ejfU=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240801182704-4810f97b7ee9/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum-optimism/op-geth v1.101316.0-rc.1 h1:S6Nw/faA4g6AicK5oQR5p2VUjq8AyTEilLfNGgprbGU=
github.com/ethereum-optimism/op-geth v1.101316.0-rc.1/go.mod h1:nZ3TvP4mhOsfKkrgaT3GrDO4oCn5awPXFHKpVHuO63s=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240803025447-c92ef420eec2 h1:ySJykDUyb8RbcfLL3pz0Cs5Ji6NMVT7kmAY634DOCoE=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240803025447-c92ef420eec2/go.mod h1:zy9f3TNPS7pwW4msMitF83fp0Wf452tZ6+Fg6d4JyXM=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
Expand Down
3 changes: 3 additions & 0 deletions op-batcher/batcher/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func (s *channel) updateInclusionBlocks() {
func (s *channel) isTimedOut() bool {
// Update min/max inclusion blocks for timeout check
s.updateInclusionBlocks()
// Prior to the granite hard fork activating, the use of the shorter ChannelTimeout here may cause the batcher
// to believe the channel timed out when it was valid. It would then resubmit the blocks needlessly.
// This wastes batcher funds but doesn't cause any problems for the chain progressing safe head.
return s.maxInclusionBlock-s.minInclusionBlock >= s.cfg.ChannelTimeout
}

Expand Down
8 changes: 7 additions & 1 deletion op-batcher/batcher/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,15 @@ func (bs *BatcherService) initRollupConfig(ctx context.Context) error {
}

func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error {
channelTimeout := bs.RollupConfig.ChannelTimeoutBedrock
// Use lower channel timeout if granite is scheduled.
// Ensures channels are restricted to the tighter timeout even if granite hasn't activated yet
if bs.RollupConfig.GraniteTime != nil {
channelTimeout = bs.RollupConfig.ChannelTimeoutGranite
}
cc := ChannelConfig{
SeqWindowSize: bs.RollupConfig.SeqWindowSize,
ChannelTimeout: bs.RollupConfig.ChannelTimeout,
ChannelTimeout: channelTimeout,
MaxChannelDuration: cfg.MaxChannelDuration,
MaxFrameSize: cfg.MaxL1TxSize - 1, // account for version byte prefix; reset for blobs
TargetNumFrames: cfg.TargetNumFrames,
Expand Down
34 changes: 28 additions & 6 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ type UpgradeScheduleDeployConfig struct {
// L2GenesisFjordTimeOffset is the number of seconds after genesis block that Fjord hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Fjord.
L2GenesisFjordTimeOffset *hexutil.Uint64 `json:"l2GenesisFjordTimeOffset,omitempty"`
// L2GenesisGraniteTimeOffset is the number of seconds after genesis block that Granite hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Granite.
L2GenesisGraniteTimeOffset *hexutil.Uint64 `json:"l2GenesisGraniteTimeOffset,omitempty"`
// L2GenesisInteropTimeOffset is the number of seconds after genesis block that the Interop hard fork activates.
// Set it to 0 to activate at genesis. Nil to disable Interop.
L2GenesisInteropTimeOffset *hexutil.Uint64 `json:"l2GenesisInteropTimeOffset,omitempty"`
Expand Down Expand Up @@ -382,6 +385,10 @@ func (d *UpgradeScheduleDeployConfig) FjordTime(genesisTime uint64) *uint64 {
return offsetToUpgradeTime(d.L2GenesisFjordTimeOffset, genesisTime)
}

func (d *UpgradeScheduleDeployConfig) GraniteTime(genesisTime uint64) *uint64 {
return offsetToUpgradeTime(d.L2GenesisGraniteTimeOffset, genesisTime)
}

func (d *UpgradeScheduleDeployConfig) InteropTime(genesisTime uint64) *uint64 {
return offsetToUpgradeTime(d.L2GenesisInteropTimeOffset, genesisTime)
}
Expand Down Expand Up @@ -415,6 +422,9 @@ func (d *UpgradeScheduleDeployConfig) Check(log log.Logger) error {
if err := checkFork(d.L2GenesisEcotoneTimeOffset, d.L2GenesisFjordTimeOffset, "ecotone", "fjord"); err != nil {
return err
}
if err := checkFork(d.L2GenesisFjordTimeOffset, d.L2GenesisGraniteTimeOffset, "fjord", "granite"); err != nil {
return err
}
return nil
}

Expand All @@ -438,8 +448,10 @@ type L2CoreDeployConfig struct {
MaxSequencerDrift uint64 `json:"maxSequencerDrift"`
// SequencerWindowSize is the number of L1 blocks per sequencing window.
SequencerWindowSize uint64 `json:"sequencerWindowSize"`
// ChannelTimeout is the number of L1 blocks that a frame stays valid when included in L1.
ChannelTimeout uint64 `json:"channelTimeout"`
// ChannelTimeoutBedrock is the number of L1 blocks that a frame stays valid when included in L1.
ChannelTimeoutBedrock uint64 `json:"channelTimeout"`
// ChannelTimeoutGranite is the number of L1 blocks that a frame stays valid when included in L1 after granite.
ChannelTimeoutGranite uint64 `json:"channelTimeoutGranite,omitempty"`
// BatchInboxAddress is the L1 account that batches are sent to.
BatchInboxAddress common.Address `json:"batchInboxAddress"`

Expand All @@ -464,7 +476,7 @@ func (d *L2CoreDeployConfig) Check(log log.Logger) error {
if d.SequencerWindowSize == 0 {
return fmt.Errorf("%w: SequencerWindowSize cannot be 0", ErrInvalidDeployConfig)
}
if d.ChannelTimeout == 0 {
if d.ChannelTimeoutBedrock == 0 {
return fmt.Errorf("%w: ChannelTimeout cannot be 0", ErrInvalidDeployConfig)
}
if d.BatchInboxAddress == (common.Address{}) {
Expand Down Expand Up @@ -534,7 +546,13 @@ type L2InitializationConfig struct {
}

func (d *L2InitializationConfig) Check(log log.Logger) error {
return checkConfigBundle(d, log)
if err := checkConfigBundle(d, log); err != nil {
return err
}
if d.ChannelTimeoutGranite == 0 && d.L2GenesisGraniteTimeOffset != nil {
return fmt.Errorf("%w: ChannelTimeoutGranite cannot be 0", ErrInvalidDeployConfig)
}
return nil
}

// DevL1DeployConfig is used to configure a L1 chain for development/testing purposes.
Expand Down Expand Up @@ -804,7 +822,9 @@ func (d *DeployConfig) Check(log log.Logger) error {
if d.L1BlockTime < d.L2BlockTime {
return fmt.Errorf("L2 block time (%d) is larger than L1 block time (%d)", d.L2BlockTime, d.L1BlockTime)
}

if d.ChannelTimeoutGranite == 0 && d.L2GenesisGraniteTimeOffset != nil {
return fmt.Errorf("%w: ChannelTimeoutGranite cannot be 0", ErrInvalidDeployConfig)
}
return checkConfigBundle(d, log)
}

Expand Down Expand Up @@ -869,7 +889,8 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
BlockTime: d.L2BlockTime,
MaxSequencerDrift: d.MaxSequencerDrift,
SeqWindowSize: d.SequencerWindowSize,
ChannelTimeout: d.ChannelTimeout,
ChannelTimeoutBedrock: d.ChannelTimeoutBedrock,
ChannelTimeoutGranite: d.ChannelTimeoutGranite,
L1ChainID: new(big.Int).SetUint64(d.L1ChainID),
L2ChainID: new(big.Int).SetUint64(d.L2ChainID),
BatchInboxAddress: d.BatchInboxAddress,
Expand All @@ -880,6 +901,7 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHas
DeltaTime: d.DeltaTime(l1StartBlock.Time()),
EcotoneTime: d.EcotoneTime(l1StartBlock.Time()),
FjordTime: d.FjordTime(l1StartBlock.Time()),
GraniteTime: d.GraniteTime(l1StartBlock.Time()),
InteropTime: d.InteropTime(l1StartBlock.Time()),
PlasmaConfig: plasma,
}, nil
Expand Down
3 changes: 2 additions & 1 deletion op-chain-ops/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
CancunTime: config.EcotoneTime(block.Time()),
EcotoneTime: config.EcotoneTime(block.Time()),
FjordTime: config.FjordTime(block.Time()),
GraniteTime: config.GraniteTime(block.Time()),
InteropTime: config.InteropTime(block.Time()),
Optimism: &params.OptimismConfig{
EIP1559Denominator: eip1559Denom,
EIP1559Elasticity: eip1559Elasticity,
EIP1559DenominatorCanyon: eip1559DenomCanyon,
EIP1559DenominatorCanyon: &eip1559DenomCanyon,
},
}

Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/genesis/layer_two.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
L2AllocsDelta L2AllocsMode = "delta"
L2AllocsEcotone L2AllocsMode = "ecotone"
L2AllocsFjord L2AllocsMode = "fjord"
L2AllocsGranite L2AllocsMode = "granite"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion op-conductor/conductor/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func mockConfig(t *testing.T) Config {
BlockTime: 2,
MaxSequencerDrift: 600,
SeqWindowSize: 3600,
ChannelTimeout: 300,
ChannelTimeoutBedrock: 300,
ChannelTimeoutGranite: 50,
L1ChainID: big.NewInt(1),
L2ChainID: big.NewInt(2),
RegolithTime: &now,
Expand Down
7 changes: 7 additions & 0 deletions op-e2e/actions/l2_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,10 @@ func (s *L2Sequencer) ActBuildL2ToFjord(t Testing) {
s.ActL2EndBlock(t)
}
}
func (s *L2Sequencer) ActBuildL2ToGranite(t Testing) {
require.NotNil(t, s.rollupCfg.GraniteTime, "cannot activate GraniteTime when it is not scheduled")
for s.L2Unsafe().Time < *s.rollupCfg.GraniteTime {
s.ActL2StartBlock(t)
s.ActL2EndBlock(t)
}
}
1 change: 1 addition & 0 deletions op-e2e/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func init() {
}
l2Allocs[mode] = allocs
}
mustL2Allocs(genesis.L2AllocsGranite)
mustL2Allocs(genesis.L2AllocsFjord)
mustL2Allocs(genesis.L2AllocsEcotone)
mustL2Allocs(genesis.L2AllocsDelta)
Expand Down
13 changes: 10 additions & 3 deletions op-e2e/e2eutils/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
deployConfig := config.DeployConfig.Copy()
deployConfig.MaxSequencerDrift = tp.MaxSequencerDrift
deployConfig.SequencerWindowSize = tp.SequencerWindowSize
deployConfig.ChannelTimeout = tp.ChannelTimeout
deployConfig.ChannelTimeoutBedrock = tp.ChannelTimeout
deployConfig.ChannelTimeoutGranite = tp.ChannelTimeout
deployConfig.L1BlockTime = tp.L1BlockTime
deployConfig.UsePlasma = tp.UsePlasma
ApplyDeployConfigForks(deployConfig)
Expand Down Expand Up @@ -173,7 +174,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
BlockTime: deployConf.L2BlockTime,
MaxSequencerDrift: deployConf.MaxSequencerDrift,
SeqWindowSize: deployConf.SequencerWindowSize,
ChannelTimeout: deployConf.ChannelTimeout,
ChannelTimeoutBedrock: deployConf.ChannelTimeoutBedrock,
ChannelTimeoutGranite: deployConf.ChannelTimeoutGranite,
L1ChainID: new(big.Int).SetUint64(deployConf.L1ChainID),
L2ChainID: new(big.Int).SetUint64(deployConf.L2ChainID),
BatchInboxAddress: deployConf.BatchInboxAddress,
Expand All @@ -184,6 +186,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
DeltaTime: deployConf.DeltaTime(uint64(deployConf.L1GenesisBlockTimestamp)),
EcotoneTime: deployConf.EcotoneTime(uint64(deployConf.L1GenesisBlockTimestamp)),
FjordTime: deployConf.FjordTime(uint64(deployConf.L1GenesisBlockTimestamp)),
GraniteTime: deployConf.GraniteTime(uint64(deployConf.L1GenesisBlockTimestamp)),
InteropTime: deployConf.InteropTime(uint64(deployConf.L1GenesisBlockTimestamp)),
PlasmaConfig: pcfg,
}
Expand Down Expand Up @@ -214,7 +217,8 @@ func SystemConfigFromDeployConfig(deployConfig *genesis.DeployConfig) eth.System
}

func ApplyDeployConfigForks(deployConfig *genesis.DeployConfig) {
isFjord := os.Getenv("OP_E2E_USE_FJORD") == "true"
isGranite := os.Getenv("OP_E2E_USE_GRANITE") == "true"
isFjord := isGranite || os.Getenv("OP_E2E_USE_FJORD") == "true"
isEcotone := isFjord || os.Getenv("OP_E2E_USE_ECOTONE") == "true"
isDelta := isEcotone || os.Getenv("OP_E2E_USE_DELTA") == "true"
if isDelta {
Expand All @@ -226,6 +230,9 @@ func ApplyDeployConfigForks(deployConfig *genesis.DeployConfig) {
if isFjord {
deployConfig.L2GenesisFjordTimeOffset = new(hexutil.Uint64)
}
if isGranite {
deployConfig.L2GenesisGraniteTimeOffset = new(hexutil.Uint64)
}
// Canyon and lower is activated by default
deployConfig.L2GenesisCanyonTimeOffset = new(hexutil.Uint64)
deployConfig.L2GenesisRegolithTimeOffset = new(hexutil.Uint64)
Expand Down
4 changes: 3 additions & 1 deletion op-e2e/op_geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ func NewOpGeth(t testing.TB, ctx context.Context, cfg *SystemConfig) (*OpGeth, e

var allocsMode genesis.L2AllocsMode
allocsMode = genesis.L2AllocsDelta
if fjordTime := cfg.DeployConfig.FjordTime(l1Block.Time()); fjordTime != nil && *fjordTime <= 0 {
if graniteTime := cfg.DeployConfig.GraniteTime(l1Block.Time()); graniteTime != nil && *graniteTime <= 0 {
allocsMode = genesis.L2AllocsGranite
} else if fjordTime := cfg.DeployConfig.FjordTime(l1Block.Time()); fjordTime != nil && *fjordTime <= 0 {
allocsMode = genesis.L2AllocsFjord
} else if ecotoneTime := cfg.DeployConfig.EcotoneTime(l1Block.Time()); ecotoneTime != nil && *ecotoneTime <= 0 {
allocsMode = genesis.L2AllocsEcotone
Expand Down
15 changes: 13 additions & 2 deletions op-e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func RegolithSystemConfig(t *testing.T, regolithTimeOffset *hexutil.Uint64) Syst
cfg.DeployConfig.L2GenesisDeltaTimeOffset = nil
cfg.DeployConfig.L2GenesisEcotoneTimeOffset = nil
cfg.DeployConfig.L2GenesisFjordTimeOffset = nil
cfg.DeployConfig.L2GenesisGraniteTimeOffset = nil
// ADD NEW FORKS HERE!
return cfg
}
Expand Down Expand Up @@ -214,6 +215,12 @@ func FjordSystemConfig(t *testing.T, fjordTimeOffset *hexutil.Uint64) SystemConf
return cfg
}

func GraniteSystemConfig(t *testing.T, graniteTimeOffset *hexutil.Uint64) SystemConfig {
cfg := EcotoneSystemConfig(t, &genesisTime)
cfg.DeployConfig.L2GenesisGraniteTimeOffset = graniteTimeOffset
return cfg
}

func writeDefaultJWT(t testing.TB) string {
// Sadly the geth node config cannot load JWT secret from memory, it has to be a file
jwtPath := path.Join(t.TempDir(), "jwt_secret")
Expand Down Expand Up @@ -540,7 +547,9 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
l1Block := l1Genesis.ToBlock()
var allocsMode genesis.L2AllocsMode
allocsMode = genesis.L2AllocsDelta
if fjordTime := cfg.DeployConfig.FjordTime(l1Block.Time()); fjordTime != nil && *fjordTime <= 0 {
if graniteTime := cfg.DeployConfig.GraniteTime(l1Block.Time()); graniteTime != nil && *graniteTime <= 0 {
allocsMode = genesis.L2AllocsGranite
} else if fjordTime := cfg.DeployConfig.FjordTime(l1Block.Time()); fjordTime != nil && *fjordTime <= 0 {
allocsMode = genesis.L2AllocsFjord
} else if ecotoneTime := cfg.DeployConfig.EcotoneTime(l1Block.Time()); ecotoneTime != nil && *ecotoneTime <= 0 {
allocsMode = genesis.L2AllocsEcotone
Expand Down Expand Up @@ -585,7 +594,8 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
BlockTime: cfg.DeployConfig.L2BlockTime,
MaxSequencerDrift: cfg.DeployConfig.MaxSequencerDrift,
SeqWindowSize: cfg.DeployConfig.SequencerWindowSize,
ChannelTimeout: cfg.DeployConfig.ChannelTimeout,
ChannelTimeoutBedrock: cfg.DeployConfig.ChannelTimeoutBedrock,
ChannelTimeoutGranite: cfg.DeployConfig.ChannelTimeoutGranite,
L1ChainID: cfg.L1ChainIDBig(),
L2ChainID: cfg.L2ChainIDBig(),
BatchInboxAddress: cfg.DeployConfig.BatchInboxAddress,
Expand All @@ -596,6 +606,7 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
DeltaTime: cfg.DeployConfig.DeltaTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
EcotoneTime: cfg.DeployConfig.EcotoneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
FjordTime: cfg.DeployConfig.FjordTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
GraniteTime: cfg.DeployConfig.GraniteTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
}
Expand Down
Loading

0 comments on commit e4c17d3

Please sign in to comment.