Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,35 @@ jobs:
# This job runs the optimism test simulations. This requires a virtual
# machine instead of the container-based build environment because hive needs
# to be able to talk to the docker containers it creates.
op-tests:
hive-rpc-tests:
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
- attach_workspace: {at: "/tmp/build"}
- run:
command: "/tmp/build/hive -sim=optimism -client=op-l1,op-l2,op-proposer,op-batcher,op-node |& tee /tmp/build/hive.log"
command: "/tmp/build/hive -sim=optimism/rpc -client=op-l1,op-l2,op-proposer,op-batcher,op-node |& tee /tmp/build/hive-rpc.log"
- run:
command: "! grep 'pass.*=false' /tmp/build/hive.log"
command: "! grep 'pass.*=false' /tmp/build/hive-rpc.log"
- slack/notify:
channel: C03N11M0BBN
event: fail
template: basic_fail_1
- slack/notify:
channel: C03N11M0BBN
event: pass
template: basic_success_1

hive-p2p-tests:
machine:
image: ubuntu-2004:202201-02
steps:
- checkout
- attach_workspace: {at: "/tmp/build"}
- run:
command: "/tmp/build/hive -sim=optimism/p2p -client=op-l1,op-l2,op-proposer,op-batcher,op-node |& tee /tmp/build/hive-p2p.log"
- run:
command: "! grep 'pass.*=false' /tmp/build/hive-p2p.log"
- slack/notify:
channel: C03N11M0BBN
event: fail
Expand Down Expand Up @@ -64,6 +83,9 @@ workflows:
jobs:
- go-test
- build
- op-tests:
- hive-rpc-tests:
requires: ["build"]
context: slack
- hive-p2p-tests:
requires: ["build"]
context: slack
1 change: 1 addition & 0 deletions clients/op-node/opnode-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ exec op-node \
--p2p.listen.ip=0.0.0.0 \
--p2p.listen.tcp=9003 \
--p2p.listen.udp=9003 \
$HIVE_P2P_STATIC_FLAG \
--snapshotlog.file=/snapshot.log \
--p2p.priv.path=/config/p2p-node-key.txt
15 changes: 7 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Microsoft/hcsshim v0.8.23 // indirect
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/btcsuite/btcd v0.20.1-beta // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/containerd/cgroups v1.0.1 // indirect
github.com/containerd/containerd v1.5.9 // indirect
github.com/deckarep/golang-set v1.7.1 // indirect
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
Expand All @@ -48,14 +47,14 @@ require (
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.0.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/tsdb v0.10.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
go.opencensus.io v0.22.3 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
52 changes: 24 additions & 28 deletions go.sum

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions optimism/devnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Devnet struct {
L1 *Eth1Node
L2 *L2Node
Rollup *OpNode
Verifier *OpNode
Proposer *L2OSNode
Batcher *BSSNode

Expand Down Expand Up @@ -204,6 +205,8 @@ func (d *Devnet) StartOp() error {
"HIVE_L2_URL": fmt.Sprintf("http://%s:%d", d.L2.IP, d.L2.HTTPPort),
"HIVE_L1_ETH_RPC_FLAG": fmt.Sprintf("--l1=ws://%s:%d", d.L1.IP, d.L1.WSPort),
"HIVE_L2_ENGINE_RPC_FLAG": fmt.Sprintf("--l2=ws://%s:%d", d.L2.IP, d.L2.WSPort),

"HIVE_P2P_STATIC_FLAG": "",
}

if op.HasRole("op-sequencer") {
Expand All @@ -217,6 +220,35 @@ func (d *Devnet) StartOp() error {
return nil
}

func (d *Devnet) StartVerifier() error {
op := d.Nodes["op-node"]

executionOpts := hivesim.Params{
"HIVE_CHECK_LIVE_PORT": "7545",
"HIVE_CATALYST_ENABLED": "1",
"HIVE_LOGLEVEL": os.Getenv("HIVE_LOGLEVEL"),
"HIVE_NODETYPE": "full",

"HIVE_L1_URL": fmt.Sprintf("http://%s:%d", d.L1.IP, d.L1.HTTPPort),
"HIVE_L2_URL": fmt.Sprintf("http://%s:%d", d.L2.IP, d.L2.HTTPPort),
"HIVE_L1_ETH_RPC_FLAG": fmt.Sprintf("--l1=ws://%s:%d", d.L1.IP, d.L1.WSPort),
"HIVE_L2_ENGINE_RPC_FLAG": fmt.Sprintf("--l2=ws://%s:%d", d.L2.IP, d.L2.WSPort),

"HIVE_SEQUENCER_ENABLED_FLAG": "",
"HIVE_SEQUENCER_KEY_FLAG": "",
// TODO: avoid hardcoding p2p key
"HIVE_P2P_STATIC_FLAG": fmt.Sprintf("--p2p.static=/ip4/%s/tcp/9003/p2p/16Uiu2HAmHqrXGts25TtKMBRHtvhWZLNypsobKoggpZye1XQtJpbZ", d.Rollup.IP),
}

p2pNodeKey := "d30e180aa6c25bac3ba2f0965af5da1934dbabe4505c92ddd1459e5cec27a882"

optimismPortalOpt := hivesim.WithDynamicFile("/OptimismPortalProxy.json", bytesSource([]byte(d.OptimismPortal)))
p2pNodeKeyOpt := hivesim.WithDynamicFile("/config/p2p-node-key.txt", bytesSource([]byte(p2pNodeKey)))
opts := []hivesim.StartOption{executionOpts, optimismPortalOpt, p2pNodeKeyOpt}
d.Verifier = &OpNode{d.T.StartClient(op.Name, opts...), 7545}
return nil
}

func (d *Devnet) StartL2OS() error {
l2os := d.Nodes["op-proposer"]

Expand Down
15 changes: 15 additions & 0 deletions simulators/optimism/p2p/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This simulation runs JSON-RPC API tests.
FROM golang:1.18-alpine3.15 as builder
RUN apk add --update gcc musl-dev linux-headers

# Build the simulator executable.
ADD . /source
WORKDIR /source
RUN go build -v .

# Build the simulator run container.
FROM alpine:latest
ADD . /source
WORKDIR /source
COPY --from=builder /source/p2p .
ENTRYPOINT ["./p2p"]
6 changes: 6 additions & 0 deletions simulators/optimism/p2p/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Optimism P2P test suite

This test suite tests the P2P protocol between the sequencer and verifier on
the optimism network.

hive --sim optimism/p2p --client=op-l1,op-l2,op-proposer,op-batcher,op-sequencer,op-verifier --docker.output
31 changes: 31 additions & 0 deletions simulators/optimism/p2p/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module github.com/ethereum/hive/simulators/optimism/p2p

go 1.18

replace github.com/ethereum/go-ethereum v1.10.17 => github.com/ethereum-optimism/reference-optimistic-geth v0.0.0-20220715235548-70b02481016d

replace github.com/ethereum/hive v0.0.0-20220630112103-4b22dc796d94 => github.com/ethereum-optimism/hive v0.0.0-20220725184331-e0ca18567bc8

require (
github.com/ethereum/go-ethereum v1.10.17
github.com/ethereum/hive v0.0.0-20220630112103-4b22dc796d94
)

require (
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
Loading