Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
fcb462f9
Unverified
Commit
fcb462f9
authored
Nov 04, 2024
by
Adrian Sutton
Committed by
GitHub
Nov 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: Add action test for op-program trace extension behaviour. (#12803)
parent
c73832d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
env.go
op-e2e/actions/proofs/helpers/env.go
+6
-0
trace_extension_test.go
op-e2e/actions/proofs/trace_extension_test.go
+68
-0
No files found.
op-e2e/actions/proofs/helpers/env.go
View file @
fcb462f9
...
@@ -145,6 +145,12 @@ func WithL2Claim(claim common.Hash) FixtureInputParam {
...
@@ -145,6 +145,12 @@ func WithL2Claim(claim common.Hash) FixtureInputParam {
}
}
}
}
func
WithL2BlockNumber
(
num
uint64
)
FixtureInputParam
{
return
func
(
f
*
FixtureInputs
)
{
f
.
L2BlockNumber
=
num
}
}
func
(
env
*
L2FaultProofEnv
)
RunFaultProofProgram
(
t
helpers
.
Testing
,
l2ClaimBlockNum
uint64
,
checkResult
CheckResult
,
fixtureInputParams
...
FixtureInputParam
)
{
func
(
env
*
L2FaultProofEnv
)
RunFaultProofProgram
(
t
helpers
.
Testing
,
l2ClaimBlockNum
uint64
,
checkResult
CheckResult
,
fixtureInputParams
...
FixtureInputParam
)
{
// Fetch the pre and post output roots for the fault proof.
// Fetch the pre and post output roots for the fault proof.
preRoot
,
err
:=
env
.
Sequencer
.
RollupClient
()
.
OutputAtBlock
(
t
.
Ctx
(),
l2ClaimBlockNum
-
1
)
preRoot
,
err
:=
env
.
Sequencer
.
RollupClient
()
.
OutputAtBlock
(
t
.
Ctx
(),
l2ClaimBlockNum
-
1
)
...
...
op-e2e/actions/proofs/trace_extension_test.go
0 → 100644
View file @
fcb462f9
package
proofs
import
(
"testing"
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/stretchr/testify/require"
)
func
runSafeHeadTraceExtensionTest
(
gt
*
testing
.
T
,
testCfg
*
helpers
.
TestCfg
[
any
])
{
t
:=
actionsHelpers
.
NewDefaultTesting
(
gt
)
env
:=
helpers
.
NewL2FaultProofEnv
(
t
,
testCfg
,
helpers
.
NewTestParams
(),
helpers
.
NewBatcherCfg
())
// Build an empty block on L2
env
.
Sequencer
.
ActL2StartBlock
(
t
)
env
.
Sequencer
.
ActL2EndBlock
(
t
)
// Instruct the batcher to submit the block to L1, and include the transaction.
env
.
Batcher
.
ActSubmitAll
(
t
)
env
.
Miner
.
ActL1StartBlock
(
12
)(
t
)
env
.
Miner
.
ActL1IncludeTxByHash
(
env
.
Batcher
.
LastSubmitted
.
Hash
())(
t
)
env
.
Miner
.
ActL1EndBlock
(
t
)
// Instruct the sequencer to derive the L2 chain from the data on L1 that the batcher just posted.
env
.
Sequencer
.
ActL1HeadSignal
(
t
)
env
.
Sequencer
.
ActL2PipelineFull
(
t
)
l1Head
:=
env
.
Miner
.
L1Chain
()
.
CurrentBlock
()
l2SafeHead
:=
env
.
Engine
.
L2Chain
()
.
CurrentSafeBlock
()
// Ensure there is only 1 block on L1.
require
.
Equal
(
t
,
uint64
(
1
),
l1Head
.
Number
.
Uint64
())
// Ensure the block is marked as safe before we attempt to fault prove it.
require
.
Equal
(
t
,
uint64
(
1
),
l2SafeHead
.
Number
.
Uint64
())
// Set claimed L2 block number to be past the actual safe head (still using the safe head output as the claim)
params
:=
[]
helpers
.
FixtureInputParam
{
helpers
.
WithL2BlockNumber
(
l2SafeHead
.
Number
.
Uint64
()
+
1
)}
params
=
append
(
params
,
testCfg
.
InputParams
...
)
env
.
RunFaultProofProgram
(
t
,
l2SafeHead
.
Number
.
Uint64
(),
testCfg
.
CheckResult
,
params
...
)
}
// Test_ProgramAction_SafeHeadTraceExtension checks that op-program correctly handles the trace extension case where
// the claimed l2 block number is after the safe head. The honest actor should repeat the output root from the safe head
// and op-program should consider it valid even though the claimed l2 block number is not reached.
// Output roots other than from the safe head should be invalid if the claimed l2 block number is not reached.
func
Test_ProgramAction_SafeHeadTraceExtension
(
gt
*
testing
.
T
)
{
matrix
:=
helpers
.
NewMatrix
[
any
]()
defer
matrix
.
Run
(
gt
)
matrix
.
AddTestCase
(
"HonestClaim"
,
nil
,
helpers
.
LatestForkOnly
,
runSafeHeadTraceExtensionTest
,
helpers
.
ExpectNoError
(),
)
matrix
.
AddTestCase
(
"JunkClaim"
,
nil
,
helpers
.
LatestForkOnly
,
runSafeHeadTraceExtensionTest
,
helpers
.
ExpectError
(
claim
.
ErrClaimNotValid
),
helpers
.
WithL2Claim
(
common
.
HexToHash
(
"0xdeadbeef"
)),
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment