-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests for L1 Pectra activation #14006
Draft
geoknee
wants to merge
19
commits into
develop
Choose a base branch
from
gk/l1-pectra-e2e-2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+191
−2
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
de73b30
op-e2e/actions: sketch out PectraForkTest
geoknee 3353602
add ActSubmitSetCodeTx to L2Batcher (for action testing only)
geoknee 19ccc34
update pectra fork test to use ActSubmitSetCodeTx
geoknee fd6859f
update latest hardfork in op-e2e config
geoknee 685f71c
try activating prague at genesis
geoknee 940343d
activate Prague on L1 EL by default at genesis
geoknee 7825597
add RequestsHash to op-service RPCHeader type
geoknee 8df217e
harmonize test for now having Pectra at genesis
geoknee 8600712
fix important typo
geoknee e457ecb
cleanup
geoknee 0426873
modify test to activate prague after genesis
geoknee aaf1795
test passes against locally modified geth
geoknee 9aa254c
action batcher actually submits unsafe data
geoknee 85195f3
transform pectra_fork_test to proofs test
geoknee e0d0877
rename
geoknee ed9ba15
rename pectra to prague
geoknee e44d8ee
revert change
geoknee 8ecb038
revert change
geoknee 3158662
revert change
geoknee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
package proofs | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
batcherFlags "github.com/ethereum-optimism/optimism/op-batcher/flags" | ||
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" | ||
actionsHelpers "github.com/ethereum-optimism/optimism/op-e2e/actions/helpers" | ||
"github.com/ethereum-optimism/optimism/op-e2e/actions/proofs/helpers" | ||
"github.com/ethereum-optimism/optimism/op-program/client/claim" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPragueForkAfterGenesis(gt *testing.T) { | ||
type testCase struct { | ||
name string | ||
useSetCodeTx bool | ||
} | ||
|
||
testCases := []testCase{ | ||
{ | ||
name: "calldata", useSetCodeTx: false, | ||
}, | ||
{ | ||
name: "setCode", useSetCodeTx: true, | ||
}, | ||
} | ||
|
||
runL1PragueTest := func(gt *testing.T, testCfg *helpers.TestCfg[testCase]) { | ||
t := actionsHelpers.NewDefaultTesting(gt) | ||
env := helpers.NewL2FaultProofEnv(t, testCfg, helpers.NewTestParams(), | ||
helpers.NewBatcherCfg( | ||
func(c *actionsHelpers.BatcherCfg) { | ||
c.DataAvailabilityType = batcherFlags.CalldataType | ||
}, | ||
), | ||
func(dp *genesis.DeployConfig) { | ||
t := hexutil.Uint64(24) // Activate at second l1 block | ||
dp.L1PragueTimeOffset = &t | ||
}, | ||
) | ||
|
||
miner, batcher, verifier, sequencer := env.Miner, env.Batcher, env.Sequencer, env.Sequencer | ||
|
||
// utils | ||
checkVerifierDerivedToL1Head := func(t actionsHelpers.StatefulTesting) { | ||
l1Head := miner.L1Chain().CurrentBlock() | ||
currentL1 := verifier.SyncStatus().CurrentL1 | ||
require.Equal(t, l1Head.Number.Int64(), int64(currentL1.Number), "verifier should derive up to and including the L1 head") | ||
require.Equal(t, l1Head.Hash(), currentL1.Hash, "verifier should derive up to and including the L1 head") | ||
} | ||
|
||
buildUnsafeL2AndSubmit := func(useSetCode bool) { | ||
sequencer.ActL2EmptyBlock(t) | ||
miner.ActL1StartBlock(12)(t) | ||
if useSetCode { | ||
batcher.ActBufferAll(t) | ||
batcher.ActL2ChannelClose(t) | ||
batcher.ActSubmitSetCodeTx(t) | ||
} else { | ||
batcher.ActSubmitAll(t) | ||
} | ||
miner.ActL1IncludeTx(batcher.BatcherAddr)(t) | ||
miner.ActL1EndBlock(t) | ||
} | ||
|
||
checkPragueStatusOnL1 := func(active bool) { | ||
l1Head := miner.L1Chain().CurrentBlock() | ||
if active { | ||
// require.True(t, sd.L1Cfg.Config.IsPrague(l1Head.Number, l1Head.Time), "Prague should be active") | ||
require.NotNil(t, l1Head.RequestsHash, "Prague header requests hash should be non-nil") | ||
} else { | ||
// require.False(t, sd.L1Cfg.Config.IsPrague(l1Head.Number, l1Head.Time), "Prague should not be active yet") | ||
require.Nil(t, l1Head.RequestsHash, "Prague header requests hash should be nil") | ||
} | ||
} | ||
|
||
syncVerifierAndCheck := func(t actionsHelpers.StatefulTesting) { | ||
verifier.ActL1HeadSignal(t) | ||
verifier.ActL2PipelineFull(t) | ||
checkVerifierDerivedToL1Head(t) | ||
} | ||
|
||
// Check initially Prague is not activated | ||
checkPragueStatusOnL1(false) | ||
|
||
// Start op-nodes | ||
sequencer.ActL2PipelineFull(t) | ||
verifier.ActL2PipelineFull(t) | ||
|
||
// Build empty L1 blocks, crossing the fork boundary | ||
miner.ActEmptyBlock(t) | ||
miner.ActEmptyBlock(t) // Prague activates here | ||
miner.ActEmptyBlock(t) | ||
|
||
// Check that Prague is active on L1 | ||
checkPragueStatusOnL1(true) | ||
|
||
// Cache safe head before verifier sync | ||
safeL2Before := verifier.SyncStatus().SafeL2 | ||
|
||
// Build L2 unsafe chain and batch it to L1 using either calldata or | ||
// EIP-7702 setCode txs | ||
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md | ||
buildUnsafeL2AndSubmit(testCfg.Custom.useSetCodeTx) | ||
|
||
// Check verifier derived from Prague L1 blocks | ||
syncVerifierAndCheck(t) | ||
|
||
// Check safe head did or did not change, | ||
// depending on tx type used by batcher: | ||
safeL2After := verifier.SyncStatus().SafeL2 | ||
if testCfg.Custom.useSetCodeTx { | ||
require.Equal(t, safeL2Before, safeL2After, "safe head should not have changed (set code batcher tx ignored)") | ||
} else { | ||
require.Greater(t, safeL2After.Number, safeL2Before.Number, "safe head should have progressed (calldata batcher tx included)") | ||
} | ||
|
||
env.RunFaultProofProgram(t, safeL2After.Number, testCfg.CheckResult, testCfg.InputParams...) | ||
} | ||
|
||
matrix := helpers.NewMatrix[testCase]() | ||
defer matrix.Run(gt) | ||
|
||
for _, tc := range testCases { | ||
matrix.AddTestCase( | ||
fmt.Sprintf("HonestClaim-%s", tc.name), | ||
tc, | ||
helpers.NewForkMatrix(helpers.LatestFork), | ||
runL1PragueTest, | ||
helpers.ExpectNoError(), | ||
) | ||
matrix.AddTestCase( | ||
fmt.Sprintf("JunkClaim-%s", tc.name), | ||
tc, | ||
helpers.NewForkMatrix(helpers.LatestFork), | ||
runL1PragueTest, | ||
helpers.ExpectError(claim.ErrClaimNotValid), | ||
helpers.WithL2Claim(common.HexToHash("0xdeadbeef")), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule automate
added at
011758
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently fails as upstream geth does not yet support EIP7702 transactions in the txpool. The test passes when run against this patch ethereum-optimism/op-geth#479