diff --git a/Cargo.lock b/Cargo.lock index a86cc9e493..154243cb57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,6 +130,107 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy-consensus" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629b62e38d471cc15fea534eb7283d2f8a4e8bdb1811bcc5d66dda6cfce6fae1" +dependencies = [ + "alloy-eips", + "alloy-primitives 0.8.5", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "serde", +] + +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives 0.8.5", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04" +dependencies = [ + "alloy-primitives 0.8.5", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f923dd5fca5f67a43d81ed3ebad0880bd41f6dd0ada930030353ac356c54cd0f" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives 0.8.5", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "derive_more 1.0.0", + "once_cell", + "serde", + "sha2 0.10.8", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3c717b5298fad078cd3a418335b266eba91b511383ca9bd497f742d5975d5ab" +dependencies = [ + "alloy-primitives 0.8.5", + "alloy-sol-types 0.8.5", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb3705ce7d8602132bcf5ac7a1dd293a42adc2f183abf5907c30ac535ceca049" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network-primitives", + "alloy-primitives 0.8.5", + "alloy-rpc-types-eth", + "alloy-serde", + "alloy-signer", + "alloy-sol-types 0.8.5", + "async-trait", + "auto_impl", + "futures-utils-wasm", + "thiserror", +] + +[[package]] +name = "alloy-network-primitives" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ad40869867ed2d9cd3842b1e800889e5b49e6b92da346e93862b4a741bedf3" +dependencies = [ + "alloy-eips", + "alloy-primitives 0.8.5", + "alloy-serde", + "serde", +] + [[package]] name = "alloy-primitives" version = "0.7.7" @@ -140,7 +241,7 @@ dependencies = [ "bytes 1.7.1", "cfg-if", "const-hex", - "derive_more", + "derive_more 0.99.18", "hex-literal", "itoa", "k256", @@ -152,45 +253,178 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "alloy-primitives" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260d3ff3bff0bb84599f032a2f2c6828180b0ea0cd41fdaf44f39cef3ba41861" +dependencies = [ + "alloy-rlp", + "bytes 1.7.1", + "cfg-if", + "const-hex", + "derive_more 1.0.0", + "hashbrown 0.14.5", + "hex-literal", + "indexmap 2.6.0", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.8.5", + "ruint", + "rustc-hash 2.0.0", + "serde", + "sha3", + "tiny-keccak", +] + [[package]] name = "alloy-rlp" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ + "alloy-rlp-derive", "arrayvec", "bytes 1.7.1", ] +[[package]] +name = "alloy-rlp-derive" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83aa984386deda02482660aa31cb8ca1e63d533f1c31a52d7d181ac5ec68e9b8" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives 0.8.5", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types 0.8.5", + "cfg-if", + "derive_more 1.0.0", + "hashbrown 0.14.5", + "itertools 0.13.0", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-serde" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "731f75ec5d383107fd745d781619bd9cedf145836c51ecb991623d41278e71fa" +dependencies = [ + "alloy-primitives 0.8.5", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307324cca94354cd654d6713629f0383ec037e1ff9e3e3d547212471209860c0" +dependencies = [ + "alloy-primitives 0.8.5", + "async-trait", + "auto_impl", + "elliptic-curve 0.13.8", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-signer-local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fabe917ab1778e760b4701628d1cae8e028ee9d52ac6307de4e1e9286ab6b5f" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives 0.8.5", + "alloy-signer", + "async-trait", + "k256", + "rand 0.8.5", + "thiserror", +] + [[package]] name = "alloy-sol-macro" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" dependencies = [ - "alloy-sol-macro-expander", - "alloy-sol-macro-input", + "alloy-sol-macro-expander 0.7.7", + "alloy-sol-macro-input 0.7.7", "proc-macro-error", "proc-macro2", "quote", "syn 2.0.72", ] +[[package]] +name = "alloy-sol-macro" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68e7f6e8fe5b443f82b3f1e15abfa191128f71569148428e49449d01f6f49e8b" +dependencies = [ + "alloy-sol-macro-expander 0.8.5", + "alloy-sol-macro-input 0.8.5", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "alloy-sol-macro-expander" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ - "alloy-sol-macro-input", + "alloy-sol-macro-input 0.7.7", "const-hex", "heck", - "indexmap 2.3.0", + "indexmap 2.6.0", "proc-macro-error", "proc-macro2", "quote", "syn 2.0.72", - "syn-solidity", + "syn-solidity 0.7.7", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b96ce28d2fde09abb6135f410c41fad670a3a770b6776869bd852f1df102e6f" +dependencies = [ + "alloy-sol-macro-input 0.8.5", + "const-hex", + "heck", + "indexmap 2.6.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.72", + "syn-solidity 0.8.5", "tiny-keccak", ] @@ -206,7 +440,22 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.72", - "syn-solidity", + "syn-solidity 0.7.7", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "906746396a8296537745711630d9185746c0b50c033d5e9d18b0a6eba3d53f90" +dependencies = [ + "const-hex", + "dunce", + "heck", + "proc-macro2", + "quote", + "syn 2.0.72", + "syn-solidity 0.8.5", ] [[package]] @@ -215,12 +464,23 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ - "alloy-primitives", - "alloy-sol-macro", + "alloy-primitives 0.7.7", + "alloy-sol-macro 0.7.7", "const-hex", "serde", ] +[[package]] +name = "alloy-sol-types" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86a533ce22525969661b25dfe296c112d35eb6861f188fd284f8bd4bb3842ae" +dependencies = [ + "alloy-primitives 0.8.5", + "alloy-sol-macro 0.8.5", + "const-hex", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -592,6 +852,28 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "async-task" version = "4.7.1" @@ -669,6 +951,381 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "aws-config" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8191fb3091fa0561d1379ef80333c3c7191c6f0435d986e85821bcf7acbd1126" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-sdk-sso", + "aws-sdk-ssooidc", + "aws-sdk-sts", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes 1.7.1", + "fastrand 2.1.0", + "hex", + "http 0.2.12", + "ring 0.17.8", + "time 0.3.36", + "tokio", + "tracing", + "url", + "zeroize", +] + +[[package]] +name = "aws-credential-types" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e8f6b615cb5fc60a98132268508ad104310f0cfb25a1c22eee76efdf9154da" +dependencies = [ + "aws-smithy-async", + "aws-smithy-runtime-api", + "aws-smithy-types", + "zeroize", +] + +[[package]] +name = "aws-runtime" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a10d5c055aa540164d9561a0e2e74ad30f0dcf7393c3a92f6733ddf9c5762468" +dependencies = [ + "aws-credential-types", + "aws-sigv4", + "aws-smithy-async", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes 1.7.1", + "fastrand 2.1.0", + "http 0.2.12", + "http-body 0.4.6", + "once_cell", + "percent-encoding", + "pin-project-lite", + "tracing", + "uuid 1.10.0", +] + +[[package]] +name = "aws-sdk-s3" +version = "1.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43fad71130014e11f42fadbdcce5df12ee61866f8ab9bad773b138d4b3c11087" +dependencies = [ + "ahash", + "aws-credential-types", + "aws-runtime", + "aws-sigv4", + "aws-smithy-async", + "aws-smithy-checksums", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", + "bytes 1.7.1", + "fastrand 2.1.0", + "hex", + "hmac 0.12.1", + "http 0.2.12", + "http-body 0.4.6", + "lru", + "once_cell", + "percent-encoding", + "regex-lite", + "sha2 0.10.8", + "tracing", + "url", +] + +[[package]] +name = "aws-sdk-sso" +version = "1.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b90cfe6504115e13c41d3ea90286ede5aa14da294f3fe077027a6e83850843c" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes 1.7.1", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-ssooidc" +version = "1.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167c0fad1f212952084137308359e8e4c4724d1c643038ce163f06de9662c1d0" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-types", + "bytes 1.7.1", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-sts" +version = "1.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb5f98188ec1435b68097daa2a37d74b9d17c9caa799466338a8d1544e71b9d" +dependencies = [ + "aws-credential-types", + "aws-runtime", + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-json", + "aws-smithy-query", + "aws-smithy-runtime", + "aws-smithy-runtime-api", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", + "http 0.2.12", + "once_cell", + "regex-lite", + "tracing", +] + +[[package]] +name = "aws-sigv4" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc8db6904450bafe7473c6ca9123f88cc11089e41a025408f992db4e22d3be68" +dependencies = [ + "aws-credential-types", + "aws-smithy-eventstream", + "aws-smithy-http", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes 1.7.1", + "crypto-bigint 0.5.5", + "form_urlencoded", + "hex", + "hmac 0.12.1", + "http 0.2.12", + "http 1.1.0", + "once_cell", + "p256", + "percent-encoding", + "ring 0.17.8", + "sha2 0.10.8", + "subtle", + "time 0.3.36", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-smithy-async" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62220bc6e97f946ddd51b5f1361f78996e704677afc518a4ff66b7a72ea1378c" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "aws-smithy-checksums" +version = "0.60.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598b1689d001c4d4dc3cb386adb07d37786783aee3ac4b324bcadac116bf3d23" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "bytes 1.7.1", + "crc32c", + "crc32fast", + "hex", + "http 0.2.12", + "http-body 0.4.6", + "md-5", + "pin-project-lite", + "sha1 0.10.6", + "sha2 0.10.8", + "tracing", +] + +[[package]] +name = "aws-smithy-eventstream" +version = "0.60.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef7d0a272725f87e51ba2bf89f8c21e4df61b9e49ae1ac367a6d69916ef7c90" +dependencies = [ + "aws-smithy-types", + "bytes 1.7.1", + "crc32fast", +] + +[[package]] +name = "aws-smithy-http" +version = "0.60.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8bc3e8fdc6b8d07d976e301c02fe553f72a39b7a9fea820e023268467d7ab6" +dependencies = [ + "aws-smithy-eventstream", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes 1.7.1", + "bytes-utils", + "futures-core", + "http 0.2.12", + "http-body 0.4.6", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tracing", +] + +[[package]] +name = "aws-smithy-json" +version = "0.60.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4683df9469ef09468dad3473d129960119a0d3593617542b7d52086c8486f2d6" +dependencies = [ + "aws-smithy-types", +] + +[[package]] +name = "aws-smithy-query" +version = "0.60.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fbd61ceb3fe8a1cb7352e42689cec5335833cd9f94103a61e98f9bb61c64bb" +dependencies = [ + "aws-smithy-types", + "urlencoding", +] + +[[package]] +name = "aws-smithy-runtime" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1ce695746394772e7000b39fe073095db6d45a862d0767dd5ad0ac0d7f8eb87" +dependencies = [ + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-runtime-api", + "aws-smithy-types", + "bytes 1.7.1", + "fastrand 2.1.0", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "http-body 1.0.1", + "httparse", + "hyper 0.14.30", + "hyper-rustls 0.24.2", + "once_cell", + "pin-project-lite", + "pin-utils", + "rustls 0.21.12", + "tokio", + "tracing", +] + +[[package]] +name = "aws-smithy-runtime-api" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e086682a53d3aa241192aa110fa8dfce98f2f5ac2ead0de84d41582c7e8fdb96" +dependencies = [ + "aws-smithy-async", + "aws-smithy-types", + "bytes 1.7.1", + "http 0.2.12", + "http 1.1.0", + "pin-project-lite", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-smithy-types" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147100a7bea70fa20ef224a6bad700358305f5dc0f84649c53769761395b355b" +dependencies = [ + "base64-simd", + "bytes 1.7.1", + "bytes-utils", + "futures-core", + "http 0.2.12", + "http 1.1.0", + "http-body 0.4.6", + "http-body 1.0.1", + "http-body-util", + "itoa", + "num-integer", + "pin-project-lite", + "pin-utils", + "ryu", + "serde", + "time 0.3.36", + "tokio", + "tokio-util", +] + +[[package]] +name = "aws-smithy-xml" +version = "0.60.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab0b0166827aa700d3dc519f72f8b3a91c35d0b8d042dc5d643a91e6f80648fc" +dependencies = [ + "xmlparser", +] + +[[package]] +name = "aws-types" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5221b91b3e441e6675310829fd8984801b772cb1546ef6c0e54dec9f1ac13fef" +dependencies = [ + "aws-credential-types", + "aws-smithy-async", + "aws-smithy-runtime-api", + "aws-smithy-types", + "rustc_version 0.4.0", + "tracing", +] + [[package]] name = "axum" version = "0.7.7" @@ -746,6 +1403,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base16ct" version = "0.2.0" @@ -770,6 +1433,16 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + [[package]] name = "base64ct" version = "1.6.0" @@ -931,6 +1604,18 @@ dependencies = [ "subtle", ] +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "bs58" version = "0.5.1" @@ -980,6 +1665,31 @@ dependencies = [ "serde", ] +[[package]] +name = "bytes-utils" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dafe3a8757b027e2be6e4e5601ed563c55989fcf1546e933c66c8eb3a058d35" +dependencies = [ + "bytes 1.7.1", + "either", +] + +[[package]] +name = "c-kzg" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + [[package]] name = "camino" version = "1.1.7" @@ -1350,6 +2060,24 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" +[[package]] +name = "crc32c" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" +dependencies = [ + "rustc_version 0.4.0", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.5.1" @@ -1417,6 +2145,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -1703,6 +2443,16 @@ dependencies = [ "rustversion", ] +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "der" version = "0.7.9" @@ -1747,6 +2497,27 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", + "unicode-xid", +] + [[package]] name = "digest" version = "0.9.0" @@ -1841,18 +2612,30 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + [[package]] name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der", + "der 0.7.9", "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", + "signature 2.2.0", + "spki 0.7.3", ] [[package]] @@ -1867,21 +2650,41 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", + "ff 0.12.1", + "generic-array 0.14.7", + "group 0.12.1", + "pkcs8 0.9.0", + "rand_core 0.6.4", + "sec1 0.3.0", + "subtle", + "zeroize", +] + [[package]] name = "elliptic-curve" version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "base16ct", - "crypto-bigint", + "base16ct 0.2.0", + "crypto-bigint 0.5.5", "digest 0.10.7", "ff 0.13.0", "generic-array 0.14.7", "group 0.13.0", - "pkcs8", + "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -1993,7 +2796,7 @@ dependencies = [ "sha2 0.10.8", "sha3", "thiserror", - "uuid", + "uuid 0.8.2", ] [[package]] @@ -2138,7 +2941,7 @@ dependencies = [ "cargo_metadata", "chrono", "const-hex", - "elliptic-curve", + "elliptic-curve 0.13.8", "ethabi", "generic-array 0.14.7", "k256", @@ -2229,7 +3032,7 @@ dependencies = [ "coins-bip32", "coins-bip39", "const-hex", - "elliptic-curve", + "elliptic-curve 0.13.8", "eth-keystore", "ethers-core", "rand 0.8.5", @@ -2549,6 +3352,12 @@ dependencies = [ "slab", ] +[[package]] +name = "futures-utils-wasm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" + [[package]] name = "fxhash" version = "0.2.1" @@ -2702,7 +3511,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.3.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -2721,7 +3530,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.3.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -2778,6 +3587,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "hashers" version = "1.0.1" @@ -2810,6 +3625,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hex-literal" @@ -3013,7 +3831,9 @@ dependencies = [ "futures-util", "http 0.2.12", "hyper 0.14.30", + "log", "rustls 0.21.12", + "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] @@ -3036,6 +3856,19 @@ dependencies = [ "webpki-roots 0.26.3", ] +[[package]] +name = "hyper-timeout" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +dependencies = [ + "hyper 1.4.1", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -3168,12 +4001,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde", ] @@ -3357,11 +4190,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", "sha2 0.10.8", - "signature", + "signature 2.2.0", ] [[package]] @@ -3504,6 +4337,15 @@ dependencies = [ "value-bag", ] +[[package]] +name = "lru" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "matchers" version = "0.1.0" @@ -3519,6 +4361,16 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + [[package]] name = "memchr" version = "2.7.4" @@ -3927,12 +4779,29 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "outref" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" + [[package]] name = "overload" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2 0.10.8", +] + [[package]] name = "p3-air" version = "0.1.3-succinct" @@ -4356,7 +5225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.3.0", + "indexmap 2.6.0", ] [[package]] @@ -4412,14 +5281,24 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der 0.6.1", + "spki 0.6.0", +] + [[package]] name = "pkcs8" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der", - "spki", + "der 0.7.9", + "spki 0.7.3", ] [[package]] @@ -4618,6 +5497,28 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "proc-macro-hack" version = "0.5.20+deprecated" @@ -4806,6 +5707,7 @@ dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", + "serde", ] [[package]] @@ -4945,6 +5847,12 @@ dependencies = [ "regex-syntax 0.8.4", ] +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + [[package]] name = "regex-syntax" version = "0.6.29" @@ -5063,6 +5971,17 @@ dependencies = [ "tower-service", ] +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac 0.12.1", + "zeroize", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -5284,6 +6203,7 @@ version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ + "log", "once_cell", "ring 0.17.8", "rustls-pki-types", @@ -5292,6 +6212,31 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile 1.0.4", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.3", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -5387,7 +6332,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" dependencies = [ "cfg-if", - "derive_more", + "derive_more 0.99.18", "parity-scale-codec", "scale-info-derive", ] @@ -5486,16 +6431,30 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "177258b64c0faaa9ffd3c65cd3262c2bc7e2588dbbd9c1641d0346145c1bbda8" +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct 0.1.1", + "der 0.6.1", + "generic-array 0.14.7", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + [[package]] name = "sec1" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "base16ct", - "der", + "base16ct 0.2.0", + "der 0.7.9", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.10.2", "subtle", "zeroize", ] @@ -5671,7 +6630,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.3.0", + "indexmap 2.6.0", "serde", "serde_derive", "serde_json", @@ -5822,6 +6781,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + [[package]] name = "signature" version = "2.2.0" @@ -6028,7 +6997,7 @@ dependencies = [ "criterion", "curve25519-dalek", "elf", - "elliptic-curve", + "elliptic-curve 0.13.8", "generic-array 1.1.0", "hashbrown 0.14.5", "hex", @@ -6108,7 +7077,7 @@ version = "2.0.0" dependencies = [ "curve25519-dalek", "dashu", - "elliptic-curve", + "elliptic-curve 0.13.8", "generic-array 1.1.0", "itertools 0.13.0", "k256", @@ -6483,9 +7452,14 @@ dependencies = [ name = "sp1-sdk" version = "2.0.0" dependencies = [ - "alloy-sol-types", + "alloy-primitives 0.8.5", + "alloy-signer", + "alloy-signer-local", + "alloy-sol-types 0.7.7", "anyhow", "async-trait", + "aws-config", + "aws-sdk-s3", "axum", "bincode", "cfg-if", @@ -6522,6 +7496,7 @@ dependencies = [ "tempfile", "thiserror", "tokio", + "tonic", "tracing", "twirp-rs", "vergen", @@ -6598,6 +7573,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der 0.6.1", +] + [[package]] name = "spki" version = "0.7.3" @@ -6605,7 +7590,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der", + "der 0.7.9", ] [[package]] @@ -6791,6 +7776,18 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "syn-solidity" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab661c8148c2261222a4d641ad5477fd4bea79406a99056096a0b41b35617a5" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -6916,6 +7913,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.2.27" @@ -7081,6 +8087,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -7121,7 +8138,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.6.0", "toml_datetime", "winnow 0.5.40", ] @@ -7132,7 +8149,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.6.0", "toml_datetime", "winnow 0.5.40", ] @@ -7143,13 +8160,46 @@ version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", "winnow 0.6.18", ] +[[package]] +name = "tonic" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.22.1", + "bytes 1.7.1", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost", + "rustls-native-certs 0.8.0", + "rustls-pemfile 2.1.3", + "socket2 0.5.7", + "tokio", + "tokio-rustls 0.26.0", + "tokio-stream", + "tower 0.4.13", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower" version = "0.4.13" @@ -7158,11 +8208,16 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", + "indexmap 1.9.3", "pin-project", "pin-project-lite", + "rand 0.8.5", + "slab", "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -7446,6 +8501,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -7468,6 +8529,12 @@ dependencies = [ "serde", ] +[[package]] +name = "uuid" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" + [[package]] name = "valuable" version = "0.1.0" @@ -7514,6 +8581,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + [[package]] name = "wait-timeout" version = "0.2.0" @@ -7969,6 +9042,12 @@ dependencies = [ "tap", ] +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" + [[package]] name = "yansi" version = "1.0.1" diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index b52880c4f6..a60c2ee22c 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -10,7 +10,7 @@ keywords = { workspace = true } categories = { workspace = true } [dependencies] -prost = "0.13" +prost = { version = "0.13", optional = true } serde = { version = "1.0.204", features = ["derive"] } serde_json = "1.0.121" twirp = { package = "twirp-rs", version = "0.13.0-succinct", optional = true } @@ -55,6 +55,12 @@ sp1-stark = { workspace = true } sp1-primitives = { workspace = true } getrandom = { version = "0.2.15", features = ["custom", "js"] } itertools = "0.13.0" +tonic = { version = "0.12", features = ["tls", "tls-roots"], optional = true } +alloy-signer = { version = "0.3.6", optional = true } +alloy-signer-local = { version = "0.3.6", optional = true } +alloy-primitives = { version = "0.8.3", optional = true } +aws-sdk-s3 = { version = "1.53.0", optional = true } +aws-config = { version = "1.5.7", optional = true } [features] default = ["network"] @@ -63,6 +69,7 @@ native-gnark = ["sp1-prover/native-gnark"] # TODO: Once alloy has a 1.* release, we can likely remove this feature flag, as there will be less # dependency resolution issues. network = [ + "dep:prost", "dep:alloy-sol-types", "dep:tokio", "dep:ethers", @@ -70,6 +77,21 @@ network = [ "dep:twirp", "dep:reqwest-middleware", ] +network-v2 = [ + "dep:prost", + "dep:alloy-sol-types", + "dep:alloy-signer", + "dep:alloy-signer-local", + "dep:alloy-primitives", + "dep:tokio", + "dep:ethers", + "dep:reqwest", + "dep:twirp", + "dep:reqwest-middleware", + "dep:tonic", + "dep:aws-sdk-s3", + "dep:aws-config", +] cuda = ["sp1-cuda"] [build-dependencies] diff --git a/crates/sdk/src/artifacts.rs b/crates/sdk/src/artifacts.rs index 5718e45512..26663c146a 100644 --- a/crates/sdk/src/artifacts.rs +++ b/crates/sdk/src/artifacts.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use anyhow::{Context, Result}; -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] use { futures::StreamExt, indicatif::{ProgressBar, ProgressStyle}, @@ -72,7 +72,7 @@ pub fn export_solidity_groth16_bn254_verifier(output_dir: impl Into) -> Ok(()) } -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] pub async fn download_file( client: &Client, url: &str, diff --git a/crates/sdk/src/install.rs b/crates/sdk/src/install.rs index 4b7ed858db..b28ce0ecab 100644 --- a/crates/sdk/src/install.rs +++ b/crates/sdk/src/install.rs @@ -1,7 +1,7 @@ use cfg_if::cfg_if; use std::path::PathBuf; -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] use { crate::block_on, futures::StreamExt, @@ -31,7 +31,7 @@ pub fn try_install_circuit_artifacts() -> PathBuf { ); } else { cfg_if! { - if #[cfg(feature = "network")] { + if #[cfg(any(feature = "network", feature = "network-v2"))] { println!( "[sp1] circuit artifacts for version {} do not exist at {}. downloading...", SP1_CIRCUIT_VERSION, @@ -48,7 +48,7 @@ pub fn try_install_circuit_artifacts() -> PathBuf { /// /// This function will download the latest circuit artifacts from the S3 bucket and extract them /// to the directory specified by [plonk_bn254_artifacts_dir()]. -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] pub fn install_circuit_artifacts(build_dir: PathBuf) { // Create the build directory. std::fs::create_dir_all(&build_dir).expect("failed to create build directory"); @@ -77,7 +77,7 @@ pub fn install_circuit_artifacts(build_dir: PathBuf) { } /// Download the file with a progress bar that indicates the progress. -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] pub async fn download_file( client: &Client, url: &str, diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index d8b572a88f..477f6653d0 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -5,18 +5,18 @@ //! Visit the [Getting Started](https://succinctlabs.github.io/sp1/getting-started.html) section //! in the official SP1 documentation for a quick start guide. -#[rustfmt::skip] -#[cfg(feature = "network")] -pub mod proto { - pub mod network; -} pub mod action; pub mod artifacts; pub mod install; #[cfg(feature = "network")] pub mod network; +#[cfg(feature = "network-v2")] +#[path = "network-v2/mod.rs"] +pub mod network_v2; #[cfg(feature = "network")] -pub use crate::network::prover::NetworkProver; +pub use crate::network::prover::NetworkProver as NetworkProverV1; +#[cfg(feature = "network-v2")] +pub use crate::network_v2::prover::NetworkProver as NetworkProverV2; #[cfg(feature = "cuda")] pub use crate::provers::CudaProver; @@ -33,7 +33,7 @@ use sp1_prover::components::DefaultProverComponents; use std::env; -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] use {std::future::Future, tokio::task::block_in_place}; pub use provers::{CpuProver, MockProver, Prover}; @@ -84,9 +84,13 @@ impl ProverClient { }, "network" => { cfg_if! { - if #[cfg(feature = "network")] { + if #[cfg(feature = "network-v2")] { + Self { + prover: Box::new(NetworkProverV2::new()), + } + } else if #[cfg(feature = "network")] { Self { - prover: Box::new(NetworkProver::new()), + prover: Box::new(NetworkProverV1::new()), } } else { panic!("network feature is not enabled") @@ -145,9 +149,13 @@ impl ProverClient { /// ``` pub fn network() -> Self { cfg_if! { - if #[cfg(feature = "network")] { + if #[cfg(feature = "network-v2")] { + Self { + prover: Box::new(NetworkProverV2::new()), + } + } else if #[cfg(feature = "network")] { Self { - prover: Box::new(NetworkProver::new()), + prover: Box::new(NetworkProverV1::new()), } } else { panic!("network feature is not enabled") @@ -277,7 +285,7 @@ impl Default for ProverClient { /// /// If we're already in a tokio runtime, we'll block in place. Otherwise, we'll create a new /// runtime. -#[cfg(feature = "network")] +#[cfg(any(feature = "network", feature = "network-v2"))] pub fn block_on(fut: impl Future) -> T { // Handle case if we're already in an tokio runtime. if let Ok(handle) = tokio::runtime::Handle::try_current() { diff --git a/crates/sdk/src/network-v2/client.rs b/crates/sdk/src/network-v2/client.rs new file mode 100644 index 0000000000..a2ad18a2a8 --- /dev/null +++ b/crates/sdk/src/network-v2/client.rs @@ -0,0 +1,228 @@ +use std::{env, time::Duration}; + +use alloy_signer::SignerSync; +use alloy_signer_local::PrivateKeySigner; +use anyhow::{Context, Ok, Result}; +use aws_config::BehaviorVersion; +use aws_sdk_s3::Client as S3Client; +use reqwest_middleware::ClientWithMiddleware as HttpClientWithMiddleware; +use serde::de::DeserializeOwned; +use serde::Serialize; +use sp1_core_machine::io::SP1Stdin; +use sp1_prover::SP1VerifyingKey; +use std::str::FromStr; +use std::time::{SystemTime, UNIX_EPOCH}; +use tokio::sync::OnceCell; +use tokio::try_join; +use tonic::transport::Channel; + +use crate::network_v2::proto::artifact::{ + artifact_store_client::ArtifactStoreClient, CreateArtifactRequest, +}; +use crate::network_v2::proto::network::{ + prover_network_client::ProverNetworkClient, GetFilteredProofRequestsRequest, + GetFilteredProofRequestsResponse, GetNonceRequest, GetProofRequestStatusRequest, + GetProofRequestStatusResponse, ProofMode, ProofStatus, ProofStrategy, RequestProofRequest, + RequestProofRequestBody, RequestProofResponse, +}; +use crate::network_v2::Signable; + +/// The default RPC endpoint for the Succinct prover network. +pub const DEFAULT_PROVER_NETWORK_RPC: &str = "http://127.0.0.1:50051"; + +pub struct NetworkClient { + signer: PrivateKeySigner, + http: HttpClientWithMiddleware, + s3: OnceCell, +} + +impl NetworkClient { + /// Create a new network client with the given private key. + pub fn new(private_key: &str) -> Self { + let signer = PrivateKeySigner::from_str(private_key).unwrap(); + + let http_client = reqwest::Client::builder() + .pool_max_idle_per_host(0) + .pool_idle_timeout(Duration::from_secs(240)) + .build() + .unwrap(); + + Self { signer, http: http_client.into(), s3: OnceCell::new() } + } + + /// Returns the currently configured RPC endpoint for the Succinct prover network. + pub fn rpc_url() -> String { + env::var("PROVER_NETWORK_RPC").unwrap_or_else(|_| DEFAULT_PROVER_NETWORK_RPC.to_string()) + } + + /// Get a connected RPC client. + async fn get_rpc(&self) -> Result> { + let rpc_url = Self::rpc_url(); + let channel = Channel::from_shared(rpc_url)?.connect().await?; + Ok(ProverNetworkClient::new(channel.clone())) + } + + /// Get a connected artifact store client. + async fn get_store(&self) -> Result> { + let rpc_url = Self::rpc_url(); + let channel = Channel::from_shared(rpc_url)?.connect().await?; + Ok(ArtifactStoreClient::new(channel.clone())) + } + + /// Get the S3 client. + async fn get_s3_client(&self) -> &S3Client { + self.s3 + .get_or_init(|| async { + let config = aws_config::load_defaults(BehaviorVersion::latest()).await; + S3Client::new(&config) + }) + .await + } + + /// Get the latest nonce for this account's address. + pub async fn get_nonce(&self) -> Result { + let mut rpc = self.get_rpc().await?; + let res = + rpc.get_nonce(GetNonceRequest { address: self.signer.address().to_vec() }).await?; + Ok(res.into_inner().nonce) + } + + /// Get the status of a given proof. If the status is Fulfilled, the proof is also returned. + pub async fn get_proof_request_status( + &self, + request_id: &[u8], + ) -> Result<(GetProofRequestStatusResponse, Option

)> { + let mut rpc = self.get_rpc().await?; + let res = rpc + .get_proof_request_status(GetProofRequestStatusRequest { + request_id: request_id.to_vec(), + }) + .await? + .into_inner(); + let status = ProofStatus::try_from(res.status)?; + let proof = match status { + ProofStatus::Fulfilled => { + log::info!("Proof request fulfilled"); + let proof_uri = res + .proof_uri + .as_ref() + .ok_or_else(|| anyhow::anyhow!("No proof URL provided"))?; + let proof_bytes = self.download_artifact(proof_uri).await?; + Some(bincode::deserialize(&proof_bytes).context("Failed to deserialize proof")?) + } + _ => None, + }; + + Ok((res, proof)) + } + + /// Get all the proof requests for a given status. Also filter by version if provided. + pub async fn get_filtered_proof_requests( + &self, + status: ProofStatus, + version: Option<&str>, + ) -> Result { + let mut rpc = self.get_rpc().await?; + let res = rpc + .get_filtered_proof_requests(GetFilteredProofRequestsRequest { + status: status.into(), + version: version.map(|v| v.to_string()).unwrap_or_default(), + }) + .await? + .into_inner(); + + Ok(res) + } + + /// Creates a proof request with the given ELF and stdin. + #[allow(clippy::too_many_arguments)] + pub async fn request_proof( + &self, + elf: &[u8], + stdin: &SP1Stdin, + vk: &SP1VerifyingKey, + mode: ProofMode, + version: &str, + strategy: ProofStrategy, + timeout_secs: u64, + cycle_limit: u64, + ) -> Result { + // Calculate the deadline. + let start = SystemTime::now(); + let since_the_epoch = start.duration_since(UNIX_EPOCH).expect("Invalid start time"); + let deadline = since_the_epoch.as_secs() + timeout_secs; + + // Create the program and stdin artifacts. + let mut store = self.get_store().await?; + let mut store_clone = store.clone(); + let program_promise = self.create_artifact_with_content(&mut store, &elf); + let stdin_promise = self.create_artifact_with_content(&mut store_clone, &stdin); + let (program_uri, stdin_uri) = try_join!(program_promise, stdin_promise)?; + + // Serialize the vkey. + let vkey = bincode::serialize(&vk)?; + + // Send the request. + let mut rpc = self.get_rpc().await?; + let nonce = self.get_nonce().await?; + let request_body = RequestProofRequestBody { + nonce, + version: format!("sp1-{}", version), + vkey, + mode: mode.into(), + strategy: strategy.into(), + program_uri, + stdin_uri, + deadline, + cycle_limit, + }; + let request_response = rpc + .request_proof(RequestProofRequest { + signature: request_body.sign(&self.signer).into(), + body: Some(request_body), + }) + .await? + .into_inner(); + + Ok(request_response) + } + + /// Uses the artifact store to to create an artifact, upload the content, and return the URI. + async fn create_artifact_with_content( + &self, + store: &mut ArtifactStoreClient, + item: &T, + ) -> Result { + let signature = self.signer.sign_message_sync("create_artifact".as_bytes())?; + let request = CreateArtifactRequest { signature: signature.as_bytes().to_vec() }; + let response = store.create_artifact(request).await?.into_inner(); + + let presigned_url = response.artifact_presigned_url; + let uri = response.artifact_uri; + + let response = + self.http.put(&presigned_url).body(bincode::serialize::(item)?).send().await?; + + assert!(response.status().is_success()); + + Ok(uri) + } + + /// Download an artifact from S3. + async fn download_artifact(&self, uri: &str) -> Result> { + let s3_client = self.get_s3_client().await; + let uri = uri.strip_prefix("s3://").context("Invalid S3 URI")?; + let (bucket, key) = uri.split_once('/').context("Invalid S3 URI format")?; + + let resp = s3_client + .get_object() + .bucket(bucket) + .key(key) + .send() + .await + .context("Failed to get object from S3")?; + + let data = resp.body.collect().await.context("Failed to read S3 object body")?; + Ok(data.into_bytes().to_vec()) + } +} diff --git a/crates/sdk/src/network-v2/mod.rs b/crates/sdk/src/network-v2/mod.rs new file mode 100644 index 0000000000..e6444357b2 --- /dev/null +++ b/crates/sdk/src/network-v2/mod.rs @@ -0,0 +1,19 @@ +pub mod client; +pub mod prover; +mod sign_message; +#[rustfmt::skip] +pub mod proto; + +use alloy_signer::{Signature, SignerSync}; +use prost::Message; +pub use serde::{Deserialize, Serialize}; + +pub trait Signable: Message { + fn sign(&self, signer: &S) -> Signature; +} + +impl Signable for T { + fn sign(&self, signer: &S) -> Signature { + signer.sign_message_sync(&self.encode_to_vec()).unwrap() + } +} diff --git a/crates/sdk/src/network-v2/proto/artifact.rs b/crates/sdk/src/network-v2/proto/artifact.rs new file mode 100644 index 0000000000..f35dcdf8e3 --- /dev/null +++ b/crates/sdk/src/network-v2/proto/artifact.rs @@ -0,0 +1,278 @@ +// This file is @generated by prost-build. +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct CreateArtifactRequest { + /// The signature of the user on a pre-defined message. Used for authentication. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct CreateArtifactResponse { + /// The unique resource identifier of the artifact. + #[prost(string, tag = "1")] + pub artifact_uri: ::prost::alloc::string::String, + /// The presigned url to upload the artifact. + #[prost(string, tag = "2")] + pub artifact_presigned_url: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod artifact_store_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::http::Uri; + use tonic::codegen::*; + #[derive(Debug, Clone)] + pub struct ArtifactStoreClient { + inner: tonic::client::Grpc, + } + impl ArtifactStoreClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ArtifactStoreClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ArtifactStoreClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + std::marker::Send + std::marker::Sync, + { + ArtifactStoreClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// / Creates an artifact that can be used for proof requests. + pub async fn create_artifact( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/artifact.ArtifactStore/CreateArtifact"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("artifact.ArtifactStore", "CreateArtifact")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod artifact_store_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ArtifactStoreServer. + #[async_trait] + pub trait ArtifactStore: std::marker::Send + std::marker::Sync + 'static { + /// / Creates an artifact that can be used for proof requests. + async fn create_artifact( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct ArtifactStoreServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ArtifactStoreServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ArtifactStoreServer + where + T: ArtifactStore, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/artifact.ArtifactStore/CreateArtifact" => { + #[allow(non_camel_case_types)] + struct CreateArtifactSvc(pub Arc); + impl tonic::server::UnaryService + for CreateArtifactSvc + { + type Response = super::CreateArtifactResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::create_artifact(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = CreateArtifactSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => Box::pin(async move { + Ok(http::Response::builder() + .status(200) + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE) + .body(empty_body()) + .unwrap()) + }), + } + } + } + impl Clone for ArtifactStoreServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "artifact.ArtifactStore"; + impl tonic::server::NamedService for ArtifactStoreServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/crates/sdk/src/network-v2/proto/mod.rs b/crates/sdk/src/network-v2/proto/mod.rs new file mode 100644 index 0000000000..48eb63675a --- /dev/null +++ b/crates/sdk/src/network-v2/proto/mod.rs @@ -0,0 +1,2 @@ +pub mod artifact; +pub mod network; diff --git a/crates/sdk/src/network-v2/proto/network.rs b/crates/sdk/src/network-v2/proto/network.rs new file mode 100644 index 0000000000..0ffa73ebf7 --- /dev/null +++ b/crates/sdk/src/network-v2/proto/network.rs @@ -0,0 +1,907 @@ +// This file is @generated by prost-build. +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredProofRequestsRequest { + /// The status of the proof requests to filter for. + #[prost(enumeration = "ProofStatus", tag = "1")] + pub status: i32, + /// The version of the proof requests to filter for. + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct ProofRequest { + /// The request identifier. + #[prost(string, tag = "1")] + pub request_id: ::prost::alloc::string::String, + /// The version of the prover to use. + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, + /// The mode for the proof. + #[prost(enumeration = "ProofMode", tag = "4")] + pub mode: i32, + /// The strategy for prover assignment. + #[prost(enumeration = "ProofStrategy", tag = "5")] + pub strategy: i32, + /// The program resource identifier. + #[prost(string, tag = "6")] + pub program_uri: ::prost::alloc::string::String, + /// The stdin resource identifier. + #[prost(string, tag = "7")] + pub stdin_uri: ::prost::alloc::string::String, + /// The deadline for the proof. + #[prost(uint64, tag = "8")] + pub deadline: u64, + /// The cycle limit for the proof. + #[prost(uint64, tag = "9")] + pub cycle_limit: u64, + /// The status of the proof request. + #[prost(enumeration = "ProofStatus", tag = "10")] + pub status: i32, + /// The requestor address. + #[prost(bytes = "vec", tag = "11")] + pub requester: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredProofRequestsResponse { + /// The proof requests for the given status. + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RequestProofRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "3")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RequestProofRequestBody { + /// The nonce of the request. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The version of the prover to use. + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, + /// The verification key. + #[prost(bytes = "vec", tag = "3")] + pub vkey: ::prost::alloc::vec::Vec, + /// The mode for the proof. + #[prost(enumeration = "ProofMode", tag = "4")] + pub mode: i32, + /// The strategy for prover assignment. + #[prost(enumeration = "ProofStrategy", tag = "5")] + pub strategy: i32, + /// The program resource identifier. + #[prost(string, tag = "6")] + pub program_uri: ::prost::alloc::string::String, + /// The stdin resource identifier. + #[prost(string, tag = "7")] + pub stdin_uri: ::prost::alloc::string::String, + /// The deadline for the proof. + #[prost(uint64, tag = "8")] + pub deadline: u64, + /// The cycle limit for the proof. + #[prost(uint64, tag = "9")] + pub cycle_limit: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RequestProofResponse { + /// / The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// / The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RequestProofResponseBody { + /// The identifier for the proof. + #[prost(bytes = "vec", tag = "1")] + pub request_id: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct FulfillProofRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "3")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct FulfillProofRequestBody { + /// The nonce of the request. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The identifier for the proof. + #[prost(bytes = "vec", tag = "2")] + pub request_id: ::prost::alloc::vec::Vec, + /// The proof bytes. + #[prost(bytes = "vec", tag = "3")] + pub proof: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct FulfillProofResponse { + /// / The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// / The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct FulfillProofResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetBalanceRequest { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetBalanceResponse { + /// The amount of the token owned by the account. + #[prost(string, tag = "1")] + pub amount: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetNonceRequest { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetNonceResponse { + /// The nonce of the account. + #[prost(uint64, tag = "1")] + pub nonce: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestStatusRequest { + /// The identifier for the proof request. + #[prost(bytes = "vec", tag = "1")] + pub request_id: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestStatusResponse { + /// The status of the proof request. + #[prost(enumeration = "ProofStatus", tag = "1")] + pub status: i32, + /// The transaction hash of the proof request. + #[prost(bytes = "vec", tag = "2")] + pub request_tx_hash: ::prost::alloc::vec::Vec, + /// The optional transaction hash of the proof fulfill. Only included if the proof request has a + /// status of FULFILLED. + #[prost(bytes = "vec", optional, tag = "3")] + pub fulfill_tx_hash: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional proof URI, where you can download the result of the proof request. Only included + /// if the proof has a status of FULFILLED. + #[prost(string, optional, tag = "4")] + pub proof_uri: ::core::option::Option<::prost::alloc::string::String>, + /// The optional error status code, if the request failed. + #[prost(uint32, optional, tag = "5")] + pub error_code: ::core::option::Option, + /// The optional error description details, if the request failed. + #[prost(string, optional, tag = "6")] + pub error_description: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ProofMode { + UnspecifiedMode = 0, + Core = 1, + Compressed = 2, + Plonk = 3, + Groth16 = 4, +} +impl ProofMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedMode => "UNSPECIFIED_MODE", + Self::Core => "CORE", + Self::Compressed => "COMPRESSED", + Self::Plonk => "PLONK", + Self::Groth16 => "GROTH16", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_MODE" => Some(Self::UnspecifiedMode), + "CORE" => Some(Self::Core), + "COMPRESSED" => Some(Self::Compressed), + "PLONK" => Some(Self::Plonk), + "GROTH16" => Some(Self::Groth16), + _ => None, + } + } +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ProofStrategy { + UnspecifiedStrategy = 0, + Hosted = 1, +} +impl ProofStrategy { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedStrategy => "UNSPECIFIED_STRATEGY", + Self::Hosted => "HOSTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_STRATEGY" => Some(Self::UnspecifiedStrategy), + "HOSTED" => Some(Self::Hosted), + _ => None, + } + } +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ProofStatus { + UnspecifiedStatus = 0, + Requested = 1, + Assigned = 2, + Fulfilled = 3, +} +impl ProofStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedStatus => "UNSPECIFIED_STATUS", + Self::Requested => "REQUESTED", + Self::Assigned => "ASSIGNED", + Self::Fulfilled => "FULFILLED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_STATUS" => Some(Self::UnspecifiedStatus), + "REQUESTED" => Some(Self::Requested), + "ASSIGNED" => Some(Self::Assigned), + "FULFILLED" => Some(Self::Fulfilled), + _ => None, + } + } +} +/// Generated client implementations. +pub mod prover_network_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::http::Uri; + use tonic::codegen::*; + #[derive(Debug, Clone)] + pub struct ProverNetworkClient { + inner: tonic::client::Grpc, + } + impl ProverNetworkClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ProverNetworkClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ProverNetworkClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + std::marker::Send + std::marker::Sync, + { + ProverNetworkClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Creates a proof. + pub async fn request_proof( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/RequestProof"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "RequestProof")); + self.inner.unary(req, path, codec).await + } + /// Fulfills a proof. + pub async fn fulfill_proof( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/FulfillProof"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "FulfillProof")); + self.inner.unary(req, path, codec).await + } + /// Get the proof requests the meet the filter criteria. + pub async fn get_filtered_proof_requests( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetFilteredProofRequests", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredProofRequests")); + self.inner.unary(req, path, codec).await + } + /// Get the status of a proof request. + pub async fn get_proof_request_status( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetProofRequestStatus", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestStatus")); + self.inner.unary(req, path, codec).await + } + /// Get the balance of the account. + pub async fn get_balance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetBalance"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetBalance")); + self.inner.unary(req, path, codec).await + } + /// Get the nonce of the account. + pub async fn get_nonce( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetNonce"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetNonce")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod prover_network_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ProverNetworkServer. + #[async_trait] + pub trait ProverNetwork: std::marker::Send + std::marker::Sync + 'static { + /// Creates a proof. + async fn request_proof( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Fulfills a proof. + async fn fulfill_proof( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the proof requests the meet the filter criteria. + async fn get_filtered_proof_requests( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get the status of a proof request. + async fn get_proof_request_status( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the balance of the account. + async fn get_balance( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the nonce of the account. + async fn get_nonce( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct ProverNetworkServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ProverNetworkServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ProverNetworkServer + where + T: ProverNetwork, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/network.ProverNetwork/RequestProof" => { + #[allow(non_camel_case_types)] + struct RequestProofSvc(pub Arc); + impl tonic::server::UnaryService + for RequestProofSvc + { + type Response = super::RequestProofResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::request_proof(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RequestProofSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/FulfillProof" => { + #[allow(non_camel_case_types)] + struct FulfillProofSvc(pub Arc); + impl tonic::server::UnaryService + for FulfillProofSvc + { + type Response = super::FulfillProofResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::fulfill_proof(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = FulfillProofSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetFilteredProofRequests" => { + #[allow(non_camel_case_types)] + struct GetFilteredProofRequestsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetFilteredProofRequestsSvc + { + type Response = super::GetFilteredProofRequestsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_filtered_proof_requests(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetFilteredProofRequestsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProofRequestStatus" => { + #[allow(non_camel_case_types)] + struct GetProofRequestStatusSvc(pub Arc); + impl + tonic::server::UnaryService + for GetProofRequestStatusSvc + { + type Response = super::GetProofRequestStatusResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_proof_request_status(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetProofRequestStatusSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetBalance" => { + #[allow(non_camel_case_types)] + struct GetBalanceSvc(pub Arc); + impl tonic::server::UnaryService for GetBalanceSvc { + type Response = super::GetBalanceResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_balance(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetBalanceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetNonce" => { + #[allow(non_camel_case_types)] + struct GetNonceSvc(pub Arc); + impl tonic::server::UnaryService for GetNonceSvc { + type Response = super::GetNonceResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_nonce(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetNonceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => Box::pin(async move { + Ok(http::Response::builder() + .status(200) + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header(http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE) + .body(empty_body()) + .unwrap()) + }), + } + } + } + impl Clone for ProverNetworkServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "network.ProverNetwork"; + impl tonic::server::NamedService for ProverNetworkServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/crates/sdk/src/network-v2/prover.rs b/crates/sdk/src/network-v2/prover.rs new file mode 100644 index 0000000000..19746b71bb --- /dev/null +++ b/crates/sdk/src/network-v2/prover.rs @@ -0,0 +1,216 @@ +use std::{ + env, + time::{Duration, Instant}, +}; + +use crate::{ + network_v2::client::{NetworkClient, DEFAULT_PROVER_NETWORK_RPC}, + network_v2::proto::network::{ProofMode, ProofStatus, ProofStrategy}, + Prover, SP1Context, SP1ProofKind, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, +}; +use anyhow::Result; +use serde::de::DeserializeOwned; +use sp1_core_machine::io::SP1Stdin; +use sp1_prover::{components::DefaultProverComponents, SP1Prover, SP1_CIRCUIT_VERSION}; +use sp1_stark::SP1ProverOpts; + +use {crate::block_on, tokio::time::sleep}; + +use crate::provers::{CpuProver, ProofOpts, ProverType}; + +/// The timeout for a proof request to be fulfilled. +const TIMEOUT_SECS: u64 = 3600; + +/// The default cycle limit for a proof request. +const DEFAULT_CYCLE_LIMIT: u64 = 1_000_000_000; + +/// An implementation of [crate::ProverClient] that can generate proofs on a remote RPC server. +pub struct NetworkProver { + client: NetworkClient, + local_prover: CpuProver, +} + +impl NetworkProver { + /// Creates a new [NetworkProver] with the private key set in `SP1_PRIVATE_KEY`. + pub fn new() -> Self { + let private_key = env::var("SP1_PRIVATE_KEY") + .unwrap_or_else(|_| panic!("SP1_PRIVATE_KEY must be set for remote proving")); + Self::new_from_key(&private_key) + } + + /// Creates a new [NetworkProver] with the given private key. + pub fn new_from_key(private_key: &str) -> Self { + let version = SP1_CIRCUIT_VERSION; + log::info!("Client circuit version: {}", version); + let local_prover = CpuProver::new(); + let client = NetworkClient::new(private_key); + Self { client, local_prover } + } + + /// Requests a proof from the prover network, returning the request ID. + pub async fn request_proof( + &self, + elf: &[u8], + stdin: SP1Stdin, + mode: ProofMode, + timeout: Option, + ) -> Result> { + // Simulate and get the cycle limit. + let skip_simulation = env::var("SKIP_SIMULATION").map(|val| val == "true").unwrap_or(false); + let cycle_limit = if !skip_simulation { + let (_, report) = + self.local_prover.sp1_prover().execute(elf, &stdin, Default::default())?; + let cycles = report.total_instruction_count(); + log::info!("Simulation complete, cycles: {}", cycles); + cycles + } else { + log::info!("Skipping simulation"); + DEFAULT_CYCLE_LIMIT + }; + + // Get the verifying key. + let (_, vk) = self.setup(elf); + + // Get the timeout. + let timeout_secs = timeout.map(|dur| dur.as_secs()).unwrap_or(TIMEOUT_SECS); + + log::info!("Requesting proof with cycle limit: {}", cycle_limit); + + // Request the proof. + let response = self + .client + .request_proof( + elf, + &stdin, + &vk, + mode, + SP1_CIRCUIT_VERSION, + ProofStrategy::Hosted, + timeout_secs, + cycle_limit, + ) + .await?; + + // Log the request ID and transaction hash. + let tx_hash_hex = "0x".to_string() + &hex::encode(response.tx_hash); + let request_id = response.body.unwrap().request_id; + let request_id_hex = "0x".to_string() + &hex::encode(request_id.clone()); + log::info!("Created request {} in transaction {}", request_id_hex, tx_hash_hex); + + if NetworkClient::rpc_url() == DEFAULT_PROVER_NETWORK_RPC { + log::info!("View in explorer: https://explorer-v2.succinct.xyz/{}", request_id_hex); + } + + Ok(request_id) + } + + /// Waits for a proof to be generated and returns the proof. If a timeout is supplied, the + /// function will return an error if the proof is not generated within the timeout. + pub async fn wait_proof( + &self, + request_id: &[u8], + timeout: Option, + ) -> Result

