Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions op-acceptance-tests/tests/osaka_on_l2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import (
"github.com/ethereum-optimism/optimism/op-devstack/devtest"
"github.com/ethereum-optimism/optimism/op-devstack/presets"
"github.com/ethereum-optimism/optimism/op-devstack/sysgo"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txplan"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
)

Expand Down Expand Up @@ -118,6 +121,57 @@ func TestEIP7883ModExpGasCostIncrease(gt *testing.T) {
t.Require().NoError(err, "post-fork: modexp should succeed with 600 execution gas (floor is 500)")
}

func TestEIP7825TxGasLimitCap(gt *testing.T) {
t := devtest.ParallelT(gt)
sysgo.SkipOnOpGeth(t, "osaka is not supported in op-geth")

testCases := map[string]struct {
opt sysgo.DeployerOption
expectErr bool
}{
"pre-karst": {
opt: sysgo.WithJovianAtGenesis,
},
"post-karst": {
opt: sysgo.WithKarstAtGenesis,
expectErr: true,
},
}

// EIP-7825 caps transaction gas at 2^24 = 16,777,216.
Comment thread
joshklop marked this conversation as resolved.
// This is a tx validity rule enforced at the txpool/block level, not by the
// EVM, so eth_call and eth_simulateV1 don't enforce it. We must send a real
// transaction and verify the RPC rejects it.
for name, testCase := range testCases {
t.Run(name, func(t devtest.T) {
t.Parallel()
sys := presets.NewMinimal(t, presets.WithDeployerOptions(testCase.opt))

eoa := sys.FunderL2.NewFundedEOA(eth.OneEther)

planWithGasLimit := func(gas uint64) txplan.Option {
return txplan.Combine(
eoa.Plan(),
txplan.WithGasLimit(gas),
txplan.WithTo(&common.Address{}),
)
}

_, err := txplan.NewPlannedTx(planWithGasLimit(params.MaxTxGas)).Success.Eval(t.Ctx())
t.Require().NoError(err, "tx with gas at 2^24 should succeed")

tx := txplan.NewPlannedTx(planWithGasLimit(params.MaxTxGas + 1))
if testCase.expectErr {
_, err := tx.Included.Eval(t.Ctx())
t.Require().Error(err, "tx with gas above 2^24 should be rejected")
} else {
_, err := tx.Success.Eval(t.Ctx())
t.Require().NoError(err, "tx with gas above 2^24 should succeed")
}
})
}
}

func TestEIP7939CLZ(gt *testing.T) {
t := devtest.ParallelT(gt)
sysgo.SkipOnOpGeth(t, "osaka is not supported in op-geth")
Expand Down
6 changes: 6 additions & 0 deletions op-devstack/sysgo/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ func WithKarstAtOffset(offset *uint64) DeployerOption {
}
}

func WithKarstAtGenesis(p devtest.T, _ devkeys.Keys, builder intentbuilder.Builder) {
for _, l2Cfg := range builder.L2s() {
l2Cfg.WithForkAtGenesis(opforks.Karst)
}
}

func WithJovianAtGenesis(p devtest.T, _ devkeys.Keys, builder intentbuilder.Builder) {
for _, l2Cfg := range builder.L2s() {
l2Cfg.WithForkAtGenesis(opforks.Jovian)
Expand Down
Loading