Skip to content

Commit

Permalink
builder service
Browse files Browse the repository at this point in the history
  • Loading branch information
bianyuanop committed May 31, 2024
1 parent 8dbdb72 commit d716cd9
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 22 deletions.
4 changes: 2 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"defaultBase": "updatedStack",
"defaultBase": "mev",
"neverConnectToCloud": true,
"affected": {
"defaultBase": "updatedStack"
"defaultBase": "mev"
},
"implicitDependencies": {
"nx.json": "*",
Expand Down
7 changes: 4 additions & 3 deletions op-node/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ func (n *OpNode) init(ctx context.Context, cfg *Config, snapshotLog log.Logger)
if err := n.initRuntimeConfig(ctx, cfg); err != nil { // depends on L2, to signal initial runtime values to
return fmt.Errorf("failed to init the runtime config: %w", err)
}
if err := n.initMev(ctx, cfg); err != nil {
return err
}
// TODO: restore this after, not needed for javelin demo
// if err := n.initMev(ctx, cfg); err != nil {
// return err
// }
if err := n.initP2PSigner(ctx, cfg); err != nil {
return fmt.Errorf("failed to init the P2P signer: %w", err)
}
Expand Down
93 changes: 82 additions & 11 deletions ops-bedrock/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ version: '3.4'
# The volumes below mount the configs generated by the script into each
# service.

networks:
static:
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
standard:

volumes:
l1_data:
l2_data:
op_log:
op2_l2_data:
op2_log:
l2_builder_data:


services:
Expand All @@ -35,6 +44,10 @@ services:
- "no-new-privileges:true"

op1-l2:
networks:
static:
ipv4_address: 172.20.0.6
standard:
build:
context: .
dockerfile: Dockerfile.l2
Expand All @@ -56,6 +69,10 @@ services:
GETH_MINER_RECOMMIT: 100ms

op1-node:
networks:
static:
ipv4_address: 172.20.0.7
standard:
depends_on:
- op_stack_go_builder
# - l1
Expand Down Expand Up @@ -108,6 +125,8 @@ services:
NODEKIT_SEQ_ADDR: $SEQ_ADDR

op1-proposer:
networks:
- standard
depends_on:
- op_stack_go_builder
# - l1
Expand Down Expand Up @@ -138,6 +157,8 @@ services:
OP_PROPOSER_RPC_ENABLE_ADMIN: "true"

op1-batcher:
networks:
- standard
depends_on:
- op_stack_go_builder
# - l1
Expand Down Expand Up @@ -171,17 +192,67 @@ services:
# The batcher does not respond to sigint
stop_grace_period: 1s

op1-geth-proxy:
l2-builder:
networks:
static:
ipv4_address: 172.20.0.8
standard:
build:
context: ../../javelin-op-stack
depends_on:
- op1-l2
- op1-node
ports:
- "9500:8545"
- "9501:8551"
- "18061:6060"
volumes:
- "l2_builder_data:/db"
- "${PWD}/../.devnet/genesis-l2.json:/genesis.json"
- "${PWD}/test-jwt-secret.txt:/config/test-jwt-secret.txt"
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
- "/bin/sh"
- "/entrypoint.sh"
- "--authrpc.jwtsecret=/config/test-jwt-secret.txt"
- "--nat=extip:172.20.0.8"
- "--builder"
- "--builder.dry-run"
- "--builder.local_relay"
- "--builder.seconds_in_slot=2"
- "--builder.submission_offset=1s"
- "--builder.beacon_endpoints=http://op-node-builder:8501"
- "--miner.extradata=IlluminateDmocratizeDstribute"
- "--miner.algotype=greedy"
- "--bootnodes=${BOOTNODE}"

op-node-builder:
restart: on-failure:5
networks:
static:
ipv4_address: 172.20.0.9
standard:
depends_on:
- op1-l2
- op1-node
- l2-builder
build:
context: ../
dockerfile: ./op-geth-proxy/Dockerfile
dockerfile: ./op-node/Dockerfile
command: >
op-node
--l1=${L1WS}
--l2=http://l2-builder:8551
--l2.jwt-secret=/config/test-jwt-secret.txt
--rollup.config=/rollup.json
--rpc.addr=0.0.0.0
--rpc.port=8500
--rpc.enable-admin
--p2p.advertise.ip=172.20.0.9
--p2p.bootnodes=${ENR}
ports:
- "$OP1_GETH_PROXY_PORT:9090"
environment:
- OP_GETH_PROXY_GETH_ADDR=http://op1-l2:8545
- OP_GETH_PROXY_LISTEN_ADDR=0.0.0.0:9090
- OP_GETH_PROXY_VM_ID=$OP1_CHAIN_ID
- OP_GETH_PROXY_CHAIN_ID=$SEQ_CHAIN_ID
- OP_GETH_PROXY_SEQ_ADDR=$SEQ_ADDR
extra_hosts:
- "host.docker.internal:host-gateway"
- "7500:8500"
- "7501:8501"
volumes:
- "${PWD}/test-jwt-secret.txt:/config/test-jwt-secret.txt"
- "${PWD}/../.devnet/rollup.json:/rollup.json"
- op_log:/op_log
16 changes: 10 additions & 6 deletions ops/docker/op-stack-go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ ARG TARGETOS TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && make cannon \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$CANNON_VERSION"
# note: we only build the host, that's all the user needs. No Go MIPS cross-build in docker
RUN --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-host \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"
# TODO: restore after fixing op-program
# RUN --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-host \
# GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"

RUN --mount=type=cache,target=/root/.cache/go-build cd op-heartbeat && make op-heartbeat \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_HEARTBEAT_VERSION"
Expand All @@ -61,8 +62,9 @@ RUN --mount=type=cache,target=/root/.cache/go-build cd op-wheel && make op-wheel

RUN --mount=type=cache,target=/root/.cache/go-build cd op-node && make op-node \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_NODE_VERSION"
RUN --mount=type=cache,target=/root/.cache/go-build cd op-challenger && make op-challenger \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_CHALLENGER_VERSION"
# TODO: restore after fix
# RUN --mount=type=cache,target=/root/.cache/go-build cd op-challenger && make op-challenger \
# GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_CHALLENGER_VERSION"
RUN --mount=type=cache,target=/root/.cache/go-build cd op-dispute-mon && make op-dispute-mon \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_DISPUTE_MON_VERSION"
RUN --mount=type=cache,target=/root/.cache/go-build cd op-batcher && make op-batcher \
Expand All @@ -76,13 +78,15 @@ RUN --mount=type=cache,target=/root/.cache/go-build cd op-conductor && make op-c
FROM alpine:3.18

COPY --from=builder /app/cannon/bin/cannon /usr/local/bin/
COPY --from=builder /app/op-program/bin/op-program /usr/local/bin/
# TODO: restore after fixing
# COPY --from=builder /app/op-program/bin/op-program /usr/local/bin/

COPY --from=builder /app/op-heartbeat/bin/op-heartbeat /usr/local/bin/
COPY --from=builder /app/op-wheel/bin/op-wheel /usr/local/bin/

COPY --from=builder /app/op-node/bin/op-node /usr/local/bin/
COPY --from=builder /app/op-challenger/bin/op-challenger /usr/local/bin/
# TOOD: restore after fixing
# COPY --from=builder /app/op-challenger/bin/op-challenger /usr/local/bin/
COPY --from=builder /app/op-dispute-mon/bin/op-dispute-mon /usr/local/bin/
COPY --from=builder /app/op-batcher/bin/op-batcher /usr/local/bin/
COPY --from=builder /app/op-proposer/bin/op-proposer /usr/local/bin/
Expand Down

0 comments on commit d716cd9

Please sign in to comment.