From c295bceb63e986bb9636b1cfeea1bfe8602f21ac Mon Sep 17 00:00:00 2001 From: Sahilgill24 Date: Tue, 21 Jul 2026 07:09:09 +0530 Subject: [PATCH 1/5] feat: adding state transition function input type --- crates/common/types/src/lib.rs | 1 + crates/common/types/src/stf.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 crates/common/types/src/stf.rs diff --git a/crates/common/types/src/lib.rs b/crates/common/types/src/lib.rs index 6db9a590..8eff6965 100644 --- a/crates/common/types/src/lib.rs +++ b/crates/common/types/src/lib.rs @@ -7,6 +7,7 @@ pub mod genesis; pub mod primitives; pub mod signature; pub mod state; +pub mod stf; /// Display helper for truncated root hashes (8 hex chars) pub struct ShortRoot<'a>(pub &'a [u8; 32]); diff --git a/crates/common/types/src/stf.rs b/crates/common/types/src/stf.rs new file mode 100644 index 00000000..a1c8e053 --- /dev/null +++ b/crates/common/types/src/stf.rs @@ -0,0 +1,28 @@ +use libssz::{SszDecode, SszEncode}; +use serde::{Deserialize, Serialize}; + +use crate::{block::Block, state::State}; + +// we will pass as bytes, as we want this to be definitely serializable and both implement Sszencode and decode +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StfInput { + state: Vec, + block: Vec, +} + +impl StfInput { + pub fn new(state: State, block: Block) -> Self { + StfInput { + state: state.to_ssz(), + block: block.to_ssz(), + } + } + + pub fn return_state(input: Self) -> State { + State::from_ssz_bytes(&input.state).expect("error decoding State") + } + + pub fn return_block(input: Self) -> Block { + Block::from_ssz_bytes(&input.block).expect("error decoding block") + } +} From d85f2a23eb25fe229626c1db54bc3fc796d47811 Mon Sep 17 00:00:00 2001 From: Sahilgill24 Date: Tue, 21 Jul 2026 07:11:05 +0530 Subject: [PATCH 2/5] feat: scaffold sp1 guest program --- Cargo.lock | 260 ++++++++++++++++++--------- Cargo.toml | 2 +- crates/guest-program/sp1/Cargo.toml | 15 ++ crates/guest-program/sp1/src/main.rs | 13 ++ 4 files changed, 204 insertions(+), 86 deletions(-) create mode 100644 crates/guest-program/sp1/Cargo.toml create mode 100644 crates/guest-program/sp1/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 7e31a87a..521bdb49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,7 +574,7 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" dependencies = [ - "base64", + "base64 0.22.1", "http", "log", "url", @@ -705,6 +705,12 @@ dependencies = [ "match-lookup", ] +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.22.1" @@ -741,7 +747,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -1148,6 +1154,12 @@ dependencies = [ "crossbeam-utils 0.8.21", ] +[[package]] +name = "const-default" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" + [[package]] name = "const-hex" version = "1.19.0" @@ -1568,7 +1580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccc2776f0c61eca1ca32528f85548abd1a4be8fb53d1b21c013e4f18da1e7090" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.117", ] [[package]] @@ -1865,6 +1877,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "embedded-alloc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f2de9133f68db0d4627ad69db767726c99ff8585272716708227008d3f1bddd" +dependencies = [ + "const-default", + "critical-section", + "linked_list_allocator", + "rlsf", +] + [[package]] name = "embedded-io" version = "0.4.0" @@ -3169,7 +3193,7 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-channel", "futures-util", @@ -4009,7 +4033,7 @@ source = "git+https://github.com/lambdaclass/rust-libp2p.git?rev=2f14d0ec9665a01 dependencies = [ "async-channel", "asynchronous-codec", - "base64", + "base64 0.22.1", "byteorder", "bytes", "either", @@ -4586,6 +4610,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked_list_allocator" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b23ac50abb8261cb38c6e2a7192d3302e0836dac1628f6a93b82b4fad185897" + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -4843,7 +4873,7 @@ source = "git+https://github.com/leanEthereum/leanVM.git?rev=e2592df#e2592df4e30 dependencies = [ "itertools 0.14.0", "mt-utils", - "num-bigint 0.3.3", + "num-bigint 0.4.6", "parallel", "paste", "rand 0.10.1", @@ -4859,7 +4889,7 @@ dependencies = [ "itertools 0.14.0", "mt-field", "mt-utils", - "num-bigint 0.3.3", + "num-bigint 0.4.6", "paste", "rand 0.10.1", "serde", @@ -5328,29 +5358,29 @@ dependencies = [ [[package]] name = "p3-bn254-fr" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "577200e3fa7e49e2b21e940a6dc7399dc63acb8581da088558cdf7c455adafc0" +checksum = "2077757c7cb514202ccb5368f521f23f5709c720599e6545c683c66e0a52d2d8" dependencies = [ "ff", "num-bigint 0.4.6", - "p3-field 0.3.3-succinct", - "p3-poseidon2 0.3.3-succinct", - "p3-symmetric 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-poseidon2 0.4.3-succinct", + "p3-symmetric 0.4.3-succinct", "rand 0.8.6", "serde", ] [[package]] name = "p3-challenger" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75358edd6e2562752c01f5064a66d88144a3e75ace0407166dbdf8a727597f52" +checksum = "b6a908924d43e4cfb93fb41c8346cac211b70314385a9037e9241f5b7f3eaf77" dependencies = [ - "p3-field 0.3.3-succinct", - "p3-maybe-rayon 0.3.3-succinct", - "p3-symmetric 0.3.3-succinct", - "p3-util 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-maybe-rayon 0.4.3-succinct", + "p3-symmetric 0.4.3-succinct", + "p3-util 0.4.3-succinct", "serde", "tracing", ] @@ -5370,14 +5400,14 @@ dependencies = [ [[package]] name = "p3-dft" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "761f1e1b014f2b1b69bd0309124e233d64aa3590e6a41ee786000dd849506d51" +checksum = "be6408b10a2c27eb13a7d5580c546c2179a8dc7dbc10a990657311891f9b41c0" dependencies = [ - "p3-field 0.3.3-succinct", - "p3-matrix 0.3.3-succinct", - "p3-maybe-rayon 0.3.3-succinct", - "p3-util 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-matrix 0.4.3-succinct", + "p3-maybe-rayon 0.4.3-succinct", + "p3-util 0.4.3-succinct", "tracing", ] @@ -5397,14 +5427,14 @@ dependencies = [ [[package]] name = "p3-field" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2df7cebaa4079b24e0dd7e3aad59eebcbb99a67c1271f79ad884a7c032f5f183" +checksum = "3dc75969ca3ac847f43e632ab979d59ff7a68f9eac8dbf8edcbba47fc2e1d3aa" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", "num-traits", - "p3-util 0.3.3-succinct", + "p3-util 0.4.3-succinct", "rand 0.8.6", "serde", ] @@ -5426,16 +5456,16 @@ dependencies = [ [[package]] name = "p3-koala-bear" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cea0ba3389b034b6088d566aea8b57aa29dd2e180966e0c8056f61331c92b4e" +checksum = "3a9683cd0ef68100df7c62490533047bcf19c04c4a0fa1efc9d7c1e03e31f6b3" dependencies = [ "cfg-if 1.0.4", "num-bigint 0.4.6", - "p3-field 0.3.3-succinct", - "p3-mds 0.3.3-succinct", - "p3-poseidon2 0.3.3-succinct", - "p3-symmetric 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-mds 0.4.3-succinct", + "p3-poseidon2 0.4.3-succinct", + "p3-symmetric 0.4.3-succinct", "rand 0.8.6", "rustc_version 0.4.1", "serde", @@ -5458,14 +5488,14 @@ dependencies = [ [[package]] name = "p3-matrix" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fae5cc6ce726cc265cc687c1214e3f1ac1f5c6e973442286ba00d1e75da1c3cb" +checksum = "75c3f150ceb90e09539413bf481e618d05ee19210b4e467d2902eb82d2e15281" dependencies = [ "itertools 0.12.1", - "p3-field 0.3.3-succinct", - "p3-maybe-rayon 0.3.3-succinct", - "p3-util 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-maybe-rayon 0.4.3-succinct", + "p3-util 0.4.3-succinct", "rand 0.8.6", "serde", "tracing", @@ -5487,9 +5517,9 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac1d2f102cf8c71dba1b449575c99697781fcc028831e83d2245787bd7a650" +checksum = "e0641952b42da45e1dfa2d4a2a3163e330f944ad9740942f35026c0a71a605f1" [[package]] name = "p3-maybe-rayon" @@ -5498,16 +5528,16 @@ source = "git+https://github.com/Plonky3/Plonky3.git#3f67d136c71bec40f180c85d0bb [[package]] name = "p3-mds" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f072643e385d65fb9eb089ee6824b320417f78671a0db748566e057e28b250e" +checksum = "aa4a5f250e174dcfca5cbeac6ad75713924e7e7320e0a335e3c50b8b1f4fe8ec" dependencies = [ "itertools 0.12.1", - "p3-dft 0.3.3-succinct", - "p3-field 0.3.3-succinct", - "p3-matrix 0.3.3-succinct", - "p3-symmetric 0.3.3-succinct", - "p3-util 0.3.3-succinct", + "p3-dft 0.4.3-succinct", + "p3-field 0.4.3-succinct", + "p3-matrix 0.4.3-succinct", + "p3-symmetric 0.4.3-succinct", + "p3-util 0.4.3-succinct", "rand 0.8.6", ] @@ -5558,14 +5588,14 @@ dependencies = [ [[package]] name = "p3-poseidon2" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00cc4b6e8a439f79541b0910a016da9e6e12a05a24309bbb713e1db0db396952" +checksum = "522986377b2164c5f94f2dae88e0e0a3d169cc6239202ef4aeb4322d60feffd0" dependencies = [ "gcd", - "p3-field 0.3.3-succinct", - "p3-mds 0.3.3-succinct", - "p3-symmetric 0.3.3-succinct", + "p3-field 0.4.3-succinct", + "p3-mds 0.4.3-succinct", + "p3-symmetric 0.4.3-succinct", "rand 0.8.6", "serde", ] @@ -5584,12 +5614,12 @@ dependencies = [ [[package]] name = "p3-symmetric" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eebff7fea7deb08a57ccf731a0ed39df25cc66a0e0c2d92c4472c4dee02ee21" +checksum = "9047ce85c086a9b3f118e10078f10636f7bfeed5da871a04da0b61400af8793a" dependencies = [ "itertools 0.12.1", - "p3-field 0.3.3-succinct", + "p3-field 0.4.3-succinct", "serde", ] @@ -5606,9 +5636,9 @@ dependencies = [ [[package]] name = "p3-util" -version = "0.3.3-succinct" +version = "0.4.3-succinct" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8164df89bbc92e29938f916cc5f1ccbfe6a36fb5040f21ba93c1f21985b9868" +checksum = "cff962f8eaa5f36e0447cee7c241f6b4b475fadf3ee61f154327a26bb4e009ba" dependencies = [ "serde", ] @@ -5708,7 +5738,7 @@ version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" dependencies = [ - "base64", + "base64 0.22.1", "serde_core", ] @@ -6042,7 +6072,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.117", @@ -6472,7 +6502,7 @@ version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-core", "http", @@ -6602,6 +6632,19 @@ dependencies = [ "rustc-hex", ] +[[package]] +name = "rlsf" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1646a59a9734b8b7a0ac51689388a60fe1625d4b956348e9de07591a1478457a" +dependencies = [ + "cfg-if 1.0.4", + "const-default", + "libc", + "rustversion", + "svgbobdoc", +] + [[package]] name = "rocksdb" version = "0.24.0" @@ -7106,20 +7149,20 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "slop-algebra" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a473c3a06b466dd0708829415a8a9fab451740da066e07862c8c098904aaad6" +checksum = "8c112cafd4c5c374d267a48c8976d12fca3b0f2cc2e44e6fb1343808310b4fc6" dependencies = [ "itertools 0.14.0", - "p3-field 0.3.3-succinct", + "p3-field 0.4.3-succinct", "serde", ] [[package]] name = "slop-bn254" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbae5dd16a3d1e87c9e99cfd557338171710be01458bd5b12dded3878d3fd8" +checksum = "ea991a652ea2e55f0523649f5c9efbfb32cf9fdcc2bf3b3580b4343a94379503" dependencies = [ "ff", "p3-bn254-fr", @@ -7132,12 +7175,12 @@ dependencies = [ [[package]] name = "slop-challenger" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e80df718cef7d3100658dc8b46fafcc994b814421ec9a7d0763a6ee1e5070c" +checksum = "33b33f1eaadcd4159157758b0edcf1c14f470915f85c648e660e4740ff83e921" dependencies = [ "futures", - "p3-challenger 0.3.3-succinct", + "p3-challenger 0.4.3-succinct", "serde", "slop-algebra", "slop-symmetric", @@ -7145,12 +7188,12 @@ dependencies = [ [[package]] name = "slop-koala-bear" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6586b1c0e66c503e4026a8cb007349fa99c2466957c5b09d18fe658d1391ed8" +checksum = "8795ee9a92ecf0a604c0e3ed20e80bbc38772310c0622f94a2e1b66ca2455cb8" dependencies = [ "lazy_static", - "p3-koala-bear 0.3.3-succinct", + "p3-koala-bear 0.4.3-succinct", "serde", "slop-algebra", "slop-challenger", @@ -7160,29 +7203,29 @@ dependencies = [ [[package]] name = "slop-poseidon2" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c956b11fff1b8a071fa4ba982dc35e458cff1620dc7b33d9cf22d8df30895f79" +checksum = "25561d9ecf4bcf1aa2e800560ac557bff6dad943b9dc5cd0e8427fceca1e8c65" dependencies = [ - "p3-poseidon2 0.3.3-succinct", + "p3-poseidon2 0.4.3-succinct", ] [[package]] name = "slop-primitives" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de169e0ca381847f9efa0db5a54533371c10558d7aaed4cb3b2a9bae24a0fe83" +checksum = "f6b24ad70b49f40d6acfe7b1ccf042db25820abe305a4c2232f15204f63f0227" dependencies = [ "slop-algebra", ] [[package]] name = "slop-symmetric" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955145ad6e3a1d083a428f9274071cfbb44c3b29013aae9d6c4c29fb7328cfc0" +checksum = "94e580d03bb5383aca1c12579a8a24b838afb12eb356439e740cba34904b6864" dependencies = [ - "p3-symmetric 0.3.3-succinct", + "p3-symmetric 0.4.3-succinct", ] [[package]] @@ -7240,7 +7283,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures", "httparse", @@ -7251,9 +7294,9 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02cd166e010c80e542585bf74585ea80eff117c361656cae43f2968cf0af12d4" +checksum = "629b673d6aa3c666b41e14d699323413fa90195c906365ba8c49d1b8e4531151" dependencies = [ "bincode", "serde", @@ -7262,9 +7305,9 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "6.2.1" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df14efe799ebd675cf530c853153a4787327a2385067716dfad4ede79ff31ad" +checksum = "421b4590a89bf7c263f8a64844a4034ee8cb73c351498911ce0acd18da6b5ed2" dependencies = [ "bincode", "blake3", @@ -7284,6 +7327,25 @@ dependencies = [ "slop-symmetric", ] +[[package]] +name = "sp1-zkvm" +version = "6.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18fbc79e5a1cc499d3ae3904771104a854493ea12c317ff1407137d86153c26" +dependencies = [ + "cfg-if 1.0.4", + "critical-section", + "embedded-alloc", + "getrandom 0.2.17", + "getrandom 0.3.4", + "lazy_static", + "libm", + "rand 0.8.6", + "sha2", + "sp1-lib", + "sp1-primitives", +] + [[package]] name = "sp1_bls12_381" version = "0.8.0-sp1-6.0.0" @@ -7461,6 +7523,19 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "svgbobdoc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" +dependencies = [ + "base64 0.13.1", + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-width", +] + [[package]] name = "syn" version = "1.0.109" @@ -7565,7 +7640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.2", "once_cell", "rustix", "windows-sys 0.61.2", @@ -8028,6 +8103,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -9063,6 +9144,15 @@ dependencies = [ "system-info", ] +[[package]] +name = "zkvm_guest_sp1" +version = "0.1.0" +dependencies = [ + "ethlambda-state-transition", + "ethlambda-types", + "sp1-zkvm", +] + [[package]] name = "zmij" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index 100b1a4a..afcf7d99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "crates/common/crypto", "crates/common/metrics", "crates/common/test-fixtures", - "crates/common/types", + "crates/common/types", "crates/guest-program/sp1", "crates/net/api", "crates/net/p2p", "crates/net/rpc", diff --git a/crates/guest-program/sp1/Cargo.toml b/crates/guest-program/sp1/Cargo.toml new file mode 100644 index 00000000..bc1b7d3b --- /dev/null +++ b/crates/guest-program/sp1/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "zkvm_guest_sp1" +authors.workspace = true +edition.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[dependencies] +sp1-zkvm = "6.1.0" +ethlambda-types.workspace = true +ethlambda-state-transition.workspace = true \ No newline at end of file diff --git a/crates/guest-program/sp1/src/main.rs b/crates/guest-program/sp1/src/main.rs new file mode 100644 index 00000000..1080d67d --- /dev/null +++ b/crates/guest-program/sp1/src/main.rs @@ -0,0 +1,13 @@ +#![no_main] +sp1_zkvm::entrypoint!(main); + +use ethlambda_state_transition::state_transition; +use ethlambda_types::{primitives::HashTreeRoot, stf::StfInput}; + +fn main() { + let input: StfInput = sp1_zkvm::io::read(); + let mut state = StfInput::return_state(input.clone()); + let block = &StfInput::return_block(input.clone()); + let _ = state_transition(&mut state, block); + sp1_zkvm::io::commit(&state.hash_tree_root()); +} From f4c5e9625634790d0e0386fde30fb1eac6a0cd52 Mon Sep 17 00:00:00 2001 From: Sahilgill24 Date: Wed, 22 Jul 2026 01:40:39 +0530 Subject: [PATCH 3/5] refactor: update guest program workspace and add public values --- Cargo.lock | 102 ++------------------------- Cargo.toml | 7 +- crates/common/types/src/stf.rs | 34 +++++++-- crates/guest-program/sp1/Cargo.toml | 20 +++--- crates/guest-program/sp1/src/main.rs | 28 ++++++-- 5 files changed, 72 insertions(+), 119 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 521bdb49..0b779c58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,7 +574,7 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" dependencies = [ - "base64 0.22.1", + "base64", "http", "log", "url", @@ -705,12 +705,6 @@ dependencies = [ "match-lookup", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.22.1" @@ -1154,12 +1148,6 @@ dependencies = [ "crossbeam-utils 0.8.21", ] -[[package]] -name = "const-default" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" - [[package]] name = "const-hex" version = "1.19.0" @@ -1877,18 +1865,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "embedded-alloc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f2de9133f68db0d4627ad69db767726c99ff8585272716708227008d3f1bddd" -dependencies = [ - "const-default", - "critical-section", - "linked_list_allocator", - "rlsf", -] - [[package]] name = "embedded-io" version = "0.4.0" @@ -3193,7 +3169,7 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-util", @@ -4033,7 +4009,7 @@ source = "git+https://github.com/lambdaclass/rust-libp2p.git?rev=2f14d0ec9665a01 dependencies = [ "async-channel", "asynchronous-codec", - "base64 0.22.1", + "base64", "byteorder", "bytes", "either", @@ -4610,12 +4586,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linked_list_allocator" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b23ac50abb8261cb38c6e2a7192d3302e0836dac1628f6a93b82b4fad185897" - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -5738,7 +5708,7 @@ version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" dependencies = [ - "base64 0.22.1", + "base64", "serde_core", ] @@ -6502,7 +6472,7 @@ version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-core", "http", @@ -6632,19 +6602,6 @@ dependencies = [ "rustc-hex", ] -[[package]] -name = "rlsf" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1646a59a9734b8b7a0ac51689388a60fe1625d4b956348e9de07591a1478457a" -dependencies = [ - "cfg-if 1.0.4", - "const-default", - "libc", - "rustversion", - "svgbobdoc", -] - [[package]] name = "rocksdb" version = "0.24.0" @@ -7283,7 +7240,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures", "httparse", @@ -7327,25 +7284,6 @@ dependencies = [ "slop-symmetric", ] -[[package]] -name = "sp1-zkvm" -version = "6.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18fbc79e5a1cc499d3ae3904771104a854493ea12c317ff1407137d86153c26" -dependencies = [ - "cfg-if 1.0.4", - "critical-section", - "embedded-alloc", - "getrandom 0.2.17", - "getrandom 0.3.4", - "lazy_static", - "libm", - "rand 0.8.6", - "sha2", - "sp1-lib", - "sp1-primitives", -] - [[package]] name = "sp1_bls12_381" version = "0.8.0-sp1-6.0.0" @@ -7523,19 +7461,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "svgbobdoc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" -dependencies = [ - "base64 0.13.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-width", -] - [[package]] name = "syn" version = "1.0.109" @@ -8103,12 +8028,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-xid" version = "0.2.6" @@ -9144,15 +9063,6 @@ dependencies = [ "system-info", ] -[[package]] -name = "zkvm_guest_sp1" -version = "0.1.0" -dependencies = [ - "ethlambda-state-transition", - "ethlambda-types", - "sp1-zkvm", -] - [[package]] name = "zmij" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index afcf7d99..d5303666 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,13 +9,18 @@ members = [ "crates/common/crypto", "crates/common/metrics", "crates/common/test-fixtures", - "crates/common/types", "crates/guest-program/sp1", + "crates/common/types", "crates/net/api", "crates/net/p2p", "crates/net/rpc", "crates/storage", ] +# NOTE: zkVM guest programs are their own workspaces: they build for the respective +# target ISA via their respective build commands, not for the host, so `cargo {clippy,test} +# --workspace` must not try to compile them. +exclude = ["crates/guest-program/sp1"] + [workspace.package] authors = ["LambdaClass"] edition = "2024" diff --git a/crates/common/types/src/stf.rs b/crates/common/types/src/stf.rs index a1c8e053..f7d0aeb2 100644 --- a/crates/common/types/src/stf.rs +++ b/crates/common/types/src/stf.rs @@ -1,15 +1,37 @@ use libssz::{SszDecode, SszEncode}; use serde::{Deserialize, Serialize}; -use crate::{block::Block, state::State}; +use crate::{block::Block, primitives::H256, state::State}; -// we will pass as bytes, as we want this to be definitely serializable and both implement Sszencode and decode + +/// Input type for the zkVM's +/// +/// The inputs to the zkVM need to derive serde Serialize/deserialize +/// which is not derived for state (libssz traits) +/// wrapping pre-serialized SSZ bytes sidesteps that part. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct StfInput { state: Vec, block: Vec, } +/// Public values committed by the STF guest program. +/// +/// These bind a proof to one concrete transition: applying the block with +/// `block_root` to the state with `pre_state_root` yields the state with +/// `post_state_root`. A verifier reads these back from the proof without ever +/// seeing the full pre-state or block, and can chain proofs by matching one +/// transition's `post_state_root` to the next's `pre_state_root`. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StfPublicValues { + /// `hash_tree_root` of the pre-state. + pub pre_state_root: H256, + /// `hash_tree_root` of the block being applied. + pub block_root: H256, + /// `hash_tree_root` of the post-state (equals `block.state_root`). + pub post_state_root: H256, +} + impl StfInput { pub fn new(state: State, block: Block) -> Self { StfInput { @@ -18,11 +40,11 @@ impl StfInput { } } - pub fn return_state(input: Self) -> State { - State::from_ssz_bytes(&input.state).expect("error decoding State") + pub fn state(&self) -> State { + State::from_ssz_bytes(&self.state).expect("error decoding State") } - pub fn return_block(input: Self) -> Block { - Block::from_ssz_bytes(&input.block).expect("error decoding block") + pub fn block(&self) -> Block { + Block::from_ssz_bytes(&self.block).expect("error decoding block") } } diff --git a/crates/guest-program/sp1/Cargo.toml b/crates/guest-program/sp1/Cargo.toml index bc1b7d3b..1e2a93c7 100644 --- a/crates/guest-program/sp1/Cargo.toml +++ b/crates/guest-program/sp1/Cargo.toml @@ -1,15 +1,15 @@ +# Standalone workspace: this guest builds for a RISC-V zkVM target via +# `cargo prove build`, so it is excluded from the root workspace and cannot +# inherit its `[workspace.package]` / `[workspace.dependencies]` values. +[workspace] + [package] name = "zkvm_guest_sp1" -authors.workspace = true -edition.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true +version = "0.1.0" +edition = "2024" +publish = false [dependencies] sp1-zkvm = "6.1.0" -ethlambda-types.workspace = true -ethlambda-state-transition.workspace = true \ No newline at end of file +ethlambda-types = { path = "../../common/types" } +ethlambda-state-transition = { path = "../../blockchain/state_transition" } diff --git a/crates/guest-program/sp1/src/main.rs b/crates/guest-program/sp1/src/main.rs index 1080d67d..859fb72a 100644 --- a/crates/guest-program/sp1/src/main.rs +++ b/crates/guest-program/sp1/src/main.rs @@ -2,12 +2,28 @@ sp1_zkvm::entrypoint!(main); use ethlambda_state_transition::state_transition; -use ethlambda_types::{primitives::HashTreeRoot, stf::StfInput}; +use ethlambda_types::{ + primitives::HashTreeRoot, + stf::{StfInput, StfPublicValues}, +}; fn main() { - let input: StfInput = sp1_zkvm::io::read(); - let mut state = StfInput::return_state(input.clone()); - let block = &StfInput::return_block(input.clone()); - let _ = state_transition(&mut state, block); - sp1_zkvm::io::commit(&state.hash_tree_root()); + let input: StfInput = sp1_zkvm::io::read(); + let mut state = input.state(); + let block = input.block(); + + // Capture the pre-state and block roots before mutating the state, so the + // committed public values bind the proof to this specific transition. + let pre_state_root = state.hash_tree_root(); + let block_root = block.hash_tree_root(); + + state_transition(&mut state, &block).expect("state transition failed"); + + let public_values = StfPublicValues { + pre_state_root, + block_root, + // state_transition already asserts this equals block.state_root. + post_state_root: state.hash_tree_root(), + }; + sp1_zkvm::io::commit(&public_values); } From 46ccd398e0a60990dbce37191b4563ab79ddd2e2 Mon Sep 17 00:00:00 2001 From: Sahilgill24 Date: Wed, 22 Jul 2026 07:29:51 +0530 Subject: [PATCH 4/5] feat: setup the prover core for zkvm proving and verification --- crates/common/types/src/stf.rs | 7 ++--- crates/prover/core/Cargo.toml | 15 ++++++++++ crates/prover/core/src/lib.rs | 55 ++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 crates/prover/core/Cargo.toml create mode 100644 crates/prover/core/src/lib.rs diff --git a/crates/common/types/src/stf.rs b/crates/common/types/src/stf.rs index f7d0aeb2..4244b5e8 100644 --- a/crates/common/types/src/stf.rs +++ b/crates/common/types/src/stf.rs @@ -3,12 +3,11 @@ use serde::{Deserialize, Serialize}; use crate::{block::Block, primitives::H256, state::State}; - -/// Input type for the zkVM's -/// +/// Input type for the zkVM's +/// /// The inputs to the zkVM need to derive serde Serialize/deserialize /// which is not derived for state (libssz traits) -/// wrapping pre-serialized SSZ bytes sidesteps that part. +/// wrapping pre-serialized SSZ bytes sidesteps that part. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct StfInput { state: Vec, diff --git a/crates/prover/core/Cargo.toml b/crates/prover/core/Cargo.toml new file mode 100644 index 00000000..a8f3187d --- /dev/null +++ b/crates/prover/core/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "ethlambda-prover-core" +authors.workspace = true +edition.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[dependencies] +ethlambda-types.workspace = true +thiserror.workspace = true + diff --git a/crates/prover/core/src/lib.rs b/crates/prover/core/src/lib.rs new file mode 100644 index 00000000..e0a7518c --- /dev/null +++ b/crates/prover/core/src/lib.rs @@ -0,0 +1,55 @@ +pub use ethlambda_types::stf::{StfInput, StfPublicValues}; + +/// A serialized proof of a single state transition. +/// +/// The bytes depend upon the specific zkVM being used, (SP1ProofWithPublicValues) +/// and carry both the proof and the committed public values, so +/// [`StfProver::verify`] can recover the [`StfPublicValues`] without re-running +/// the transition. +#[derive(Debug, Clone)] +pub struct Proof(pub Vec); + +impl Proof { + /// Borrow the raw proof bytes. + pub fn as_bytes(&self) -> &[u8] { + &self.0 + } +} + +impl From> for Proof { + fn from(bytes: Vec) -> Self { + Self(bytes) + } +} + +/// Proves and verifies state-transition executions on a zkVM backend. +/// +/// The methods are `async` because real backends (SP1, RISC0, …) drive an +/// async prover client. This makes the trait non–object-safe, so consumers +/// select a backend by concrete type rather than `Box`. +/// +/// `async_fn_in_trait` is allowed deliberately: we don't constrain the returned +/// futures to `Send`, since backend prover clients don't all guarantee it. +#[allow(async_fn_in_trait)] +pub trait StfProver { + /// Prove that applying the input's block to its pre-state is a valid + /// transition, returning [`Proof`]. + async fn prove(&self, input: &StfInput) -> Result; + + /// Verify a proof and return the public values it commits to. + async fn verify(&self, proof: &Proof) -> Result; +} + +/// Errors raised while proving or verifying a state transition. +#[derive(Debug, thiserror::Error)] +pub enum ProverError { + /// The backend failed to produce a proof. + #[error("proving failed: {0}")] + Prove(String), + /// The proof did not verify, or verification could not run. + #[error("verification failed: {0}")] + Verify(String), + /// A proof or its public values could not be (de)serialized. + #[error("proof (de)serialization failed: {0}")] + Serialization(String), +} From 8d2dde523293b8b3839a069ba4d0e49b4cfab7ca Mon Sep 17 00:00:00 2001 From: Sahilgill24 Date: Wed, 22 Jul 2026 07:31:17 +0530 Subject: [PATCH 5/5] feat: setup the prover backend for sp1 --- Cargo.lock | 8 +++++ Cargo.toml | 21 ++++++++--- crates/prover/sp1/Cargo.toml | 20 +++++++++++ crates/prover/sp1/build.rs | 5 +++ crates/prover/sp1/src/lib.rs | 67 ++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 crates/prover/sp1/Cargo.toml create mode 100644 crates/prover/sp1/build.rs create mode 100644 crates/prover/sp1/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 0b779c58..cb9c6137 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2124,6 +2124,14 @@ dependencies = [ "tracing", ] +[[package]] +name = "ethlambda-prover-core" +version = "0.1.0" +dependencies = [ + "ethlambda-types", + "thiserror 2.0.18", +] + [[package]] name = "ethlambda-rpc" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index d5303666..a27e9f72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,18 @@ members = [ "crates/net/api", "crates/net/p2p", "crates/net/rpc", + "crates/prover/core", "crates/storage", ] -# NOTE: zkVM guest programs are their own workspaces: they build for the respective +# NOTE: zkVM guest programs are their own workspaces: they build for the respective # target ISA via their respective build commands, not for the host, so `cargo {clippy,test} # --workspace` must not try to compile them. -exclude = ["crates/guest-program/sp1"] +# +# `ethlambda-prover-sp1` targets the host, but its build script compiles the +# guest ELF and needs the SP1 (`cargo prove`) toolchain, so it is kept out of +# the default `--workspace` build too. +exclude = ["crates/guest-program/sp1", "crates/prover/sp1"] [workspace.package] authors = ["LambdaClass"] @@ -43,6 +48,8 @@ ethlambda-network-api = { path = "crates/net/api" } ethlambda-p2p = { path = "crates/net/p2p" } ethlambda-rpc = { path = "crates/net/rpc" } ethlambda-storage = { path = "crates/storage" } +ethlambda-prover-core = { path = "crates/prover/core" } +ethlambda-prover-sp1 = { path = "crates/prover/sp1" } tracing = "0.1" thiserror = "2.0.9" @@ -77,11 +84,17 @@ rand = "0.10" lru = "0.16" rocksdb = "0.24" libc = "0.2" -reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } +reqwest = { version = "0.12", default-features = false, features = [ + "rustls-tls", +] } eyre = "0.6" # Allocator + heap profiling -tikv-jemallocator = { version = "0.6", features = ["stats", "unprefixed_malloc_on_supported_platforms", "profiling"] } +tikv-jemallocator = { version = "0.6", features = [ + "stats", + "unprefixed_malloc_on_supported_platforms", + "profiling", +] } jemalloc_pprof = { version = "0.8", features = ["flamegraph"] } # NOTE: Shadow-simulator builds also replace quinn-udp with the fallback crate diff --git a/crates/prover/sp1/Cargo.toml b/crates/prover/sp1/Cargo.toml new file mode 100644 index 00000000..395223c3 --- /dev/null +++ b/crates/prover/sp1/Cargo.toml @@ -0,0 +1,20 @@ +# Standalone workspace: this crate is excluded from the root workspace because +# its build script needs the SP1 (`cargo prove`) toolchain. +[workspace] + +[package] +name = "ethlambda-prover-sp1" +version = "0.1.0" +edition = "2024" +publish = false + +[dependencies] +sp1-sdk = "6.3.1" +ethlambda-prover-core = { path = "../core" } +ethlambda-types = { path = "../../common/types" } +# Serializes the whole SP1ProofWithPublicValues into `Proof` so verify can +# recover the committed public values. +bincode = "1.3" + +[build-dependencies] +sp1-build = "6.3.1" diff --git a/crates/prover/sp1/build.rs b/crates/prover/sp1/build.rs new file mode 100644 index 00000000..9952bcb9 --- /dev/null +++ b/crates/prover/sp1/build.rs @@ -0,0 +1,5 @@ +fn main() { + // Compile the RISC-V guest program so `include_elf!("zkvm_guest_sp1")` can + // embed its ELF. Path is relative to this crate's manifest directory. + sp1_build::build_program("../../guest-program/sp1"); +} diff --git a/crates/prover/sp1/src/lib.rs b/crates/prover/sp1/src/lib.rs new file mode 100644 index 00000000..cb8cc688 --- /dev/null +++ b/crates/prover/sp1/src/lib.rs @@ -0,0 +1,67 @@ +use ethlambda_prover_core::{Proof, ProverError, StfInput, StfProver, StfPublicValues}; +use sp1_sdk::{ + MockProver, Prover, SP1ProofWithPublicValues, SP1ProvingKey, SP1Stdin, SP1VerifyingKey, + include_elf, +}; + + +const STATE_TRANSITION_ELF: &[u8] = include_elf!("zkvm_guest_sp1"); +const CYCLE_LIMIT: u64 = 10_000_000; + +/// SP1 prover: proves the STF guest and verifies its proofs. +/// +/// The proving/verifying keys are derived once via [`Sp1Prover::new`] because +/// `setup` is expensive and must not run per proof. +/// [TODO!]: check if using Lazylock might be better +pub struct Sp1Prover { + client: MockProver, + pk: SP1ProvingKey, + vk: SP1VerifyingKey, +} + +impl Sp1Prover { + /// Build the prover once, caching the proving/verifying keys and + /// currently uses the MockProver. + pub async fn new() -> Self { + let client = MockProver::new().await; + // let client = ProverClient::builder().cpu().await; + let (pk, vk) = client.setup(STATE_TRANSITION_ELF).await; + Self { client, pk, vk } + } +} + +impl StfProver for Sp1Prover { + async fn prove(&self, input: &StfInput) -> Result { + + let mut stdin = SP1Stdin::new(); + stdin.write(input); + + // use `.groth16()` instead of `.compressed()` for real proving and verification + let proof = self + .client + .prove(&self.pk, stdin) + .compressed() + .cycle_limit(CYCLE_LIMIT) + .await + .map_err(|err| ProverError::Prove(err.to_string()))?; + + // Store the whole proof (including public values) so `verify` can + // recover the committed `StfPublicValues`. + let bytes = + bincode::serialize(&proof).map_err(|err| ProverError::Serialization(err.to_string()))?; + Ok(Proof(bytes)) + } + + async fn verify(&self, proof: &Proof) -> Result { + let mut sp1_proof: SP1ProofWithPublicValues = bincode::deserialize(proof.as_bytes()) + .map_err(|err| ProverError::Serialization(err.to_string()))?; + + self.client + .verify(&sp1_proof, &self.vk) + .await + .map_err(|err| ProverError::Verify(err.to_string()))?; + + // The guest committed `StfPublicValues` via `io::commit`; read it back. + Ok(sp1_proof.public_values.read::()) + } +}