Skip to content

Commit 2bfb52d

Browse files
sebastianstclaude
andauthored
fix(op-e2e): make Holocene activation proof test non-trivial (#20023)
* fix(op-e2e): make Holocene activation proof test non-trivial The test was running RunFaultProofProgramFromGenesis with safe head at block 0, making the proof trivially pass over genesis. Now batch-mines and syncs past the activation boundary so the proof runs over the actual Holocene activation block (block 14). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(op-e2e): ensure holocene proofs tests don't run trivially on genesis Fix holocene_batches_test and holocene_frame_test: when disordered batches/frames cause the channel to be dropped (safe head = 0), build a new block and rebatch so the FPP runs on a non-trivial safe head. For holocene_invalid_batch_test, the blocks themselves have intentionally invalid contents (over-advanced L1 origin, sequencer drift breach), so rebatching them produces the same invalid result. In those cases, skip the proof with a log message. The Holocene variants of these tests advance the safe head and do run the proof. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(op-e2e): skip FPP for dropped batches/frames instead of rebatching Rebatching glosses over the invalid range and doesn't test that the derivation pipeline correctly dropped the problematic data. Instead, skip the FPP with a log message when safe head is at genesis, matching the approach in holocene_invalid_batch_test. Filed #20050 to track running the FPP and asserting no new blocks are produced over the dropped range. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * make 14 a const --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 822f616 commit 2bfb52d

File tree

4 files changed

+40
-26
lines changed

4 files changed

+40
-26
lines changed

op-e2e/actions/proofs/holocene_activation_test.go

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import (
66
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
77
actionsHelpers "github.com/ethereum-optimism/optimism/op-e2e/actions/helpers"
88
"github.com/ethereum-optimism/optimism/op-e2e/actions/proofs/helpers"
9-
"github.com/ethereum-optimism/optimism/op-program/client/claim"
109
"github.com/ethereum-optimism/optimism/op-service/testlog"
11-
"github.com/ethereum/go-ethereum/common"
1210
"github.com/ethereum/go-ethereum/common/hexutil"
1311
"github.com/stretchr/testify/require"
1412
)
@@ -17,11 +15,11 @@ func Test_ProgramAction_HoloceneActivation(gt *testing.T) {
1715

1816
runHoloceneDerivationTest := func(gt *testing.T, testCfg *helpers.TestCfg[any]) {
1917
t := actionsHelpers.NewDefaultTesting(gt)
18+
const holoceneOffset = 14
2019

2120
// Define override to activate Holocene 14 seconds after genesis
2221
var setHoloceneTime = func(dc *genesis.DeployConfig) {
23-
fourteen := hexutil.Uint64(14)
24-
dc.L2GenesisHoloceneTimeOffset = &fourteen
22+
dc.L2GenesisHoloceneTimeOffset = ptr(hexutil.Uint64(holoceneOffset))
2523
}
2624

2725
env := helpers.NewL2FaultProofEnv(t, testCfg, helpers.NewTestParams(), helpers.NewBatcherCfg(), setHoloceneTime)
@@ -89,11 +87,9 @@ func Test_ProgramAction_HoloceneActivation(gt *testing.T) {
8987
env.Sequencer.ActL2PipelineFull(t)
9088

9189
l2SafeHead := env.Sequencer.L2Safe()
92-
t.Log(l2SafeHead.Time)
90+
t.Log("Safe head", "time", l2SafeHead.Time)
9391
require.EqualValues(t, uint64(0), l2SafeHead.Number) // channel should be dropped, so no safe head progression
94-
if uint64(0) == l2SafeHead.Number {
95-
t.Log("Safe head progressed as expected", "l2SafeHeadNumber", l2SafeHead.Number)
96-
}
92+
t.Log("Safe head progressed as expected", "number", l2SafeHead.Number)
9793

9894
// Log assertions
9995
filters := []string{
@@ -106,25 +102,21 @@ func Test_ProgramAction_HoloceneActivation(gt *testing.T) {
106102
recs := env.Logs.FindLogs(testlog.NewMessageContainsFilter(filter), testlog.NewAttributesFilter("role", "sequencer"))
107103
require.Len(t, recs, 1, "searching for %d instances of '%s' in logs from role %s", 1, filter, "sequencer")
108104
}
109-
env.RunFaultProofProgramFromGenesis(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
105+
106+
// Now make sure the safe head progresses over the activation boundary so proofs tests aren't trivial over the genesis block.
107+
env.BatchMineAndSync(t)
108+
l2SafeHead = env.Sequencer.L2Safe()
109+
t.Log("Safe head", "time", l2SafeHead.Time)
110+
require.EqualValues(t, uint64(holoceneOffset), l2SafeHead.Number)
111+
t.Log("Safe head progressed as expected", "number", l2SafeHead.Number)
112+
env.RunFaultProofProgram(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
110113
}
111114

112115
matrix := helpers.NewMatrix[any]()
113-
defer matrix.Run(gt)
114-
115-
matrix.AddTestCase(
116-
"HonestClaim-HoloceneActivation",
117-
nil,
118-
helpers.NewForkMatrix(helpers.Granite),
119-
runHoloceneDerivationTest,
120-
helpers.ExpectNoError(),
121-
)
122-
matrix.AddTestCase(
123-
"JunkClaim-HoloceneActivation",
116+
matrix.AddDefaultTestCases(
124117
nil,
125118
helpers.NewForkMatrix(helpers.Granite),
126119
runHoloceneDerivationTest,
127-
helpers.ExpectError(claim.ErrClaimNotValid),
128-
helpers.WithL2Claim(common.HexToHash("0xdeadbeef")),
129120
)
121+
matrix.Run(gt)
130122
}

op-e2e/actions/proofs/holocene_batches_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,15 @@ func Test_ProgramAction_HoloceneBatches(gt *testing.T) {
130130
testCfg.Custom.RequireExpectedProgressAndLogs(t, l2SafeHead, isHolocene, env.Engine, env.Logs)
131131
t.Log("Safe head progressed as expected", "l2SafeHeadNumber", l2SafeHead.Number)
132132

133-
env.RunFaultProofProgramFromGenesis(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
133+
// Run the fault proof program on a non-trivial block. When safe head is 0 because
134+
// the derivation pipeline correctly dropped disordered batches, we skip the proof —
135+
// rebatching would gloss over the problematic range and not test the drop behavior.
136+
// TODO(#20050): run FPP over the genesis range and assert derivation produces no new blocks.
137+
if l2SafeHead.Number > 0 {
138+
env.RunFaultProofProgramFromGenesis(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
139+
} else {
140+
t.Log("Skipping fault proof program: safe head is at genesis due to dropped batches")
141+
}
134142
}
135143

136144
matrix := helpers.NewMatrix[testCase]()

op-e2e/actions/proofs/holocene_frame_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,15 @@ func Test_ProgramAction_HoloceneFrames(gt *testing.T) {
113113
testCfg.Custom.RequireExpectedProgressAndLogs(t, l2SafeHead, isHolocene, env.Engine, env.Logs)
114114
t.Log("Safe head progressed as expected", "l2SafeHeadNumber", l2SafeHead.Number)
115115

116-
env.RunFaultProofProgramFromGenesis(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
116+
// Run the fault proof program on a non-trivial block. When safe head is 0 because
117+
// the derivation pipeline correctly dropped disordered frames, we skip the proof —
118+
// rebatching would gloss over the problematic range and not test the drop behavior.
119+
// TODO(#20050): run FPP over the genesis range and assert derivation produces no new blocks.
120+
if l2SafeHead.Number > 0 {
121+
env.RunFaultProofProgramFromGenesis(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
122+
} else {
123+
t.Log("Skipping fault proof program: safe head is at genesis due to dropped frames")
124+
}
117125
}
118126

119127
matrix := helpers.NewMatrix[testCase]()

op-e2e/actions/proofs/holocene_invalid_batch_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,14 @@ func Test_ProgramAction_HoloceneInvalidBatch(gt *testing.T) {
239239
testCfg.Custom.RequireExpectedProgressAndLogs(t, l2SafeHead, isHolocene, env.Engine, env.Logs)
240240
t.Log("Safe head progressed as expected", "l2SafeHeadNumber", l2SafeHead.Number)
241241

242-
if safeHeadNumber := l2SafeHead.Number; safeHeadNumber > 0 {
243-
env.RunFaultProofProgram(t, safeHeadNumber, testCfg.CheckResult, testCfg.InputParams...)
242+
// Run the fault proof program on a non-trivial block. When safe head is 0 due to
243+
// intentionally invalid block contents (e.g. over-advanced L1 origin, sequencer drift breach),
244+
// rebatching produces the same invalid result, so skip the proof in those cases.
245+
// The Holocene variants of these tests DO advance the safe head and run the proof.
246+
if l2SafeHead.Number > 0 {
247+
env.RunFaultProofProgram(t, l2SafeHead.Number, testCfg.CheckResult, testCfg.InputParams...)
248+
} else {
249+
t.Log("Skipping fault proof program: safe head is at genesis due to intentionally invalid block contents")
244250
}
245251
}
246252

0 commit comments

Comments
 (0)