From 927e6973ae2ba8c68b18cb7e53a719c1eaee5896 Mon Sep 17 00:00:00 2001 From: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com> Date: Sun, 16 Jun 2024 22:59:37 -0400 Subject: [PATCH] feat(prover): track cycles of sp1 guest & patch Secp256k1 (#288) * add cycle-tracker * git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" * revm v35_taiko_v2-cycls * make harness part of root workspace * update Cargo.lock * [dev-dependencies] substrate-bn = "0.6.0" * use secp256k1@0.28.2 * cargo update * clippy & fmt * remove typo * add [features] sp1-cycle-tracker in guest * apply comment * struct CycleTracker * update * fmt * Update proof.rs * Update proof.rs * Update proof.rs --- Cargo.lock | 424 +++++++++++---- Cargo.toml | 26 +- core/src/prover.rs | 13 +- docker/docker-compose.yml | 2 +- host/src/server/api/v1/proof.rs | 6 +- lib/Cargo.toml | 1 + lib/src/builder/execute.rs | 25 +- lib/src/builder/finalize.rs | 13 + lib/src/builder/initialize.rs | 14 + lib/src/builder/mod.rs | 21 +- lib/src/lib.rs | 26 + provers/risc0/guest/Cargo.lock | 513 ++++++++++++++----- provers/risc0/guest/Cargo.toml | 4 +- provers/risc0/guest/src/benchmark/ecdsa.rs | 5 +- provers/risc0/guest/src/benchmark/sha256.rs | 8 +- provers/risc0/guest/src/main.rs | 10 +- provers/risc0/guest/src/zk_op.rs | 20 +- provers/sgx/guest/Cargo.toml | 2 +- provers/sgx/guest/src/one_shot.rs | 6 +- provers/sgx/guest/src/signature.rs | 6 +- provers/sp1/guest/Cargo.lock | 372 +++++++++++--- provers/sp1/guest/Cargo.toml | 17 +- provers/sp1/guest/src/benchmark/bn254_add.rs | 2 +- provers/sp1/guest/src/main.rs | 8 +- provers/sp1/guest/src/zk_op.rs | 3 +- 25 files changed, 1180 insertions(+), 367 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac454104..e530b73c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,7 +115,7 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy-consensus" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-eips", "alloy-primitives", @@ -129,7 +129,7 @@ dependencies = [ [[package]] name = "alloy-contract" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -146,9 +146,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd2404399cb1b50572758e66e9b4bf088e5a3df9007be7126456c7e50af935f" +checksum = "cb6e6436a9530f25010d13653e206fab4c9feddacf21a54de8d7311b275bc56b" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -177,7 +177,7 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "alloy-serde", @@ -187,9 +187,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3abf6446a292e19853aaca43590eeb48bf435dfd2c74200259e8f4872f6ce3" +checksum = "aaeaccd50238126e3a0ff9387c7c568837726ad4f4e399b528ca88104d6c25ef" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -200,7 +200,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "serde", @@ -212,7 +212,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-consensus", "alloy-eips", @@ -228,9 +228,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277af0cbcc483ee6ad2c1e818090b5928d27f04fd6580680f31c1cf8068bcc2" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" dependencies = [ "alloy-rlp", "bytes", @@ -251,7 +251,7 @@ dependencies = [ [[package]] name = "alloy-provider" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-eips", "alloy-json-rpc", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-consensus", "alloy-eips", @@ -339,7 +339,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -351,7 +351,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "serde", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "alloy-signer" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "async-trait", @@ -374,7 +374,7 @@ dependencies = [ [[package]] name = "alloy-signer-wallet" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-consensus", "alloy-network", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30708a79919b082f2692423c8cc72fc250477e4a2ecb0d4a7244cd3cdb299965" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -402,9 +402,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a679ac01774ab7e00a567a918d4231ae692c5c8cedaf4e16956c3116d7896" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -420,9 +420,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356da0c2228aa6675a5faaa08a3e4061b967f924753983d72b9a18d9a3fad44e" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" dependencies = [ "const-hex", "dunce", @@ -435,18 +435,18 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fd4783b0a5840479013e9ce960d2eb7b3be381f722e0fe3d1f7c3bb6bd4ebd" +checksum = "baa2fbd22d353d8685bd9fee11ba2d8b5c3b1d11e56adb3265fcf1f32bfdf404" dependencies = [ "winnow 0.6.13", ] [[package]] name = "alloy-sol-types" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb5e6234c0b62514992589fe1578f64d418dbc8ef5cd1ab2d7f2f568f599698" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -457,7 +457,7 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -475,7 +475,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -1277,7 +1277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", - "regex-automata 0.4.6", + "regex-automata 0.4.7", "serde", ] @@ -1496,9 +1496,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.6" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -1506,9 +1506,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.6" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -2004,6 +2004,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -3241,12 +3252,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -3260,9 +3271,9 @@ checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "9f3935c160d00ac752e09787e6e6bfc26494c2183cc922f1bc678a60d4733bc2" [[package]] name = "httpdate" @@ -3430,6 +3441,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -3438,12 +3567,14 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -3798,6 +3929,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -4955,7 +5092,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", "rusty-fork", "tempfile", "unarray", @@ -5067,7 +5204,7 @@ dependencies = [ "anyhow", "assert_cmd", "c-kzg-taiko", - "clap 4.5.6", + "clap 4.5.7", "ethers-core 2.0.10", "raiko-lib", "reqwest 0.11.27", @@ -5108,7 +5245,7 @@ dependencies = [ "c-kzg-taiko", "cap", "cfg-if", - "clap 4.5.6", + "clap 4.5.7", "env_logger", "ethers-core 2.0.10", "flate2", @@ -5220,7 +5357,7 @@ dependencies = [ "bytemuck", "cap", "cfg-if", - "clap 4.5.6", + "clap 4.5.7", "dirs", "env_logger", "ethers-core 2.0.10", @@ -5348,14 +5485,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -5369,13 +5506,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -5386,9 +5523,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "relative-path" @@ -5507,7 +5644,7 @@ dependencies = [ [[package]] name = "revm" version = "8.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "auto_impl", "cfg-if", @@ -5521,7 +5658,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "4.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "revm-primitives", "serde", @@ -5530,7 +5667,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "6.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "aurora-engine-modexp", "c-kzg-taiko", @@ -5547,7 +5684,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "3.1.1" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "alloy-primitives", "auto_impl", @@ -6278,38 +6415,36 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.27.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ "rand", - "secp256k1-sys 0.8.1", + "secp256k1-sys 0.9.2", ] [[package]] name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +version = "0.29.0" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#09fe6ec0c0f0de848da5e295022029f46e0389e3" dependencies = [ "rand", - "secp256k1-sys 0.9.2", + "secp256k1-sys 0.10.0", ] [[package]] name = "secp256k1-sys" -version = "0.8.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" dependencies = [ "cc", ] [[package]] name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +version = "0.10.0" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#09fe6ec0c0f0de848da5e295022029f46e0389e3" dependencies = [ "cc", ] @@ -6503,13 +6638,13 @@ dependencies = [ "base64 0.21.7", "base64-serde", "bincode", - "clap 4.5.6", + "clap 4.5.7", "dirs", "hex", "raiko-lib", "rand", "rand_core", - "secp256k1 0.27.0", + "secp256k1 0.29.0", "serde", "serde_json", "sha3", @@ -6793,7 +6928,7 @@ dependencies = [ "anyhow", "backtrace", "bincode", - "clap 4.5.6", + "clap 4.5.7", "dirs", "futures", "hex", @@ -7167,9 +7302,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fe08d08d84f2c0a77f1e7c46518789d745c2e87a2721791ed7c3c9bc78df28" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" dependencies = [ "paste", "proc-macro2", @@ -7189,6 +7324,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -7344,6 +7490,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -7840,27 +7996,12 @@ dependencies = [ "version_check", ] -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -7893,9 +8034,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", @@ -7908,6 +8049,18 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -8412,6 +8565,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -8440,6 +8605,30 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -8460,6 +8649,27 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -8480,6 +8690,28 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "zip" version = "0.6.6" diff --git a/Cargo.toml b/Cargo.toml index a009c224..fde793c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,8 @@ raiko-lib = { path = "./lib", features = ["std"] } raiko-core = { path = "./core" } # revm -revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false } -revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false, features = [ +revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false } +revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false, features = [ "serde", "std", "c-kzg", @@ -64,22 +64,22 @@ alloy-dyn-abi = { version = "0.7.1", default-features = false } alloy-json-abi = { version = "0.7.1", default-features = false } alloy-primitives = { version = "0.7.1", default-features = false } alloy-sol-types = { version = "0.7.1", default-features = false } -alloy-rpc-types = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-rpc-client = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-consensus = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e", features = [ +alloy-rpc-types = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-rpc-client = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-consensus = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle", features = [ "serde", ] } -alloy-network = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e", features = [ +alloy-network = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle", features = [ "k256", ] } -alloy-contract = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-eips = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e", features = [ +alloy-contract = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-eips = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle", features = [ "serde", ] } -alloy-provider = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-transport-http = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-signer = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } -alloy-signer-wallet = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" } +alloy-provider = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-transport-http = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-signer = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } +alloy-signer-wallet = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle" } reqwest_alloy = { package = "reqwest", version = "0.12.4", features = ["json"] } @@ -139,7 +139,7 @@ c-kzg = { package = "c-kzg-taiko", git = "https://github.com/smtmfft/c-kzg-4844" ] } sha3 = { version = "0.10", default-features = false } sha2 = "0.10.8" -secp256k1 = { version = "0.27.0", features = [ +secp256k1 = { git = "https://github.com/CeciliaZ030/rust-secp256k1", branch = "sp1-patch", features = [ 'global-context', "rand", "recovery", diff --git a/core/src/prover.rs b/core/src/prover.rs index 84a1e26b..188e2dd4 100644 --- a/core/src/prover.rs +++ b/core/src/prover.rs @@ -29,12 +29,13 @@ impl Prover for NativeProver { output: &GuestOutput, config: &ProverConfig, ) -> ProverResult { - let param = config - .get("native") - .map(|v| NativeParam::deserialize(v)) - .ok_or(ProverError::Param(serde_json::Error::custom( - "native param not provided", - )))??; + let param = + config + .get("native") + .map(NativeParam::deserialize) + .ok_or(ProverError::Param(serde_json::Error::custom( + "native param not provided", + )))??; if let Some(path) = param.write_guest_input_path { let path = Path::new(&path); diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5f83b16b..20ec0c02 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -124,4 +124,4 @@ services: volumes: - ${HOME}/.config/sgx-pccs/default.json:/opt/intel/pccs/config/default.json - ${HOME}/.config/sgx-pccs/file.crt:/opt/intel/pccs/ssl_key/file.crt - - ${HOME}/.config/sgx-pccs/private.pem:/opt/intel/pccs/ssl_key/private.pem + - ${HOME}/.config/sgx-pccs/private.pem:/opt/intel/pccs/ssl_key/private.pem \ No newline at end of file diff --git a/host/src/server/api/v1/proof.rs b/host/src/server/api/v1/proof.rs index bdc55fae..185f677c 100644 --- a/host/src/server/api/v1/proof.rs +++ b/host/src/server/api/v1/proof.rs @@ -80,7 +80,7 @@ async fn validate_cache_input( // double check if cache is valid if cached_block_hash == real_block_hash { - return Ok(cache_input); + Ok(cache_input) } else { Err(HostError::InvalidRequestConfig( "Cached input is not valid".to_owned(), @@ -251,7 +251,7 @@ mod test { block_number: u64, ) -> (GuestInput, RpcBlockDataProvider) { let l1_chain_spec = SupportedChainSpecs::default() - .get_chain_spec(&l1_network) + .get_chain_spec(l1_network) .unwrap(); let taiko_chain_spec = SupportedChainSpecs::default() .get_chain_spec(network) @@ -287,7 +287,7 @@ mod test { async fn test_generate_input_from_cache() { let l1 = &Network::Holesky.to_string(); let l2 = &Network::TaikoA7.to_string(); - let block_number: u64 = 7; + let block_number: u64 = 69627; let (input, provider) = create_cache_input(l1, l2, block_number).await; let cache_path = Some("./".into()); assert!(set_cached_input(&cache_path, block_number, l2, &input).is_ok()); diff --git a/lib/Cargo.toml b/lib/Cargo.toml index ec269609..9737d0b9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -72,3 +72,4 @@ sgx = [] sp1 = [] risc0 = [] c-kzg = ["revm-primitives/c-kzg", "dep:tempfile"] +sp1-cycle-tracker = [] \ No newline at end of file diff --git a/lib/src/builder/execute.rs b/lib/src/builder/execute.rs index 8cdc7d91..ccf06367 100644 --- a/lib/src/builder/execute.rs +++ b/lib/src/builder/execute.rs @@ -48,6 +48,7 @@ use crate::{ print_duration, time::{AddAssign, Duration, Instant}, utils::{check_anchor_tx, generate_transactions}, + CycleTracker, }; /// Minimum supported protocol version: SHANGHAI @@ -176,7 +177,16 @@ impl TxExecStrategy for TkoTxExecStrategy { let num_transactions = transactions.len(); for (tx_no, tx) in take(&mut transactions).into_iter().enumerate() { if !is_optimistic { - inplace_print(&format!("\rprocessing tx {tx_no}/{num_transactions}...")); + cfg_if::cfg_if! { + if #[cfg(all(all(target_os = "zkvm", target_vendor = "succinct"), feature = "sp1-cycle-tracker"))]{ + println!( + "{:?}", + &format!("\rprocessing tx {tx_no}/{num_transactions}...") + ); + } else { + inplace_print(&format!("\rprocessing tx {tx_no}/{num_transactions}...")); + } + } } else { trace!("\rprocessing tx {tx_no}/{num_transactions}..."); } @@ -255,6 +265,7 @@ impl TxExecStrategy for TkoTxExecStrategy { // process the transaction let start = Instant::now(); + let cycle_tracker = CycleTracker::start("evm.transact()"); let ResultAndState { result, state } = match evm.transact() { Ok(result) => result, Err(err) => { @@ -276,6 +287,7 @@ impl TxExecStrategy for TkoTxExecStrategy { EVMError::Transaction(invalid_transaction) => { #[cfg(feature = "std")] debug!("Invalid tx at {tx_no}: {invalid_transaction:?}"); + cycle_tracker.end(); // skip the tx continue; } @@ -286,6 +298,7 @@ impl TxExecStrategy for TkoTxExecStrategy { } } }; + cycle_tracker.end(); #[cfg(feature = "std")] trace!(" Ok: {result:?}"); @@ -340,6 +353,8 @@ impl TxExecStrategy for TkoTxExecStrategy { print_duration("Tx transact time: ", tx_transact_duration); print_duration("Tx misc time: ", tx_misc_duration); } + clear_line(); + println!("actual Tx: {}", actual_tx_no); let mut db = &mut evm.context.evm.db; @@ -387,7 +402,9 @@ pub fn fill_eth_tx_env(tx_env: &mut TxEnv, tx: &TxEnvelope) -> Result<(), Error> // TODO(Brecht): use optimized recover match tx { TxEnvelope::Legacy(tx) => { + let cycle_tracker = CycleTracker::start("Legacy"); tx_env.caller = tx.recover_signer().unwrap_or_default(); + cycle_tracker.end(); let tx = tx.tx(); tx_env.gas_limit = tx.gas_limit.try_into().unwrap(); tx_env.gas_price = tx.gas_price.try_into().unwrap(); @@ -404,7 +421,9 @@ pub fn fill_eth_tx_env(tx_env: &mut TxEnv, tx: &TxEnvelope) -> Result<(), Error> tx_env.access_list.clear(); } TxEnvelope::Eip2930(tx) => { + let cycle_tracker = CycleTracker::start("Eip2930"); tx_env.caller = tx.recover_signer().unwrap_or_default(); + cycle_tracker.end(); let tx = tx.tx(); tx_env.gas_limit = tx.gas_limit.try_into().unwrap(); tx_env.gas_price = tx.gas_price.try_into().unwrap(); @@ -421,7 +440,9 @@ pub fn fill_eth_tx_env(tx_env: &mut TxEnv, tx: &TxEnvelope) -> Result<(), Error> tx_env.access_list = tx.access_list.flattened(); } TxEnvelope::Eip1559(tx) => { + let cycle_tracker = CycleTracker::start("Eip1559"); tx_env.caller = tx.recover_signer().unwrap_or_default(); + cycle_tracker.end(); let tx = tx.tx(); tx_env.gas_limit = tx.gas_limit.try_into().unwrap(); tx_env.gas_price = tx.max_fee_per_gas.try_into().unwrap(); @@ -438,7 +459,9 @@ pub fn fill_eth_tx_env(tx_env: &mut TxEnv, tx: &TxEnvelope) -> Result<(), Error> tx_env.access_list = tx.access_list.flattened(); } TxEnvelope::Eip4844(tx) => { + let cycle_tracker = CycleTracker::start("Eip1559"); tx_env.caller = tx.recover_signer().unwrap_or_default(); + cycle_tracker.end(); let tx = tx.tx().tx(); tx_env.gas_limit = tx.gas_limit.try_into().unwrap(); tx_env.gas_price = tx.max_fee_per_gas.try_into().unwrap(); diff --git a/lib/src/builder/finalize.rs b/lib/src/builder/finalize.rs index a13442f5..86a1259c 100644 --- a/lib/src/builder/finalize.rs +++ b/lib/src/builder/finalize.rs @@ -42,6 +42,9 @@ impl BlockFinalizeStrategy for MemDbBlockFinalizeStrategy { fn finalize(mut block_builder: BlockBuilder) -> Result<(AlloyConsensusHeader, MptNode)> { let db: MemDb = block_builder.db.take().expect("DB not initialized"); + let mut account_touched = 0; + let mut storage_touched = 0; + // apply state updates let mut state_trie = mem::take(&mut block_builder.input.parent_state_trie); for (address, account) in &db.accounts { @@ -59,6 +62,8 @@ impl BlockFinalizeStrategy for MemDbBlockFinalizeStrategy { continue; } + account_touched += 1; + // otherwise, compute the updated storage root for that account let state_storage = &account.storage; let storage_root = { @@ -82,6 +87,8 @@ impl BlockFinalizeStrategy for MemDbBlockFinalizeStrategy { } else { storage_trie.insert_rlp(&storage_trie_index, *value)?; } + + storage_touched += 1; } storage_trie.hash() @@ -96,6 +103,12 @@ impl BlockFinalizeStrategy for MemDbBlockFinalizeStrategy { state_trie.insert_rlp(&state_trie_index, state_account)?; } + #[cfg(feature = "sp1-cycle-tracker")] + { + println!("finalize Account touched {:?}", account_touched); + println!("finalize Storage touched {:?}", storage_touched); + } + // update result header with the new state root let mut header = block_builder.header.take().expect("Header not initialized"); header.state_root = state_trie.hash(); diff --git a/lib/src/builder/initialize.rs b/lib/src/builder/initialize.rs index 394f19d8..90b40d4a 100644 --- a/lib/src/builder/initialize.rs +++ b/lib/src/builder/initialize.rs @@ -62,6 +62,9 @@ impl DbInitStrategy for MemDbInitStrategy { .map(|bytes| (keccak(&bytes).into(), bytes)) .collect(); + let mut account_touched = 0; + let mut storage_touched = 0; + // Load account data into db let mut accounts = HashMap::with_capacity(block_builder.input.parent_storage.len()); for (address, (storage_trie, slots)) in &mut block_builder.input.parent_storage { @@ -82,6 +85,7 @@ impl DbInitStrategy for MemDbInitStrategy { storage_trie.hash() ); } + account_touched += 1; // load the corresponding code let code_hash = state_account.code_hash; @@ -102,6 +106,7 @@ impl DbInitStrategy for MemDbInitStrategy { .get_rlp(&keccak(slot.to_be_bytes::<32>()))? .unwrap_or_default(); storage.insert(slot, value); + storage_touched += 1; } let mem_account = DbAccount { @@ -119,6 +124,15 @@ impl DbInitStrategy for MemDbInitStrategy { } guest_mem_forget(contracts); + #[cfg(all( + all(target_os = "zkvm", target_vendor = "succinct"), + feature = "sp1-cycle-tracker" + ))] + { + println!("initialize_db Account touch {:?}", account_touched); + println!("initialize_db Storage touch {:?}", storage_touched); + } + // prepare block hash history let mut block_hashes = HashMap::with_capacity(block_builder.input.ancestor_headers.len() + 1); diff --git a/lib/src/builder/mod.rs b/lib/src/builder/mod.rs index 6afeb72a..be76fe72 100644 --- a/lib/src/builder/mod.rs +++ b/lib/src/builder/mod.rs @@ -27,6 +27,7 @@ use crate::{ input::GuestInput, mem_db::MemDb, primitives::mpt::MptNode, + CycleTracker, }; pub mod execute; @@ -76,22 +77,34 @@ where /// Initializes the database from the input. pub fn initialize_database>(self) -> Result { - T::initialize_database(self) + let cycle_tracker = CycleTracker::start("initialize_database"); + let res = T::initialize_database(self); + cycle_tracker.end(); + res } /// Initializes the header. This must be called before executing transactions. pub fn prepare_header(self) -> Result { - T::prepare_header(self) + let cycle_tracker = CycleTracker::start("prepare_header"); + let res = T::prepare_header(self); + cycle_tracker.end(); + res } /// Executes all input transactions. pub fn execute_transactions(self) -> Result { - T::execute_transactions(self) + let cycle_tracker = CycleTracker::start("execute_transactions"); + let res = T::execute_transactions(self); + cycle_tracker.end(); + res } /// Finalizes the block building and returns the header and the state trie. pub fn finalize>(self) -> Result<(AlloyConsensusHeader, MptNode)> { - T::finalize(self) + let cycle_tracker = CycleTracker::start("finalize"); + let res = T::finalize(self); + cycle_tracker.end(); + res } /// Returns a reference to the database. diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 5facdcef..dd745d79 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -85,6 +85,32 @@ mod time { } } +pub struct CycleTracker { + title: String, +} + +impl CycleTracker { + pub fn start(title: &str) -> CycleTracker { + let ct = CycleTracker { + title: title.to_string(), + }; + #[cfg(all( + all(target_os = "zkvm", target_vendor = "succinct"), + feature = "sp1-cycle-tracker" + ))] + println!("cycle-tracker-start: {title}"); + ct + } + + pub fn end(&self) { + #[cfg(all( + all(target_os = "zkvm", target_vendor = "succinct"), + feature = "sp1-cycle-tracker" + ))] + println!("cycle-tracker-end: {self.title}"); + } +} + pub struct Measurement { start: time::Instant, title: String, diff --git a/provers/risc0/guest/Cargo.lock b/provers/risc0/guest/Cargo.lock index 07ab5ec7..95737aa1 100644 --- a/provers/risc0/guest/Cargo.lock +++ b/provers/risc0/guest/Cargo.lock @@ -35,7 +35,7 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy-consensus" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-eips", "alloy-primitives", @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -62,7 +62,7 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "alloy-serde", @@ -73,7 +73,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "serde", @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-consensus", "alloy-eips", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525448f6afc1b70dd0f9d0a8145631bf2f5e434678ab23ab18409ca264cae6b3" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" dependencies = [ "alloy-rlp", "bytes", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -134,19 +134,19 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-consensus", "alloy-eips", @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "serde", @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "alloy-signer" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#6310be6f73bc998116a5f05713e49a324f4b7184" dependencies = [ "alloy-primitives", "async-trait", @@ -186,42 +186,56 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c80a2cb97e7aa48611cbb63950336f9824a174cdf670527cc6465078a26ea1" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" dependencies = [ "alloy-sol-macro-input", "const-hex", - "heck 0.4.1", + "heck", "indexmap 2.2.6", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58894b58ac50979eeac6249661991ac40b9d541830d9a725f7714cc9ef08c23" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" dependencies = [ "const-hex", "dunce", - "heck 0.5.0", + "heck", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", ] [[package]] name = "alloy-sol-types" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399287f68d1081ed8b1f4903c49687658b95b142207d7cb4ae2f4813915343ef" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -245,9 +259,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "ark-bn254" @@ -497,7 +511,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -518,7 +532,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -602,9 +616,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" dependencies = [ "cc", "glob", @@ -626,22 +640,22 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" +checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -676,7 +690,7 @@ dependencies = [ [[package]] name = "c-kzg-taiko" version = "1.0.0" -source = "git+https://github.com/smtmfft/c-kzg-4844?branch=for-alpha7#77e9ba0a65e10e6a470832da2914b17a968da791" +source = "git+https://github.com/smtmfft/c-kzg-4844?branch=for-alpha7#a2d3ae768eede8228920619c98c87584ad8afd09" dependencies = [ "blst", "cc", @@ -688,9 +702,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" [[package]] name = "cfg-if" @@ -713,9 +727,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" dependencies = [ "cfg-if", "cpufeatures", @@ -762,9 +776,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -799,9 +813,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ "darling_core", "darling_macro", @@ -809,27 +823,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -903,6 +917,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -937,9 +962,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "elf" @@ -974,7 +999,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1153,12 +1178,6 @@ dependencies = [ "serde", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1218,6 +1237,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1226,12 +1363,14 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -1365,9 +1504,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libflate" @@ -1401,9 +1540,15 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" [[package]] name = "log" @@ -1419,9 +1564,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -1473,7 +1618,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1656,9 +1801,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] @@ -1781,14 +1926,14 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "revm" version = "8.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "auto_impl", "cfg-if", @@ -1802,7 +1947,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "4.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "revm-primitives", "serde", @@ -1811,7 +1956,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "6.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "aurora-engine-modexp", "c-kzg-taiko", @@ -1828,7 +1973,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "3.1.1" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#7d23b1c557cf3d0e93f859b6794e580b9f0381c2" dependencies = [ "alloy-primitives", "auto_impl", @@ -2034,9 +2179,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.12.1" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -2058,9 +2203,9 @@ dependencies = [ [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-hex" @@ -2176,22 +2321,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2233,7 +2378,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2287,6 +2432,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "spin" version = "0.5.2" @@ -2303,6 +2454,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2311,9 +2468,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "substrate-bn" @@ -2347,9 +2504,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -2358,14 +2515,25 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa0cefd02f532035d83cfec82647c6eb53140b0485220760e669f4bad489e36" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", ] [[package]] @@ -2388,22 +2556,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2476,25 +2644,20 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" [[package]] name = "toml_edit" @@ -2527,7 +2690,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2579,38 +2742,35 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "valuable" version = "0.1.0" @@ -2659,7 +2819,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -2681,7 +2841,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2783,6 +2943,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -2792,6 +2964,30 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -2809,14 +3005,35 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -2829,5 +3046,27 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", +] + +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", ] diff --git a/provers/risc0/guest/Cargo.toml b/provers/risc0/guest/Cargo.toml index 37edfb44..49cb9f23 100644 --- a/provers/risc0/guest/Cargo.toml +++ b/provers/risc0/guest/Cargo.toml @@ -23,12 +23,12 @@ risc0-zkvm = { version = "0.21.0", default-features = false, features = [ 'std', "getrandom", ] } -revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false, features = [ +revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false, features = [ "taiko", "std", "c-kzg", ] } -revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false } +revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false } k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.3-risczero.0" } sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.6-risczero.0" } diff --git a/provers/risc0/guest/src/benchmark/ecdsa.rs b/provers/risc0/guest/src/benchmark/ecdsa.rs index baadc161..d93bd477 100644 --- a/provers/risc0/guest/src/benchmark/ecdsa.rs +++ b/provers/risc0/guest/src/benchmark/ecdsa.rs @@ -1,12 +1,11 @@ #![no_main] harness::entrypoint!(main); +use revm_precompile::zk_op::ZkvmOperator; use risc0_zkvm::guest::env; use std::hint::black_box; -use revm_precompile::zk_op::ZkvmOperator; use zk_op::Risc0Operator; fn main() { - let sig = black_box([ 0xb5, 0x0b, 0xb6, 0x79, 0x5f, 0x31, 0x74, 0x8a, 0x4d, 0x37, 0xc3, 0xa9, 0x7e, 0xbd, 0x06, 0xa2, 0x2e, 0xa3, 0x37, 0x71, 0x04, 0x0f, 0x5c, 0x05, 0xd6, 0xe2, 0xbb, 0x2d, 0x38, 0xc6, @@ -21,7 +20,7 @@ fn main() { 0x6e, 0x61, ]); - let op = Risc0Operator{}; + let op = Risc0Operator {}; let res = op.secp256k1_ecrecover(&sig, recid, &msg).unwrap(); env::commit::<[u8; 32]>(&res); diff --git a/provers/risc0/guest/src/benchmark/sha256.rs b/provers/risc0/guest/src/benchmark/sha256.rs index 346f605d..c604bc1e 100644 --- a/provers/risc0/guest/src/benchmark/sha256.rs +++ b/provers/risc0/guest/src/benchmark/sha256.rs @@ -1,7 +1,7 @@ #![no_main] harness::entrypoint!(main); -use std::hint::black_box; use risc0_zkvm::guest::env; +use std::hint::black_box; use revm_precompile::zk_op::ZkvmOperator; use zk_op::Risc0Operator; @@ -12,9 +12,9 @@ fn main() { 0x61, 0x67, 0x69, 0x76, 0x65, 0x79, 0x6f, 0x75, 0x72, 0x6d, 0x69, 0x6e, 0x64, 0x6f, 0x6e, 0x6e, 0x61, ]); - - let op = Risc0Operator{}; + + let op = Risc0Operator {}; let res = op.sha256_run(&input).unwrap(); env::commit::<[u8; 32]>(&res); -} \ No newline at end of file +} diff --git a/provers/risc0/guest/src/main.rs b/provers/risc0/guest/src/main.rs index f592589a..070e8802 100644 --- a/provers/risc0/guest/src/main.rs +++ b/provers/risc0/guest/src/main.rs @@ -4,17 +4,15 @@ use risc0_zkvm::guest::env; use raiko_lib::protocol_instance::ProtocolInstance; use raiko_lib::{ - consts::VerifierType, builder::{BlockBuilderStrategy, TaikoStrategy}, - input::{GuestInput, GuestOutput}, + consts::VerifierType, + input::GuestInput, }; use revm_precompile::zk_op::ZkOperation; use zk_op::Risc0Operator; pub mod mem; -#[cfg(test)] -use harness::*; pub use mem::*; fn main() { @@ -27,8 +25,8 @@ fn main() { let (header, _mpt_node) = TaikoStrategy::build_from(&input).unwrap(); let pi = ProtocolInstance::new(&input, &header, VerifierType::RISC0) - .unwrap() - .instance_hash(); + .unwrap() + .instance_hash(); env::commit(&pi); } diff --git a/provers/risc0/guest/src/zk_op.rs b/provers/risc0/guest/src/zk_op.rs index 8a9b8406..88b98281 100644 --- a/provers/risc0/guest/src/zk_op.rs +++ b/provers/risc0/guest/src/zk_op.rs @@ -41,7 +41,6 @@ impl ZkvmOperator for Risc0Operator { mut recid: u8, msg: &[u8; 32], ) -> Result<[u8; 32], Error> { - use risc0_k256::ecdsa::{RecoveryId, Signature, VerifyingKey}; // parse signature @@ -74,22 +73,29 @@ harness::zk_suits!( pub mod tests { #[test] pub fn test_sha256() { + use crate::risc0_sha2::{Digest, Sha256}; use harness::*; use raiko_lib::primitives::hex; - use risc0_sha2::{Digest, Sha256}; let test_ves = [ - ("", hex!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")), - ( "The quick brown fox jumps over the lazy dog", - hex!("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592") + ( + "", + hex!("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"), + ), + ( + "The quick brown fox jumps over the lazy dog", + hex!("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"), + ), + ( + "hello", + hex!("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"), ), - ("hello", hex!("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")), ]; for v in test_ves.iter() { let (input, expected) = *v; let result: [u8; 32] = Sha256::digest(input.as_bytes()).into(); - harness::assert_eq!(result, expected); + assert!(result == expected); } } } diff --git a/provers/sgx/guest/Cargo.toml b/provers/sgx/guest/Cargo.toml index d52e62ba..d583dfa0 100644 --- a/provers/sgx/guest/Cargo.toml +++ b/provers/sgx/guest/Cargo.toml @@ -10,7 +10,7 @@ raiko-lib = { workspace = true, features = ["sgx"] } tokio = { workspace = true } anyhow = { workspace = true } thiserror = { workspace = true } -secp256k1 = { workspace = true } +secp256k1 = { workspace = true, features = ["rand-std"]} serde = { workspace = true } rand = { workspace = true } hex = { workspace = true } diff --git a/provers/sgx/guest/src/one_shot.rs b/provers/sgx/guest/src/one_shot.rs index b7b62808..8c734183 100644 --- a/provers/sgx/guest/src/one_shot.rs +++ b/provers/sgx/guest/src/one_shot.rs @@ -14,7 +14,7 @@ use raiko_lib::{ primitives::Address, protocol_instance::ProtocolInstance, }; -use secp256k1::{KeyPair, SecretKey}; +use secp256k1::{Keypair, SecretKey}; use serde::Serialize; base64_serde_type!(Base64Standard, base64::engine::general_purpose::STANDARD); @@ -37,7 +37,7 @@ struct BootstrapData { quote: String, } -fn save_priv_key(key_pair: &KeyPair, privkey_path: &PathBuf) -> Result<()> { +fn save_priv_key(key_pair: &Keypair, privkey_path: &PathBuf) -> Result<()> { let mut file = fs::File::create(privkey_path).with_context(|| { format!( "Failed to create private key file {}", @@ -60,7 +60,7 @@ fn get_sgx_quote() -> Result> { } fn save_bootstrap_details( - key_pair: &KeyPair, + key_pair: &Keypair, new_instance: Address, quote: Vec, bootstrap_details_file_path: &Path, diff --git a/provers/sgx/guest/src/signature.rs b/provers/sgx/guest/src/signature.rs index a0b831b1..ff076529 100644 --- a/provers/sgx/guest/src/signature.rs +++ b/provers/sgx/guest/src/signature.rs @@ -4,11 +4,11 @@ use raiko_lib::primitives::{keccak256, Address, Signature, B256}; use rand_core::OsRng; use secp256k1::{ ecdsa::{RecoverableSignature, RecoveryId}, - Error, KeyPair, Message, PublicKey, SecretKey, SECP256K1, + Error, Keypair, Message, PublicKey, SecretKey, SECP256K1, }; -pub fn generate_key() -> KeyPair { - KeyPair::new_global(&mut OsRng) +pub fn generate_key() -> Keypair { + Keypair::new_global(&mut OsRng) } /// Recovers the address of the sender using secp256k1 pubkey recovery. diff --git a/provers/sp1/guest/Cargo.lock b/provers/sp1/guest/Cargo.lock index b2b939b6..c844bc06 100644 --- a/provers/sp1/guest/Cargo.lock +++ b/provers/sp1/guest/Cargo.lock @@ -35,7 +35,7 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy-consensus" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-eips", "alloy-primitives", @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -62,7 +62,7 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-primitives", "alloy-serde", @@ -73,7 +73,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-primitives", "serde", @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-consensus", "alloy-eips", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277af0cbcc483ee6ad2c1e818090b5928d27f04fd6580680f31c1cf8068bcc2" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" dependencies = [ "alloy-rlp", "bytes", @@ -146,7 +146,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-consensus", "alloy-eips", @@ -164,7 +164,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-primitives", "serde", @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "alloy-signer" version = "0.1.0" -source = "git+https://github.com/brechtpd/alloy?branch=175_4e22b9e#5f972199a8208969e838203c3db48f467c629d49" +source = "git+https://github.com/ceciliaz030/alloy?branch=175_4e22b9e-cycle#e589f8f2e856d83ec7cfa4d297d59f2e2f121857" dependencies = [ "alloy-primitives", "async-trait", @@ -186,9 +186,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30708a79919b082f2692423c8cc72fc250477e4a2ecb0d4a7244cd3cdb299965" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -200,9 +200,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a679ac01774ab7e00a567a918d4231ae692c5c8cedaf4e16956c3116d7896" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -218,9 +218,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356da0c2228aa6675a5faaa08a3e4061b967f924753983d72b9a18d9a3fad44e" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" dependencies = [ "const-hex", "dunce", @@ -233,9 +233,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb5e6234c0b62514992589fe1578f64d418dbc8ef5cd1ab2d7f2f568f599698" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -787,6 +787,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "dunce" version = "1.0.4" @@ -802,12 +813,12 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +source = "git+https://github.com/taikoxyz/signatures.git?branch=0.16.9#bb774a2595fcb07528930013e9306de5700f4a85" dependencies = [ "der", "digest 0.10.7", "elliptic-curve", + "raiko-sp1-hack", "rfc6979", "signature", "spki", @@ -1077,6 +1088,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1085,12 +1214,14 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -1252,6 +1383,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "log" version = "0.4.21" @@ -1576,6 +1713,15 @@ dependencies = [ "url", ] +[[package]] +name = "raiko-sp1-hack" +version = "0.1.0" +source = "git+https://github.com/taikoxyz/signatures.git?branch=0.16.9#bb774a2595fcb07528930013e9306de5700f4a85" +dependencies = [ + "bincode", + "serde", +] + [[package]] name = "rand" version = "0.8.5" @@ -1617,14 +1763,14 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "revm" version = "8.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#9a1e6db4b84c35e05308ec2d7dbb50a48aea6fed" dependencies = [ "auto_impl", "cfg-if", @@ -1638,7 +1784,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "4.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#9a1e6db4b84c35e05308ec2d7dbb50a48aea6fed" dependencies = [ "revm-primitives", "serde", @@ -1647,7 +1793,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "6.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#9a1e6db4b84c35e05308ec2d7dbb50a48aea6fed" dependencies = [ "aurora-engine-modexp", "c-kzg-taiko", @@ -1664,7 +1810,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "3.1.1" -source = "git+https://github.com/taikoxyz/revm.git?branch=v35_taiko_v2#a5c01f345f4362f4d5d8bbddf37e9d8aeb27b0d3" +source = "git+https://github.com/taikoxyz/revm.git?branch=v35-taiko#9a1e6db4b84c35e05308ec2d7dbb50a48aea6fed" dependencies = [ "alloy-primitives", "auto_impl", @@ -1684,8 +1830,7 @@ dependencies = [ [[package]] name = "rfc6979" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +source = "git+https://github.com/taikoxyz/signatures.git?branch=0.16.9#bb774a2595fcb07528930013e9306de5700f4a85" dependencies = [ "hmac", "subtle", @@ -1841,9 +1986,8 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +version = "0.29.0" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#09fe6ec0c0f0de848da5e295022029f46e0389e3" dependencies = [ "rand", "secp256k1-sys", @@ -1851,9 +1995,8 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +version = "0.10.0" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#09fe6ec0c0f0de848da5e295022029f46e0389e3" dependencies = [ "cc", ] @@ -1995,6 +2138,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "snowbridge-amcl" version = "1.0.2" @@ -2009,6 +2158,7 @@ dependencies = [ name = "sp1-guest" version = "0.1.0" dependencies = [ + "alloy-consensus", "harness", "harness-core", "raiko-lib", @@ -2070,6 +2220,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2125,9 +2281,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fe08d08d84f2c0a77f1e7c46518789d745c2e87a2721791ed7c3c9bc78df28" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" dependencies = [ "paste", "proc-macro2", @@ -2135,6 +2291,17 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "tap" version = "1.0.1" @@ -2243,20 +2410,15 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "toml_datetime" version = "0.6.6" @@ -2335,38 +2497,35 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "valuable" version = "0.1.0" @@ -2539,6 +2698,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -2548,6 +2719,30 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -2568,6 +2763,27 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -2587,3 +2803,25 @@ dependencies = [ "quote", "syn 2.0.66", ] + +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] diff --git a/provers/sp1/guest/Cargo.toml b/provers/sp1/guest/Cargo.toml index 66218400..46ab25b8 100644 --- a/provers/sp1/guest/Cargo.toml +++ b/provers/sp1/guest/Cargo.toml @@ -37,18 +37,29 @@ path = "src/benchmark/bn254_mul.rs" [dependencies] raiko-lib = { path = "../../../lib", features = ["std", "sp1"] } sp1-zkvm ={ git = "https://github.com/succinctlabs/sp1.git", branch = "main" } -revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false, features = [ +revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false, features = [ "taiko", "std", "c-kzg", ] } -revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35_taiko_v2", default-features = false } +revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v35-taiko", default-features = false } sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "v0.10.8" } sp1-precompiles = { git = "https://github.com/succinctlabs/sp1.git", branch = "main"} harness-core = { path = "../../../harness/core" } harness = { path = "../../../harness/macro", features = ["sp1"]} substrate-bn = "0.6.0" - +alloy-consensus = { git = "https://github.com/ceciliaz030/alloy", branch = "175_4e22b9e-cycle", optional = true, features = [ + "serde", +] } [patch.crates-io] # Cant's use ZkOp for keccak since it's not precompile +ecdsa = { git = "https://github.com/taikoxyz/signatures.git", branch = "0.16.9", package = "ecdsa", default-features = false, features = ["der"] } tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch = "patch-v2.0.2" } +secp256k1 = { git = "https://github.com/CeciliaZ030/rust-secp256k1", branch = "sp1-patch", features = ["recovery", "sp1"]} + +[features] +sp1-cycle-tracker = [ + "alloy-consensus/sp1-cycle-tracker", + "raiko-lib/sp1-cycle-tracker", + "revm-precompile/sp1-cycle-tracker" + ] diff --git a/provers/sp1/guest/src/benchmark/bn254_add.rs b/provers/sp1/guest/src/benchmark/bn254_add.rs index 6d314c5c..15554c52 100644 --- a/provers/sp1/guest/src/benchmark/bn254_add.rs +++ b/provers/sp1/guest/src/benchmark/bn254_add.rs @@ -20,7 +20,7 @@ fn main() { let hi = res[..32].to_vec(); let lo = res[32..].to_vec(); - // Longer than 32 bit register + // Longer than 32 bit register sp1_zkvm::io::commit(&hi); sp1_zkvm::io::commit(&lo); } diff --git a/provers/sp1/guest/src/main.rs b/provers/sp1/guest/src/main.rs index f146b935..d3cbe38e 100644 --- a/provers/sp1/guest/src/main.rs +++ b/provers/sp1/guest/src/main.rs @@ -3,9 +3,9 @@ harness::entrypoint!(main, tests, zk_op::tests); // harness::entrypoint!(main, tests); use raiko_lib::{ - consts::VerifierType, builder::{BlockBuilderStrategy, TaikoStrategy}, - input::{GuestInput, GuestOutput}, + consts::VerifierType, + input::{GuestInput}, protocol_instance::ProtocolInstance, }; use revm_precompile::zk_op::ZkOperation; @@ -28,8 +28,8 @@ pub fn main() { let (header, _mpt_node) = TaikoStrategy::build_from(&input).unwrap(); let pi = ProtocolInstance::new(&input, &header, VerifierType::SP1) - .unwrap() - .instance_hash(); + .unwrap() + .instance_hash(); sp1_zkvm::io::commit(&pi); } diff --git a/provers/sp1/guest/src/zk_op.rs b/provers/sp1/guest/src/zk_op.rs index 128ace64..749f0997 100644 --- a/provers/sp1/guest/src/zk_op.rs +++ b/provers/sp1/guest/src/zk_op.rs @@ -1,5 +1,4 @@ use revm_precompile::{bn128::ADD_INPUT_LEN, utilities::right_pad, zk_op::ZkvmOperator, Error}; -use revm_primitives::keccak256; use sha2_v0_10_8 as sp1_sha2; use sp1_zkvm::precompiles::{bn254::Bn254, utils::AffinePoint}; @@ -68,7 +67,7 @@ impl ZkvmOperator for Sp1Operator { let recovered_key = sp1_precompiles::secp256k1::ecrecover(&sig_id, msg) .map_err(|e| Error::ZkvmOperation(e.to_string()))?; - let mut hash = keccak256(&recovered_key[1..]); + let mut hash = revm_primitives::keccak256(&recovered_key[1..]); // truncate to 20 bytes hash[..12].fill(0);