Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ RUN touch -a -m crates/prover/src/lib.rs
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-lib
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-bin
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-jit
RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-validation-server

FROM scratch AS prover-export
COPY --from=prover-builder /workspace/target/ /
Expand Down Expand Up @@ -318,6 +319,18 @@ ENTRYPOINT [ "/usr/local/bin/nitro" , "--validation.wasm.allowed-wasm-module-roo

USER user

# The nitro-node-rust-validator runs a single Rust validation server that handles all WASM module roots.
FROM nitro-node AS nitro-node-rust-validator
USER root
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y xxd curl && \
rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/ldconfig/aux-cache /usr/lib/python3.9/__pycache__/ /usr/lib/python3.9/*/__pycache__/ /var/log/*
COPY --from=prover-export /bin/validator /usr/local/bin/
COPY scripts/rust-val-entry.sh /usr/local/bin/
ENTRYPOINT [ "/usr/local/bin/rust-val-entry.sh" ]
USER user

# The nitro-node-validator is needed in case some modifications are needed in arbitrator or jit API.
# That was the case when enabling arbos30.
# We no longer support pre-arbos-30 wasmmoduleroots (newer wasmmoduleroots can execute old blocks)
Expand Down
3 changes: 3 additions & 0 deletions changelog/bragaigor-nit-4662.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added
- Add `scripts/rust-val-entry.sh` Docker entrypoint script that launches a single Rust validation server alongside the nitro node
- Add `nitro-node-rust-validator` Docker target
22 changes: 22 additions & 0 deletions scripts/rust-val-entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

xxd -l 32 -ps -c 40 /dev/urandom > /tmp/nitro-val.jwt

valopts=()
while [[ $1 == "--val-options"* ]]; do
shift
while [[ "$1" != "--" ]] && [[ $# -gt 0 ]]; do
valopts=( "${valopts[@]}" "$1" )
shift
done
shift
done
echo launching rust validation server
/usr/local/bin/validator --address 0.0.0.0:4141 --jwt-secret /tmp/nitro-val.jwt --root-path /home/user/target/machines "${valopts[@]}" &
echo waiting for rust validation server to start
if ! timeout 30s bash -c 'until curl -s localhost:4141 > /dev/null 2>&1; do sleep 1; done'; then
echo rust validation server failed to start within timeout
exit 1
fi
echo launching nitro-node
exec /usr/local/bin/nitro --validation.wasm.allowed-wasm-module-roots /home/user/target/machines --node.block-validator.validation-server-configs-list='[{"jwtsecret":"/tmp/nitro-val.jwt","url":"http://127.0.0.1:4141"}]' "$@"
Loading