diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5bb6edf7b..8e3d2adae 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -36,7 +36,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 - - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: @@ -56,7 +55,8 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: "--all --release -- --test-threads 32" + args: "--all --release" + fmt: name: Rustfmt diff --git a/Cargo.lock b/Cargo.lock index facf89616..7756fc328 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,42 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.6" @@ -15,6 +51,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -36,24 +81,152 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", +] + +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "sha2", + "tinyvec", +] + [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "byteorder" version = "1.5.0" @@ -65,6 +238,41 @@ name = "bytes" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +dependencies = [ + "serde", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] [[package]] name = "cc" @@ -91,9 +299,90 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.5", + "bech32", + "bs58", + "digest", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + +[[package]] +name = "const-hex" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", ] +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + [[package]] name = "const-random" version = "0.1.17" @@ -114,12 +403,31 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + [[package]] name = "crossbeam-deque" version = "0.8.3" @@ -159,6 +467,37 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "darling" version = "0.20.3" @@ -194,6 +533,16 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "deranged" version = "0.3.9" @@ -205,592 +554,2316 @@ dependencies = [ ] [[package]] -name = "either" -version = "1.9.0" +name = "derive_more" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] -name = "fixed-hash" -version = "0.7.0" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "static_assertions", + "block-buffer", + "const-oid", + "crypto-common", + "subtle", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "dunce" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] -name = "getrandom" -version = "0.2.11" +name = "ecdsa" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "either" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] -name = "hashbrown" -version = "0.14.2" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "ahash", - "rayon", - "serde", + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", ] [[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "iana-time-zone" -version = "0.1.58" +name = "encoding_rs" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", + "cfg-if", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "enr" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "cc", + "base64 0.21.5", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", ] [[package]] -name = "ident_case" +name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "indexmap" -version = "1.9.3" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid", ] [[package]] -name = "itertools" -version = "0.10.5" +name = "ethabi" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ - "either", + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", ] [[package]] -name = "itertools" -version = "0.11.0" +name = "ethbloom" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ - "either", + "crunchy", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", ] [[package]] -name = "itertools" -version = "0.12.0" +name = "ethereum-types" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "either", + "ethbloom", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types 0.12.2", + "scale-info", + "uint", ] [[package]] -name = "itoa" -version = "1.0.9" +name = "ethers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "1a5344eea9b20effb5efeaad29418215c4d27017639fd1f908260f59cbbd226e" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-middleware", + "ethers-providers", + "ethers-signers", +] [[package]] -name = "js-sys" -version = "0.3.65" +name = "ethers-addressbook" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "8c405f24ea3a517899ba7985385c43dc4a7eb1209af3b1e0a1a32d7dcc7f8d09" dependencies = [ - "wasm-bindgen", + "ethers-core", + "once_cell", + "serde", + "serde_json", ] [[package]] -name = "keccak-hash" -version = "0.8.0" +name = "ethers-contract" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ - "primitive-types", - "tiny-keccak", + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", ] [[package]] -name = "libc" -version = "0.2.150" +name = "ethers-contract-abigen" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "syn 2.0.39", + "toml", + "walkdir", +] [[package]] -name = "log" -version = "0.4.20" +name = "ethers-contract-derive" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.39", +] [[package]] -name = "mapreduce-plonky2" -version = "0.1.0" +name = "ethers-core" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ - "anyhow", - "itertools 0.12.0", - "plonky2", - "plonky2_crypto", + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand", "rlp", "serde", + "serde_json", + "strum", + "syn 2.0.39", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", ] [[package]] -name = "memoffset" -version = "0.9.0" +name = "ethers-middleware" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "681ece6eb1d10f7cf4f873059a77c04ff1de4f35c63dd7bccde8f438374fcb93" dependencies = [ - "autocfg", + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", ] [[package]] -name = "num" -version = "0.4.1" +name = "ethers-providers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", + "async-trait", + "auto_impl", + "base64 0.21.5", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "num-bigint" -version = "0.4.4" +name = "ethers-signers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "0cb1b714e227bbd2d8c53528adb580b203009728b17d0d0e4119353aa9bc5532" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", "rand", + "sha2", + "thiserror", + "tracing", ] [[package]] -name = "num-complex" -version = "0.4.4" +name = "eyre" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "80f656be11ddf91bd709454d15d5bd896fbaf4cc3314e69349e4d1569f5b46cd" dependencies = [ - "num-traits", - "rand", + "indenter", + "once_cell", ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "fastrand" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] -name = "num-iter" -version = "0.1.43" +name = "ff" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "rand_core", + "subtle", ] [[package]] -name = "num-rational" -version = "0.4.1" +name = "fixed-hash" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", + "static_assertions", ] [[package]] -name = "num-traits" -version = "0.2.17" +name = "fixed-hash" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ - "autocfg", + "byteorder", + "rand", + "rustc-hex", + "static_assertions", ] [[package]] -name = "once_cell" -version = "1.18.0" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "plonky2" -version = "0.1.4" +name = "form_urlencoded" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c7acc7871fdaf000d3533116eab95d89ada3dfb82b7bb0231da981323c27d6" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "ahash", - "anyhow", - "getrandom", - "hashbrown 0.14.2", - "itertools 0.11.0", - "keccak-hash", - "log", - "num", - "plonky2_field", - "plonky2_maybe_rayon", - "plonky2_util", - "rand", - "rand_chacha", - "serde", - "serde_json", - "static_assertions", - "unroll", + "percent-encoding", ] [[package]] -name = "plonky2_crypto" -version = "0.1.0" -source = "git+https://github.com/nikkolasg/plonky2-crypto#011183a3cf5e5b67e5e47c88954f629cdb8b7d2a" -dependencies = [ - "anyhow", - "hex", - "itertools 0.10.5", - "num", - "plonky2", - "plonky2_maybe_rayon", - "rand", - "rayon", - "serde", - "serde_with", -] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] -name = "plonky2_field" -version = "0.1.1" +name = "futures" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33a655ab5d274f763c292fe7e14577f25e40d9d8607b70ef10b39f8619e60b4" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ - "anyhow", - "itertools 0.11.0", - "num", - "plonky2_util", - "rand", - "serde", - "static_assertions", - "unroll", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "plonky2_maybe_rayon" -version = "0.1.1" +name = "futures-channel" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194db0cbdd974e92d897cd92b74adb3968dc1b967315eb280357c49a7637994e" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ - "rayon", + "futures-core", + "futures-sink", ] [[package]] -name = "plonky2_util" -version = "0.1.1" +name = "futures-core" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5696e2e2a6bb5c48a6e33fb0dd4d20d0a9472784b709964f337f224e99bd6d06" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] -name = "powerfmt" -version = "0.2.0" +name = "futures-executor" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "futures-io" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] -name = "primitive-types" -version = "0.10.1" +name = "futures-locks" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" dependencies = [ - "fixed-hash", - "uint", + "futures-channel", + "futures-task", ] [[package]] -name = "proc-macro2" -version = "1.0.69" +name = "futures-macro" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "unicode-ident", + "proc-macro2", + "quote", + "syn 2.0.39", ] [[package]] -name = "quote" -version = "1.0.33" +name = "futures-sink" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" dependencies = [ - "proc-macro2", + "gloo-timers", + "send_wrapper 0.4.0", ] [[package]] -name = "rand" -version = "0.8.5" +name = "futures-util" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ - "ppv-lite86", - "rand_core", + "byteorder", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "getrandom", + "typenum", + "version_check", + "zeroize", ] [[package]] -name = "rayon" +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +dependencies = [ + "ahash", + "rayon", + "serde", +] + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", - "rayon-core", ] [[package]] -name = "rayon-core" -version = "1.12.0" +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.5", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851" +dependencies = [ + "primitive-types 0.10.1", + "tiny-keccak", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mapreduce-plonky2" +version = "0.1.0" +dependencies = [ + "anyhow", + "ethers", + "hex", + "itertools 0.12.0", + "plonky2", + "plonky2_crypto", + "rand", + "rlp", + "serde", + "sha3", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "rand", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" +dependencies = [ + "proc-macro-crate 2.0.0", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "plonky2" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c7acc7871fdaf000d3533116eab95d89ada3dfb82b7bb0231da981323c27d6" +dependencies = [ + "ahash", + "anyhow", + "getrandom", + "hashbrown 0.14.2", + "itertools 0.11.0", + "keccak-hash", + "log", + "num", + "plonky2_field", + "plonky2_maybe_rayon", + "plonky2_util", + "rand", + "rand_chacha", + "serde", + "serde_json", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_crypto" +version = "0.1.0" +source = "git+https://github.com/nikkolasg/plonky2-crypto#011183a3cf5e5b67e5e47c88954f629cdb8b7d2a" +dependencies = [ + "anyhow", + "hex", + "itertools 0.10.5", + "num", + "plonky2", + "plonky2_maybe_rayon", + "rand", + "rayon", + "serde", + "serde_with", +] + +[[package]] +name = "plonky2_field" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d33a655ab5d274f763c292fe7e14577f25e40d9d8607b70ef10b39f8619e60b4" +dependencies = [ + "anyhow", + "itertools 0.11.0", + "num", + "plonky2_util", + "rand", + "serde", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194db0cbdd974e92d897cd92b74adb3968dc1b967315eb280357c49a7637994e" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5696e2e2a6bb5c48a6e33fb0dd4d20d0a9472784b709964f337f224e99bd6d06" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.39", +] + +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash 0.7.0", + "uint", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bitflags 2.4.1", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "unarray", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64 0.21.5", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +dependencies = [ + "serde", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.39", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ - "crossbeam-deque", - "crossbeam-utils", + "time-core", ] [[package]] -name = "rlp" -version = "0.5.2" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ - "bytes", - "rustc-hex", + "crunchy", ] [[package]] -name = "rustc-hex" -version = "2.1.0" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] [[package]] -name = "ryu" -version = "1.0.15" +name = "tinyvec_macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "scopeguard" -version = "1.2.0" +name = "tokio" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2 0.5.5", + "windows-sys 0.48.0", +] [[package]] -name = "serde" -version = "1.0.193" +name = "tokio-util" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "serde_derive", + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "serde_derive" -version = "1.0.193" +name = "toml" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.21.0", ] [[package]] -name = "serde_json" -version = "1.0.108" +name = "toml_datetime" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ - "itoa", - "ryu", "serde", ] [[package]] -name = "serde_with" -version = "2.3.3" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "base64", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time", + "indexmap 2.1.0", + "toml_datetime", + "winnow", ] [[package]] -name = "serde_with_macros" -version = "2.3.3" +name = "toml_edit" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.39", + "indexmap 2.1.0", + "toml_datetime", + "winnow", ] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "toml_edit" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] [[package]] -name = "strsim" -version = "0.10.0" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] -name = "syn" -version = "1.0.109" +name = "tracing" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "pin-project-lite", + "tracing-attributes", + "tracing-core", ] [[package]] -name = "syn" -version = "2.0.39" +name = "tracing-attributes" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "unicode-ident", + "syn 2.0.39", ] [[package]] -name = "time" -version = "0.3.30" +name = "tracing-core" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", + "once_cell", ] [[package]] -name = "time-core" -version = "0.1.2" +name = "tracing-futures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] [[package]] -name = "time-macros" -version = "0.2.15" +name = "try-lock" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", -] +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] -name = "tiny-keccak" -version = "2.0.2" +name = "typenum" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uint" @@ -804,12 +2877,39 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[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.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "unroll" version = "0.1.5" @@ -820,12 +2920,58 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -857,6 +3003,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.88" @@ -886,13 +3044,72 @@ version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +[[package]] +name = "web-sys" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -901,13 +3118,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -916,42 +3148,131 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "zerocopy" version = "0.7.26" @@ -971,3 +3292,9 @@ dependencies = [ "quote", "syn 2.0.39", ] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 90684ab19..e60f532f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,19 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +anyhow = "1.0.75" itertools = "0.12.0" plonky2 = "0.1.4" # supporting latest plonky2 plonky2_crypto = { git = "https://github.com/nikkolasg/plonky2-crypto" } +rand = "0.8.5" serde = "1.0.193" [dev-dependencies] anyhow = "1.0.75" +ethers = { version ="2.0.11", default-features = false } +hex = "0.4.3" +itertools = "0.12.0" rlp = "0.5.2" +sha3 = "0.10.8" diff --git a/src/lib.rs b/src/lib.rs index 5c953234e..415274303 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,18 @@ +#![feature(generic_const_exprs)] + +use plonky2::plonk::{ + circuit_data::{CommonCircuitData, VerifierOnlyCircuitData}, + proof::ProofWithPublicInputs, +}; + +mod mpt_tx; mod rlp; mod utils; + +/// Bundle containing the raw proof, the verification key, and some common data +/// necessary for prover and verifier. +pub(crate) type ProofTuple = ( + ProofWithPublicInputs, + VerifierOnlyCircuitData, + CommonCircuitData, +); diff --git a/src/mpt_tx.rs b/src/mpt_tx.rs new file mode 100644 index 000000000..653608db4 --- /dev/null +++ b/src/mpt_tx.rs @@ -0,0 +1,489 @@ +use anyhow::Result; +use plonky2::{ + field::extension::Extendable, + hash::hash_types::RichField, + iop::{ + target::Target, + witness::{PartialWitness, WitnessWrite}, + }, + plonk::{circuit_builder::CircuitBuilder, circuit_data::CircuitConfig, config::GenericConfig}, + util::ceil_div_usize, +}; +use plonky2_crypto::{ + biguint::BigUintTarget, + hash::{ + keccak256::{CircuitBuilderHashKeccak, KECCAK256_R}, + HashInputTarget, + }, + u32::arithmetic_u32::U32Target, +}; + +use crate::{ + rlp::{decode_fixed_list, decode_tuple, extract_array}, + utils::{convert_u8_to_u32, less_than}, + ProofTuple, +}; + +/// The maximum length of a RLP encoded leaf node in a MPT tree holding a legacy tx. +const MAX_LEGACY_TX_NODE_LENGTH: usize = 532; +/// The maximum size a RLP encoded legacy tx can take. This is different from +/// `LEGACY_TX_NODE_LENGTH` because the latter contains the key in the path +/// as well. +const MAX_LEGACY_TX_LENGTH: usize = 532; +/// Maximum size the gas value can take in bytes. +const MAX_GAS_VALUE_LEN: usize = 32; + +/// There are different ways to extract values from a transaction. This enum +/// list some. +pub(crate) enum ExtractionMethod { + /// RLPBased decodes each header consecutively and extract the gas value + /// TODO: Currently hardcode that the gas value is 3rd item in the tx list + /// because we use const generics and can't pass the index as a parameter. + RLPBased, + /// Directly reads at the specified offset. + /// Offset of the item in the tx list - length is assumed to be constant + /// OffsetBased is NOT secure, it is only useful for testing & quick prototyping purposes. + OffsetBased(usize), +} + +/// Provides a proof for a leaf node in a MPT tree holding a legacy tx. It exposes +/// the hash of the node as public input, as well as the gas value of the tx. +pub fn legacy_tx_leaf_node_proof< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, +>( + config: &CircuitConfig, + mut node: Vec, + extract: ExtractionMethod, +) -> Result> { + let mut b = CircuitBuilder::::new(config.clone()); + let mut pw = PartialWitness::new(); + + let node_length = node.len(); + node.resize(MAX_LEGACY_TX_NODE_LENGTH, 0); + let node_targets = b.add_virtual_targets(MAX_LEGACY_TX_NODE_LENGTH); + + // Witness assignement + for i in 0..MAX_LEGACY_TX_NODE_LENGTH { + pw.set_target(node_targets[i], F::from_canonical_u8(node[i])); + } + + // Hash computation and exposing as public input + let length_target = b.add_virtual_target(); + pw.set_target(length_target, F::from_canonical_usize(node_length)); + hash_node(&mut b, &mut pw, &node_targets, length_target, node_length); + + // Gas value extraction and exposing as public input + let gas_value_array = match extract { + // gas is at 3rd position + ExtractionMethod::RLPBased => { + extract_item_from_tx_list::(&mut b, &node_targets) + } + ExtractionMethod::OffsetBased(offset) => { + // NOTE: It does NOT guarantee the offset is _correct_. The prover CAN give + // any offset within the given slice that has been hashed, and claim it is + // the gas value. + let gas_offset_target = b.add_virtual_target(); + pw.set_target(gas_offset_target, F::from_canonical_usize(offset)); + extract_array::(&mut b, &node_targets, gas_offset_target) + } + }; + // maximum length that the RLP(gas) == RLP(U256) can take: + // * 32 bytes for the value (U256 = 32 bytes) + // TODO: pack the gas value into U32Target - more compact + b.register_public_inputs(&gas_value_array); + + // proving part + let data = b.build::(); + let proof = data.prove(pw)?; + + Ok((proof, data.verifier_only, data.common)) +} + +/// Reads the header of the RLP node, then reads the header of the TX item +/// then reads all headers of the items in the list until it reaches the given +/// header at position N. It reads that header and returns the offset from the array +/// where the data is starting +fn extract_item_from_tx_list< + F: RichField + Extendable, + const D: usize, + const N_FIELDS: usize, + const MAX_VALUE_SIZE: usize, +>( + b: &mut CircuitBuilder, + node: &[Target], + // TODO: make that const generic +) -> [Target; MAX_VALUE_SIZE] { + // First, decode headers of RLP ( RLP (key), RLP(tx) ) + let tuple_headers = decode_tuple(b, node); + let rlp_tx_index = 1; + // extract the RLP(tx) from the node encoding + let tx_offset = tuple_headers.offset[rlp_tx_index]; + let rlp_tx = extract_array::(b, node, tx_offset); + + // then extract the gas fees: it's the third item in the tx list (out of 9 for legacy tx) + // NOTE: we should only decode the things we need, so for example here + // the gas fee is at the 3rd position then we only need to decode up to the 3rd + // headers in the list and keep the rest untouched. However, later user query might + // want the whole thing. + let tx_list = decode_fixed_list::(b, &rlp_tx); + let item_index = N_FIELDS - 1; + let item_offset = tx_list.offset[item_index]; + extract_array::(b, &rlp_tx, item_offset) +} + +fn hash_node, const D: usize>( + b: &mut CircuitBuilder, + pw: &mut PartialWitness, + node: &[Target], // assume constant size : TODO make it const generic + length_target: Target, // the size of the data inside this fixed size array + length: usize, // could maybe be done with a generator but simpler this way +) { + let total_len = node.len(); + // the computation of the padding length can be done outside the circuit + // because the important thing is that we prove in crcuit (a) we did some padding + // starting from the end of the message and (b) that padded array is transformed + // into u32 array correctly. + // We don't care if the _padding length_ if done incorrectly, + // because the hash output will be incorrect because hash computation is constrained. + // If the prover gave a incorrect length_target, that means either the data buffer + // will be changed, OR the the padding "buffer" will be changed from what is expected + // -> in both cases, the resulting hash will be different. + // (a) is necessary to allow the circuit to take as witness this length_target such + // that we can _directly_ lookup the data that is interesting for us _without_ passing + // through the expensive RLP decoding steps. To do this, we need to make sure, the prover + // can NOT give a target_length value which points to an index > to where we actually + // start padding the data. Otherwise, target_length could point to _any_ byte after + // the end of the data slice up to the end of the fixed size array. + let input_len_bits = length * 8; // only pad the data that is inside the fixed buffer + let num_actual_blocks = 1 + input_len_bits / KECCAK256_R; + let padded_len_bits = num_actual_blocks * KECCAK256_R; + // reason why ^: this is annoying to do in circuit. + let num_bytes = ceil_div_usize(padded_len_bits, 8); + let diff = num_bytes - length; + + let diff_target = b.add_virtual_target(); + pw.set_target(diff_target, F::from_canonical_usize(diff)); + let end_padding = b.add(length_target, diff_target); + let one = b.one(); + let end_padding = b.sub(end_padding, one); // inclusive range + // little endian so we start padding from the end of the byte + let single_pad = b.constant(F::from_canonical_usize(0x81)); // 1000 0001 + let begin_pad = b.constant(F::from_canonical_usize(0x01)); // 0000 0001 + let end_pad = b.constant(F::from_canonical_usize(0x80)); // 1000 0000 + // TODO : make that const generic + let padded_node = node + .iter() + .enumerate() + .map(|(i, byte)| { + let i_target = b.constant(F::from_canonical_usize(i)); + // condition if we are within the data range ==> i < length + let is_data = less_than(b, i_target, length_target, 32); + // condition if we start the padding ==> i == length + let is_start_padding = b.is_equal(i_target, length_target); + // condition if we are done with the padding ==> i == length + diff - 1 + let is_end_padding = b.is_equal(i_target, end_padding); + // condition if we only need to add one byte 1000 0001 to pad + // because we work on u8 data, we know we're at least adding 1 byte and in + // this case it's 0x81 = 1000 0001 + // i == length == diff - 1 + let is_start_and_end = b.and(is_start_padding, is_end_padding); + + // nikko XXX: Is this sound ? I think so but not 100% sure. + // I think it's ok to not use `quin_selector` or `b.random_acess` because + // if the prover gives another byte target, then the resulting hash would be invalid, + let item_data = b.mul(is_data.target, *byte); + let item_start_padding = b.mul(is_start_padding.target, begin_pad); + let item_end_padding = b.mul(is_end_padding.target, end_pad); + let item_start_and_end = b.mul(is_start_and_end.target, single_pad); + // if all of these conditions are false, then item will be 0x00,i.e. the padding + let mut item = item_data; + item = b.add(item, item_start_padding); + item = b.add(item, item_end_padding); + item = b.add(item, item_start_and_end); + item + }) + .collect::>(); + + // NOTE we don't pad anymore because we enforce that the resulting length is already a multiple + // of 4 so it will fit the conversion to u32 and circuit vk would stay the same for different + // data length + assert!(total_len % 4 == 0); + + // convert padded node to u32 + let node_u32_target: Vec = convert_u8_to_u32(b, &padded_node); + + // fixed size block delimitation: this is where we tell the hash function gadget + // to only look at a certain portion of our data, each bool says if the hash function + // will update its state for this block or not. + let rate_bytes = b.constant(F::from_canonical_usize(KECCAK256_R / 8)); + let end_padding_offset = b.add(end_padding, one); + let nb_blocks = b.div(end_padding_offset, rate_bytes); + // - 1 because keccak always take first block so we don't count it + let nb_actual_blocks = b.sub(nb_blocks, one); + let total_num_blocks = total_len / (KECCAK256_R / 8) - 1; + let blocks = (0..total_num_blocks) + .map(|i| { + let i_target = b.constant(F::from_canonical_usize(i)); + less_than(b, i_target, nb_actual_blocks, 8) + }) + .collect::>(); + + let hash_target = HashInputTarget { + input: BigUintTarget { + limbs: node_u32_target, + }, + input_bits: padded_len_bits, + blocks, + }; + + let hash_output = b.hash_keccak256(&hash_target); + b.register_public_inputs( + &hash_output + .limbs + .iter() + .map(|limb| limb.0) + .collect::>(), + ); +} + +#[cfg(test)] +mod test { + use anyhow::Result; + use ethers::types::Transaction; + use plonky2::field::extension::Extendable; + use plonky2::hash::hash_types::RichField; + use plonky2::{ + iop::witness::PartialWitness, + plonk::{ + circuit_builder::CircuitBuilder, + circuit_data::{CircuitConfig, VerifierCircuitData}, + config::{GenericConfig, PoseidonGoldilocksConfig}, + }, + }; + use rlp::{Decodable, Encodable, Rlp}; + const D: usize = 2; + type C = PoseidonGoldilocksConfig; + type F = >::F; + + const STRING: usize = 0; + const LIST: usize = 1; + + use crate::utils::test::data_to_constant_targets; + use crate::utils::test::{connect, keccak256}; + use crate::ProofTuple; + use crate::{ + mpt_tx::MAX_LEGACY_TX_NODE_LENGTH, + rlp::{decode_header, decode_tuple}, + }; + + use super::{legacy_tx_leaf_node_proof, ExtractionMethod}; + fn run_leaf_proof_test< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, + Circuit, + >( + circuit: Circuit, + ) -> Result<()> + where + Circuit: FnOnce(&CircuitConfig, &[u8]) -> Result>, + { + // The following test data comes from: + // ``` + // let block_number = 10593417; + // let tx_index = U64::from(3); + // ``` + let leaf_node_hex= "f87420b871f86f826b2585199c82cc0083015f9094e955ede0a3dbf651e2891356ecd0509c1edb8d9c8801051fdc4efdc0008025a02190f26e70a82d7f66354a13cda79b6af1aa808db768a787aeb348d425d7d0b3a06a82bd0518bc9b69dc551e20d772a1b06222edfc5d39b6973e4f4dc46ed8b196"; + let leaf_node_buff = hex::decode(leaf_node_hex).unwrap(); + let node_hash = keccak256(&leaf_node_buff); + let tx_hex = "f86f826b2585199c82cc0083015f9094e955ede0a3dbf651e2891356ecd0509c1edb8d9c8801051fdc4efdc0008025a02190f26e70a82d7f66354a13cda79b6af1aa808db768a787aeb348d425d7d0b3a06a82bd0518bc9b69dc551e20d772a1b06222edfc5d39b6973e4f4dc46ed8b196"; + let tx_buff = hex::decode(tx_hex).unwrap(); + let tx = Transaction::decode(&Rlp::new(&tx_buff)).unwrap(); + + let config = CircuitConfig::standard_recursion_config(); + let leaf_proof = circuit(&config, &leaf_node_buff)?; + let vcd = VerifierCircuitData { + verifier_only: leaf_proof.1.clone(), + common: leaf_proof.2.clone(), + }; + + vcd.verify(leaf_proof.0.clone())?; + // verify hash of the node + let expected_hash = crate::utils::test::hash_to_fields::(&node_hash); + let proof_hash = &leaf_proof.0.public_inputs[0..8]; + assert!(expected_hash == proof_hash, "hashes not equal?"); + // verify gas value + let gas_buff = tx.gas.rlp_bytes(); + let gas_rlp = rlp::Rlp::new(&gas_buff); + let gas_header = gas_rlp.payload_info()?; + let gas_value = gas_rlp.data().unwrap().to_vec(); + assert_eq!( + &leaf_proof.0.public_inputs[8..8 + gas_header.value_len], + gas_value + .iter() + .take(gas_header.value_len) + .map(|byte| F::from_canonical_u8(*byte)) + .collect::>() + .as_slice() + ); + Ok(()) + } + #[test] + fn test_legacy_tx_leaf_proof_rlp_extract() -> Result<()> { + run_leaf_proof_test(|c, n| { + legacy_tx_leaf_node_proof::(c, n.to_vec(), ExtractionMethod::RLPBased) + }) + } + #[test] + fn test_legacy_tx_leaf_proof_offset() -> Result<()> { + run_leaf_proof_test(|c, n| { + let (gas_offset, _) = gas_offset_from_rlp_node(n); + legacy_tx_leaf_node_proof::( + c, + n.to_vec(), + ExtractionMethod::OffsetBased(gas_offset), + ) + }) + } + #[test] + fn test_rlp_mpt_node_list() -> Result<()> { + // come from last tx in block 10593417, leaf node for tx idx 03 in the MPT + let data_str = "f87420b871f86f826b2585199c82cc0083015f9094e955ede0a3dbf651e2891356ecd0509c1edb8d9c8801051fdc4efdc0008025a02190f26e70a82d7f66354a13cda79b6af1aa808db768a787aeb348d425d7d0b3a06a82bd0518bc9b69dc551e20d772a1b06222edfc5d39b6973e4f4dc46ed8b196"; + let mut data = hex::decode(data_str).unwrap(); + assert!(data.len() > 55); + + let r = rlp::Rlp::new(&data); + let prototype = r.prototype().expect("error reading prototype"); + assert!( + matches!(prototype, rlp::Prototype::List(2)), + "prototype is {:?}", + prototype + ); + let header = r.payload_info().expect("can't get payload info"); + let key_rlp = r.at(0).expect("can't get key rlp"); + let value_rlp = r.at(1).expect("can't get value rlp"); + let key_header = key_rlp.payload_info().expect("can't get key payload info"); + let value_header = value_rlp + .payload_info() + .expect("can't get value payload info"); + assert!(key_header.header_len == 0); // this is short value so directly single byte! 0x20 + assert!(key_header.value_len > 0); // there is a value to be read + assert!(value_header.header_len > 0); // tx is more than 55 bytes long + assert!(key_header.value_len > 0); + + // check total value checks out for sub items length + let computed_len = header.header_len + + key_header.value_len + + value_header.value_len + + key_header.header_len + + value_header.header_len; + // add redundant header_len to mimick the circuit function + assert!(header.value_len + header.header_len == computed_len); + + let config = CircuitConfig::standard_recursion_config(); + + let mut pw = PartialWitness::new(); + let mut b = CircuitBuilder::::new(config); + + // before transforming to targets, we pad to constant size so circuit always work for different sizes + // Note we can't do it when reading rlp data offcircuit because rlp library continues to read until the + // end of the array so it's not gonna be a list(2) anymore but much longer list. + data.resize(MAX_LEGACY_TX_NODE_LENGTH, 0); + let node_targets = data_to_constant_targets(&mut b, &data); + + // check the header of the list is correctly decoded + let rlp_header = decode_header(&mut b, &node_targets); + connect(&mut b, &mut pw, rlp_header.offset, header.header_len as u32); + connect(&mut b, &mut pw, rlp_header.len, header.value_len as u32); + // it's a list so type = 1 + connect(&mut b, &mut pw, rlp_header.data_type, LIST as u32); + + // decode all the sub headers now, we know there are only two + let rlp_list = decode_tuple(&mut b, &node_targets); + // check the first sub header which is the key of the MPT leaf node + // value of the key header starts after first header and after header of the key item + let expected_key_value_offset = key_header.header_len + header.header_len; + + connect( + &mut b, + &mut pw, + rlp_list.offset[0], + expected_key_value_offset as u32, + ); + connect(&mut b, &mut pw, rlp_list.data_type[0], STRING as u32); + connect( + &mut b, + &mut pw, + rlp_list.len[0], + key_header.value_len as u32, + ); + // check the second sub header which is the key of the MPT leaf node + // value starts after first header, after key header, after key value and after value header + let expected_value_value_offset = value_header.header_len + + key_header.header_len + + key_header.value_len + + header.header_len; + connect( + &mut b, + &mut pw, + rlp_list.offset[1], + expected_value_value_offset as u32, + ); + connect(&mut b, &mut pw, rlp_list.data_type[1], STRING as u32); + connect( + &mut b, + &mut pw, + rlp_list.len[1], + value_header.value_len as u32, + ); + + let data = b.build::(); + let proof = data.prove(pw)?; + data.verify(proof) + } + use std::cmp::Ordering; + /// Function that returns the offset of the gas value in the RLP encoded + /// node containing a transaction. It also returns the gas length. + fn gas_offset_from_rlp_node(node: &[u8]) -> (usize, usize) { + let node_rlp = rlp::Rlp::new(node); + let tuple_info = node_rlp.payload_info().unwrap(); + let tuple_offset = tuple_info.header_len; + assert_eq!(node_rlp.item_count().unwrap(), 2); + let tx_index = 1; + let gas_index = 2; + let mut tx_offset = tuple_offset; + let mut gas_value_len = 0; + let mut gas_offset = 0; + node_rlp.iter().enumerate().for_each(|(i, r)| { + let h = r.payload_info().unwrap(); + tx_offset += h.header_len; + match i.cmp(&tx_index) { + Ordering::Less => tx_offset += h.value_len, + Ordering::Greater => panic!("node should not have more than 2 items"), + Ordering::Equal => { + let tx_rlp = rlp::Rlp::new(r.data().unwrap()); + gas_offset += tx_rlp.payload_info().unwrap().header_len; + tx_rlp.iter().enumerate().for_each(|(j, rr)| { + let hh = rr.payload_info().unwrap(); + match j.cmp(&gas_index) { + Ordering::Less => { + gas_offset += hh.header_len; + gas_offset += hh.value_len; + } + // do nothing as we don't care about the other items + Ordering::Greater => {} + Ordering::Equal => { + // we want the value directly - we skip the header + gas_offset += hh.header_len; + gas_value_len = hh.value_len; + } + } + }); + } + } + }); + (tx_offset + gas_offset, gas_value_len) + } +} diff --git a/src/rlp.rs b/src/rlp.rs index 63ada1de9..1b6aa396d 100644 --- a/src/rlp.rs +++ b/src/rlp.rs @@ -4,20 +4,13 @@ use plonky2::hash::hash_types::RichField; use plonky2::iop::target::Target; use plonky2::plonk::circuit_builder::CircuitBuilder; -// nikko: Seems like this constant means the maximum number of bytes the length of data -// can take. However, this is set arbitrarily because there can be up 7 bytes -// expressing the length of the data according to RLP specs for long lists -// size = prefix - 248 (where prefix is a single byte so can go up to 255) -pub const MAX_LEN_BYTES: usize = 2; - -// nikko: I assume this is a practical consideration that tx and storage and receipts -// don't have more than 17 fields and each items list don't have more than 17? -pub const MAX_FIELDS: usize = 17; - -/// Whether the data represents a list or a string. -pub const STRING: usize = 0; -/// Whether the data represents a list or a string. -pub const LIST: usize = 1; +/// The maximum number of bytes the length of data can take. +/// NOTE: However, this is set arbitrarily because there can be up 7 bytes +/// expressing the length of the data according to RLP specs for long lists +/// size = prefix - 248 (where prefix is a single byte so can go up to 255) +/// 2 is the usual in practice for eth MPT related data. +/// nikko: verify that assumption. +const MAX_LEN_BYTES: usize = 2; #[derive(Clone, Copy, Debug)] pub struct RlpHeader { @@ -140,30 +133,6 @@ pub fn decode_header, const D: usize>( } } -/// RLP String decoder : returns the offset in the array where string starts and -/// the length of the string. -/// It checks that the type is correctly a string and the length is within correct -/// range. -/// nikko: I dont think we need these extra checks - we should remove. -pub(crate) fn decode_str, const D: usize>( - b: &mut CircuitBuilder, - data: &[Target], -) -> (Target, Target) { - let rlp_header: RlpHeader = decode_header(b, data); - - let is_string = b.constant(F::from_canonical_usize(STRING)); - b.connect(rlp_header.data_type, is_string); - - let data_len = data.len(); - let total_len = b.add(rlp_header.len, rlp_header.offset); - let data_len_target = b.constant(F::from_canonical_usize(data_len)); - let is_lt = less_than(b, total_len, data_len_target, 63); - let true_pred = b._true(); - b.connect(is_lt.target, true_pred.target); - - (rlp_header.offset, rlp_header.len) -} - /// Decodes a list of two elements. pub(crate) fn decode_tuple, const D: usize>( b: &mut CircuitBuilder, @@ -172,42 +141,35 @@ pub(crate) fn decode_tuple, const D: usize>( decode_fixed_list::(b, data) } -/// Decodes a list of fixed number of items +/// Decodes the header of the list, and then decodes the first N items of the list. +/// NOTE: the `num_field` is set to N in this case, since it does not read the full array. +/// Hence, N can be lower than the actual number of fields in the list. pub fn decode_fixed_list, const D: usize, const N: usize>( b: &mut CircuitBuilder, data: &[Target], ) -> RlpList { let zero = b.zero(); let one = b.one(); + let n_target = b.constant(F::from_canonical_usize(N)); let mut num_fields = zero; let mut dec_off = [zero; N]; let mut dec_len = [zero; N]; let mut dec_type = [zero; N]; - let RlpHeader { - len: payload_len, - offset: header_len, - data_type, - } = decode_header(b, data); - - // total_len includes the header byte + potential len_len bytes + payload len - let total_len = b.add(header_len, payload_len); - - let is_list = b.constant(F::from_canonical_usize(LIST)); - b.connect(is_list, data_type); + let list_header = decode_header(b, data); + let mut offset = list_header.offset; - let mut offset = header_len; // decode each headers of each items ofthe list // remember in a list each item of the list is RLP encoded for i in 0..N { - // stop when you've looked at the whole expected length - let mut loop_p = b.is_equal(offset, total_len); + // stop when you've looked at the number of expected items + let mut loop_p = b.is_equal(num_fields, n_target); loop_p = b.not(loop_p); // read the header starting from the offset - // nikko: this is assuming the header will take at least 1 bytes and less than 1 + MAX_LEN_BYTES - let header = take_dot_drop::(b, data, offset); + let header = extract_array::(b, data, offset); let RlpHeader { len: field_len, offset: field_offset, @@ -242,10 +204,6 @@ pub fn decode_fixed_list, const D: usize, const N: num_fields = b.add(num_fields, loop_p.target); } - // make sure the total length is equal to the added length of all items - // otherwise attacker could specify an inconsistent length in the first header - b.connect(total_len, offset); - RlpList { offset: dec_off, len: dec_len, @@ -253,180 +211,9 @@ pub fn decode_fixed_list, const D: usize, const N: num_fields, } } -/// RLP List decoder : returns the offsetS in the array where elementS start and -/// their respective lengthS -pub fn decode_list, const D: usize>( - b: &mut CircuitBuilder, - data: &[Target], -) -> RlpList { - let zero = b.zero(); - let one = b.one(); - - let mut num_fields = zero; - let mut dec_off = [zero; MAX_FIELDS]; - let mut dec_len = [zero; MAX_FIELDS]; - let mut dec_type = [zero; MAX_FIELDS]; - - let RlpHeader { - len: payload_len, - mut offset, - data_type, - } = decode_header(b, data); - - // total_len includes the header byte + potential len_len bytes + payload len - let total_len = b.add(offset, payload_len); - - let is_list = b.constant(F::from_canonical_usize(LIST)); - b.connect(is_list, data_type); - - for i in 0..MAX_FIELDS { - let mut loop_p = b.is_equal(offset, total_len); - loop_p = b.not(loop_p); - - // read the header starting from the offset - the header will at most 1 bytes + MAX_LEN_BYTES - // remember in a list each item of the list is RLP encoded - let header = take_dot_drop::(b, data, offset); - let RlpHeader { - len: field_len, - offset: field_offset, - data_type: field_type, - } = decode_header(b, &header); - let total_field_len = b.add(field_offset, field_len); - let one_sub_field_type = b.sub(one, field_type); - // d_off_i = ((1-field_type) * field_offset + offset) * (offset != total_len) - // - if type is 0, str, then d_off_i basically = field_offset + offset - // -> value starts at offset + field_offset from the beginning of the given array - // - if type is 1, list, then d_off_i basically = offset because it's a list so we - // again need to decode the rlp header right at the offset? - let mut d_off_i = b.mul(one_sub_field_type, field_offset); - d_off_i = b.add(d_off_i, offset); - d_off_i = b.mul(loop_p.target, d_off_i); - - // d_len_i = ((field_type * field_offset) + field_len) * (offset != total_len) - // - if type is 0, str, then d_len_i = field_len - // - if type is 1, list, then d_len_i = field_offset + field_len - // index where to find the data within the item array - let mut d_len_i = b.mul(field_type, field_offset); - d_len_i = b.add(d_len_i, field_len); - d_len_i = b.mul(loop_p.target, d_len_i); - let d_type_i = b.mul(loop_p.target, field_type); - - dec_off[i] = d_off_i; - dec_len[i] = d_len_i; - dec_type[i] = d_type_i; - - // move offset to the next field in the list - offset = b.mul_add(loop_p.target, total_field_len, offset); - num_fields = b.add(num_fields, loop_p.target); - } - - // nikko: I think we can remove this - no need to check RLP is correct ! - b.connect(total_len, offset); - - RlpList { - offset: dec_off, - len: dec_len, - data_type: dec_type, - num_fields, - } -} - -/// decode a list whose length (= sum of its items) are less than 55 bytes -/// and all its items must be a string (no sub-list) -pub fn decode_short_list, const D: usize>( - b: &mut CircuitBuilder, - data: &[Target], -) -> RlpList { - let zero = b.zero(); - - let mut num_fields = zero; - let mut dec_off = [zero; MAX_FIELDS]; - let mut dec_len = [zero; MAX_FIELDS]; - let mut dec_type = [zero; MAX_FIELDS]; - - let RlpHeader { - len: payload_len, - mut offset, - data_type, - } = decode_header(b, data); - let total_len = b.add(offset, payload_len); - let true_pred = b._true(); - let is_list = b.constant(F::from_canonical_usize(LIST)); - b.connect(is_list, data_type); - - for i in 0..MAX_FIELDS { - let mut loop_p = b.is_equal(offset, total_len); - loop_p = b.not(loop_p); - - // let header = b.random_access(offset, data.to_vec()); - let header = quin_selector(b, data, offset); - - // assert(header < 0xb8); // Header must represent a string of length < 56 bytes. - let bytes_0xb8 = b.constant(F::from_canonical_usize(0xb8)); - let is_lt = less_than(b, header, bytes_0xb8, 63); - b.connect(is_lt.target, true_pred.target); - - let field_type = b.constant(F::from_canonical_usize(STRING)); - - let bytes_0x80 = b.constant(F::from_canonical_usize(0x80)); - let single_bytes_p = less_than(b, header, bytes_0x80, 63); - let field_off = b.not(single_bytes_p); - - let mut field_len = b.sub(header, bytes_0x80); - field_len = b.mul(field_len, field_off.target); - field_len = b.add(single_bytes_p.target, field_len); - - let total_field_len = b.add(field_off.target, field_len); - - let mut d_off_i = b.add(offset, field_off.target); - d_off_i = b.mul(loop_p.target, d_off_i); - let d_len_i = b.mul(loop_p.target, field_len); - let d_type_i = b.mul(loop_p.target, field_type); - - dec_off[i] = d_off_i; - dec_len[i] = d_len_i; - dec_type[i] = d_type_i; - - let offset_add = b.mul(loop_p.target, total_field_len); - offset = b.add(offset, offset_add); - num_fields = b.add(num_fields, loop_p.target); - } - - b.connect(total_len, offset); - - RlpList { - offset: dec_off, - len: dec_len, - data_type: dec_type, - num_fields, - } -} - -/// Returns an array of length `len` containing the elements of `array` starting at `offset`. -// nikko TODO: this is my own to hack around, and avoid take dot drop which is -// super expensive, but we should remove the call to quin_selector -// and directly make the constraints inside the loop, will remove the N^2 complexity -// into just linear ? -// TODO: remove and only use take_dot_drop if possible (and rename it to extract_array) -pub fn extract_array, const D: usize>( - b: &mut CircuitBuilder, - array: &[Target], - offset: Target, - len: usize, -) -> Vec { - (0..len) - .map(|i| { - let i_target = b.constant(F::from_canonical_usize(i)); - let offset_plus_i = b.add(offset, i_target); - quin_selector(b, array, offset_plus_i) - }) - .collect() -} - -/// Similar to extract_array but for a constant size. -/// nikko: Make it such other circuits only use this one. -pub fn take_dot_drop, const D: usize, const M: usize>( +/// Returns an array of length `M` from the array `arr` starting at index `offset` +pub fn extract_array, const D: usize, const M: usize>( b: &mut CircuitBuilder, arr: &[Target], offset: Target, @@ -486,7 +273,7 @@ mod tests { use plonky2::field::types::Field; use plonky2::iop::target::Target; - use plonky2::iop::witness::{PartialWitness, WitnessWrite}; + use plonky2::iop::witness::PartialWitness; use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::circuit_data::CircuitConfig; use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; @@ -520,6 +307,8 @@ mod tests { data.verify(proof) } + // TODO: replace these tests by deterministic tests by creating the data first and then + // encoding in RLP and give that to circuit. Right now we just don't know what these vectors hold. #[test] fn test_decode_len() -> Result<()> { const D: usize = 2; @@ -643,7 +432,7 @@ mod tests { }; let res_dot_drop = - super::take_dot_drop::(&mut builder, &data3, zero); + super::extract_array::(&mut builder, &data3, zero); let res_rlp_header3 = super::decode_header(&mut builder, &res_dot_drop); // builder.connect(rlp_header.len, res_rlp_header.len); @@ -660,33 +449,6 @@ mod tests { data.verify(proof) } - #[test] - fn test_rlp_decode_empty_list() -> Result<()> { - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - type F = >::F; - let config = CircuitConfig::standard_recursion_config(); - let pw = PartialWitness::new(); - let mut builder = CircuitBuilder::::new(config); - - let zero = builder.zero(); - - let data: Vec = [0xc0] - .iter() - .map(|x| builder.constant(F::from_canonical_u64(*x))) - .collect(); - - let empty_list = super::decode_list(&mut builder, &data); - builder.connect(empty_list.num_fields, zero); - - builder.register_public_inputs(&data); - builder.register_public_input(empty_list.num_fields); - - let data = builder.build::(); - let proof = data.prove(pw)?; - data.verify(proof) - } - #[test] fn test_rlp_decode() -> Result<()> { let data: [u64; 532] = [ @@ -734,9 +496,8 @@ mod tests { .map(|x| builder.constant(F::from_canonical_u64(*x))) .collect(); - let decoded = super::decode_list(&mut builder, &data); + let decoded = super::decode_fixed_list::(&mut builder, &data); - let num_fields = builder.constant(F::from_canonical_u64(17)); let offset: Vec = [ 4, 37, 70, 103, 136, 169, 202, 235, 268, 301, 334, 367, 400, 433, 466, 499, 532, ] @@ -754,7 +515,6 @@ mod tests { .map(|x| builder.constant(F::from_canonical_u64(*x))) .collect(); - builder.connect(decoded.num_fields, num_fields); for i in 0..17 { builder.connect(decoded.offset[i], offset[i]); builder.connect(decoded.len[i], len[i]); diff --git a/src/utils.rs b/src/utils.rs index 556e12321..53ec8f0da 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -3,57 +3,52 @@ use plonky2::field::extension::Extendable; use plonky2::hash::hash_types::RichField; use plonky2::iop::target::{BoolTarget, Target}; use plonky2::plonk::circuit_builder::CircuitBuilder; -use plonky2_crypto::hash::HashOutputTarget; use plonky2_crypto::u32::arithmetic_u32::U32Target; -pub(crate) const TWO_POWER_8: usize = 256; -pub(crate) const TWO_POWER_16: usize = 65536; -pub(crate) const TWO_POWER_24: usize = 16777216; - -/// Useful to convert between u32 representation and u8 representation in circuit. -/// For example hash output is using u32 representations. -pub fn array_u8_to_u32, const D: usize>( +pub(crate) fn convert_u8_to_u32, const D: usize>( b: &mut CircuitBuilder, - arr: &[Target; 32], // each target represents a single byte -) -> [U32Target; 8] { + data: &[Target], +) -> Vec { + assert!(data.len() % 4 == 0); + const TWO_POWER_8: usize = 256; + const TWO_POWER_16: usize = 65536; + const TWO_POWER_24: usize = 16777216; + let padded = data; + // constants to convert [u8; 4] to u32 // u32 = u8[0] + u8[1] * 2^8 + u8[2] * 2^16 + u8[3] * 2^24 let two_power_8: Target = b.constant(F::from_canonical_usize(TWO_POWER_8)); let two_power_16: Target = b.constant(F::from_canonical_usize(TWO_POWER_16)); let two_power_24: Target = b.constant(F::from_canonical_usize(TWO_POWER_24)); - let mut u32_array = [U32Target(b.zero()); 8]; - (0..arr.len()).step_by(4).for_each(|i| { - // u8[0] - let mut x = arr[i]; - - // u8[1] - let mut y = arr[i + 1]; - // u8[1] * 2^8 - y = b.mul(y, two_power_8); - - // u8[0] + u8[1] * 2^8 - x = b.add(x, y); - - // u8[2] - y = arr[i + 2]; - // u8[2] * 2^16 - y = b.mul(y, two_power_16); - - // u8[0] + u8[1] * 2^8 + u8[2] * 2^16 - x = b.add(x, y); - - // u8[3] - y = arr[i + 3]; - // u8[3] * 2^24 - y = b.mul(y, two_power_24); - - // u8[0] + u8[1] * 2^8 + u8[2] * 2^16 + u8[3] * 2^24 - x = b.add(x, y); - - u32_array[i / 4] = U32Target(x); - }); - u32_array + // convert padded node to u32 + (0..padded.len()) + .step_by(4) + .map(|i| { + // u8[0] + let mut x = padded[i]; + // u8[1] + let mut y = padded[i + 1]; + // u8[1] * 2^8 + y = b.mul(y, two_power_8); + // u8[0] + u8[1] * 2^8 + x = b.add(x, y); + // u8[2] + y = padded[i + 2]; + // u8[2] * 2^16 + y = b.mul(y, two_power_16); + // u8[0] + u8[1] * 2^8 + u8[2] * 2^16 + x = b.add(x, y); + // u8[3] + y = padded[i + 3]; + // u8[3] * 2^24 + y = b.mul(y, two_power_24); + // u8[0] + u8[1] * 2^8 + u8[2] * 2^16 + u8[3] * 2^24 + x = b.add(x, y); + + U32Target(x) + }) + .collect_vec() } pub fn num_to_bits, const D: usize>( @@ -128,63 +123,65 @@ pub fn greater_than_or_equal_to, const D: usize>( less_than(builder, b, a_plus_1, n) } -// Returns the shifted bits as a num -pub fn right_shift, const D: usize>( - builder: &mut CircuitBuilder, - n: usize, - x: Target, - shift: usize, -) -> Target { - // nikko: Is this legit ? an IF depending on the witness seems - // wrong, because then the circuit is not the same depending - // on the value of the witness... - let bits = num_to_bits(builder, n, x); - if bits.is_empty() || shift >= bits.len() { - return builder.zero(); - } - // Remove the least significant bits according to the shift value - let shifted_bits = &bits[shift..]; - - // Convert the shifted bits back to a number - bits_to_num(builder, shifted_bits) -} - #[cfg(test)] -mod test { +pub(crate) mod test { use crate::utils::{ bits_to_num, greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to, - num_to_bits, right_shift, + num_to_bits, }; use anyhow::Result; + use itertools::Itertools; + use plonky2::field::extension::Extendable; use plonky2::field::types::Field; + use plonky2::hash::hash_types::RichField; use plonky2::iop::target::Target; - use plonky2::iop::witness::PartialWitness; + use plonky2::iop::witness::{PartialWitness, WitnessWrite}; use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::circuit_data::CircuitConfig; use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; + use sha3::{Digest, Keccak256}; - #[test] - fn test_right_shift() -> Result<()> { - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - type F = >::F; - let config = CircuitConfig::standard_recursion_config(); - let pw = PartialWitness::new(); - let mut builder = CircuitBuilder::::new(config); - - let a = builder.constant(F::from_canonical_u64(121u64)); - let b = builder.constant(F::from_canonical_u64(15u64)); - let res = right_shift(&mut builder, 64, a, 3); - - builder.connect(res, b); + pub(crate) fn keccak256(data: &[u8]) -> Vec { + let mut hasher = Keccak256::new(); + hasher.update(data); + hasher.finalize().to_vec() + } + pub(crate) fn hash_to_fields(expected: &[u8]) -> Vec { + let iter_u32 = expected.iter().chunks(4); + iter_u32 + .into_iter() + .map(|chunk| { + let chunk_buff = chunk.copied().collect::>(); + let u32_num = read_le_u32(&mut chunk_buff.as_slice()); + F::from_canonical_u32(u32_num) + }) + .collect::>() + } - builder.register_public_input(a); - builder.register_public_input(b); - builder.register_public_input(res); + // taken from rust doc https://doc.rust-lang.org/std/primitive.u32.html#method.from_be_bytes + fn read_le_u32(input: &mut &[u8]) -> u32 { + let (int_bytes, rest) = input.split_at(std::mem::size_of::()); + *input = rest; + u32::from_le_bytes(int_bytes.try_into().unwrap()) + } + pub(crate) fn connect, const D: usize, I: Into>( + b: &mut CircuitBuilder, + pw: &mut PartialWitness, + a: Target, + v: I, + ) { + let t = b.add_virtual_target(); + pw.set_target(t, F::from_canonical_u32(v.into())); + b.connect(a, t); + } - let data = builder.build::(); - let proof = data.prove(pw)?; - data.verify(proof) + pub(crate) fn data_to_constant_targets, const D: usize>( + b: &mut CircuitBuilder, + d: &[u8], + ) -> Vec { + d.iter() + .map(|x| b.constant(F::from_canonical_u8(*x))) + .collect() } #[test]