Skip to content

Commit feaea86

Browse files
committed
init p2p
1 parent 7fbd110 commit feaea86

23 files changed

+1459
-1
lines changed

clients/op-batcher/entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ exec op-batcher \
3232
--resubmission-timeout=30s \
3333
--mnemonic="test test test test test test test test test test test junk" \
3434
--sequencer-hd-path="m/44'/60'/0'/0/2" \
35-
--sequencer-history-db-filename="history_db.json" \
3635
--sequencer-genesis-hash=$SEQUENCER_GENESIS_HASH \
3736
--sequencer-batch-inbox-address=$SEQUENCER_BATCH_INBOX_ADDRESS \
3837
--log-terminal=true

clients/op-sequencer/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM golang:1.18.0-alpine3.15 as builder
2+
3+
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
4+
5+
RUN git clone https://github.com/ethereum-optimism/optimism /app
6+
7+
WORKDIR /app/op-node
8+
RUN make op-node
9+
10+
FROM alpine:3.15
11+
12+
RUN apk add jq curl
13+
14+
COPY --from=builder /app/op-node/bin/op-node /usr/local/bin
15+
COPY ./opnode-entrypoint.sh /opnode-entrypoint.sh
16+
COPY ./rollup.json /rollup.json
17+
RUN mkdir /hive /config
18+
COPY p2p-node-key.txt /config
19+
COPY p2p-sequencer-key.txt /config
20+
COPY test-jwt-secret.txt /config
21+
22+
RUN op-node --version 2>/dev/null | head -1 > /version.txt
23+
24+
EXPOSE 7545/tcp
25+
26+
ENTRYPOINT ["/bin/sh", "/opnode-entrypoint.sh"]

clients/op-sequencer/bss-key.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bf7604d9d3a1c7748642b1b7b05c2bd219c9faa91458b370f85e5a40f3b03af7

clients/op-sequencer/hive.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
roles:
2+
- "op-sequencer"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/sh
2+
set -exu
3+
4+
# Generate the rollup config.
5+
6+
L1_URL="http://172.17.0.3:8545"
7+
L2_URL="http://172.17.0.4:9545"
8+
9+
# Grab the L1 genesis. We can use cURL here to retry.
10+
L1_GENESIS=$(curl \
11+
--silent \
12+
--fail \
13+
--retry 10 \
14+
--retry-delay 2 \
15+
--retry-connrefused \
16+
-X POST \
17+
-H "Content-Type: application/json" \
18+
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' \
19+
$L1_URL)
20+
21+
# Grab the L2 genesis. We can use cURL here to retry.
22+
L2_GENESIS=$(curl \
23+
--silent \
24+
--fail \
25+
--retry 10 \
26+
--retry-delay 2 \
27+
--retry-connrefused \
28+
-X POST \
29+
-H "Content-Type: application/json" \
30+
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' \
31+
$L2_URL)
32+
33+
DEPOSIT_CONTRACT_ADDRESS=$(jq -r .address < /OptimismPortalProxy.json)
34+
35+
jq ". | .genesis.l1.hash = \"$(echo $L1_GENESIS | jq -r '.result.hash')\"" < /rollup.json | \
36+
jq ". | .genesis.l2.hash = \"$(echo $L2_GENESIS | jq -r '.result.hash')\"" | \
37+
jq ". | .genesis.l2_time = $(echo $L2_GENESIS | jq -r '.result.timestamp' | xargs printf "%d")" | \
38+
jq ". | .deposit_contract_address = \"$DEPOSIT_CONTRACT_ADDRESS\"" > /hive/rollup.json
39+
40+
exec op-node \
41+
--l1=ws://172.17.0.3:8546 \
42+
--l2=ws://172.17.0.4:9546 \
43+
--l2.jwt-secret=/config/test-jwt-secret.txt \
44+
--sequencer.enabled \
45+
--sequencer.l1-confs=0 \
46+
--verifier.l1-confs=0 \
47+
--p2p.sequencer.key=/config/p2p-sequencer-key.txt \
48+
--rollup.config=/hive/rollup.json \
49+
--rpc.addr=0.0.0.0 \
50+
--rpc.port=7545 \
51+
--p2p.listen.ip=0.0.0.0 \
52+
--p2p.listen.tcp=9003 \
53+
--p2p.listen.udp=9003 \
54+
--snapshotlog.file=/snapshot.log \
55+
--p2p.priv.path=/config/p2p-node-key.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dae4671006c60a3619556ace98eca6f6e092948d05b13070a27ac492a4fba419
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba

clients/op-sequencer/rollup.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"genesis": {
3+
"l1": {
4+
"hash": "0x21837b23495539c19e4b85d3d115c740c677d2609480eb67c3b2bb218a3ffd8f",
5+
"number": 0
6+
},
7+
"l2": {
8+
"hash": "0x00574ae7ed85cf485dd148011ab78c138becdd65b3078bd46c94c55766c8fc7a",
9+
"number": 0
10+
},
11+
"l2_time": 1647573629
12+
},
13+
14+
"block_time": 2,
15+
16+
"max_sequencer_drift": 1000,
17+
18+
"seq_window_size": 4,
19+
20+
"channel_timeout": 40,
21+
22+
"l1_chain_id": 900,
23+
24+
"l2_chain_id": 901,
25+
26+
"p2p_sequencer_address": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
27+
28+
"fee_recipient_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
29+
30+
"batch_inbox_address": "0xff00000000000000000000000000000000000002",
31+
32+
"batch_sender_address": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
33+
34+
"deposit_contract_address": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001"
35+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

clients/op-verifier/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM golang:1.18.0-alpine3.15 as builder
2+
3+
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
4+
5+
RUN git clone https://github.com/ethereum-optimism/optimism /app
6+
7+
WORKDIR /app/op-node
8+
RUN make op-node
9+
10+
FROM alpine:3.15
11+
12+
RUN apk add jq curl
13+
14+
COPY --from=builder /app/op-node/bin/op-node /usr/local/bin
15+
COPY ./opnode-entrypoint.sh /opnode-entrypoint.sh
16+
COPY ./rollup.json /rollup.json
17+
RUN mkdir /hive /config
18+
COPY p2p-node-key.txt /config
19+
COPY test-jwt-secret.txt /config
20+
21+
RUN op-node --version 2>/dev/null | head -1 > /version.txt
22+
23+
EXPOSE 7545/tcp
24+
25+
ENTRYPOINT ["/bin/sh", "/opnode-entrypoint.sh"]

0 commit comments

Comments
 (0)