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
3206f4bb
Unverified
Commit
3206f4bb
authored
Sep 29, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into jg/configurable_txmgr_cli_default_values
parents
507524e2
dca6720b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
53 deletions
+91
-53
l2_batcher_test.go
op-e2e/actions/l2_batcher_test.go
+1
-1
l2_engine.go
op-e2e/actions/l2_engine.go
+18
-5
blocks.go
op-e2e/e2eutils/wait/blocks.go
+59
-0
waits.go
op-e2e/e2eutils/wait/waits.go
+0
-37
system_adminrpc_test.go
op-e2e/system_adminrpc_test.go
+13
-10
No files found.
op-e2e/actions/l2_batcher_test.go
View file @
3206f4bb
...
...
@@ -504,7 +504,7 @@ func TestBigL2Txs(gt *testing.T) {
if
miner
.
l1GasPool
.
Gas
()
<
tx
.
Gas
()
{
// fill the L1 block with batcher txs until we run out of gas
break
}
log
.
Info
(
"including batcher tx"
,
"nonce"
,
tx
)
log
.
Info
(
"including batcher tx"
,
"nonce"
,
tx
.
Nonce
()
)
miner
.
IncludeTx
(
t
,
tx
)
txs
=
txs
[
1
:
]
}
...
...
op-e2e/actions/l2_engine.go
View file @
3206f4bb
package
actions
import
(
"context"
"errors"
"time"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-program/client/l2/engineapi"
"github.com/stretchr/testify/require"
...
...
@@ -176,12 +179,22 @@ func (e *L2Engine) ActL2IncludeTx(from common.Address) Action {
return
}
i
:=
e
.
engineApi
.
PendingIndices
(
from
)
txs
,
q
:=
e
.
eth
.
TxPool
()
.
ContentFrom
(
from
)
require
.
Greaterf
(
t
,
uint64
(
len
(
txs
)),
i
,
"no pending txs from %s, and have %d unprocessable queued txs from this account"
,
from
,
len
(
q
))
var
i
uint64
var
txs
[]
*
types
.
Transaction
var
q
[]
*
types
.
Transaction
// Wait for the tx to be in the pending tx queue
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
err
:=
wait
.
For
(
ctx
,
time
.
Second
,
func
()
(
bool
,
error
)
{
i
=
e
.
engineApi
.
PendingIndices
(
from
)
txs
,
q
=
e
.
eth
.
TxPool
()
.
ContentFrom
(
from
)
return
uint64
(
len
(
txs
))
>
i
,
nil
})
require
.
NoError
(
t
,
err
,
"no pending txs from %s, and have %d unprocessable queued txs from this account: %w"
,
from
,
len
(
q
),
err
)
tx
:=
txs
[
i
]
err
:
=
e
.
engineApi
.
IncludeTx
(
tx
,
from
)
err
=
e
.
engineApi
.
IncludeTx
(
tx
,
from
)
if
errors
.
Is
(
err
,
engineapi
.
ErrNotBuildingBlock
)
{
t
.
InvalidAction
(
err
.
Error
())
}
else
if
errors
.
Is
(
err
,
engineapi
.
ErrUsesTooMuchGas
)
{
...
...
op-e2e/e2eutils/wait/blocks.go
0 → 100644
View file @
3206f4bb
package
wait
import
(
"context"
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/core/types"
)
// BlockCaller is a subset of the [ethclient.Client] interface
// encompassing methods that query for block information.
type
BlockCaller
interface
{
BlockByNumber
(
ctx
context
.
Context
,
number
*
big
.
Int
)
(
*
types
.
Block
,
error
)
BlockNumber
(
ctx
context
.
Context
)
(
uint64
,
error
)
}
func
ForBlock
(
ctx
context
.
Context
,
client
BlockCaller
,
n
uint64
)
error
{
for
{
if
ctx
.
Done
()
!=
nil
{
return
ctx
.
Err
()
}
height
,
err
:=
client
.
BlockNumber
(
ctx
)
if
err
!=
nil
{
return
err
}
if
height
<
n
{
time
.
Sleep
(
500
*
time
.
Millisecond
)
continue
}
break
}
return
nil
}
func
ForBlockWithTimestamp
(
ctx
context
.
Context
,
client
BlockCaller
,
target
uint64
)
error
{
_
,
err
:=
AndGet
(
ctx
,
time
.
Second
,
func
()
(
uint64
,
error
)
{
head
,
err
:=
client
.
BlockByNumber
(
ctx
,
nil
)
if
err
!=
nil
{
return
0
,
err
}
return
head
.
Time
(),
nil
},
func
(
actual
uint64
)
bool
{
return
actual
>=
target
})
return
err
}
func
ForNextBlock
(
ctx
context
.
Context
,
client
BlockCaller
)
error
{
current
,
err
:=
client
.
BlockNumber
(
ctx
)
// Long timeout so we don't have to care what the block time is. If the test passes this will complete early anyway.
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
60
*
time
.
Second
)
defer
cancel
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"get starting block number: %w"
,
err
)
}
return
ForBlock
(
ctx
,
client
,
current
+
1
)
}
op-e2e/e2eutils/wait/waits.go
View file @
3206f4bb
...
...
@@ -69,43 +69,6 @@ func printDebugTrace(ctx context.Context, client *ethclient.Client, txHash commo
fmt
.
Printf
(
"TxTrace: %v
\n
"
,
trace
)
}
func
ForBlock
(
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
n
uint64
)
error
{
for
{
height
,
err
:=
client
.
BlockNumber
(
ctx
)
if
err
!=
nil
{
return
err
}
if
height
<
n
{
time
.
Sleep
(
500
*
time
.
Millisecond
)
continue
}
break
}
return
nil
}
func
ForBlockWithTimestamp
(
ctx
context
.
Context
,
client
*
ethclient
.
Client
,
target
uint64
)
error
{
_
,
err
:=
AndGet
(
ctx
,
time
.
Second
,
func
()
(
uint64
,
error
)
{
head
,
err
:=
client
.
BlockByNumber
(
ctx
,
nil
)
if
err
!=
nil
{
return
0
,
err
}
return
head
.
Time
(),
nil
},
func
(
actual
uint64
)
bool
{
return
actual
>=
target
})
return
err
}
func
ForNextBlock
(
ctx
context
.
Context
,
client
*
ethclient
.
Client
)
error
{
current
,
err
:=
client
.
BlockNumber
(
ctx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"get starting block number: %w"
,
err
)
}
return
ForBlock
(
ctx
,
client
,
current
+
1
)
}
func
For
(
ctx
context
.
Context
,
rate
time
.
Duration
,
cb
func
()
(
bool
,
error
))
error
{
tick
:=
time
.
NewTicker
(
rate
)
defer
tick
.
Stop
()
...
...
op-e2e/system_adminrpc_test.go
View file @
3206f4bb
...
...
@@ -5,6 +5,7 @@ import (
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils/wait"
"github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/node"
"github.com/ethereum-optimism/optimism/op-node/sources"
...
...
@@ -34,10 +35,11 @@ func TestStopStartSequencer(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
active
,
"sequencer should be active"
)
blockBefore
:=
latestBlock
(
t
,
l2Seq
)
time
.
Sleep
(
time
.
Duration
(
cfg
.
DeployConfig
.
L2BlockTime
+
1
)
*
time
.
Second
)
blockAfter
:=
latestBlock
(
t
,
l2Seq
)
require
.
Greaterf
(
t
,
blockAfter
,
blockBefore
,
"Chain did not advance"
)
require
.
NoError
(
t
,
wait
.
ForNextBlock
(
ctx
,
l2Seq
),
"Chain did not advance after starting sequencer"
,
)
ctx
,
cancel
=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Second
)
defer
cancel
()
...
...
@@ -50,9 +52,9 @@ func TestStopStartSequencer(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
False
(
t
,
active
,
"sequencer should be inactive"
)
blockBefore
=
latestBlock
(
t
,
l2Seq
)
blockBefore
:
=
latestBlock
(
t
,
l2Seq
)
time
.
Sleep
(
time
.
Duration
(
cfg
.
DeployConfig
.
L2BlockTime
+
1
)
*
time
.
Second
)
blockAfter
=
latestBlock
(
t
,
l2Seq
)
blockAfter
:
=
latestBlock
(
t
,
l2Seq
)
require
.
Equal
(
t
,
blockAfter
,
blockBefore
,
"Chain advanced after stopping sequencer"
)
ctx
,
cancel
=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Second
)
...
...
@@ -66,10 +68,11 @@ func TestStopStartSequencer(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
True
(
t
,
active
,
"sequencer should be active again"
)
blockBefore
=
latestBlock
(
t
,
l2Seq
)
time
.
Sleep
(
time
.
Duration
(
cfg
.
DeployConfig
.
L2BlockTime
+
1
)
*
time
.
Second
)
blockAfter
=
latestBlock
(
t
,
l2Seq
)
require
.
Greater
(
t
,
blockAfter
,
blockBefore
,
"Chain did not advance after starting sequencer"
)
require
.
NoError
(
t
,
wait
.
ForNextBlock
(
ctx
,
l2Seq
),
"Chain did not advance after starting sequencer"
,
)
}
func
TestPersistSequencerStateWhenChanged
(
t
*
testing
.
T
)
{
...
...
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