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
9223f920
Unverified
Commit
9223f920
authored
Sep 27, 2023
by
OptimismBot
Committed by
GitHub
Sep 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7436 from ethereum-optimism/aj/external-client
op-e2e: Support external client in the e2e new tests
parents
058c796f
c8fad370
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
13 deletions
+24
-13
external.go
op-e2e/external.go
+2
-1
main_test.go
op-e2e/external_geth/main_test.go
+1
-1
op_geth.go
op-e2e/op_geth.go
+16
-4
op_geth_test.go
op-e2e/op_geth_test.go
+2
-4
setup.go
op-e2e/setup.go
+3
-3
No files found.
op-e2e/external.go
View file @
9223f920
...
...
@@ -46,13 +46,14 @@ func (eec *ExternalEthClient) WSAuthEndpoint() string {
return
eec
.
Endpoints
.
WSAuthEndpoint
}
func
(
eec
*
ExternalEthClient
)
Close
()
{
func
(
eec
*
ExternalEthClient
)
Close
()
error
{
eec
.
Session
.
Terminate
()
select
{
case
<-
time
.
After
(
5
*
time
.
Second
)
:
eec
.
Session
.
Kill
()
case
<-
eec
.
Session
.
Exited
:
}
return
nil
}
func
(
er
*
ExternalRunner
)
Run
(
t
*
testing
.
T
)
*
ExternalEthClient
{
...
...
op-e2e/external_geth/main_test.go
View file @
9223f920
...
...
@@ -39,7 +39,7 @@ func TestShim(t *testing.T) {
Name
:
"TestShim"
,
BinPath
:
shimPath
,
})
.
Run
(
t
)
t
.
Cleanup
(
ec
.
Close
)
t
.
Cleanup
(
func
()
{
_
=
ec
.
Close
}
)
for
_
,
endpoint
:=
range
[]
string
{
ec
.
HTTPEndpoint
(),
...
...
op-e2e/op_geth.go
View file @
9223f920
...
...
@@ -38,7 +38,7 @@ var (
// OpGeth is an actor that functions as a l2 op-geth node
// It provides useful functions for advancing and querying the chain
type
OpGeth
struct
{
node
*
gn
.
Nod
e
node
EthInstanc
e
l2Engine
*
sources
.
EngineClient
L2Client
*
ethclient
.
Client
SystemConfig
eth
.
SystemConfig
...
...
@@ -73,9 +73,21 @@ func NewOpGeth(t *testing.T, ctx context.Context, cfg *SystemConfig) (*OpGeth, e
SystemConfig
:
e2eutils
.
SystemConfigFromDeployConfig
(
cfg
.
DeployConfig
),
}
node
,
_
,
err
:=
geth
.
InitL2
(
"l2"
,
big
.
NewInt
(
int64
(
cfg
.
DeployConfig
.
L2ChainID
)),
l2Genesis
,
cfg
.
JWTFilePath
)
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
node
.
Start
())
var
node
EthInstance
if
cfg
.
ExternalL2Shim
==
""
{
gethNode
,
_
,
err
:=
geth
.
InitL2
(
"l2"
,
big
.
NewInt
(
int64
(
cfg
.
DeployConfig
.
L2ChainID
)),
l2Genesis
,
cfg
.
JWTFilePath
)
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
gethNode
.
Start
())
node
=
gethNode
}
else
{
externalNode
:=
(
&
ExternalRunner
{
Name
:
"l2"
,
BinPath
:
cfg
.
ExternalL2Shim
,
Genesis
:
l2Genesis
,
JWTPath
:
cfg
.
JWTFilePath
,
})
.
Run
(
t
)
node
=
externalNode
}
auth
:=
rpc
.
WithHTTPAuth
(
gn
.
NewJWTAuth
(
cfg
.
JWTSecret
))
l2Node
,
err
:=
client
.
NewRPC
(
ctx
,
logger
,
node
.
WSAuthEndpoint
(),
client
.
WithGethRPCOptions
(
auth
))
...
...
op-e2e/op_geth_test.go
View file @
9223f920
...
...
@@ -38,6 +38,7 @@ func TestMissingGasLimit(t *testing.T) {
attrs
.
GasLimit
=
nil
res
,
err
:=
opGeth
.
StartBlockBuilding
(
ctx
,
attrs
)
require
.
Error
(
t
,
err
)
require
.
ErrorIs
(
t
,
err
,
eth
.
InputError
{})
require
.
Equal
(
t
,
eth
.
InvalidPayloadAttributes
,
err
.
(
eth
.
InputError
)
.
Code
)
require
.
Nil
(
t
,
res
)
...
...
@@ -157,15 +158,12 @@ func TestGethOnlyPendingBlockIsLatest(t *testing.T) {
require
.
NoError
(
t
,
opGeth
.
L2Client
.
SendTransaction
(
ctx
,
tx
),
"send tx to make pending work different"
)
checkPending
(
"prepared"
,
0
)
rpcClient
:=
opGeth
.
node
.
Attach
()
defer
rpcClient
.
Close
()
// Wait for tx to be in tx-pool, for it to be picked up in block building
var
txPoolStatus
struct
{
Pending
hexutil
.
Uint64
`json:"pending"`
}
for
i
:=
0
;
i
<
5
;
i
++
{
require
.
NoError
(
t
,
rpcClient
.
CallContext
(
ctx
,
&
txPoolStatus
,
"txpool_status"
))
require
.
NoError
(
t
,
opGeth
.
L2Client
.
Client
()
.
Call
(
&
txPoolStatus
,
"txpool_status"
))
if
txPoolStatus
.
Pending
==
0
{
time
.
Sleep
(
time
.
Second
)
}
else
{
...
...
op-e2e/setup.go
View file @
9223f920
...
...
@@ -225,8 +225,8 @@ func (gi *GethInstance) HTTPAuthEndpoint() string {
return
gi
.
Node
.
HTTPAuthEndpoint
()
}
func
(
gi
*
GethInstance
)
Close
()
{
gi
.
Node
.
Close
()
func
(
gi
*
GethInstance
)
Close
()
error
{
return
gi
.
Node
.
Close
()
}
// EthInstance is either an in process Geth or external process exposing its
...
...
@@ -236,7 +236,7 @@ type EthInstance interface {
WSEndpoint
()
string
HTTPAuthEndpoint
()
string
WSAuthEndpoint
()
string
Close
()
Close
()
error
}
type
System
struct
{
...
...
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