Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prove stdio using amqp docker compose setup #763

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
46 changes: 46 additions & 0 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "3"
services:

leader:
build:
context: ../
dockerfile: Dockerfile
depends_on:
rabbitmq:
condition: service_healthy
command: bash -c "leader --runtime amqp --proof-output-dir ./proofs --block-batch-size ${LEADER_BLOCK_BATCH_SIZE} stdio < /witness"
environment:
- RUST_LOG=info
- AMQP_URI=amqp://rabbitmq:5672
volumes:
- ${PROOF_OUTPUT_DIR}:/proofs/:rw
- ${LEADER_INPUT_JSON_FILE}:/witness:ro

worker:
build:
context: ../
dockerfile: Dockerfile
depends_on:
rabbitmq:
condition: service_healthy
environment:
- RUST_LOG=info
- AMQP_URI=amqp://rabbitmq:5672
- ZK_EVM_CACHE_DIR=/zk_evm_circuit_cache
command: worker
volumes:
- ${DOCKER_CIRCUITS_CACHE_DIR}/worker:/zk_evm_circuit_cache:rw
deploy:
mode: replicated
replicas: 2

rabbitmq:
image: rabbitmq:3-management
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 10s
timeout: 30s
retries: 3
17 changes: 17 additions & 0 deletions scripts/prove_stdio_docker_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

export LEADER_INPUT_JSON_FILE=$1

export LEADER_BLOCK_BATCH_SIZE="${BLOCK_BATCH_SIZE:-8}"

REPO_ROOT=$(git rev-parse --show-toplevel)

export PROOF_OUTPUT_DIR="${REPO_ROOT}/proofs"
mkdir -p "$PROOF_OUTPUT_DIR"
chmod 777 "$PROOF_OUTPUT_DIR"

export DOCKER_CIRCUITS_CACHE_DIR="./docker_circuit_cache"
mkdir -p "$DOCKER_CIRCUITS_CACHE_DIR/worker"
chmod 777 "$DOCKER_CIRCUITS_CACHE_DIR/worker"

docker compose up
12 changes: 12 additions & 0 deletions zero/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,18 @@ echo "[" > $file_name && cast rpc eth_getBlockByNumber "0x<block_number>" 'false

Move the generated files to the appropriate subdirectory, and they will be automatically included in the test run.


### Proving blocks using docker compose setup and leader-worker amqp communication

To prove blocks using the docker compose setup and independent container leader and worker execution, you can use the `prove_stdio_docker_compose.sh` script:

```sh
cd scripts
prove_stdio_docker_compose.sh ../path/to/block_witness.json
```

Check the script and `docker-compose.yml` file to further customize the setup (e.g. number of workers).

## License

Licensed under either of
Expand Down
Loading