From 0fa42a92e94d1ad6c7ca060354dd9dc5ab4ba763 Mon Sep 17 00:00:00 2001 From: nabarun Date: Fri, 31 Mar 2023 13:39:31 +0530 Subject: [PATCH] Implement op-node container --- .../docker-compose-fixturenet-optimism.yml | 25 +++++++++++++++++++ .../fixturenet-optimism/run-op-batcher.sh | 21 ++++++++++++++++ .../config/fixturenet-optimism/run-op-node.sh | 6 ++--- .../cerc-optimism-op-node/Dockerfile | 2 +- 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100755 app/data/config/fixturenet-optimism/run-op-batcher.sh diff --git a/app/data/compose/docker-compose-fixturenet-optimism.yml b/app/data/compose/docker-compose-fixturenet-optimism.yml index 4d17e5f2..cf9c9109 100644 --- a/app/data/compose/docker-compose-fixturenet-optimism.yml +++ b/app/data/compose/docker-compose-fixturenet-optimism.yml @@ -70,6 +70,31 @@ services: # TODO: Integrate - ../test/l2-accounts:/l2-accounts command: ["sh", "/app/run-op-node.sh"] + ports: + - "8547" + healthcheck: + test: ["CMD", "nc", "-vz", "localhost:8547"] + interval: 30s + timeout: 10s + retries: 10 + start_period: 10s + + op-batcher: + environment: + # TODO: Integrate + L1_RPC: "http://fixturenet-eth-geth-1:8545" + depends_on: + op-node: + condition: service_healthy + op-geth: + condition: service_healthy + image: cerc/optimism-op-batcher:local + volumes: + - ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh + # TODO: Integrate + - ../test/l2-accounts:/l2-accounts + entrypoint: "sh" + command: "/run-op-batcher.sh" volumes: op_node_data: diff --git a/app/data/config/fixturenet-optimism/run-op-batcher.sh b/app/data/config/fixturenet-optimism/run-op-batcher.sh new file mode 100755 index 00000000..56981112 --- /dev/null +++ b/app/data/config/fixturenet-optimism/run-op-batcher.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +# Get BACTHER_KEY from keys.json +BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"') + +op-batcher \ + --l2-eth-rpc=http://op-geth:8545 \ + --rollup-rpc=http://op-node:8547 \ + --poll-interval=1s \ + --sub-safety-margin=6 \ + --num-confirmations=1 \ + --safe-abort-nonce-too-low-count=3 \ + --resubmission-timeout=30s \ + --rpc.addr=0.0.0.0 \ + --rpc.port=8548 \ + --rpc.enable-admin \ + --max-channel-duration=1 \ + --target-l1-tx-size-bytes=2048 \ + --l1-eth-rpc=$L1_RPC \ + --private-key=$BATCHER_KEY diff --git a/app/data/config/fixturenet-optimism/run-op-node.sh b/app/data/config/fixturenet-optimism/run-op-node.sh index 097b0983..28f76b5b 100755 --- a/app/data/config/fixturenet-optimism/run-op-node.sh +++ b/app/data/config/fixturenet-optimism/run-op-node.sh @@ -2,15 +2,15 @@ set -e # Get SEQUENCER KEY from keys.json -SEQUENCER_KEY=`jq '.Sequencer.privateKey' /l2-accounts/keys.json` +SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"') op-node \ --l2=http://op-geth:8551 \ - --l2.jwt-secret=./jwt.txt \ + --l2.jwt-secret=/app/jwt.txt \ --sequencer.enabled \ --sequencer.l1-confs=3 \ --verifier.l1-confs=3 \ - --rollup.config=./rollup.json \ + --rollup.config=/app/rollup.json \ --rpc.addr=0.0.0.0 \ --rpc.port=8547 \ --p2p.disable \ diff --git a/app/data/container-build/cerc-optimism-op-node/Dockerfile b/app/data/container-build/cerc-optimism-op-node/Dockerfile index ee878471..17d273b6 100644 --- a/app/data/container-build/cerc-optimism-op-node/Dockerfile +++ b/app/data/container-build/cerc-optimism-op-node/Dockerfile @@ -23,7 +23,7 @@ RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH FROM alpine:3.15 -RUN apk add --no-cache openssl +RUN apk add --no-cache openssl jq COPY --from=builder /app/op-node/bin/op-node /usr/local/bin