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
0e294749
Unverified
Commit
0e294749
authored
Sep 12, 2024
by
clabby
Committed by
GitHub
Sep 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sequence window expiry test (#11897)
parent
9e1f077f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
6 deletions
+96
-6
env.go
op-e2e/actions/proofs/env.go
+14
-6
sequence_window_expiry_test.go
op-e2e/actions/proofs/sequence_window_expiry_test.go
+82
-0
No files found.
op-e2e/actions/proofs/env.go
View file @
0e294749
...
@@ -41,13 +41,13 @@ func NewL2FaultProofEnv(t actions.Testing, tp *e2eutils.TestParams, dp *e2eutils
...
@@ -41,13 +41,13 @@ func NewL2FaultProofEnv(t actions.Testing, tp *e2eutils.TestParams, dp *e2eutils
miner
:=
actions
.
NewL1Miner
(
t
,
log
.
New
(
"role"
,
"l1-miner"
),
sd
.
L1Cfg
)
miner
:=
actions
.
NewL1Miner
(
t
,
log
.
New
(
"role"
,
"l1-miner"
),
sd
.
L1Cfg
)
l1
F
,
err
:=
sources
.
NewL1Client
(
miner
.
RPCClient
(),
log
,
nil
,
sources
.
L1ClientDefaultConfig
(
sd
.
RollupCfg
,
false
,
sources
.
RPCKindStandard
))
l1
Cl
,
err
:=
sources
.
NewL1Client
(
miner
.
RPCClient
(),
log
,
nil
,
sources
.
L1ClientDefaultConfig
(
sd
.
RollupCfg
,
false
,
sources
.
RPCKindStandard
))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
engine
:=
actions
.
NewL2Engine
(
t
,
log
.
New
(
"role"
,
"sequencer-engine"
),
sd
.
L2Cfg
,
sd
.
RollupCfg
.
Genesis
.
L1
,
jwtPath
,
actions
.
EngineWithP2P
())
engine
:=
actions
.
NewL2Engine
(
t
,
log
.
New
(
"role"
,
"sequencer-engine"
),
sd
.
L2Cfg
,
sd
.
RollupCfg
.
Genesis
.
L1
,
jwtPath
,
actions
.
EngineWithP2P
())
l2Cl
,
err
:=
sources
.
NewEngineClient
(
engine
.
RPCClient
(),
log
,
nil
,
sources
.
EngineClientDefaultConfig
(
sd
.
RollupCfg
))
l2
Engine
Cl
,
err
:=
sources
.
NewEngineClient
(
engine
.
RPCClient
(),
log
,
nil
,
sources
.
EngineClientDefaultConfig
(
sd
.
RollupCfg
))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
sequencer
:=
actions
.
NewL2Sequencer
(
t
,
log
.
New
(
"role"
,
"sequencer"
),
l1
F
,
miner
.
BlobStore
(),
altda
.
Disabled
,
l2
Cl
,
sd
.
RollupCfg
,
0
,
cfg
.
InteropBackend
)
sequencer
:=
actions
.
NewL2Sequencer
(
t
,
log
.
New
(
"role"
,
"sequencer"
),
l1
Cl
,
miner
.
BlobStore
(),
altda
.
Disabled
,
l2Engine
Cl
,
sd
.
RollupCfg
,
0
,
cfg
.
InteropBackend
)
miner
.
ActL1SetFeeRecipient
(
common
.
Address
{
0xCA
,
0xFE
,
0xBA
,
0xBE
})
miner
.
ActL1SetFeeRecipient
(
common
.
Address
{
0xCA
,
0xFE
,
0xBA
,
0xBE
})
sequencer
.
ActL2PipelineFull
(
t
)
sequencer
.
ActL2PipelineFull
(
t
)
engCl
:=
engine
.
EngineClient
(
t
,
sd
.
RollupCfg
)
engCl
:=
engine
.
EngineClient
(
t
,
sd
.
RollupCfg
)
...
@@ -57,14 +57,22 @@ func NewL2FaultProofEnv(t actions.Testing, tp *e2eutils.TestParams, dp *e2eutils
...
@@ -57,14 +57,22 @@ func NewL2FaultProofEnv(t actions.Testing, tp *e2eutils.TestParams, dp *e2eutils
batcher
:=
actions
.
NewL2Batcher
(
log
,
sd
.
RollupCfg
,
batcherCfg
,
sequencer
.
RollupClient
(),
miner
.
EthClient
(),
engine
.
EthClient
(),
engCl
)
batcher
:=
actions
.
NewL2Batcher
(
log
,
sd
.
RollupCfg
,
batcherCfg
,
sequencer
.
RollupClient
(),
miner
.
EthClient
(),
engine
.
EthClient
(),
engCl
)
addresses
:=
e2eutils
.
CollectAddresses
(
sd
,
dp
)
addresses
:=
e2eutils
.
CollectAddresses
(
sd
,
dp
)
cl
:=
engine
.
EthClient
()
l1EthCl
:=
miner
.
EthClient
()
l2EthCl
:=
engine
.
EthClient
()
l1UserEnv
:=
&
actions
.
BasicUserEnv
[
*
actions
.
L1Bindings
]{
EthCl
:
l1EthCl
,
Signer
:
types
.
LatestSigner
(
sd
.
L1Cfg
.
Config
),
AddressCorpora
:
addresses
,
Bindings
:
actions
.
NewL1Bindings
(
t
,
l1EthCl
),
}
l2UserEnv
:=
&
actions
.
BasicUserEnv
[
*
actions
.
L2Bindings
]{
l2UserEnv
:=
&
actions
.
BasicUserEnv
[
*
actions
.
L2Bindings
]{
EthCl
:
c
l
,
EthCl
:
l2EthC
l
,
Signer
:
types
.
LatestSigner
(
sd
.
L2Cfg
.
Config
),
Signer
:
types
.
LatestSigner
(
sd
.
L2Cfg
.
Config
),
AddressCorpora
:
addresses
,
AddressCorpora
:
addresses
,
Bindings
:
actions
.
NewL2Bindings
(
t
,
c
l
,
engine
.
GethClient
()),
Bindings
:
actions
.
NewL2Bindings
(
t
,
l2EthC
l
,
engine
.
GethClient
()),
}
}
alice
:=
actions
.
NewCrossLayerUser
(
log
,
dp
.
Secrets
.
Alice
,
rand
.
New
(
rand
.
NewSource
(
0xa57b
)))
alice
:=
actions
.
NewCrossLayerUser
(
log
,
dp
.
Secrets
.
Alice
,
rand
.
New
(
rand
.
NewSource
(
0xa57b
)))
alice
.
L1
.
SetUserEnv
(
l1UserEnv
)
alice
.
L2
.
SetUserEnv
(
l2UserEnv
)
alice
.
L2
.
SetUserEnv
(
l2UserEnv
)
return
&
L2FaultProofEnv
{
return
&
L2FaultProofEnv
{
...
...
op-e2e/actions/proofs/sequence_window_expiry_test.go
0 → 100644
View file @
0e294749
package
proofs
import
(
"testing"
"github.com/ethereum-optimism/optimism/op-e2e/actions"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"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"
)
// Run a test that proves a deposit-only block generated due to sequence window expiry.
func
runSequenceWindowExpireTest
(
gt
*
testing
.
T
,
checkResult
func
(
gt
*
testing
.
T
,
err
error
),
inputParams
...
FixtureInputParam
)
{
t
:=
actions
.
NewDefaultTesting
(
gt
)
tp
:=
NewTestParams
()
dp
:=
NewDeployParams
(
t
,
func
(
dp
*
e2eutils
.
DeployParams
)
{
genesisBlock
:=
hexutil
.
Uint64
(
0
)
// Enable Cancun on L1 & Granite on L2 at genesis
dp
.
DeployConfig
.
L1CancunTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisRegolithTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisCanyonTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisDeltaTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisEcotoneTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisFjordTimeOffset
=
&
genesisBlock
dp
.
DeployConfig
.
L2GenesisGraniteTimeOffset
=
&
genesisBlock
})
bCfg
:=
NewBatcherCfg
()
env
:=
NewL2FaultProofEnv
(
t
,
tp
,
dp
,
bCfg
)
// Mine an empty block for gas estimation purposes.
env
.
miner
.
ActEmptyBlock
(
t
)
// Expire the sequence window by building `SequenceWindow + 1` empty blocks on L1.
for
i
:=
0
;
i
<
int
(
tp
.
SequencerWindowSize
)
+
1
;
i
++
{
env
.
alice
.
L1
.
ActResetTxOpts
(
t
)
env
.
alice
.
ActDeposit
(
t
)
env
.
miner
.
ActL1StartBlock
(
12
)(
t
)
env
.
miner
.
ActL1IncludeTx
(
env
.
alice
.
Address
())(
t
)
env
.
miner
.
ActL1EndBlock
(
t
)
env
.
miner
.
ActL1SafeNext
(
t
)
env
.
miner
.
ActL1FinalizeNext
(
t
)
}
// Ensure the safe head is still 0.
l2SafeHead
:=
env
.
engine
.
L2Chain
()
.
CurrentSafeBlock
()
require
.
EqualValues
(
t
,
0
,
l2SafeHead
.
Number
.
Uint64
())
// Ask the sequencer to derive the deposit-only L2 chain.
env
.
sequencer
.
ActL1HeadSignal
(
t
)
env
.
sequencer
.
ActL2PipelineFull
(
t
)
// Ensure the safe head advanced forcefully.
l2SafeHead
=
env
.
engine
.
L2Chain
()
.
CurrentSafeBlock
()
require
.
Greater
(
t
,
l2SafeHead
.
Number
.
Uint64
(),
uint64
(
0
))
// Run the FPP on one of the auto-derived blocks.
err
:=
env
.
RunFaultProofProgram
(
t
,
gt
,
l2SafeHead
.
Number
.
Uint64
()
/
2
,
inputParams
...
)
checkResult
(
gt
,
err
)
}
func
Test_ProgramAction_SequenceWindowExpired_HonestClaim_Granite
(
gt
*
testing
.
T
)
{
runSequenceWindowExpireTest
(
gt
,
func
(
gt
*
testing
.
T
,
err
error
)
{
require
.
NoError
(
gt
,
err
,
"fault proof program should have succeeded"
)
})
}
func
Test_ProgramAction_SequenceWindowExpired_JunkClaim_Granite
(
gt
*
testing
.
T
)
{
runSequenceWindowExpireTest
(
gt
,
func
(
gt
*
testing
.
T
,
err
error
)
{
require
.
ErrorIs
(
gt
,
err
,
claim
.
ErrClaimNotValid
,
"fault proof program should have failed"
)
},
func
(
f
*
FixtureInputs
)
{
f
.
L2Claim
=
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