From 8f34e88386438aa9da295ccc78b0a4349f9e7508 Mon Sep 17 00:00:00 2001 From: Lewis Revill Date: Wed, 4 Dec 2024 18:30:05 +0000 Subject: [PATCH 1/3] Dependency modifications required to run cargo test on reth-primitives We build a lot more dependencies for a test build compared to a normal library build, a lot of which needed to be forked for valida. We also need to register a getrandom implementation, just like we would as if we were creating a binary crate build. Included for convenience is also a cargo config.toml to allow us to simply run cargo with no extra RUSTFLAGS etc. --- .cargo/config.toml | 18 ++++++++++++++++++ Cargo.toml | 11 ++++++++++- bin/reth/Cargo.toml | 1 + crates/primitives/Cargo.toml | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 9430f38d1d04..8bdf9ed9dbbc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -14,3 +14,21 @@ rustflags = [ # in line with Linux (whereas default for Windows is 1MB) "-Clink-arg=/STACK:10000000", ] + + +[build] +target = "valida-unknown-baremetal-gnu" + +[target.valida-unknown-baremetal-gnu] +linker = "/valida-toolchain/bin/ld.lld" +rustflags = [ + "-C", "link-arg=/valida-toolchain/ValidaEntryPoint.o", + "-C", "link-arg=--script=/valida-toolchain/valida.ld", + "-C", "link-arg=/valida-toolchain/lib/valida-unknown-baremetal-gnu/libc.a", + "-C", "link-arg=/valida-toolchain/lib/valida-unknown-baremetal-gnu/libm.a", + "-C", "link-arg=--noinhibit-exec", +] + +[env] +CC_valida_unknown_baremetal_gnu = "/valida-toolchain/bin/clang" +CFLAGS_valida_unknown_baremetal_gnu = "--sysroot=/valida-toolchain/ -isystem /valida-toolchain/include" diff --git a/Cargo.toml b/Cargo.toml index 12c96668394b..92a2efccb23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -602,7 +602,16 @@ tikv-jemalloc-ctl = "0.6" tikv-jemallocator = "0.6" tracy-client = "0.17.3" -#[patch.crates-io] +[patch.crates-io] +wait-timeout = { git = "https://github.com/lita-xyz/wait-timeout", branch = "0.2.0-valida" } +rusty-fork = { git = "https://github.com/lita-xyz/rusty-fork", branch = "0.3.0-valida" } +is-terminal = { git = "https://github.com/lita-xyz/is-terminal", branch = "0.4.13-valida" } +cc = { git = "https://github.com/lita-xyz/cc-rs.git", branch = "1.1.18-delendum" } +blst = { git = "https://github.com/lita-xyz/blst.git", branch = "0.3.13-delendum" } +c-kzg = { git = "https://github.com/lita-xyz/c-kzg-4844.git", branch = "1.0.3-delendum" } +zstd-sys = { git = "https://github.com/lita-xyz/zstd-rs.git", branch = "zstd-sys-2.0.13-delendum" } +proptest = { git = "https://github.com/lita-xyz/proptest", branch = "1.5.0-valida" } +pprof = { git = "https://github.com/lita-xyz/pprof-rs", branch = "0.13.0-valida" } #alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } #alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } #alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index ffd1998b24ea..dcfc6c2ec80e 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -13,6 +13,7 @@ default-run = "reth" workspace = true [dependencies] +valida-rs = { git = "https://github.com/lita-xyz/valida-rs.git", branch = "main" } # reth reth-cli.workspace = true reth-ethereum-cli.workspace = true diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 5e761f41fe22..c3e64fcec828 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -12,6 +12,7 @@ description = "Commonly used types in reth." workspace = true [dependencies] +valida-rs = { git = "https://github.com/lita-xyz/valida-rs.git", branch = "main" } # reth reth-primitives-traits.workspace = true reth-ethereum-forks.workspace = true From b221ce8cfe2fc602d1da398e0bfef181d4cae4aa Mon Sep 17 00:00:00 2001 From: Lewis Revill Date: Tue, 10 Dec 2024 10:39:25 +0000 Subject: [PATCH 2/3] Add runner to cargo config for valida --- .cargo/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 8bdf9ed9dbbc..1646901bb408 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -20,6 +20,7 @@ rustflags = [ target = "valida-unknown-baremetal-gnu" [target.valida-unknown-baremetal-gnu] +runner = "/valida-toolchain/valida-runner.sh" linker = "/valida-toolchain/bin/ld.lld" rustflags = [ "-C", "link-arg=/valida-toolchain/ValidaEntryPoint.o", From ec24d78e1c355deea96f41ddceb20231d0339680 Mon Sep 17 00:00:00 2001 From: Lewis Revill Date: Thu, 19 Dec 2024 15:37:27 +0000 Subject: [PATCH 3/3] Add io.o file to config.toml --- .cargo/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 1646901bb408..cc2d5b60d31d 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -24,6 +24,7 @@ runner = "/valida-toolchain/valida-runner.sh" linker = "/valida-toolchain/bin/ld.lld" rustflags = [ "-C", "link-arg=/valida-toolchain/ValidaEntryPoint.o", + "-C", "link-arg=/valida-toolchain/io.o", "-C", "link-arg=--script=/valida-toolchain/valida.ld", "-C", "link-arg=/valida-toolchain/lib/valida-unknown-baremetal-gnu/libc.a", "-C", "link-arg=/valida-toolchain/lib/valida-unknown-baremetal-gnu/libm.a",