diff --git a/.gitignore b/.gitignore index abfa990f..fe96efc4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ tmp .vscode .idea .idea/* + +data diff --git a/Cargo.lock b/Cargo.lock index 3044ff93..83b3b597 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,18 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -47,6 +59,171 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloy-json-rpc" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fa8a1a3c4cbd221f2b8e3693aeb328fca79a757fe556ed08e47bbbc2a70db7" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-primitives" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260d3ff3bff0bb84599f032a2f2c6828180b0ea0cd41fdaf44f39cef3ba41861" +dependencies = [ + "alloy-rlp", + "bytes", + "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", + "ruint", + "rustc-hash", + "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 = [ + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "370143ed581aace6e663342d21d209c6b2e34ee6142f7d6675adb518deeaf0dc" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "alloy-transport-http", + "futures", + "pin-project", + "reqwest 0.12.8", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower 0.5.1", + "tracing", + "url", +] + +[[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", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[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", + "const-hex", + "heck", + "indexmap 2.6.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn-solidity", + "tiny-keccak", +] + +[[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.68", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-types" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86a533ce22525969661b25dfe296c112d35eb6861f188fd284f8bd4bb3842ae" +dependencies = [ + "alloy-primitives", + "alloy-sol-macro", + "const-hex", +] + +[[package]] +name = "alloy-transport" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac3e97dad3d31770db0fc89bd6a63b789fbae78963086733f960cf32c483904" +dependencies = [ + "alloy-json-rpc", + "base64 0.22.1", + "futures-util", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower 0.5.1", + "tracing", + "url", +] + +[[package]] +name = "alloy-transport-http" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b367dcccada5b28987c2296717ee04b9a5637aacd78eacb1726ef211678b5212" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest 0.12.8", + "serde_json", + "tower 0.5.1", + "tracing", + "url", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -117,6 +294,130 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "arrayvec" version = "0.7.4" @@ -151,7 +452,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -228,15 +529,6 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -369,7 +661,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -390,14 +682,23 @@ dependencies = [ name = "cdk" version = "0.1.0" dependencies = [ + "alloy-json-rpc", + "alloy-rpc-client", + "alloy-transport-http", "anyhow", "cdk-config", "clap", "dotenvy", "execute", + "reqwest 0.12.8", + "serde", + "serde_json", + "tempfile", + "tokio", "toml", "tracing", "tracing-subscriber", + "url", ] [[package]] @@ -439,7 +740,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -500,7 +801,7 @@ checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" dependencies = [ "bs58", "coins-core", - "digest", + "digest 0.10.7", "hmac", "k256", "serde", @@ -533,7 +834,7 @@ dependencies = [ "base64 0.21.7", "bech32", "bs58", - "digest", + "digest 0.10.7", "generic-array 0.14.7", "hex", "ripemd", @@ -751,6 +1052,17 @@ dependencies = [ "serde", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -762,6 +1074,36 @@ dependencies = [ "syn 2.0.68", ] +[[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.68", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "digest" version = "0.10.7" @@ -835,7 +1177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -856,7 +1198,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array 0.14.7", "group", @@ -927,7 +1269,7 @@ checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ "aes", "ctr", - "digest", + "digest 0.10.7", "hex", "hmac", "pbkdf2 0.11.0", @@ -1052,7 +1394,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "syn 2.0.68", @@ -1114,8 +1456,8 @@ checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" dependencies = [ "chrono", "ethers-core", - "reqwest", - "semver", + "reqwest 0.11.27", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -1139,7 +1481,7 @@ dependencies = [ "futures-locks", "futures-util", "instant", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", @@ -1171,7 +1513,7 @@ dependencies = [ "jsonwebtoken", "once_cell", "pin-project", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", @@ -1224,7 +1566,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver", + "semver 1.0.23", "serde", "serde_json", "solang-parser", @@ -1290,6 +1632,17 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "ff" version = "0.13.0" @@ -1334,6 +1687,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1468,6 +1836,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" @@ -1522,15 +1896,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gloo-net" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43aaa242d1239a8822c15c645f02166398da4f8b5c4bae795c1f5b44e9eee173" +checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580" dependencies = [ "futures-channel", "futures-core", "futures-sink", "gloo-utils", - "http 0.2.12", + "http 1.1.0", "js-sys", "pin-project", "serde", @@ -1589,7 +1963,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1608,7 +1982,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1626,6 +2000,16 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "hashers" @@ -1653,6 +2037,15 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hmac" @@ -1660,7 +2053,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1817,6 +2210,22 @@ dependencies = [ "tower-service", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.4.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + [[package]] name = "hyper-util" version = "0.1.6" @@ -1832,7 +2241,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", + "tower 0.4.13", "tower-service", "tracing", ] @@ -1933,12 +2342,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde", ] @@ -1972,6 +2381,15 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.11.0" @@ -2027,9 +2445,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b089779ad7f80768693755a031cc14a7766aba707cbe886674e3f79e9b7e47" +checksum = "126b48a5acc3c52fbd5381a77898cb60e145123179588a29e7ac48f9c06e401b" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -2045,9 +2463,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08163edd8bcc466c33d79e10f695cdc98c00d1e6ddfb95cec41b6b0279dd5432" +checksum = "bf679a8e0e083c77997f7c4bb4ca826577105906027ae462aac70ff348d02c6a" dependencies = [ "base64 0.22.1", "futures-channel", @@ -2070,13 +2488,11 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79712302e737d23ca0daa178e752c9334846b08321d439fd89af9a384f8c830b" +checksum = "b0e503369a76e195b65af35058add0e6900b794a4e9a9316900ddd3a87a80477" dependencies = [ - "anyhow", "async-trait", - "beef", "bytes", "futures-timer", "futures-util", @@ -2099,9 +2515,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d90064e04fb9d7282b1c71044ea94d0bbc6eff5621c66f1a0bce9e9de7cf3ac" +checksum = "f2c0caba4a6a8efbafeec9baa986aa22a75a96c29d3e4b0091b0098d6470efb5" dependencies = [ "async-trait", "base64 0.22.1", @@ -2117,16 +2533,16 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tower", + "tower 0.4.13", "tracing", "url", ] [[package]] name = "jsonrpsee-proc-macros" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7895f186d5921065d96e16bd795e5ca89ac8356ec423fafc6e3d7cf8ec11aee4" +checksum = "fc660a9389e2748e794a40673a4155d501f32db667757cdb80edeff0306b489b" dependencies = [ "heck", "proc-macro-crate", @@ -2137,11 +2553,10 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "654afab2e92e5d88ebd8a39d6074483f3f2bfdf91c5ac57fe285e7127cdd4f51" +checksum = "af6e6c9b6d975edcb443565d648b605f3e85a04ec63aa6941811a8894cc9cded" dependencies = [ - "anyhow", "futures-util", "http 1.1.0", "http-body 1.0.0", @@ -2159,17 +2574,16 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tower", + "tower 0.4.13", "tracing", ] [[package]] name = "jsonrpsee-types" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c465fbe385238e861fdc4d1c85e04ada6c1fd246161d26385c1b311724d2af" +checksum = "d8fb16314327cbc94fdf7965ef7e4422509cd5597f76d137bd104eb34aeede67" dependencies = [ - "beef", "http 1.1.0", "serde", "serde_json", @@ -2178,9 +2592,9 @@ dependencies = [ [[package]] name = "jsonrpsee-wasm-client" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4727ac037f834c6f04c0912cada7532dbddb54e92fbc64e33d6cb8c24af313c9" +checksum = "e0da62b43702bd5640ea305d35df95da30abc878e79a7b4b01feda3beaf35d3c" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -2189,9 +2603,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.23.2" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c28759775f5cb2f1ea9667672d3fe2b0e701d1f4b7b67954e60afe7fd058b5e" +checksum = "39aabf5d6c6f22da8d5b808eea1fab0736059f11fb42f71f141b14f404e5046a" dependencies = [ "http 1.1.0", "jsonrpsee-client-transport", @@ -2237,6 +2651,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "lalrpop" version = "0.20.2" @@ -2246,7 +2670,7 @@ dependencies = [ "ascii-canvas", "bit-set", "ena", - "itertools", + "itertools 0.11.0", "lalrpop-util", "petgraph", "regex", @@ -2333,7 +2757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if", - "digest", + "digest 0.10.7", ] [[package]] @@ -2359,13 +2783,31 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -2490,12 +2932,50 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "openssl" +version = "0.10.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -2554,7 +3034,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2568,6 +3048,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "path-slash" version = "0.2.1" @@ -2580,7 +3066,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest", + "digest 0.10.7", "hmac", "password-hash", "sha2", @@ -2592,7 +3078,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest", + "digest 0.10.7", "hmac", ] @@ -2611,6 +3097,17 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + [[package]] name = "petgraph" version = "0.6.5" @@ -2618,7 +3115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.6.0", ] [[package]] @@ -2628,7 +3125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -2781,6 +3278,28 @@ dependencies = [ "toml_edit 0.21.1", ] +[[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.68", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -2796,6 +3315,8 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ + "bit-set", + "bit-vec", "bitflags 2.6.0", "lazy_static", "num-traits", @@ -2803,9 +3324,17 @@ dependencies = [ "rand_chacha", "rand_xorshift", "regex-syntax 0.8.4", + "rusty-fork", + "tempfile", "unarray", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" version = "1.0.36" @@ -2830,6 +3359,7 @@ dependencies = [ "libc", "rand_chacha", "rand_core", + "serde", ] [[package]] @@ -2972,8 +3502,8 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", - "system-configuration", + "sync_wrapper 0.1.2", + "system-configuration 0.5.1", "tokio", "tokio-rustls 0.24.1", "tower-service", @@ -2985,6 +3515,49 @@ dependencies = [ "winreg", ] +[[package]] +name = "reqwest" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.4.1", + "hyper-rustls 0.27.2", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.1.2", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "system-configuration 0.6.1", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -3031,7 +3604,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -3062,6 +3635,36 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -3070,9 +3673,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustc-hex" @@ -3080,13 +3683,22 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.23", ] [[package]] @@ -3221,6 +3833,18 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.18" @@ -3252,7 +3876,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", ] @@ -3344,6 +3968,15 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.23" @@ -3353,6 +3986,15 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "send_wrapper" version = "0.4.0" @@ -3367,18 +4009,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -3387,20 +4029,21 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -3419,15 +4062,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.3" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377" +checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.6.0", "serde", "serde_derive", "serde_json", @@ -3437,9 +4080,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.3" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703" +checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec" dependencies = [ "darling", "proc-macro2", @@ -3455,7 +4098,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3466,7 +4109,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3475,10 +4118,20 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -3494,7 +4147,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core", ] @@ -3563,7 +4216,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" dependencies = [ - "itertools", + "itertools 0.11.0", "lalrpop", "lalrpop-util", "phf", @@ -3656,8 +4309,8 @@ dependencies = [ "fs2", "hex", "once_cell", - "reqwest", - "semver", + "reqwest 0.11.27", + "semver 1.0.23", "serde", "serde_json", "sha2", @@ -3688,12 +4341,33 @@ dependencies = [ "unicode-ident", ] +[[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.68", +] + [[package]] name = "sync_wrapper" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -3702,7 +4376,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys 0.6.0", ] [[package]] @@ -3715,6 +4400,16 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tap" version = "1.0.1" @@ -3723,14 +4418,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3746,18 +4442,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -3831,32 +4527,41 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", "syn 2.0.68", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.24.1" @@ -3921,21 +4626,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.15", + "toml_edit 0.22.22", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -3946,22 +4651,22 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.6.0", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.20", ] [[package]] @@ -3980,17 +4685,31 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -4121,6 +4840,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "uint" version = "0.9.5" @@ -4218,12 +4943,27 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -4377,7 +5117,37 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -4395,7 +5165,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -4415,18 +5194,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -4437,9 +5216,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -4449,9 +5228,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -4461,15 +5240,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -4479,9 +5258,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -4491,9 +5270,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -4503,9 +5282,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -4515,9 +5294,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -4530,9 +5309,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -4558,7 +5337,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version", + "rustc_version 0.4.0", "send_wrapper 0.6.0", "thiserror", "wasm-bindgen", @@ -4581,11 +5360,45 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index 0bb41677..debf9da1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,15 @@ version = "0.1.0" edition = "2021" [workspace.dependencies] -serde = { version = "1.0.197", features = ["derive"] } -serde_json = "1.0.116" -serde_with = "3.7.0" -thiserror = "1.0.58" -toml = "0.8.12" +serde = { version = "1.0.210", features = ["derive"] } +serde_json = "1.0.128" +serde_with = "3.10.0" +thiserror = "1.0.64" +toml = "0.8.19" tracing = "0.1.40" tracing-appender = "0.2.3" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } url = { version = "2.5.2", features = ["serde"] } ethers = "2.0.14" -jsonrpsee = { version = "0.23.2", features = ["full"] } +jsonrpsee = { version = "0.24.5", features = ["full"] } diff --git a/Dockerfile b/Dockerfile index f2970447..ac5e759b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,11 +9,12 @@ RUN go mod download # BUILD BINARY COPY . . -RUN make build +RUN make build-go # BUILD RUST BIN -FROM --platform=${BUILDPLATFORM} rust:slim-bullseye AS chef +FROM --platform=${BUILDPLATFORM} rust:slim-bookworm AS chef USER root +RUN apt-get update && apt-get install -y openssl pkg-config libssl-dev RUN cargo install cargo-chef WORKDIR /app @@ -41,7 +42,7 @@ RUN cargo build --release --bin cdk # CONTAINER FOR RUNNING BINARY FROM --platform=${BUILDPLATFORM} debian:bookworm-slim -RUN apt-get update && apt-get install -y ca-certificates postgresql-client +RUN apt-get update && apt-get install -y ca-certificates postgresql-client libssl-dev && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/cdk /usr/local/bin/ COPY --from=build /go/src/github.com/0xPolygon/cdk/target/cdk-node /usr/local/bin/ diff --git a/Makefile b/Makefile index c653ec1e..2adb0c40 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,14 @@ install-linter: check-go check-curl generate-code-from-proto: check-protoc .PHONY: build -build: ## Builds the binary locally into ./dist +build: build-rust build-go ## Builds the binaries locally into ./target + +.PHONY: build-rust +build-rust: + export BUILD_SCRIPT_DISABLED=1 && cargo build --release + +.PHONY: build-go +build-go: $(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD) .PHONY: build-docker diff --git a/README.md b/README.md index 23a4e4e8..9c9480bd 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,30 @@ Setup Kurtosis following this instructions https://github.com/0xPolygon/kurtosis - You can run locally against kurtosis-cdk environment using: [docs/local_debug.md](docs/local_debug.md) +### Build locally + +You can locally build a production release of CDK CLI + cdk-node with: + +``` +make build +``` + +### Run locally + +You can build and run a debug release locally using: + +``` +cargo run +``` + +It will build and run both binaries. +### Running with Kurtosis + +1. Run your kurtosis environment +2. build `cdk-erigon` and make it available in your system's PATH +3. Run `scripts/local_config` +4. cargo run -- --config ./tmp/cdk/local_config/test.kurtosis.toml --chain ./tmp/cdk/local_config/genesis.json erigon + ## Contributing Contributions are very welcomed, the guidelines are currently not available (WIP) diff --git a/config/example-config.toml b/config/example-config.toml deleted file mode 100644 index c3e222ed..00000000 --- a/config/example-config.toml +++ /dev/null @@ -1,122 +0,0 @@ -ForkUpgradeBatchNumber = 0 -ForkUpgradeNewForkId = 0 - -[Log] -Environment = "development" # "production" or "development" -Level = "info" -Outputs = ["stderr"] - -[SequenceSender] -IsValidiumMode = false -WaitPeriodSendSequence = "15s" -LastBatchVirtualizationTimeMaxWaitPeriod = "10s" -L1BlockTimestampMargin = "30s" -MaxTxSizeForL1 = 131072 -L2Coinbase = "0xfa3b44587990f97ba8b6ba7e230a5f0e95d14b3d" -PrivateKey = {Path = "./test/sequencer.keystore", Password = "testonly"} -SequencesTxFileName = "sequencesender.json" -GasOffset = 80000 -WaitPeriodPurgeTxFile = "15m" -MaxPendingTx = 1 - [SequenceSender.StreamClient] - Server = "127.0.0.1:6900" - [SequenceSender.EthTxManager] - FrequencyToMonitorTxs = "1s" - WaitTxToBeMined = "2m" - GetReceiptMaxTime = "250ms" - GetReceiptWaitInterval = "1s" - PrivateKeys = [ - {Path = "./test/sequencer.keystore", Password = "testonly"}, - ] - ForcedGas = 0 - GasPriceMarginFactor = 1 - MaxGasPriceLimit = 0 - StoragePath = "ethtxmanager.db" - ReadPendingL1Txs = false - SafeStatusL1NumberOfBlocks = 0 - FinalizedStatusL1NumberOfBlocks = 0 - [SequenceSender.EthTxManager.Etherman] - URL = "http://127.0.0.1:32771" - MultiGasProvider = false - L1ChainID = 1337 -[Aggregator] -Host = "0.0.0.0" -Port = 50081 -RetryTime = "5s" -VerifyProofInterval = "10s" -TxProfitabilityCheckerType = "acceptall" -TxProfitabilityMinReward = "1.1" -ProofStatePollingInterval = "5s" -SenderAddress = "" -CleanupLockedProofsInterval = "2m" -GeneratingProofCleanupThreshold = "10m" -ForkId = 9 -GasOffset = 0 -WitnessURL = "localhost:8123" -UseL1BatchData = true -UseFullWitness = false -SettlementBackend = "l1" -AggLayerTxTimeout = "5m" -AggLayerURL = "" -SequencerPrivateKey = {} - [Aggregator.DB] - Name = "aggregator_db" - User = "aggregator_user" - Password = "master_password" - Host = "localhost" - Port = "32780" - EnableLog = false - MaxConns = 200 - [Aggregator.Log] - Environment = "development" # "production" or "development" - Level = "info" - Outputs = ["stderr"] - [Aggregator.StreamClient] - Server = "localhost:6900" - [Aggregator.EthTxManager] - FrequencyToMonitorTxs = "1s" - WaitTxToBeMined = "2m" - GetReceiptMaxTime = "250ms" - GetReceiptWaitInterval = "1s" - PrivateKeys = [ - {Path = "/pk/aggregator.keystore", Password = "testonly"}, - ] - ForcedGas = 0 - GasPriceMarginFactor = 1 - MaxGasPriceLimit = 0 - StoragePath = "" - ReadPendingL1Txs = false - SafeStatusL1NumberOfBlocks = 0 - FinalizedStatusL1NumberOfBlocks = 0 - [Aggregator.EthTxManager.Etherman] - URL = "" - L1ChainID = 11155111 - HTTPHeaders = [] - [Aggregator.Synchronizer] - [Aggregator.Synchronizer.DB] - Name = "sync_db" - User = "sync_user" - Password = "sync_password" - Host = "cdk-l1-sync-db" - Port = "5432" - EnableLog = false - MaxConns = 10 - [Aggregator.Synchronizer.Synchronizer] - SyncInterval = "10s" - SyncChunkSize = 1000 - GenesisBlockNumber = 5511080 - SyncUpToBlock = "finalized" - BlockFinality = "finalized" - OverrideStorageCheck = false - [Aggregator.Synchronizer.Etherman] - [Aggregator.Synchronizer.Etherman.Validium] - Enabled = false - -[RPC] - -[NetworkConfig.L1] -ChainID = 11155111 -PolAddr = "0xEdE9cf798E0fE25D35469493f43E88FeA4a5da0E" -ZkEVMAddr = "0x1Fe038B54aeBf558638CA51C91bC8cCa06609e91" -RollupManagerAddr = "0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2" -GlobalExitRootManagerAddr = "0x1f7ad7caA53e35b4f0D138dC5CBF91aC108a2674" diff --git a/crates/cdk-config/src/aggregator.rs b/crates/cdk-config/src/aggregator.rs new file mode 100644 index 00000000..85a2a06c --- /dev/null +++ b/crates/cdk-config/src/aggregator.rs @@ -0,0 +1,118 @@ +use ethers::types::Address; +use serde::Deserialize; +use url::Url; + +/// The StreamClient configuration. +#[derive(Deserialize, Debug, Clone)] +pub struct StreamClient { + #[serde(rename = "Server")] + pub server: String, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct EthTxManager { + #[serde(rename = "Etherman")] + pub etherman: Etherman, +} + +#[derive(Deserialize, Debug, Clone)] +pub struct Etherman { + #[serde(rename = "URL")] + pub url: String, +} + +/// The Aggregator configuration. +#[derive(Deserialize, Debug, Clone)] +pub struct Aggregator { + #[serde(rename = "ChainID")] + pub chain_id: String, + #[serde(rename = "Host")] + pub host: String, + #[serde(rename = "Port")] + pub port: String, + #[serde(rename = "RetryTime")] + pub retry_time: String, + #[serde(rename = "VerifyProofInterval")] + pub verify_proof_interval: String, + #[serde(rename = "ProofStatePollingInterval")] + pub proof_state_polling_interval: String, + #[serde(rename = "TxProfitabilityCheckerType")] + pub tx_profitability_checker_type: String, + #[serde(rename = "TxProfitabilityMinReward")] + pub tx_profitability_min_reward: String, + #[serde(rename = "IntervalAfterWhichBatchConsolidateAnyway")] + pub interval_after_which_batch_consolidate_anyway: String, + #[serde(rename = "ForkId")] + pub fork_id: u64, + #[serde(rename = "CleanupLockedProofsInterval")] + pub cleanup_locked_proofs_interval: String, + #[serde(rename = "GeneratingProofCleanupThreshold")] + pub generating_proof_cleanup_threshold: String, + #[serde(rename = "GasOffset")] + pub gas_offset: u64, + #[serde(rename = "WitnessURL")] + pub witness_url: Url, + #[serde(rename = "SenderAddress")] + pub sender_address: Address, + #[serde(rename = "SettlementBackend")] + pub settlement_backend: String, + #[serde(rename = "AggLayerTxTimeout")] + pub agg_layer_tx_timeout: String, + #[serde(rename = "AggLayerURL")] + pub agg_layer_url: Url, + #[serde(rename = "UseL1BatchData")] + pub use_l1_batch_data: bool, + #[serde(rename = "UseFullWitness")] + pub use_full_witness: bool, + #[serde(rename = "MaxWitnessRetrievalWorkers")] + pub max_witness_retrieval_workers: u32, + #[serde(rename = "SyncModeOnlyEnabled")] + pub sync_mode_only_enabled: bool, + + #[serde(rename = "StreamClient")] + pub stream_client: StreamClient, + + #[serde(rename = "EthTxManager")] + pub eth_tx_manager: EthTxManager, +} + +#[cfg(any(test, feature = "testutils"))] +impl Default for Aggregator { + fn default() -> Self { + // Values are coming from https://github.com/0xPolygon/agglayer/blob/main/config/default.go#L11 + Self { + chain_id: "1".to_string(), + host: "localhost".to_string(), + port: "8545".to_string(), + retry_time: "10s".to_string(), + verify_proof_interval: "1m".to_string(), + proof_state_polling_interval: "10s".to_string(), + tx_profitability_checker_type: "default".to_string(), + tx_profitability_min_reward: "0.1".to_string(), + interval_after_which_batch_consolidate_anyway: "5m".to_string(), + fork_id: 0, + cleanup_locked_proofs_interval: "1h".to_string(), + generating_proof_cleanup_threshold: "10m".to_string(), + gas_offset: 0, + witness_url: Url::parse("http://localhost:8546").unwrap(), + sender_address: "0x0000000000000000000000000000000000000000" + .parse() + .unwrap(), + settlement_backend: "default".to_string(), + agg_layer_tx_timeout: "30s".to_string(), + agg_layer_url: Url::parse("http://localhost:8547").unwrap(), + use_l1_batch_data: true, + use_full_witness: false, + max_witness_retrieval_workers: 4, + sync_mode_only_enabled: false, + stream_client: StreamClient { + server: "localhost:9092".to_string(), + }, + eth_tx_manager: EthTxManager { + etherman: Etherman { + url: "http://localhost:9093".to_string(), + }, + }, + } + } +} diff --git a/crates/cdk-config/src/l1.rs b/crates/cdk-config/src/l1.rs new file mode 100644 index 00000000..55fb2fb6 --- /dev/null +++ b/crates/cdk-config/src/l1.rs @@ -0,0 +1,39 @@ +use ethers::types::Address; +use serde::Deserialize; + +/// The L1 configuration. +#[derive(Deserialize, Debug, Clone)] +pub struct L1 { + #[serde(rename = "L1ChainID")] + pub l1_chain_id: String, + #[serde(rename = "PolAddr")] + pub pol_addr: Address, + #[serde(rename = "ZkEVMAddr")] + pub zk_evm_addr: Address, + #[serde(rename = "RollupManagerAddr")] + pub rollup_manager_addr: Address, + #[serde(rename = "GlobalExitRootManagerAddr")] + pub global_exit_root_manager_addr: Address, +} + +#[cfg(any(test, feature = "testutils"))] +impl Default for L1 { + fn default() -> Self { + // Values are coming from https://github.com/0xPolygon/agglayer/blob/main/config/default.go#L11 + Self { + l1_chain_id: "1337".to_string(), + pol_addr: "0x5b06837A43bdC3dD9F114558DAf4B26ed49842Ed" + .parse() + .unwrap(), + zk_evm_addr: "0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2" + .parse() + .unwrap(), + rollup_manager_addr: "0x1Fe038B54aeBf558638CA51C91bC8cCa06609e91" + .parse() + .unwrap(), + global_exit_root_manager_addr: "0x1f7ad7caA53e35b4f0D138dC5CBF91aC108a2674" + .parse() + .unwrap(), + } + } +} diff --git a/crates/cdk-config/src/layer1.rs b/crates/cdk-config/src/layer1.rs deleted file mode 100644 index a5bd19d0..00000000 --- a/crates/cdk-config/src/layer1.rs +++ /dev/null @@ -1,28 +0,0 @@ -use ethers::types::Address; -use serde::Deserialize; -use url::Url; - -/// The L1 configuration. -#[derive(Deserialize, Debug, Clone)] -pub struct Layer1 { - #[serde(rename = "ChainID")] - pub chain_id: u64, - #[serde(rename = "NodeURL")] - pub node_url: Url, - #[serde(rename = "RollupManagerContract")] - pub rollup_manager_contract: Address, -} - -#[cfg(any(test, feature = "testutils"))] -impl Default for Layer1 { - fn default() -> Self { - // Values are coming from https://github.com/0xPolygon/agglayer/blob/main/config/default.go#L11 - Self { - chain_id: 1337, - node_url: "http://zkevm-mock-l1-network:8545".parse().unwrap(), - rollup_manager_contract: "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e" - .parse() - .unwrap(), - } - } -} diff --git a/crates/cdk-config/src/lib.rs b/crates/cdk-config/src/lib.rs index 13298073..cb3ecb8f 100644 --- a/crates/cdk-config/src/lib.rs +++ b/crates/cdk-config/src/lib.rs @@ -6,23 +6,33 @@ use serde::Deserialize; pub(crate) const DEFAULT_IP: std::net::Ipv4Addr = std::net::Ipv4Addr::new(0, 0, 0, 0); -pub(crate) mod layer1; +pub(crate) mod aggregator; +pub(crate) mod l1; pub mod log; +pub(crate) mod network_config; +pub(crate) mod sequence_sender; pub(crate) mod telemetry; -pub use layer1::Layer1; pub use log::Log; +use sequence_sender::SequenceSender; /// The Agglayer configuration. #[derive(Deserialize, Debug)] #[cfg_attr(any(test, feature = "testutils"), derive(Default))] pub struct Config { - /// A map of Zkevm node RPC endpoints for each rollup. - /// /// The log configuration. #[serde(rename = "Log")] pub log: Log, #[serde(rename = "ForkUpgradeBatchNumber")] pub fork_upgrade_batch_number: Option, + + #[serde(rename = "NetworkConfig")] + pub network_config: network_config::NetworkConfig, + + #[serde(rename = "Aggregator")] + pub aggregator: aggregator::Aggregator, + + #[serde(rename = "SequenceSender")] + pub sequence_sender: SequenceSender, } diff --git a/crates/cdk-config/src/network_config.rs b/crates/cdk-config/src/network_config.rs new file mode 100644 index 00000000..ffabffad --- /dev/null +++ b/crates/cdk-config/src/network_config.rs @@ -0,0 +1,16 @@ +use crate::l1::L1; +use serde::Deserialize; + +/// The L1 configuration. +#[derive(Deserialize, Debug, Clone)] +pub struct NetworkConfig { + #[serde(rename = "L1")] + pub l1: L1, +} + +#[cfg(any(test, feature = "testutils"))] +impl Default for NetworkConfig { + fn default() -> Self { + Self { l1: L1::default() } + } +} diff --git a/crates/cdk-config/src/sequence_sender.rs b/crates/cdk-config/src/sequence_sender.rs new file mode 100644 index 00000000..006547e8 --- /dev/null +++ b/crates/cdk-config/src/sequence_sender.rs @@ -0,0 +1,50 @@ +use serde::Deserialize; + +/// The SequenceSender configuration. +#[derive(Deserialize, Debug, Clone)] +pub struct SequenceSender { + #[serde(rename = "WaitPeriodSendSequence")] + pub wait_period_send_sequence: String, + #[serde(rename = "LastBatchVirtualizationTimeMaxWaitPeriod")] + pub last_batch_virtualization_time_max_wait_period: String, + #[serde(rename = "MaxTxSizeForL1")] + pub max_tx_size_for_l1: u32, + #[serde(rename = "L2Coinbase")] + pub l2_coinbase: String, + #[serde(rename = "SequencesTxFileName")] + pub sequences_tx_file_name: String, + #[serde(rename = "GasOffset")] + pub gas_offset: u64, + #[serde(rename = "WaitPeriodPurgeTxFile")] + pub wait_period_purge_tx_file: String, + #[serde(rename = "MaxPendingTx")] + pub max_pending_tx: u32, + #[serde(rename = "MaxBatchesForL1")] + pub max_batches_for_l1: u32, + #[serde(rename = "BlockFinality")] + pub block_finality: String, + #[serde(rename = "RPCURL")] + pub rpc_url: String, + #[serde(rename = "GetBatchWaitInterval")] + pub get_batch_wait_interval: String, +} + +// Default trait implementation +impl Default for SequenceSender { + fn default() -> Self { + Self { + wait_period_send_sequence: "1s".to_string(), + last_batch_virtualization_time_max_wait_period: "1s".to_string(), + max_tx_size_for_l1: 1000, + l2_coinbase: "0x".to_string(), + sequences_tx_file_name: "sequences_tx.json".to_string(), + gas_offset: 0, + wait_period_purge_tx_file: "1s".to_string(), + max_pending_tx: 1000, + max_batches_for_l1: 100, + block_finality: "1s".to_string(), + rpc_url: "http://localhost:8545".to_string(), + get_batch_wait_interval: "1s".to_string(), + } + } +} diff --git a/crates/cdk-config/src/telemetry.rs b/crates/cdk-config/src/telemetry.rs index 407145f2..728611ce 100644 --- a/crates/cdk-config/src/telemetry.rs +++ b/crates/cdk-config/src/telemetry.rs @@ -1,11 +1,10 @@ -use std::net::SocketAddr; - -use serde::Deserialize; - use super::DEFAULT_IP; +use serde::Deserialize; +use std::net::SocketAddr; #[derive(Deserialize, Debug, Clone, Copy)] #[serde(rename_all = "PascalCase")] +#[allow(dead_code)] pub struct TelemetryConfig { #[serde(rename = "PrometheusAddr", default = "default_metrics_api_addr")] pub addr: SocketAddr, diff --git a/crates/cdk/Cargo.toml b/crates/cdk/Cargo.toml index 913fc492..964d8f83 100644 --- a/crates/cdk/Cargo.toml +++ b/crates/cdk/Cargo.toml @@ -13,6 +13,15 @@ execute = "0.2.13" toml = "0.8.14" tracing.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter", "json"] } +url = { workspace = true, features = ["serde"] } cdk-config = { path = "../cdk-config" } +serde.workspace = true +serde_json.workspace = true +tempfile = "3.12.0" +alloy-rpc-client = "0.4.2" +alloy-transport-http = "0.4.2" +tokio = "1.40.0" +reqwest = "0.12.8" +alloy-json-rpc = "0.4.2" diff --git a/crates/cdk/build.rs b/crates/cdk/build.rs index 1a01704a..59fffda7 100644 --- a/crates/cdk/build.rs +++ b/crates/cdk/build.rs @@ -23,7 +23,7 @@ fn main() { // Call the make command let output = Command::new("make") - .arg("build") // Create a new make command + .arg("build-go") // Create a new make command .current_dir(build_path) // Set the current directory for the command .output() // Execute the command and capture the output .expect("Failed to execute make command"); diff --git a/crates/cdk/src/allocs_render.rs b/crates/cdk/src/allocs_render.rs new file mode 100644 index 00000000..3b881149 --- /dev/null +++ b/crates/cdk/src/allocs_render.rs @@ -0,0 +1,99 @@ +use anyhow::{Context, Result}; +use serde::{Deserialize, Serialize}; +use serde_json::{self, Value}; +use std::collections::HashMap; +use std::fs::File; +use std::io::Read; +use std::path::Path; + +#[derive(Serialize, Deserialize, Debug, Clone)] +struct Input { + #[serde(rename = "contractName", skip_serializing_if = "Option::is_none")] + contract_name: Option, + #[serde(rename = "accountName", skip_serializing_if = "Option::is_none")] + account_name: Option, + balance: String, + nonce: String, + address: String, + #[serde(skip_serializing_if = "Option::is_none")] + bytecode: Option, + #[serde(skip_serializing_if = "Option::is_none")] + storage: Option>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Wrapper { + pub root: String, + #[serde(rename = "L1Config")] + pub l1_config: L1Config, + genesis: Vec, + #[serde(rename = "rollupCreationBlockNumber")] + pub rollup_creation_block_number: u64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct L1Config { + #[serde(rename = "chainId")] + pub chain_id: u64, + #[serde(rename = "polygonZkEVMGlobalExitRootAddress")] + pub zkevm_global_exit_root_address: String, + #[serde(rename = "polygonRollupManagerAddress")] + pub rollup_manager_address: String, + #[serde(rename = "polTokenAddress")] + pub pol_token_address: String, + #[serde(rename = "polygonZkEVMAddress")] + pub zkevm_address: String, +} + +#[derive(Serialize, Deserialize, Debug)] +struct Output { + #[serde(rename = "contractName", skip_serializing_if = "Option::is_none")] + contract_name: Option, + #[serde(rename = "accountName", skip_serializing_if = "Option::is_none")] + account_name: Option, + balance: Option, + nonce: Option, + code: Option, + storage: Option, +} + +pub struct Rendered { + pub output: String, + pub wrapper: Wrapper, +} + +pub fn render_allocs(genesis_file_path: &str) -> Result { + let path = Path::new(genesis_file_path); + let display = path.display(); + + let mut file = File::open(&path).with_context(|| format!("couldn't open {}", display))?; + + let mut data = String::new(); + file.read_to_string(&mut data) + .with_context(|| format!("couldn't read {}", display))?; + + let wrapper: Wrapper = serde_json::from_str(&data) + .with_context(|| format!("couldn't parse JSON from {}", display))?; + + let mut outputs: HashMap = HashMap::new(); + + for input in wrapper.genesis.clone() { + let output = Output { + contract_name: input.contract_name, + account_name: input.account_name, + balance: Some(input.balance), + nonce: Some(input.nonce), + code: input.bytecode, + storage: input.storage.map(|s| serde_json::to_value(s).unwrap()), + }; + outputs.insert(input.address, output); + } + + // outputs.sort_by(|a, b| a.contract_name.cmp(&b.contract_name)); + + Ok(Rendered { + output: serde_json::to_string_pretty(&outputs) + .with_context(|| "couldn't serialize outputs to JSON")?, + wrapper, + }) +} diff --git a/crates/cdk/src/cli.rs b/crates/cdk/src/cli.rs index 1bf29d2c..12acc8a8 100644 --- a/crates/cdk/src/cli.rs +++ b/crates/cdk/src/cli.rs @@ -11,8 +11,6 @@ pub(crate) struct Cli { long, short, value_hint = ValueHint::FilePath, - global = true, - default_value = "config/example-config.toml", env = "CDK_CONFIG_PATH" )] pub(crate) config: PathBuf, @@ -22,8 +20,6 @@ pub(crate) struct Cli { long, short = 'g', value_hint = ValueHint::FilePath, - global = true, - default_value = "config/genesis.json", env = "CDK_GENESIS_PATH" )] pub(crate) chain: PathBuf, @@ -34,6 +30,15 @@ pub(crate) struct Cli { #[derive(Subcommand)] pub(crate) enum Commands { - Node, + Node { + /// Components to run. + #[arg( + long, + short, + value_hint = ValueHint::CommandString, + env = "CDK_COMPONENTS", + )] + components: Option, + }, Erigon, } diff --git a/crates/cdk/src/config_render.rs b/crates/cdk/src/config_render.rs new file mode 100644 index 00000000..2c230c52 --- /dev/null +++ b/crates/cdk/src/config_render.rs @@ -0,0 +1,130 @@ +use crate::allocs_render::Rendered; +use anyhow::Error; +use cdk_config::Config; +use std::fs; +use std::path::PathBuf; +use tempfile::{tempdir, TempDir}; + +pub fn render(config: &Config, genesis_file: PathBuf, timestamp: u64) -> Result { + // Create a temporary directory + let tmp_dir = tempdir()?; + let chain_id = config.aggregator.chain_id.clone(); + let res = crate::allocs_render::render_allocs(genesis_file.to_str().unwrap())?; + // Write the three files to disk + fs::write( + tmp_dir + .path() + .join(format!("dynamic-{}-allocs.json", chain_id.clone())), + res.output.clone(), + )?; + fs::write( + tmp_dir + .path() + .join(format!("dynamic-{}-chainspec.json", chain_id.clone())), + render_chainspec(chain_id.clone()), + )?; + fs::write( + tmp_dir + .path() + .join(format!("dynamic-{}-conf.json", chain_id.clone())), + render_conf(res.wrapper.root.clone(), timestamp), + )?; + + let contents = render_yaml(config, res); + fs::write( + tmp_dir + .path() + .join(format!("dynamic-{}.yaml", chain_id.clone())), + contents, + )?; + + Ok(tmp_dir) +} + +fn render_chainspec(chain_id: String) -> String { + format!( + r#" +{{ + "ChainName": "dynamic-{chain_id}", + "chainId": {chain_id}, + "consensus": "ethash", + "homesteadBlock": 0, + "daoForkBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 0, + "londonBlock": 9999999999999999999999999999999999999999999999999, + "arrowGlacierBlock": 9999999999999999999999999999999999999999999999999, + "grayGlacierBlock": 9999999999999999999999999999999999999999999999999, + "terminalTotalDifficulty": 58750000000000000000000, + "terminalTotalDifficultyPassed": false, + "shanghaiTime": 9999999999999999999999999999999999999999999999999, + "cancunTime": 9999999999999999999999999999999999999999999999999, + "pragueTime": 9999999999999999999999999999999999999999999999999, + "ethash": {{}} +}} + "# + ) +} + +fn render_conf(root: String, timestamp: u64) -> String { + format!( + r#" +{{ + "root": {:?}, + "timestamp": {:?}, + "gasLimit": 0, + "difficulty": 0 +}} + "#, + root, timestamp + ) +} + +// render_config renders the configuration file for the Erigon node. +fn render_yaml(config: &Config, res: Rendered) -> String { + format!( + r#" +chain: dynamic-{chain_id} +zkevm.l2-chain-id: {chain_id} +zkevm.l2-sequencer-rpc-url: {l2_sequencer_rpc_url} +zkevm.l2-datastreamer-url: {datastreamer_host} +zkevm.l1-chain-id: {l1_chain_id} +zkevm.l1-rpc-url: {l1_rpc_url} +zkevm.address-sequencer: {sequencer_address} +zkevm.address-zkevm: {zkevm_address} +zkevm.address-rollup: {rollup_address} +zkevm.address-ger-manager: {ger_manager_address} +zkevm.l1-matic-contract-address: {pol_token_address} +zkevm.l1-first-block: {l1_first_block} +datadir: ./data/dynamic-{chain_id} + +externalcl: true +http: true +private.api.addr: "localhost:9092" +zkevm.rpc-ratelimit: 250 +zkevm.datastream-version: 3 +http.api: [eth, debug,net,trace,web3,erigon,zkevm] +http.addr: "0.0.0.0" +http.vhosts: any +http.corsdomain: any +ws: true +"#, + chain_id = config.aggregator.chain_id.clone(), + l2_sequencer_rpc_url = config.aggregator.witness_url.to_string(), + datastreamer_host = config.aggregator.stream_client.server, + l1_rpc_url = config.aggregator.eth_tx_manager.etherman.url, + l1_chain_id = config.network_config.l1.l1_chain_id, + sequencer_address = config.sequence_sender.l2_coinbase, + zkevm_address = res.wrapper.l1_config.zkevm_address, + rollup_address = res.wrapper.l1_config.rollup_manager_address, + ger_manager_address = res.wrapper.l1_config.zkevm_global_exit_root_address, + pol_token_address = res.wrapper.l1_config.pol_token_address, + l1_first_block = res.wrapper.rollup_creation_block_number + ) +} diff --git a/crates/cdk/src/main.rs b/crates/cdk/src/main.rs index 99a8a752..7f7f3991 100644 --- a/crates/cdk/src/main.rs +++ b/crates/cdk/src/main.rs @@ -1,4 +1,6 @@ //! Command line interface. +use alloy_rpc_client::ClientBuilder; +use alloy_rpc_client::ReqwestClient; use cdk_config::Config; use clap::Parser; use cli::Cli; @@ -6,28 +8,59 @@ use execute::Execute; use std::env; use std::path::PathBuf; use std::process::Command; -use std::sync::Arc; +use url::Url; +pub mod allocs_render; mod cli; +mod config_render; mod logging; -const CDK_CLIENT_PATH: &str = "cdk-node"; -const CDK_ERIGON_PATH: &str = "cdk-erigon"; +const CDK_CLIENT_BIN: &str = "cdk-node"; +const CDK_ERIGON_BIN: &str = "cdk-erigon"; -fn main() -> anyhow::Result<()> { +#[tokio::main] +async fn main() -> anyhow::Result<()> { dotenvy::dotenv().ok(); let cli = Cli::parse(); + // Read the config + let config = read_config(cli.config.clone())?; + + // Initialize the logger + logging::tracing(&config.log); + + println!( + r#"🐼 + _____ _ _____ _____ _ __ + | __ \ | | / ____| __ \| |/ / + | |__) |__ | |_ _ __ _ ___ _ __ | | | | | | ' / + | ___/ _ \| | | | |/ _` |/ _ \| '_ \ | | | | | | < + | | | (_) | | |_| | (_| | (_) | | | | | |____| |__| | . \ + |_| \___/|_|\__, |\__, |\___/|_| |_| \_____|_____/|_|\_\ + __/ | __/ | + |___/ |___/ +"# + ); + match cli.cmd { - cli::Commands::Node {} => node(cli.config)?, - cli::Commands::Erigon {} => erigon(cli.config)?, + cli::Commands::Node { components } => node(cli.config, components)?, + cli::Commands::Erigon {} => erigon(config, cli.chain).await?, // _ => forward()?, } Ok(()) } +// read_config reads the configuration file and returns the configuration. +fn read_config(config_path: PathBuf) -> anyhow::Result { + let config = std::fs::read_to_string(config_path) + .map_err(|e| anyhow::anyhow!("Failed to read configuration file: {}", e))?; + let config: Config = toml::from_str(&config)?; + + Ok(config) +} + /// This is the main node entrypoint. /// /// This function starts everything needed to run an Agglayer node. @@ -36,29 +69,27 @@ fn main() -> anyhow::Result<()> { /// /// This function returns on fatal error or after graceful shutdown has /// completed. -pub fn node(config_path: PathBuf) -> anyhow::Result<()> { - // Load the configuration file - let config_read = std::fs::read_to_string(config_path.clone()); - let toml_str = match config_read { - Ok(toml) => toml, - Err(e) => { - eprintln!( - "Failed to read configuration file, from path: {}", - config_path.to_str().unwrap() - ); - return Err(e.into()); - } - }; - let config: Arc = Arc::new(toml::from_str(&toml_str)?); - - let mut bin_path = env::var("CARGO_MANIFEST_DIR").unwrap_or(CDK_CLIENT_PATH.into()); - if bin_path != CDK_CLIENT_PATH { - bin_path = format!("{}/../../{}", bin_path, CDK_CLIENT_PATH); +pub fn node(config_path: PathBuf, components: Option) -> anyhow::Result<()> { + // This is to find the erigon binary when running in development mode + // otherwise it will use system path + let mut bin_path = env::var("CARGO_MANIFEST_DIR").unwrap_or(CDK_CLIENT_BIN.into()); + if bin_path != CDK_CLIENT_BIN { + bin_path = format!("{}/../../target/{}", bin_path, CDK_CLIENT_BIN); } + let components_param = match components { + Some(components) => format!("-components={}", components), + None => "".to_string(), + }; + // Run the node passing the config file path as argument let mut command = Command::new(bin_path.clone()); - command.args(&["run", "-cfg", config_path.canonicalize()?.to_str().unwrap()]); + command.args(&[ + "run", + "-cfg", + config_path.canonicalize()?.to_str().unwrap(), + components_param.as_str(), + ]); let output_result = command.execute_output(); let output = match output_result { @@ -82,38 +113,40 @@ pub fn node(config_path: PathBuf) -> anyhow::Result<()> { eprintln!("Interrupted!"); } - // Initialize the logger - logging::tracing(&config.log); - Ok(()) } /// This is the main erigon entrypoint. /// This function starts everything needed to run an Erigon node. -pub fn erigon(config_path: PathBuf) -> anyhow::Result<()> { - // Load the configuration file - let _config: Arc = Arc::new(toml::from_str(&std::fs::read_to_string( - config_path.clone(), - )?)?); - - let mut bin_path = env::var("CARGO_MANIFEST_DIR").unwrap_or(CDK_ERIGON_PATH.into()); - if bin_path != CDK_ERIGON_PATH { - bin_path = format!("{}/../../{}", bin_path, CDK_ERIGON_PATH); - } - - let mut command = Command::new(bin_path); - - // TODO: 1. Prepare erigon config files or flags - - command.args(&["--config", config_path.to_str().unwrap()]); - - let output = command.execute_output().unwrap(); +pub async fn erigon(config: Config, genesis_file: PathBuf) -> anyhow::Result<()> { + // Render configuration files + let chain_id = config.aggregator.chain_id.clone(); + let rpc_url = Url::parse(&config.sequence_sender.rpc_url).unwrap(); + let timestamp = get_timestamp(rpc_url).await.unwrap(); + let erigon_config_path = config_render::render(&config, genesis_file, timestamp)?; + + println!("Starting erigon with config: {:?}", erigon_config_path); + + // Run cdk-erigon in system path + let output = Command::new(CDK_ERIGON_BIN) + .args(&[ + "--config", + erigon_config_path + .path() + .join(format!("dynamic-{}.yaml", chain_id)) + .to_str() + .unwrap(), + ]) + .execute_output() + .unwrap(); if let Some(exit_code) = output.status.code() { - if exit_code == 0 { - println!("Ok."); - } else { - eprintln!("Failed."); + if exit_code != 0 { + eprintln!( + "Failed. Leaving configuration files in: {:?}", + erigon_config_path + ); + std::process::exit(1); } } else { eprintln!("Interrupted!"); @@ -121,3 +154,25 @@ pub fn erigon(config_path: PathBuf) -> anyhow::Result<()> { Ok(()) } + +/// Call the rpc server to retrieve the first batch timestamp +async fn get_timestamp(url: Url) -> Result { + // Instantiate a new client over a transport. + let client: ReqwestClient = ClientBuilder::default().http(url); + + // Prepare a request to the server. + let request = client.request("zkevm_getBatchByNumber", vec!["0"]); + + // Poll the request to completion. + let batch_json: Batch = request.await.unwrap(); + + // Parse the timestamp hex string into u64. + let ts = u64::from_str_radix(batch_json.timestamp.trim_start_matches("0x"), 16)?; + + Ok(ts) +} + +#[derive(serde::Deserialize, Debug, Clone)] +struct Batch { + timestamp: String, +}