Commit 6a3d1e74 authored by protolambda's avatar protolambda Committed by GitHub

specs,op-node: handle when Ecotone is active on L2 before L1 (#9073)

parent 9603ab0c
......@@ -175,3 +175,32 @@ func TestEcotoneNetworkUpgradeTransactions(gt *testing.T) {
expectedL1Fee = expectedL1Fee.Div(expectedL1Fee, big.NewInt(16e6))
require.Equal(t, expectedL1Fee, cost, "expecting cost based on regular base fee scalar alone")
}
// TestEcotoneBeforeL1 tests that the L2 Ecotone fork can activate before L1 Dencun does
func TestEcotoneBeforeL1(gt *testing.T) {
t := NewDefaultTesting(gt)
dp := e2eutils.MakeDeployParams(t, defaultRollupTestParams)
offset := hexutil.Uint64(0)
farOffset := hexutil.Uint64(10000)
dp.DeployConfig.L2GenesisRegolithTimeOffset = &offset
dp.DeployConfig.L1CancunTimeOffset = &farOffset // L1 Dencun will not be active at genesis
dp.DeployConfig.L2GenesisCanyonTimeOffset = &offset
dp.DeployConfig.L2GenesisDeltaTimeOffset = &offset
dp.DeployConfig.L2GenesisEcotoneTimeOffset = &offset
sd := e2eutils.Setup(t, dp, defaultAlloc)
log := testlog.Logger(t, log.LvlDebug)
_, _, _, sequencer, engine, verifier, _, _ := setupReorgTestActors(t, dp, sd, log)
// start op-nodes
sequencer.ActL2PipelineFull(t)
verifier.ActL2PipelineFull(t)
// Genesis block has ecotone properties
verifyEcotoneBlock(gt, engine.l2Chain.CurrentBlock())
// Blocks post fork have Ecotone properties
sequencer.ActL2StartBlock(t)
sequencer.ActL2EndBlock(t)
verifyEcotoneBlock(gt, engine.l2Chain.CurrentBlock())
}
......@@ -126,8 +126,8 @@ func (ba *FetchingAttributesBuilder) PreparePayloadAttributes(ctx context.Contex
var parentBeaconRoot *common.Hash
if ba.rollupCfg.IsEcotone(nextL2Time) {
parentBeaconRoot = l1Info.ParentBeaconRoot()
if parentBeaconRoot == nil {
return nil, NewCriticalError(fmt.Errorf("cannot build Ecotone (L2 Dencun) block without L1 Dencun info, at L2 timestamp %d", nextL2Time))
if parentBeaconRoot == nil { // default to zero hash if there is no beacon-block-root available
parentBeaconRoot = new(common.Hash)
}
}
......
......@@ -278,8 +278,9 @@ PayloadAttributesV3: {
The requirements of this object are the same as extended [`PayloadAttributesV2`][#extended-payloadattributesv2] with
the addition of `parentBeaconBlockRoot` which is the parent beacon block root from the L1 origin block of the L2 block.
`parentBeaconBlockRoot` must be nil for Bedrock/Canyon/Delta payloads, but must be set to the L1
origin `parentBeaconBlockRoot`.
The `parentBeaconBlockRoot` must be nil for Bedrock/Canyon/Delta payloads.
Starting at Ecotone, the `parentBeaconBlockRoot` must be set to the L1 origin `parentBeaconBlockRoot`,
or a zero `bytes32` if the Dencun functionality with `parentBeaconBlockRoot` is not active on L1.
### `engine_newPayloadV2`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment