-
Notifications
You must be signed in to change notification settings - Fork 4k
op-e2e/actions: add L1 Osaka activation test #17666
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
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d591144
add Fusaka activation test
DenseDenise 20865f2
updated the test to add L1 blob base fee assertions
DenseDenise 8f4f259
fixes
geoknee 2904c92
Merge remote-tracking branch 'origin/develop' into FusakaTest
geoknee ad87c6f
wire up Fusaka on L1 and improve test
geoknee 6349fd0
give test teeth
geoknee 4eece32
improve prague fork test
geoknee 93271d9
activate prague at genesis and osaka after
geoknee ba6d771
updated op-geth to v1.101603.0-synctest.0.0.20250930110811-5eee1eab50e6
geoknee e8cfecc
Merge branch 'FusakaTest' into gk/actions-cherry
geoknee 7e2df56
extend test to cover BPO forks
geoknee 81193ce
Merge remote-tracking branch 'origin/develop' into gk/actions-cherry
geoknee 0aa5c1a
typo fix
geoknee 417dedf
typo fix
geoknee cc37aff
dedupe tests
geoknee 39e491a
rename file
geoknee 28a7882
respond to review
geoknee a022ebd
Merge remote-tracking branch 'origin/develop' into gk/actions-cherry
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,141 @@ | ||
| package proofs_test | ||
|
|
||
| import ( | ||
| "math/big" | ||
| "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" | ||
| legacybindings "github.com/ethereum-optimism/optimism/op-e2e/bindings" | ||
| "github.com/ethereum-optimism/optimism/op-service/eth" | ||
| "github.com/ethereum-optimism/optimism/op-service/predeploys" | ||
| "github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
| "github.com/ethereum/go-ethereum/common" | ||
| "github.com/ethereum/go-ethereum/common/hexutil" | ||
| "github.com/ethereum/go-ethereum/consensus/misc/eip4844" | ||
| "github.com/ethereum/go-ethereum/params" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // Test_ProgramAction_BlobParameterForks tests the blob base fee calculation for different forks. | ||
| func Test_ProgramAction_BlobParameterForks(gt *testing.T) { | ||
| runBlobParameterForksTest := func(gt *testing.T, testCfg *helpers.TestCfg[any]) { | ||
| t := actionsHelpers.NewDefaultTesting(gt) | ||
|
|
||
| // Create test environment with Fusaka activation | ||
| env := helpers.NewL2FaultProofEnv(t, testCfg, helpers.NewTestParams(), | ||
| helpers.NewBatcherCfg( | ||
| func(c *actionsHelpers.BatcherCfg) { | ||
| c.DataAvailabilityType = batcherFlags.BlobsType | ||
| }, | ||
| ), | ||
| func(dp *genesis.DeployConfig) { | ||
| dp.L1CancunTimeOffset = ptr(hexutil.Uint64(0)) | ||
| dp.L1PragueTimeOffset = ptr(hexutil.Uint64(12)) | ||
| dp.L1OsakaTimeOffset = ptr(hexutil.Uint64(24)) | ||
| dp.L1BPO1TimeOffset = ptr(hexutil.Uint64(36)) | ||
| dp.L1BPO2TimeOffset = ptr(hexutil.Uint64(48)) | ||
| dp.L1BPO3TimeOffset = ptr(hexutil.Uint64(60)) | ||
| dp.L1BPO4TimeOffset = ptr(hexutil.Uint64(72)) | ||
| dp.L1BlobScheduleConfig = ¶ms.BlobScheduleConfig{ | ||
| Cancun: params.DefaultCancunBlobConfig, | ||
| Osaka: params.DefaultOsakaBlobConfig, | ||
| Prague: params.DefaultPragueBlobConfig, | ||
| BPO1: params.DefaultBPO1BlobConfig, | ||
| BPO2: params.DefaultBPO2BlobConfig, | ||
| BPO3: params.DefaultBPO3BlobConfig, | ||
| BPO4: params.DefaultBPO4BlobConfig, | ||
| } | ||
| dp.L1GenesisBlockExcessBlobGas = ptr(hexutil.Uint64(1e8)) // Jack up the blob market so we can test the blob fee calculation | ||
|
geoknee marked this conversation as resolved.
|
||
| }, | ||
| ) | ||
|
|
||
| miner, sequencer := env.Miner, env.Sequencer | ||
|
|
||
| // Bind to L1Block contract on L2 | ||
| l1BlockContract, err := legacybindings.NewL1Block(predeploys.L1BlockAddr, env.Engine.EthClient()) | ||
| require.NoError(t, err) | ||
|
|
||
| atBlockWithHash := func(hash common.Hash) *bind.CallOpts { | ||
| return &bind.CallOpts{ | ||
| BlockHash: hash, | ||
| } | ||
| } | ||
|
|
||
| // requireConsistentBlobBaseFeeForFork requires the blob base fee to be consistent between | ||
| // the L1 Origin block (computed using the excess blob gas and l1 chain config) | ||
| // and the L1 Block contract on L2 (accessed with a contract method call), for a given fork predicate. | ||
| requireConsistentBlobBaseFeeForFork := func(t actionsHelpers.StatefulTesting, l2Block eth.L2BlockRef, expectActive bool, label string, isActive func(num *big.Int, time uint64) bool) { | ||
| bbfL2, err := l1BlockContract.BlobBaseFee(atBlockWithHash(l2Block.Hash)) | ||
| require.NoError(t, err) | ||
|
|
||
| l1Origin := miner.L1Chain().GetHeaderByHash(l2Block.L1Origin.Hash) | ||
| if expectActive { | ||
| require.True(t, isActive(l1Origin.Number, l1Origin.Time), "%s not active at l1 origin %d, time %d", label, l1Origin.Number, l1Origin.Time) | ||
| } else { | ||
| require.False(t, isActive(l1Origin.Number, l1Origin.Time), "%s should not be active at l1 origin %d, time %d", label, l1Origin.Number, l1Origin.Time) | ||
| } | ||
| bbfL1 := eip4844.CalcBlobFee(env.Sd.L1Cfg.Config, l1Origin) | ||
|
|
||
| require.True(t, bbfL2.Cmp(bbfL1) == 0, | ||
| "%s: blob base fee does not match, bbfL2=%d, bbfL1=%d, l1BlockNum=%d, l2BlockNum=%d", label, bbfL2, bbfL1, l1Origin.Number, l2Block.Number) | ||
|
|
||
| require.True(t, bbfL2.Cmp(big.NewInt(1)) > 0, | ||
| "%s: blob base fee is unrealistically low and doesn't exercise the blob fee calculation", label) | ||
| } | ||
|
|
||
| // buildL1ToTime advances L1 with empty blocks until the given fork time. | ||
| buildL1ToTime := func(t actionsHelpers.StatefulTesting, forkTime *uint64) { | ||
| require.NotNil(t, forkTime, "fork time must be configured") | ||
| h := miner.L1Chain().CurrentHeader() | ||
| for h.Time < *forkTime { | ||
| h = miner.ActEmptyBlock(t).Header() | ||
| } | ||
| } | ||
|
|
||
| // Iterate through all forks and assert pre/post activation blob fees match expectations | ||
| cfg := env.Sd.L1Cfg.Config | ||
| forks := []struct { | ||
| label string | ||
| forkTime *uint64 | ||
| isActive func(num *big.Int, time uint64) bool | ||
| }{ | ||
| {"Prague", cfg.PragueTime, func(num *big.Int, time uint64) bool { return cfg.IsPrague(num, time) }}, | ||
| {"Osaka", cfg.OsakaTime, func(num *big.Int, time uint64) bool { return cfg.IsOsaka(num, time) }}, | ||
| {"BPO1", cfg.BPO1Time, func(num *big.Int, time uint64) bool { return cfg.IsBPO1(num, time) }}, | ||
| {"BPO2", cfg.BPO2Time, func(num *big.Int, time uint64) bool { return cfg.IsBPO2(num, time) }}, | ||
| {"BPO3", cfg.BPO3Time, func(num *big.Int, time uint64) bool { return cfg.IsBPO3(num, time) }}, | ||
| {"BPO4", cfg.BPO4Time, func(num *big.Int, time uint64) bool { return cfg.IsBPO4(num, time) }}, | ||
| } | ||
| for _, f := range forks { | ||
| // Advance L1 to fork activation | ||
| buildL1ToTime(t, f.forkTime) | ||
|
|
||
| // Build an empty L2 block which still has a pre-fork L1 origin, and check blob fee | ||
| sequencer.ActL2EmptyBlock(t) | ||
| l2Block := sequencer.SyncStatus().UnsafeL2 | ||
| requireConsistentBlobBaseFeeForFork(t, l2Block, false, f.label, f.isActive) | ||
|
|
||
| // Advance L2 chain until L1 origin is at/after the fork activation | ||
| sequencer.ActL1HeadSignal(t) | ||
| sequencer.ActBuildToL1HeadUnsafe(t) | ||
|
|
||
| l2Block = sequencer.L2Unsafe() | ||
| require.Greater(t, l2Block.Number, uint64(1)) | ||
| requireConsistentBlobBaseFeeForFork(t, l2Block, true, f.label, f.isActive) | ||
| } | ||
|
|
||
| // Final sync | ||
| env.BatchMineAndSync(t) | ||
|
|
||
| // Run fault proof program | ||
| safeL2Head := sequencer.L2Safe() | ||
| env.RunFaultProofProgramFromGenesis(t, safeL2Head.Number, testCfg.CheckResult, testCfg.InputParams...) | ||
| } | ||
|
|
||
| matrix := helpers.NewMatrix[any]() | ||
| defer matrix.Run(gt) | ||
| matrix.AddDefaultTestCases(nil, helpers.NewForkMatrix(helpers.LatestFork), runBlobParameterForksTest) | ||
|
geoknee marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.