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
fb2530c4
Unverified
Commit
fb2530c4
authored
Aug 24, 2024
by
protolambda
Committed by
GitHub
Aug 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-e2e: fix waitForSafeHead hot loop (#11595)
parent
518359c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
21 deletions
+8
-21
system_fpp_test.go
op-e2e/system_fpp_test.go
+7
-20
system_test.go
op-e2e/system_test.go
+1
-1
No files found.
op-e2e/system_fpp_test.go
View file @
fb2530c4
...
@@ -16,6 +16,7 @@ import (
...
@@ -16,6 +16,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/geth"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-program/client/claim"
"github.com/ethereum-optimism/optimism/op-program/client/claim"
opp
"github.com/ethereum-optimism/optimism/op-program/host"
opp
"github.com/ethereum-optimism/optimism/op-program/host"
oppconf
"github.com/ethereum-optimism/optimism/op-program/host/config"
oppconf
"github.com/ethereum-optimism/optimism/op-program/host/config"
...
@@ -114,10 +115,10 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
...
@@ -114,10 +115,10 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
// Avoids flaky test by avoiding reorgs at epoch 0
// Avoids flaky test by avoiding reorgs at epoch 0
t
.
Log
(
"Wait for safe head to advance once for setup"
)
t
.
Log
(
"Wait for safe head to advance once for setup"
)
// Safe head doesn't exist at genesis. Wait for the first one before proceeding
// Safe head doesn't exist at genesis. Wait for the first one before proceeding
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
1
,
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
1
))
ss
,
err
:=
l2Seq
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
int64
(
rpc
.
SafeBlockNumber
)))
ss
,
err
:=
l2Seq
.
BlockByNumber
(
ctx
,
big
.
NewInt
(
int64
(
rpc
.
SafeBlockNumber
)))
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
ss
.
NumberU64
()
+
cfg
.
DeployConfig
.
SequencerWindowSize
+
1
,
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
ss
.
NumberU64
()
+
cfg
.
DeployConfig
.
SequencerWindowSize
+
1
))
t
.
Log
(
"Sending transactions to setup existing state, prior to challenged period"
)
t
.
Log
(
"Sending transactions to setup existing state, prior to challenged period"
)
aliceKey
:=
cfg
.
Secrets
.
Alice
aliceKey
:=
cfg
.
Secrets
.
Alice
...
@@ -125,7 +126,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
...
@@ -125,7 +126,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
opts
.
ToAddr
=
&
cfg
.
Secrets
.
Addresses
()
.
Bob
opts
.
ToAddr
=
&
cfg
.
Secrets
.
Addresses
()
.
Bob
opts
.
Value
=
big
.
NewInt
(
1
_000
)
opts
.
Value
=
big
.
NewInt
(
1
_000
)
})
})
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
receipt
.
BlockNumber
.
Uint64
(),
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
receipt
.
BlockNumber
.
Uint64
()
))
t
.
Logf
(
"Capture current L2 head as agreed starting point. l2Head=%x l2BlockNumber=%v"
,
receipt
.
BlockHash
,
receipt
.
BlockNumber
)
t
.
Logf
(
"Capture current L2 head as agreed starting point. l2Head=%x l2BlockNumber=%v"
,
receipt
.
BlockHash
,
receipt
.
BlockNumber
)
agreedL2Output
,
err
:=
rollupClient
.
OutputAtBlock
(
ctx
,
receipt
.
BlockNumber
.
Uint64
())
agreedL2Output
,
err
:=
rollupClient
.
OutputAtBlock
(
ctx
,
receipt
.
BlockNumber
.
Uint64
())
...
@@ -151,7 +152,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
...
@@ -151,7 +152,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
// Wait for safe head to start advancing again when the sequencing window elapses, for at least three blocks
// Wait for safe head to start advancing again when the sequencing window elapses, for at least three blocks
t
.
Log
(
"Wait for safe head to advance after sequencing window elapses"
)
t
.
Log
(
"Wait for safe head to advance after sequencing window elapses"
)
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
safeBlock
.
NumberU64
()
+
3
,
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
safeBlock
.
NumberU64
()
+
3
))
// Use the 2nd empty block as our L2 claim block
// Use the 2nd empty block as our L2 claim block
t
.
Log
(
"Determine L2 claim"
)
t
.
Log
(
"Determine L2 claim"
)
...
@@ -172,7 +173,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
...
@@ -172,7 +173,7 @@ func testVerifyL2OutputRootEmptyBlock(t *testing.T, detached bool, spanBatchActi
opts
.
Value
=
big
.
NewInt
(
1
_000
)
opts
.
Value
=
big
.
NewInt
(
1
_000
)
opts
.
Nonce
=
1
opts
.
Nonce
=
1
})
})
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
receipt
.
BlockNumber
.
Uint64
(),
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
receipt
.
BlockNumber
.
Uint64
()
))
t
.
Log
(
"Determine L1 head that includes batch after sequence of empty blocks"
)
t
.
Log
(
"Determine L1 head that includes batch after sequence of empty blocks"
)
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
nil
)
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
nil
)
...
@@ -257,7 +258,7 @@ func testVerifyL2OutputRoot(t *testing.T, detached bool, spanBatchActivated bool
...
@@ -257,7 +258,7 @@ func testVerifyL2OutputRoot(t *testing.T, detached bool, spanBatchActivated bool
l2Claim
:=
l2Output
.
OutputRoot
l2Claim
:=
l2Output
.
OutputRoot
t
.
Log
(
"Determine L1 head that includes all batches required for L2 claim block"
)
t
.
Log
(
"Determine L1 head that includes all batches required for L2 claim block"
)
require
.
NoError
(
t
,
wait
ForSafeHead
(
ctx
,
l2ClaimBlockNumber
,
rollupClient
))
require
.
NoError
(
t
,
wait
.
ForSafeBlock
(
ctx
,
rollupClient
,
l2ClaimBlockNumber
))
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
nil
)
l1HeadBlock
,
err
:=
l1Client
.
BlockByNumber
(
ctx
,
nil
)
require
.
NoError
(
t
,
err
,
"get l1 head block"
)
require
.
NoError
(
t
,
err
,
"get l1 head block"
)
l1Head
:=
l1HeadBlock
.
Hash
()
l1Head
:=
l1HeadBlock
.
Hash
()
...
@@ -326,17 +327,3 @@ func testFaultProofProgramScenario(t *testing.T, ctx context.Context, sys *Syste
...
@@ -326,17 +327,3 @@ func testFaultProofProgramScenario(t *testing.T, ctx context.Context, sys *Syste
require
.
ErrorIs
(
t
,
err
,
claim
.
ErrClaimNotValid
)
require
.
ErrorIs
(
t
,
err
,
claim
.
ErrClaimNotValid
)
}
}
}
}
func
waitForSafeHead
(
ctx
context
.
Context
,
safeBlockNum
uint64
,
rollupClient
*
sources
.
RollupClient
)
error
{
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
60
*
time
.
Second
)
defer
cancel
()
for
{
seqStatus
,
err
:=
rollupClient
.
SyncStatus
(
ctx
)
if
err
!=
nil
{
return
err
}
if
seqStatus
.
SafeL2
.
Number
>=
safeBlockNum
{
return
nil
}
}
}
op-e2e/system_test.go
View file @
fb2530c4
...
@@ -524,7 +524,7 @@ func TestMissingBatchE2E(t *testing.T) {
...
@@ -524,7 +524,7 @@ func TestMissingBatchE2E(t *testing.T) {
require
.
Equal
(
t
,
ethereum
.
NotFound
,
err
,
"Found transaction in verifier when it should not have been included"
)
require
.
Equal
(
t
,
ethereum
.
NotFound
,
err
,
"Found transaction in verifier when it should not have been included"
)
// Wait a short time for the L2 reorg to occur on the sequencer as well.
// Wait a short time for the L2 reorg to occur on the sequencer as well.
err
=
wait
ForSafeHead
(
ctx
,
receipt
.
BlockNumber
.
Uint64
(),
seqRollupClient
)
err
=
wait
.
ForSafeBlock
(
ctx
,
seqRollupClient
,
receipt
.
BlockNumber
.
Uint64
()
)
require
.
Nil
(
t
,
err
,
"timeout waiting for L2 reorg on sequencer safe head"
)
require
.
Nil
(
t
,
err
,
"timeout waiting for L2 reorg on sequencer safe head"
)
// Assert that the reconciliation process did an L2 reorg on the sequencer to remove the invalid block
// Assert that the reconciliation process did an L2 reorg on the sequencer to remove the invalid block
...
...
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