This crate is a modified version of reth
, to be run on the v0.7.0-alpha version of Valida zkVM.
It is to be used in conjunction with prepare_block
. This version is tested to be compatible with prepare_block
v0.7.0-alpha
. It reads a specific serialized block prepared by prepare_block
, and prove the block on the Ethereum engine, using Valida.
To compile this to run on the Valida zkVM, make sure you have the Valida Compiler installed. Follow its README to install. Make sure there is no error in the compilation process.
After the Valida compiler is successfully installed, run the following command in the reth-valida
directory:
cargo +valida build --release
This is in active development. If you get compilation errors, run git pull
, cargo clean
, cargo update
and try again.
If you get the following error:
error: toolchain 'valida' is not installable
Run this script from the Valida repo to add the Valida compiler to rustc
.
To provide a Valida binary that runs/proves slightly faster you might want to use LTO (Link Time Optimization). To do this, you will need to modify the build command as follows:
CFLAGS_valida_unknown_baremetal_gnu="-O3 -flto" LDFLAGS_valida_unknown_baremetal_gnu="-O3 -flto" RUSTFLAGS="-C linker-plugin-lto -C linker=clang -C link-arg=-fuse-ld=lld -C link-arg=-O3 -C link-arg=-flto -C link-arg=--target=valida-unknown-baremetal-gnu -C link-arg=-Wl,-O3" cargo +valida build --release
After successful compilation, the binary will be in target/valida-unknown-baremetal-gnu/release/reth-valida
. One can prove a block by running the binary in Valida, with the block data input input.bin
(obtained from running prepare_block
, more details to follow). To do this, run this command in the valida-toolchain
directory:
./valida/target/release/valida run ../reth-valida/target/valida-unknown-baremetal-gnu/release/reth-valida log ../prepare_block/input.bin
Alternatively, run the built binary in a valida-shell
with the block data input file:
>valida run <path to reth-valida binary> log <path to input.bin>
To prepare the block data, clone the prepare_block repository and run the following command (see also its README):
Note that prepare_block
is not intended to be compiled with the Valida compiler because it has features that are not supported by the Valida compiler. Use the standard Rust toolchain to compile and run prepare_block
.
cargo run -- --rpc-url "<RPC URL>" --block-number <block number>
The output will be in the current directory as input.bin
.
This is in active development. If you get compilation errors, run git pull
, cargo clean
, cargo update
and try again.