{ + let mut is_assigned = false; + let start_time = Instant::now(); + loop { + if let Some(timeout) = timeout { + if start_time.elapsed() > timeout { + return Err(anyhow::anyhow!("Proof request timed out.")); + } + } + + let (status, maybe_proof) = + self.client.get_proof_request_status::

(request_id).await?; + + match status.status() { + ProofStatus::Fulfilled => { + return Ok(maybe_proof.unwrap()); + } + ProofStatus::Assigned => { + if !is_assigned { + log::info!("Proof request assigned, proving..."); + is_assigned = true; + } + } + _ => {} + } + sleep(Duration::from_secs(2)).await; + } + } + + /// Requests a proof from the prover network and waits for it to be generated. + pub async fn prove( + &self, + elf: &[u8], + stdin: SP1Stdin, + mode: ProofMode, + timeout: Option, + ) -> Result { + let request_id = self.request_proof(elf, stdin, mode, timeout).await?; + self.wait_proof(&request_id, timeout).await + } +} + +impl Prover for NetworkProver { + fn id(&self) -> ProverType { + ProverType::Network + } + + fn setup(&self, elf: &[u8]) -> (SP1ProvingKey, SP1VerifyingKey) { + self.local_prover.setup(elf) + } + + fn sp1_prover(&self) -> &SP1Prover { + self.local_prover.sp1_prover() + } + + fn prove<'a>( + &'a self, + pk: &SP1ProvingKey, + stdin: SP1Stdin, + opts: ProofOpts, + context: SP1Context<'a>, + kind: SP1ProofKind, + ) -> Result { + warn_if_not_default(&opts.sp1_prover_opts, &context); + block_on(self.prove(&pk.elf, stdin, kind.into(), opts.timeout)) + } +} + +impl Default for NetworkProver { + fn default() -> Self { + Self::new() + } +} + +/// Warns if `opts` or `context` are not default values, since they are currently unsupported. +fn warn_if_not_default(opts: &SP1ProverOpts, context: &SP1Context) { + let _guard = tracing::warn_span!("network_prover").entered(); + if opts != &SP1ProverOpts::default() { + tracing::warn!("non-default opts will be ignored: {:?}", opts.core_opts); + tracing::warn!("custom SP1ProverOpts are currently unsupported by the network prover"); + } + // Exhaustive match is done to ensure we update the warnings if the types change. + let SP1Context { hook_registry, subproof_verifier, .. } = context; + if hook_registry.is_some() { + tracing::warn!("non-default context.hook_registry will be ignored: {:?}", hook_registry); + tracing::warn!("custom runtime hooks are currently unsupported by the network prover"); + tracing::warn!("proving may fail due to missing hooks"); + } + if subproof_verifier.is_some() { + tracing::warn!("non-default context.subproof_verifier will be ignored"); + tracing::warn!("custom subproof verifiers are currently unsupported by the network prover"); + } +} + +impl From for ProofMode { + fn from(value: SP1ProofKind) -> Self { + match value { + SP1ProofKind::Core => Self::Core, + SP1ProofKind::Compressed => Self::Compressed, + SP1ProofKind::Plonk => Self::Plonk, + SP1ProofKind::Groth16 => Self::Groth16, + } + } +} diff --git a/crates/sdk/src/network-v2/sign_message.rs b/crates/sdk/src/network-v2/sign_message.rs new file mode 100644 index 0000000000..f8b794a5cb --- /dev/null +++ b/crates/sdk/src/network-v2/sign_message.rs @@ -0,0 +1,73 @@ +use alloy_primitives::{Address, Signature}; +use prost::Message; +use thiserror::Error; + +use crate::network_v2::proto::network::{FulfillProofRequest, RequestProofRequest}; + +#[allow(dead_code)] +pub trait SignedMessage { + fn signature(&self) -> Vec; + fn nonce(&self) -> Result; + fn message(&self) -> Result, MessageError>; + fn recover_sender(&self) -> Result; +} + +#[derive(Error, Debug)] +pub enum MessageError { + #[error("Empty message")] + EmptyMessage, +} + +#[derive(Error, Debug)] +pub enum RecoverSenderError { + #[error("Failed to deserialize signature: {0}")] + SignatureDeserializationError(String), + #[error("Empty message")] + EmptyMessage, + #[error("Failed to recover address: {0}")] + AddressRecoveryError(String), +} + +macro_rules! impl_signed_message { + ($type:ty) => { + impl SignedMessage for $type { + fn signature(&self) -> Vec { + self.signature.clone() + } + + fn nonce(&self) -> Result { + match &self.body { + Some(body) => Ok(body.nonce as u64), + None => Err(MessageError::EmptyMessage), + } + } + + fn message(&self) -> Result, MessageError> { + match &self.body { + Some(body) => Ok(body.encode_to_vec()), + None => Err(MessageError::EmptyMessage), + } + } + + fn recover_sender(&self) -> Result { + let message = self.message().map_err(|_| RecoverSenderError::EmptyMessage)?; + recover_sender_raw(self.signature.clone(), message) + } + } + }; +} + +impl_signed_message!(RequestProofRequest); +impl_signed_message!(FulfillProofRequest); + +pub fn recover_sender_raw( + signature: Vec, + message: Vec, +) -> Result { + let signature = Signature::try_from(signature.as_slice()) + .map_err(|e| RecoverSenderError::SignatureDeserializationError(e.to_string()))?; + + signature + .recover_address_from_msg(message) + .map_err(|e| RecoverSenderError::AddressRecoveryError(e.to_string())) +} diff --git a/crates/sdk/src/network/auth.rs b/crates/sdk/src/network/auth.rs index 7cb2c2ef7d..dbce5bb3e0 100644 --- a/crates/sdk/src/network/auth.rs +++ b/crates/sdk/src/network/auth.rs @@ -7,7 +7,7 @@ use ethers::{ types::H256, }; -use crate::proto::network::UnclaimReason; +use crate::network::proto::network::UnclaimReason; sol! { struct CreateProof { diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index f9bdd94ccd..893b5e6cca 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -2,7 +2,7 @@ use std::{env, time::Duration}; use crate::{ network::auth::NetworkAuth, - proto::network::{ + network::proto::network::{ ModifyCpuCyclesRequest, ModifyCpuCyclesResponse, UnclaimProofRequest, UnclaimReason, }, }; @@ -18,7 +18,7 @@ use std::{ }; use twirp::{Client as TwirpClient, ClientError}; -use crate::proto::network::{ +use crate::network::proto::network::{ ClaimProofRequest, ClaimProofResponse, CreateProofRequest, FulfillProofRequest, FulfillProofResponse, GetNonceRequest, GetProofRequestsRequest, GetProofRequestsResponse, GetProofStatusRequest, GetProofStatusResponse, NetworkServiceClient, ProofMode, ProofStatus, diff --git a/crates/sdk/src/network/mod.rs b/crates/sdk/src/network/mod.rs index 950aa10953..12d9b7b352 100644 --- a/crates/sdk/src/network/mod.rs +++ b/crates/sdk/src/network/mod.rs @@ -1,3 +1,6 @@ pub mod auth; pub mod client; pub mod prover; + +#[rustfmt::skip] +pub mod proto; diff --git a/crates/sdk/src/network/proto/mod.rs b/crates/sdk/src/network/proto/mod.rs new file mode 100644 index 0000000000..a61610bd4d --- /dev/null +++ b/crates/sdk/src/network/proto/mod.rs @@ -0,0 +1 @@ +pub mod network; diff --git a/crates/sdk/src/proto/network.rs b/crates/sdk/src/network/proto/network.rs similarity index 100% rename from crates/sdk/src/proto/network.rs rename to crates/sdk/src/network/proto/network.rs diff --git a/crates/sdk/src/network/prover.rs b/crates/sdk/src/network/prover.rs index d7561a123f..df7388d8e3 100644 --- a/crates/sdk/src/network/prover.rs +++ b/crates/sdk/src/network/prover.rs @@ -5,7 +5,7 @@ use std::{ use crate::{ network::client::{NetworkClient, DEFAULT_PROVER_NETWORK_RPC}, - proto::network::{ProofMode, ProofStatus}, + network::proto::network::{ProofMode, ProofStatus}, Prover, SP1Context, SP1ProofKind, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; @@ -14,7 +14,6 @@ use sp1_core_machine::io::SP1Stdin; use sp1_prover::{components::DefaultProverComponents, SP1Prover, SP1_CIRCUIT_VERSION}; use sp1_stark::SP1ProverOpts; -#[cfg(feature = "network")] use {crate::block_on, tokio::time::sleep}; use crate::provers::{CpuProver, ProofOpts, ProverType};