Skip to content

Commit

Permalink
Merge pull request #22 from flashbots/devnet-script-builder
Browse files Browse the repository at this point in the history
Optionally run builder services with DEVNET_BUILDER=true
  • Loading branch information
jinmel authored Aug 21, 2024
2 parents 4f57cb7 + 232b7e4 commit 35837eb
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
19 changes: 15 additions & 4 deletions bedrock-devnet/devnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
DEVNET_NO_BUILD = os.getenv('DEVNET_NO_BUILD') == "true"
DEVNET_L2OO = os.getenv('DEVNET_L2OO') == "true"
DEVNET_PLASMA = os.getenv('DEVNET_PLASMA') == "true"
DEVNET_BUILDER = os.getenv('DEVNET_BUILDER') == "true"
DEVNET_LOAD_TEST = os.getenv('DEVNET_LOAD_TEST') == "true"
GENERIC_PLASMA = os.getenv('GENERIC_PLASMA') == "true"

class Bunch:
Expand Down Expand Up @@ -299,10 +301,19 @@ def devnet_deploy(paths):
log.info('Bringing up `da-server`, `sentinel`.') # TODO(10141): We don't have public sentinel images yet
run_command(['docker', 'compose', 'up', '-d', 'da-server'], cwd=paths.ops_bedrock_dir, env=docker_env)

log.info('Bringing up `builders`.')
run_command(['docker', 'compose', 'up', '-d', 'builder-op-node', 'builder-op-geth'],
cwd=paths.ops_bedrock_dir,
env=docker_env)
# Optionally bring up the builders.
if DEVNET_BUILDER:
log.info('Bringing up `builders`.')
run_command(['docker', 'compose', 'up', '-d', 'builder-op-node', 'builder-op-geth'],
cwd=paths.ops_bedrock_dir,
env=docker_env)
wait_up(5545)
wait_for_rpc_server('127.0.0.1:5545')

if DEVNET_LOAD_TEST:
log.info("Bringing up `load-test`")
run_command(['docker', 'compose', 'up', '-d', 'load-test'], cwd=paths.ops_bedrock_dir, env=docker_env)

# Fin.
log.info('Devnet ready.')

Expand Down
20 changes: 20 additions & 0 deletions ops-bedrock/Dockerfile.tx-fuzz
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Start from the official Golang image
FROM golang:1.21-alpine AS builder

# Set the working directory inside the container
WORKDIR /app

RUN apk add --no-cache git \
&& git clone --depth=1 https://github.com/MariusVanDerWijden/tx-fuzz.git . \
&& apk del git \
&& cd cmd/livefuzzer \
&& go build

# Create a minimal image to run the binary
FROM alpine:latest

# Copy the binary from the builder stage
COPY --from=builder /app/cmd/livefuzzer/livefuzzer /app/livefuzzer

# Set the working directory
WORKDIR /app
23 changes: 23 additions & 0 deletions ops-bedrock/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ services:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:devnet
depends_on:
- l1
- l2
- op-node
- builder-op-geth
command: >
op-node
Expand Down Expand Up @@ -303,6 +305,10 @@ services:
ipv4_address: 10.5.0.123

builder-op-geth:
depends_on:
- l1
- l2
- op-node
image: jinmel/builder:latest # NOTE: Replace with the builder image
ports:
- "5545:8545"
Expand Down Expand Up @@ -335,3 +341,20 @@ services:
networks:
custom_net:
ipv4_address: "10.5.0.201"

load-test:
depends_on:
- builder-op-geth
build:
context: .
dockerfile: Dockerfile.tx-fuzz
entrypoint:
- "/app/livefuzzer"
- "spam"
- "--seed=31337"
- "--slot-time=2s"
- "--sk=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
- "--rpc=http://builder-op-geth:8545"
networks:
custom_net:
ipv4_address: 10.5.0.78

0 comments on commit 35837eb

Please sign in to comment.