diff --git a/Cargo.lock b/Cargo.lock index 9382d897..d81df05f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,9 +79,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0be470ab41e3aaed6c54dbb2b6224d3048de467d8009cf9d5d32a8b8957ef7" +checksum = "0cd58a5dd60681ca6faffe2abf6507409e8f4f18e528c931930371e3a36df13a" dependencies = [ "alloy-consensus", "alloy-contract", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4fbb5e716faa10fc4e7a122307afcf55bae7272fc69286ee3eee881f757c66" +checksum = "6b2123d190c823301be54e14a12ef10c00823d90047a140aa41650c26668d5b1" dependencies = [ "alloy-eips", "alloy-primitives 1.1.0", @@ -140,9 +140,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42c04d03d9ee6b6768cad687df5a360fc58714f39a37c971b907a8965717636d" +checksum = "c89b71e608e06b3d55169595c8ff39bd2177389508b0e91da8400b48d88d3afd" dependencies = [ "alloy-consensus", "alloy-eips", @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ff39ab8bf0d23caa41ec1898d80ad1bcb037c94a048141ac4a961980164e65" +checksum = "210f50a648d28ee4266ff42523186efab61dd54d2ab2f8853fe38ad45d254756" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -230,9 +230,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804cefe429015b4244966c006d25bda5545fa9db5990e9c9079faf255052f50a" +checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" dependencies = [ "alloy-primitives 1.1.0", "alloy-rlp", @@ -243,9 +243,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22c3699f23cea35d97a0a911b42c3cfd54dd95233df09307f5ebe52e0a74ad6e" +checksum = "f7d2126e39e1557f0e661e0a5a36748a0bf280490ca2c0a1d149a55d2c2c8675" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -263,9 +263,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c5a4e3f60f0b53b5dbd13904694e775a23ff98a43d6dd640b753b72669b993" +checksum = "1cf47e07c0dbcb8f1fa2c903d9eb32b14fec3dc04e60e7fee29fc0d3799fba34" dependencies = [ "alloy-eips", "alloy-primitives 1.1.0", @@ -301,9 +301,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea71d308c1f3e42172c7fe9dccc6e63d97fa0cfd21d21f73c04d5e2640826f64" +checksum = "83498cbeb8353b78985ad6c127fc7376767c5d341e05e3f641076d61f3a78471" dependencies = [ "alloy-primitives 1.1.0", "alloy-sol-types", @@ -315,9 +315,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd432f53775e6ef85cfc8a3c90f174786bdc15d5cac379dcea01bd0e6f93edc" +checksum = "2c443287af072731c28fb6c09b62fb882257a4d20fc151bc110357a56fb19559" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -341,9 +341,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2dea138d01f0e9739dee905a9e40a0f2347dd217360d813b6b7967ee8c0a8e" +checksum = "ad99d5b76aed5ed7bd752a9ef5c5e4acf74e8956df80080a492dc83e96d7067e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -354,9 +354,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5609b9f21ea725a76b42e97c2baa81fc671c9d1b02248b378b7935b73ebe4024" +checksum = "6df1cbb080e0f41874a2f492939444852f4bcad754a4bfa7dc8368f4abb79640" dependencies = [ "alloy-genesis", "alloy-hardforks", @@ -421,9 +421,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1e1dc8a0a368a62455b526a037557b1e57c7fda652748e5e2c66db517906ed" +checksum = "39721fb4c0526ec2c98ad47f5010ea6930ba121e56f46a0ff2746ed761e92a40" dependencies = [ "alloy-chains", "alloy-consensus", @@ -468,9 +468,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b322e679094ec8876d05e69f75f0c16b056514422ed79187bac1ee42ac432c75" +checksum = "bbeb2dd970e7d70d2d408bc6fba391ad66406d766312399a42d6f93a9586f818" dependencies = [ "alloy-json-rpc", "alloy-primitives 1.1.0", @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97da6111d0232cc890aa4d334b5e427aa25491cf34adbe9806fa440a6f32650f" +checksum = "0e59b7ec68078fcae32736052a5f56ffe1a01da267c10692757a9ae70698bb99" dependencies = [ "alloy-json-rpc", "alloy-primitives 1.1.0", @@ -539,9 +539,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835291d2f5423e02f755872b329c0bae97743936f596749f6fb6f0cf4de1324e" +checksum = "933d9ad7e50156f1cd5574227e6f15c6d237d50006b1754e3f3564d6e8293ed5" dependencies = [ "alloy-primitives 1.1.0", "alloy-rpc-types-anvil", @@ -555,9 +555,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ce5c36f947103fa98278c20f60dac4c35c11bc2a15a0e255845345c471af4d" +checksum = "6895febd23a9fd75a58d2fb8fa27e6ed84f4aaada309c6905e156af37afbb6e6" dependencies = [ "alloy-primitives 1.1.0", "alloy-rpc-types-eth", @@ -567,9 +567,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c8536c15442b001046dcaff415067600231261e7c53767e74e69d15f72f651" +checksum = "7233023bbb100b0527e5eb7ad9fe87b74a1dfed75bb202302c318f1cc68094ab" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -578,9 +578,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74029c8c08c3332779c6a5b98f32a6a47d6e61c847a3d18cffcc56c8c65016c2" +checksum = "e393e02f83d17384a7595d5288d1217cab0863ad5f10b0824325d814e7bf21c5" dependencies = [ "alloy-primitives 1.1.0", "serde", @@ -588,9 +588,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79e3df17a03b9e1ee61a40ef38deb5cd9b4fcd916642a23f29b78783c5fd335" +checksum = "8298431d08611686fb021210b12fb229657490e3bd0658acdd709a19886b6cdf" dependencies = [ "alloy-consensus", "alloy-eips", @@ -605,9 +605,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da690eafe37fe096037f8820b6bf2382f3ea68120d06a4253e4ac725a7e652dd" +checksum = "e5c2b3bd2a36df4417a349a5405b5130af948a72bf2f305fc0084cac5fbe5cc1" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -625,9 +625,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a337d99df8adaaf6ec2707bf8ee410c927b89dd64cf9fe67558a18f4917d10d7" +checksum = "2d4c2404b7ee0bd81900d63c61adef877992f430d7c932d4f3ce2a79e3f3f822" dependencies = [ "alloy-primitives 1.1.0", "alloy-rpc-types-eth", @@ -639,9 +639,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d2182b8ce80589c173cd847989f728a1bd9cfc0df6dab404f39a4125930052" +checksum = "ff9f501c596cc75a973f0f9dd3dce796d18a9454426807f30c6d28f3141540f6" dependencies = [ "alloy-primitives 1.1.0", "alloy-rpc-types-eth", @@ -651,9 +651,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261be2da2ef0bbbf80eed153c995822725cbef193e49eb251e2bf72cac29dbaf" +checksum = "ec9f6973e552b33c9e0733165ef3f6cea3cc70617d5768260e98a29aab5e974e" dependencies = [ "alloy-primitives 1.1.0", "serde", @@ -662,9 +662,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fdf929ce72d18aa40974ecaa2cd77c5062a0baa105fdb95e6aa5609642d7210" +checksum = "873c4e578c20af87b62b66d6f6c1cd81ab192f52515d4e63ddfecba1ac69216b" dependencies = [ "alloy-primitives 1.1.0", "async-trait", @@ -677,15 +677,16 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94910e0d75f086d4ed15d6a884170f648c28d06e4a8516156ea90204c0560595" +checksum = "52bbc5479f66f49f06c91b69c4ffd33b4df3b6f286c55c2dc94fb7ac8571053a" dependencies = [ "alloy-consensus", "alloy-network", "alloy-primitives 1.1.0", "alloy-signer", "async-trait", + "eth-keystore", "k256", "rand 0.8.5", "thiserror 2.0.12", @@ -767,9 +768,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4f3654d5195c0c3f502bfd6ed299ea9eb5cb275d7a88d04ce0d189bca416b2" +checksum = "db88a480955a3a1a6dbcd51076b03f522c64fb4ecb74545c4d38b0ca58d9fbe6" dependencies = [ "alloy-json-rpc", "alloy-primitives 1.1.0", @@ -790,9 +791,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a9372fba202370973748d76c2891344cbacfb012d44a8ed62135ba53d4408e" +checksum = "1ba0d8eace41128b4dbf87adff5d63347b8004977aa7f9c62b63308539dd2a29" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -805,9 +806,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc96665d4e52d55b48998f955bb7253e2b41b1d96200c47ca5b187f0239e602" +checksum = "6c8d9fcdeeaeb9bfa08bc70031c9518f0d9d31766c0fa71500737b4a4a215249" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -825,9 +826,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.15.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "334b1e456e62cf561d80feda0604e1f80e898d29a1fab426ca25020e7628fa59" +checksum = "c7d39c87d5b9f3dd8e8efdc95bd3aaeef947e7938dbf45cffda9bd5689cd9517" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -2515,46 +2516,20 @@ dependencies = [ "uint", ] -[[package]] -name = "ethers" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "ethers-addressbook 2.0.13", - "ethers-contract 2.0.13", - "ethers-core 2.0.13", - "ethers-etherscan 2.0.13", - "ethers-middleware 2.0.13", - "ethers-providers 2.0.13", - "ethers-signers 2.0.13", - "ethers-solc 2.0.13", -] - [[package]] name = "ethers" version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" dependencies = [ - "ethers-addressbook 2.0.14", - "ethers-contract 2.0.14", - "ethers-core 2.0.14", - "ethers-etherscan 2.0.14", - "ethers-middleware 2.0.14", - "ethers-providers 2.0.14", - "ethers-signers 2.0.14", - "ethers-solc 2.0.14", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "ethers-core 2.0.13", - "once_cell", - "serde", - "serde_json", + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", ] [[package]] @@ -2563,28 +2538,10 @@ version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" dependencies = [ - "ethers-core 2.0.14", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "const-hex", - "ethers-contract-abigen 2.0.13", - "ethers-contract-derive 2.0.13", - "ethers-core 2.0.13", - "ethers-providers 2.0.13", - "futures-util", + "ethers-core", "once_cell", - "pin-project", "serde", "serde_json", - "thiserror 1.0.69", ] [[package]] @@ -2594,10 +2551,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" dependencies = [ "const-hex", - "ethers-contract-abigen 2.0.14", - "ethers-contract-derive 2.0.14", - "ethers-core 2.0.14", - "ethers-providers 2.0.14", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", "futures-util", "once_cell", "pin-project", @@ -2606,29 +2563,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "ethers-contract-abigen" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core 2.0.13", - "ethers-etherscan 2.0.13", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest 0.11.27", - "serde", - "serde_json", - "syn 2.0.101", - "toml", - "walkdir", -] - [[package]] name = "ethers-contract-abigen" version = "2.0.14" @@ -2638,8 +2572,8 @@ dependencies = [ "Inflector", "const-hex", "dunce", - "ethers-core 2.0.14", - "ethers-etherscan 2.0.14", + "ethers-core", + "ethers-etherscan", "eyre", "prettyplease", "proc-macro2", @@ -2653,21 +2587,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "ethers-contract-derive" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen 2.0.13", - "ethers-core 2.0.13", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.101", -] - [[package]] name = "ethers-contract-derive" version = "2.0.14" @@ -2676,43 +2595,14 @@ checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" dependencies = [ "Inflector", "const-hex", - "ethers-contract-abigen 2.0.14", - "ethers-core 2.0.14", + "ethers-contract-abigen", + "ethers-core", "proc-macro2", "quote", "serde_json", "syn 2.0.101", ] -[[package]] -name = "ethers-core" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand 0.8.5", - "rlp 0.5.2", - "serde", - "serde_json", - "strum 0.26.3", - "syn 2.0.101", - "tempfile", - "thiserror 1.0.69", - "tiny-keccak", - "unicode-xid", -] - [[package]] name = "ethers-core" version = "2.0.14" @@ -2743,21 +2633,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "ethers-etherscan" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "chrono", - "ethers-core 2.0.13", - "reqwest 0.11.27", - "semver 1.0.26", - "serde", - "serde_json", - "thiserror 1.0.69", - "tracing", -] - [[package]] name = "ethers-etherscan" version = "2.0.14" @@ -2765,7 +2640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" dependencies = [ "chrono", - "ethers-core 2.0.14", + "ethers-core", "reqwest 0.11.27", "semver 1.0.26", "serde", @@ -2774,31 +2649,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "ethers-middleware" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract 2.0.13", - "ethers-core 2.0.13", - "ethers-providers 2.0.13", - "ethers-signers 2.0.13", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest 0.11.27", - "serde", - "serde_json", - "thiserror 1.0.69", - "tokio", - "tracing", - "tracing-futures", - "url", -] - [[package]] name = "ethers-middleware" version = "2.0.14" @@ -2807,11 +2657,11 @@ checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" dependencies = [ "async-trait", "auto_impl", - "ethers-contract 2.0.14", - "ethers-core 2.0.14", - "ethers-etherscan 2.0.14", - "ethers-providers 2.0.14", - "ethers-signers 2.0.14", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", "futures-channel", "futures-locks", "futures-util", @@ -2826,42 +2676,6 @@ dependencies = [ "url", ] -[[package]] -name = "ethers-providers" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.7", - "bytes", - "const-hex", - "enr", - "ethers-core 2.0.13", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "http 0.2.12", - "instant", - "jsonwebtoken", - "once_cell", - "pin-project", - "reqwest 0.11.27", - "serde", - "serde_json", - "thiserror 1.0.69", - "tokio", - "tokio-tungstenite 0.20.1", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "ws_stream_wasm", -] - [[package]] name = "ethers-providers" version = "2.0.14" @@ -2874,7 +2688,7 @@ dependencies = [ "bytes", "const-hex", "enr", - "ethers-core 2.0.14", + "ethers-core", "futures-core", "futures-timer", "futures-util", @@ -2899,24 +2713,6 @@ dependencies = [ "ws_stream_wasm", ] -[[package]] -name = "ethers-signers" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core 2.0.13", - "rand 0.8.5", - "sha2", - "thiserror 1.0.69", - "tracing", -] - [[package]] name = "ethers-signers" version = "2.0.14" @@ -2929,44 +2725,13 @@ dependencies = [ "const-hex", "elliptic-curve", "eth-keystore", - "ethers-core 2.0.14", + "ethers-core", "rand 0.8.5", "sha2", "thiserror 1.0.69", "tracing", ] -[[package]] -name = "ethers-solc" -version = "2.0.13" -source = "git+https://github.com/Lagrange-Labs/ethers-rs?branch=get-proof-0x#07ee38ea0cbdade798717805af28b6e4779071f8" -dependencies = [ - "cfg-if", - "const-hex", - "dirs", - "dunce", - "ethers-core 2.0.13", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.26", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror 1.0.69", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - [[package]] name = "ethers-solc" version = "2.0.14" @@ -2977,7 +2742,7 @@ dependencies = [ "const-hex", "dirs", "dunce", - "ethers-core 2.0.14", + "ethers-core", "glob", "home", "md-5", @@ -3405,7 +3170,7 @@ dependencies = [ [[package]] name = "gnark-utils" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "anyhow", "base64 0.22.1", @@ -3425,7 +3190,7 @@ dependencies = [ [[package]] name = "groth16_framework" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -4322,17 +4087,17 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" name = "lgn-auth" version = "1.1.2" dependencies = [ + "alloy", "anyhow", "base64 0.22.1", "elliptic-curve", - "ethers 2.0.13", - "ethers-core 2.0.13", "generic-array", "hex", "jwt", "rand 0.8.5", "serde", "serde_json", + "serde_with 3.12.0", ] [[package]] @@ -4341,7 +4106,6 @@ version = "1.1.8" dependencies = [ "alloy", "derive-debug-plus", - "ethers 2.0.14", "mp2_common", "mp2_v1", "object_store", @@ -4360,8 +4124,8 @@ dependencies = [ "bincode", "blake3", "bytes", - "ethers 2.0.14", "exponential-backoff", + "futures", "groth16_framework", "lgn-messages", "mp2_common", @@ -4379,6 +4143,7 @@ dependencies = [ name = "lgn-worker" version = "1.1.8" dependencies = [ + "alloy", "anyhow", "backtrace", "bincode", @@ -4386,7 +4151,6 @@ dependencies = [ "clap", "config", "elliptic-curve", - "ethers 2.0.13", "groth16_framework", "hex", "jwt", @@ -4730,7 +4494,7 @@ dependencies = [ [[package]] name = "mp2_common" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -4757,7 +4521,7 @@ dependencies = [ [[package]] name = "mp2_test" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -4776,7 +4540,7 @@ dependencies = [ [[package]] name = "mp2_v1" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -4797,6 +4561,7 @@ dependencies = [ "plonky2_crypto", "plonky2_ecdsa", "plonky2_ecgfp5", + "poseidon2_plonky2", "rand 0.8.5", "recursion_framework", "rlp 0.6.1", @@ -5184,7 +4949,7 @@ dependencies = [ [[package]] name = "parsil" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -5526,7 +5291,7 @@ dependencies = [ "dotenv", "ed25519-dalek", "env_logger 0.10.2", - "ethers 2.0.14", + "ethers", "ff", "futures", "hex", @@ -5998,12 +5763,13 @@ dependencies = [ [[package]] name = "recursion_framework" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "anyhow", "log", "mp2_common", "plonky2", + "poseidon2_plonky2", "serde", ] @@ -6568,7 +6334,7 @@ dependencies = [ [[package]] name = "ryhope" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "anyhow", "bb8", @@ -8129,7 +7895,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "verifiable-db" version = "2.1.1" -source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?rev=2.1.1#399b10c44232935e6da8af4e64b9e172dd228eaf" +source = "git+https://github.com/Lagrange-Labs/mapreduce-plonky2.git?branch=main#42c98af9675b4a4d45614ed7e22581776e4f96c2" dependencies = [ "alloy", "anyhow", @@ -8145,6 +7911,7 @@ dependencies = [ "plonky2_crypto", "plonky2_ecdsa", "plonky2_ecgfp5", + "poseidon2_plonky2", "rand 0.8.5", "recursion_framework", "ryhope", diff --git a/Cargo.toml b/Cargo.toml index 057f4c0f..684c6b3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,14 @@ resolver = "2" members = ["lgn-auth", "lgn-messages", "lgn-provers", "lgn-worker"] [workspace.dependencies] -groth16_framework = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", rev = "2.1.1" } -mp2_common = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", rev = "2.1.1" } -mp2_v1 = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", rev = "2.1.1" } -parsil = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", rev = "2.1.1" } -verifiable-db = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", rev = "2.1.1" } +groth16_framework = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", branch = "main" } +mp2_common = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", branch = "main" } +mp2_v1 = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", branch = "main" } +parsil = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", branch = "main" } +verifiable-db = { git = "https://github.com/Lagrange-Labs/mapreduce-plonky2.git", branch = "main" } -alloy = { version = "0.15", features = [ "serde" ] } +alloy = { version = "1.0", features = [ "serde" ] } +futures = { version = "0.3" } anyhow = { version = "1.0" } backtrace = { version = "0.3" } base64 = { version = "0.22" } @@ -20,8 +21,6 @@ clap = { version = "4.5", default-features = false } config = { version = "0.15", default-features = false } derive-debug-plus = { version = "0.5" } elliptic-curve = { version = "0.13", default-features = false } -ethers = { version = "2.0" } -ethers-core = { git = "https://github.com/Lagrange-Labs/ethers-rs", branch = "get-proof-0x", default-features = false } generic-array = { version = "0.14", default-features = false } hex = { version = "0.4" } jwt = { version = "0.16" } @@ -44,6 +43,7 @@ semver = { version = "1.0.26" } serde = { version = "1.0", features = ["derive"] } serde_derive = { version = "1.0" } serde_json = { version = "1.0" } +serde_with = { version = "3.12" } thiserror = { version = "2" } tokio = { version = "1.44" } tokio-stream = { version = "0.1" } diff --git a/devenv.nix b/devenv.nix index e3fe54fd..071dc414 100644 --- a/devenv.nix +++ b/devenv.nix @@ -43,7 +43,7 @@ in pull = []; }; - packages = [ pkgs.perl pkgs.git pkgs.openssl pkgs.pkg-config pkgs.protobuf ] + packages = [ pkgs.perl pkgs.git pkgs.openssl pkgs.pkg-config pkgs.protobuf pkgs.rustup ] ++ lib.optionals pkgs.stdenv.targetPlatform.isDarwin [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.SystemConfiguration @@ -84,7 +84,7 @@ in languages = { go.enable = true; rust = { - enable = true; + enable = false; channel = "nightly"; }; }; diff --git a/lgn-auth/Cargo.toml b/lgn-auth/Cargo.toml index 2d3f2f0e..4253b437 100644 --- a/lgn-auth/Cargo.toml +++ b/lgn-auth/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" anyhow = { workspace = true } base64 = { workspace = true } elliptic-curve = { workspace = true } -ethers = { git = "https://github.com/Lagrange-Labs/ethers-rs", default-features = false, features = [ "rustls" ], branch = "get-proof-0x" } -ethers-core = { workspace = true } +alloy = { workspace = true } generic-array = { workspace = true } hex = { workspace = true } jwt = { workspace = true } rand = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +serde_with = { workspace = true } diff --git a/lgn-auth/src/jwt.rs b/lgn-auth/src/jwt.rs index 392efdd6..150acbb8 100644 --- a/lgn-auth/src/jwt.rs +++ b/lgn-auth/src/jwt.rs @@ -1,27 +1,33 @@ //! JWT authorization logic used in both worker and gateway +use alloy::primitives::eip191_hash_message; +use alloy::primitives::Signature; +use alloy::signers::k256::ecdsa::RecoveryId; +use alloy::signers::k256::ecdsa::Signature as RecoverableSignature; +use alloy::signers::k256::ecdsa::Signature as K256Signature; +use alloy::signers::k256::ecdsa::SigningKey; +use alloy::signers::k256::ecdsa::VerifyingKey; +use alloy::signers::k256::PublicKey; +use alloy::signers::local::LocalSigner; +use alloy::signers::SignerSync; use anyhow::Result; use base64::prelude::BASE64_URL_SAFE_NO_PAD; use base64::Engine; use elliptic_curve::consts::U32; use elliptic_curve::sec1::ToEncodedPoint; -use ethers::prelude::LocalWallet; -use ethers::prelude::Signature; -use ethers_core::k256::ecdsa::RecoveryId; -use ethers_core::k256::ecdsa::Signature as RecoverableSignature; -use ethers_core::k256::ecdsa::Signature as K256Signature; -use ethers_core::k256::ecdsa::VerifyingKey; -use ethers_core::k256::PublicKey; -use ethers_core::utils::hash_message; use generic_array::GenericArray; use jwt::Claims; use jwt::ToBase64; use serde::Deserialize; use serde::Serialize; +use serde_with::serde_as; +use serde_with::DisplayFromStr; +#[serde_as] #[derive(Clone, Debug, Serialize, Deserialize)] pub struct JWTAuth { claims: Claims, + #[serde_as(as = "DisplayFromStr")] signature: Signature, } @@ -29,15 +35,11 @@ impl JWTAuth { /// Create a new instance and sign with the wallet. pub fn new( claims: Claims, - wallet: &LocalWallet, + wallet: &LocalSigner, ) -> Result { let msg = claims.to_base64()?; - // `sign_message` is an async function: - // - // Seems not make sense, so copy the code here. - let message_hash = hash_message(msg.as_bytes()); - let signature = wallet.sign_hash(message_hash)?; + let signature = wallet.sign_message_sync(msg.as_bytes())?; Ok(Self { claims, signature }) } @@ -66,7 +68,7 @@ impl JWTAuth { /// Recovers the Lagrange public key which was used to sign the claims. pub fn recover_public_key(&self) -> Result { let msg = self.claims.to_base64()?; - let message_hash = hash_message(msg.as_bytes()); + let message_hash = eip191_hash_message(msg.as_bytes()); let (recoverable_sig, recovery_id) = self.as_signature()?; let verifying_key = VerifyingKey::recover_from_prehash( @@ -94,12 +96,10 @@ impl JWTAuth { /// Copied from ethers-rs since it's private: /// fn as_signature(&self) -> Result<(RecoverableSignature, RecoveryId)> { - let mut recovery_id = self.signature.recovery_id()?; + let mut recovery_id = self.signature.recid(); let mut signature = { - let mut r_bytes = [0u8; 32]; - let mut s_bytes = [0u8; 32]; - self.signature.r.to_big_endian(&mut r_bytes); - self.signature.s.to_big_endian(&mut s_bytes); + let r_bytes: [_; 32] = self.signature.r().to_be_bytes(); + let s_bytes: [_; 32] = self.signature.s().to_be_bytes(); let gar: &GenericArray = GenericArray::from_slice(&r_bytes); let gas: &GenericArray = GenericArray::from_slice(&s_bytes); K256Signature::from_scalars(*gar, *gas)? @@ -125,7 +125,6 @@ mod tests { use elliptic_curve::sec1::Coordinates; use jwt::RegisteredClaims; - use rand::thread_rng; use super::*; @@ -133,7 +132,7 @@ mod tests { #[test] fn test_middleware_jwt_auth_process() -> Result<()> { // Create a random wallet. - let wallet = LocalWallet::new(&mut thread_rng()); + let wallet = LocalSigner::random(); let expected_public_key = get_public_key_by_wallet(&wallet); // Encode the JWT auth. @@ -150,8 +149,8 @@ mod tests { } /// Get the public key from wallet. - fn get_public_key_by_wallet(wallet: &LocalWallet) -> String { - let public_key = wallet.signer().verifying_key().to_encoded_point(false); + fn get_public_key_by_wallet(wallet: &LocalSigner) -> String { + let public_key = wallet.credential().verifying_key().to_encoded_point(false); // We use another method (different with `recover_public_key`) to get // the coordinates of public key, then combine the big-endian bytes. diff --git a/lgn-messages/Cargo.toml b/lgn-messages/Cargo.toml index 7928ed52..67157a89 100644 --- a/lgn-messages/Cargo.toml +++ b/lgn-messages/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [dependencies] alloy.workspace = true derive-debug-plus = { workspace = true } -ethers = { workspace = true } mp2_common = { workspace = true } mp2_v1 = { workspace = true } object_store = { workspace = true } diff --git a/lgn-messages/src/lib.rs b/lgn-messages/src/lib.rs index 974bc769..974ab31c 100644 --- a/lgn-messages/src/lib.rs +++ b/lgn-messages/src/lib.rs @@ -1,4 +1,4 @@ -use ethers::types::H256; +use alloy::primitives::FixedBytes; pub mod routing; pub mod types; @@ -18,4 +18,4 @@ pub type KeyedPayload = (String, Vec); /// /// This type is versioned by the block number, since a node that stores data for /// a slot `X` can be modified through out the contract's lifetime. -pub type MptNodeVersion = (BlockNr, H256); +pub type MptNodeVersion = (BlockNr, FixedBytes<32>); diff --git a/lgn-messages/src/types/v1/preprocessing/ext_tasks.rs b/lgn-messages/src/types/v1/preprocessing/ext_tasks.rs index f52e0ad6..9670ceb8 100644 --- a/lgn-messages/src/types/v1/preprocessing/ext_tasks.rs +++ b/lgn-messages/src/types/v1/preprocessing/ext_tasks.rs @@ -1,8 +1,9 @@ use alloy::primitives::Address; +use alloy::primitives::FixedBytes; use alloy::primitives::U256; use derive_debug_plus::Dbg; -use ethers::types::H256; -use ethers::utils::rlp; +use mp2_common::eth::node_type; +use mp2_common::eth::NodeType; use mp2_v1::api::TableRow; use mp2_v1::final_extraction::OffChainRootOfTrust; use mp2_v1::indexing::cell::Cell; @@ -41,7 +42,7 @@ pub enum ExtractionType { pub struct Mpt { pub table_hash: TableHash, pub block_nr: BlockNr, - pub node_hash: H256, + pub node_hash: FixedBytes<32>, pub mpt_type: MptType, } @@ -49,7 +50,7 @@ impl Mpt { pub fn new( table_hash: TableId, block_nr: BlockNr, - node_hash: H256, + node_hash: FixedBytes<32>, mpt_type: MptType, ) -> Self { Self { @@ -204,13 +205,12 @@ impl MPTExtractionType { node: &[u8], i: usize, ) -> Self { - let list: Vec> = rlp::decode_list(node); - match list.len() { + match node_type(node).unwrap() { // assuming the first node in the path is the leaf - 2 if i == 0 => MPTExtractionType::Leaf, - 2 => MPTExtractionType::Extension, + NodeType::Leaf if i == 0 => MPTExtractionType::Leaf, + NodeType::Leaf | NodeType::Extension => MPTExtractionType::Extension, // assuming all nodes are valid so branch is the only choice left - _ => MPTExtractionType::Branch, + NodeType::Branch => MPTExtractionType::Branch, } } } diff --git a/lgn-messages/src/types/v1/preprocessing/mod.rs b/lgn-messages/src/types/v1/preprocessing/mod.rs index 83d481a7..245e4af8 100644 --- a/lgn-messages/src/types/v1/preprocessing/mod.rs +++ b/lgn-messages/src/types/v1/preprocessing/mod.rs @@ -1,6 +1,6 @@ use alloy::primitives::Address; +use alloy::primitives::FixedBytes; use alloy::primitives::U256; -use ethers::prelude::H256; use ext_tasks::FinalExtractionType; use mp2_common::types::HashOutput; use mp2_v1::values_extraction::gadgets::column_info::ColumnInfo; @@ -78,7 +78,7 @@ impl WorkerTaskType { pub fn ext_variable_leaf( table_hash: TableHash, block_nr: BlockNr, - node_hash: H256, + node_hash: FixedBytes<32>, node: Vec, slot: u8, evm_word: u32, @@ -97,7 +97,7 @@ impl WorkerTaskType { pub fn ext_variable_branch( table_hash: TableHash, block_nr: BlockNr, - node_hash: H256, + node_hash: FixedBytes<32>, node: Vec, children: Vec, ) -> WorkerTaskType { @@ -113,7 +113,7 @@ impl WorkerTaskType { pub fn ext_mapping_leaf( table_hash: TableHash, block_nr: BlockNr, - node_hash: H256, + node_hash: FixedBytes<32>, key: Vec, node: Vec, slot: u8, @@ -134,7 +134,7 @@ impl WorkerTaskType { pub fn ext_mapping_branch( table_hash: TableHash, block_nr: BlockNr, - node_hash: H256, + node_hash: FixedBytes<32>, node: Vec, children: Vec, ) -> WorkerTaskType { diff --git a/lgn-provers/Cargo.toml b/lgn-provers/Cargo.toml index 5b716d0a..aa0bb025 100644 --- a/lgn-provers/Cargo.toml +++ b/lgn-provers/Cargo.toml @@ -9,7 +9,7 @@ anyhow = { workspace = true } bincode = { workspace = true } blake3.workspace = true bytes = { workspace = true } -ethers = { workspace = true } +futures = { workspace = true } groth16_framework = { workspace = true } mp2_common = { workspace = true } mp2_v1 = { workspace = true } diff --git a/lgn-provers/src/params/mod.rs b/lgn-provers/src/params/mod.rs index 08f133e4..ebcb41fd 100644 --- a/lgn-provers/src/params/mod.rs +++ b/lgn-provers/src/params/mod.rs @@ -8,7 +8,7 @@ use anyhow::bail; use anyhow::ensure; use anyhow::Context; use bytes::Bytes; -use ethers::providers::StreamExt; +use futures::StreamExt; use reqwest::StatusCode; use tokio::fs::File; use tokio::io::AsyncWriteExt; diff --git a/lgn-provers/src/provers/v1/preprocessing/euclid_prover.rs b/lgn-provers/src/provers/v1/preprocessing/euclid_prover.rs index ad2049b0..2a2fa5fb 100644 --- a/lgn-provers/src/provers/v1/preprocessing/euclid_prover.rs +++ b/lgn-provers/src/provers/v1/preprocessing/euclid_prover.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use alloy::primitives::Address; use alloy::primitives::U256; use anyhow::bail; -use ethers::utils::rlp::Prototype; -use ethers::utils::rlp::Rlp; +use mp2_common::eth::node_type; +use mp2_common::eth::NodeType; use mp2_common::poseidon::empty_poseidon_hash_as_vec; use mp2_common::types::HashOutput; use mp2_v1::api::generate_proof; @@ -99,23 +99,24 @@ impl PreprocessingEuclidProver { node: Vec, child_proofs: Vec>, ) -> anyhow::Result> { - let rlp = Rlp::new(&node); - match rlp.prototype()? { - Prototype::List(2) => { + let node_type = node_type(&node)?; + + match node_type { + NodeType::Extension => { let input = ValuesExtraction(values_extraction::CircuitInput::new_extension( node, child_proofs[0].to_owned(), )); generate_proof(&self.params, input) }, - Prototype::List(17) => { + NodeType::Branch => { let input = ValuesExtraction(values_extraction::CircuitInput::new_branch( node, child_proofs, )); generate_proof(&self.params, input) }, - _ => bail!("Invalid RLP item count"), + NodeType::Leaf => bail!("unexpected NodeType::Leaf"), } } diff --git a/lgn-worker/Cargo.toml b/lgn-worker/Cargo.toml index 58c57838..2516c76f 100644 --- a/lgn-worker/Cargo.toml +++ b/lgn-worker/Cargo.toml @@ -16,6 +16,7 @@ name = "one-shot" path = "src/one-shot.rs" [dependencies] +alloy = { workspace = true, features = ["signers", "signer-local", "signer-keystore"] } anyhow = { workspace = true } backtrace = { workspace = true } bincode.workspace = true @@ -23,8 +24,6 @@ blake3 = { workspace = true } clap = { workspace = true, features = ["derive", "env", "help", "std", "suggestions"] } config = { workspace = true, features = ["toml"] } elliptic-curve = { workspace = true } -# The ethers macro `abigen` needs to import ethers as a crate. -ethers = { git = "https://github.com/Lagrange-Labs/ethers-rs", default-features = false, features = [ "rustls" ], branch = "get-proof-0x" } groth16_framework.workspace = true hex = { workspace = true } jwt = { workspace = true } diff --git a/lgn-worker/bin/avs.rs b/lgn-worker/bin/avs.rs index 50e8acc3..889a7ac6 100644 --- a/lgn-worker/bin/avs.rs +++ b/lgn-worker/bin/avs.rs @@ -6,19 +6,18 @@ use std::path::Path; use std::str::FromStr; use std::sync::Arc; +use alloy::providers::Provider; +use alloy::providers::ProviderBuilder; +use alloy::signers::local::LocalSigner; +use alloy::signers::Signer; use anyhow::bail; use anyhow::Result; use clap::Args; use clap::Parser; -use ethers::providers::Http; -use ethers::providers::Provider; -use ethers::signers::Signer; -use ethers::signers::Wallet; use lgn_worker::avs::contract::calculate_registration_digest_hash; use lgn_worker::avs::contract::deregister_operator; use lgn_worker::avs::contract::is_operator; use lgn_worker::avs::contract::register_operator; -use lgn_worker::avs::contract::Client; use lgn_worker::avs::contract::Network; use lgn_worker::avs::public_key::PublicKey; use lgn_worker::avs::utils::expiry_timestamp; @@ -27,6 +26,7 @@ use lgn_worker::avs::utils::read_password; use lgn_worker::avs::utils::salt; use lgn_worker::avs::utils::sign_hash; use rand::thread_rng; +use reqwest::Url; use tracing::debug; use tracing::info; use tracing_subscriber::EnvFilter; @@ -70,9 +70,9 @@ impl NewKey { fs::create_dir_all(dir)?; let filename = path.file_name().and_then(|s| s.to_str()); - let (wallet, _) = Wallet::new_keystore(dir, &mut thread_rng(), password, filename)?; + let (wallet, _) = LocalSigner::new_keystore(dir, &mut thread_rng(), password, filename)?; info!("new Lagrange keystore stored under {}", self.lagr_keystore); - let public_key: PublicKey = wallet.signer().verifying_key().into(); + let public_key: PublicKey = wallet.credential().verifying_key().into(); info!("public key: {}", public_key.to_hex()); Ok(()) } @@ -82,7 +82,7 @@ impl NewKey { struct Register { /// URL for RPC requests #[clap(short, long, env)] - rpc_url: String, + rpc_url: Url, /// File path to load the main AVS keystore for signing, could set ENV /// AVS__AVS_PWD for password or input following the prompt. /// If the ENV AVS_SECRET_KEY is set as the main AVS private key, this @@ -111,10 +111,10 @@ impl Register { }, |main_key| { // Restore the main AVS key for the secret key. - Ok(Wallet::from_str(&main_key)?) + Ok(LocalSigner::from_str(&main_key)?) }, )?; - let main_wallet = main_wallet.with_chain_id(self.network.chain_id()); + let main_wallet = main_wallet.with_chain_id(Some(self.network.chain_id())); // Restore the Lagrange key for registering to the AVS service. let password = read_password(LAGR_PWD_ENV_VAR, "Input password for Lagrange key: ")?; @@ -123,8 +123,9 @@ impl Register { let operator = main_wallet.address(); let salt = salt(); - let provider = Arc::new(Provider::::try_from(&self.rpc_url)?); - let expiry = expiry_timestamp(&provider).await?; + let provider = Arc::new(ProviderBuilder::new().connect_http(self.rpc_url.clone())); + let rprovider = Arc::new(provider.root().clone()); + let expiry = expiry_timestamp(provider.root()).await?; debug!( "operator = {}, salt = 0x{}, expiry = {}", @@ -136,7 +137,7 @@ impl Register { // Call the AVSDirectory contract to calculate the digest hash. let digest_hash = calculate_registration_digest_hash( &self.network, - provider.clone(), + rprovider.clone(), operator, salt, expiry, @@ -146,10 +147,14 @@ impl Register { debug!("digest_hash = 0x{}", hex::encode(digest_hash)); // Sign the hash. - let client = Arc::new(Client::new(provider.clone(), main_wallet)); - let signature = sign_hash(client.signer(), digest_hash)?; + let client = Arc::new( + ProviderBuilder::new() + .wallet(main_wallet.clone()) + .connect_http(self.rpc_url.clone()), + ); + let signature = sign_hash(&lagrange_wallet, digest_hash)?; - let public_key = lagrange_wallet.signer().verifying_key().into(); + let public_key = lagrange_wallet.credential().verifying_key().into(); debug!( "signature = 0x{}, public_key = {:?}", @@ -157,7 +162,7 @@ impl Register { public_key, ); - let is_operator = is_operator(&self.network, provider, operator).await?; + let is_operator = is_operator(&self.network, rprovider, operator).await?; if !is_operator { bail!(" Please register the main key as an operator of EigenLayer first: @@ -166,7 +171,16 @@ https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation#ope } // Call the ZKMRStakeRegistry contract to register the operator. - register_operator(&self.network, client, public_key, salt, expiry, signature).await?; + register_operator( + &self.network, + client.root().clone(), + main_wallet, + public_key, + salt, + expiry, + signature, + ) + .await?; info!("Operator {} successfully registered", operator); @@ -177,7 +191,7 @@ https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation#ope struct DeRegister { /// URL for blockchain RPC requests. #[clap(short, long, env)] - rpc_url: String, + rpc_url: Url, /// File path to load the main AVS keystore for signing, could set ENV /// AVS__AVS_PWD for password or input following the prompt. /// @@ -206,21 +220,21 @@ impl DeRegister { }, |main_key| { // Restore the main AVS key for the secret key. - Ok(Wallet::from_str(&main_key)?) + Ok(LocalSigner::from_str(&main_key)?) }, )?; - let main_wallet = main_wallet.with_chain_id(self.network.chain_id()); + let main_wallet = main_wallet.with_chain_id(Some(self.network.chain_id())); let operator = main_wallet.address(); info!("deregistering operator at address {}", operator); - let provider = Arc::new(Provider::::try_from(&self.rpc_url)?); - let client = Arc::new(Client::new(provider.clone(), main_wallet.clone())); + let provider = Arc::new(ProviderBuilder::new().connect_http(self.rpc_url.clone())); + let rprovider = Arc::new(provider.root().clone()); - let is_operator = is_operator(&self.network, provider, operator).await?; + let is_operator = is_operator(&self.network, rprovider, operator).await?; if !is_operator { bail!("Address {} does not belong to a known operator", operator); } - deregister_operator(&self.network, client).await?; + deregister_operator(&self.network, provider.root()).await?; info!("Successfully de-registered operator {}", operator); Ok(()) diff --git a/lgn-worker/src/avs/contract.rs b/lgn-worker/src/avs/contract.rs index d51932fb..4821af12 100644 --- a/lgn-worker/src/avs/contract.rs +++ b/lgn-worker/src/avs/contract.rs @@ -1,52 +1,79 @@ use std::sync::Arc; +use alloy::primitives::address; +use alloy::primitives::Address; +use alloy::primitives::U256; +use alloy::providers::RootProvider; +use alloy::signers::local::PrivateKeySigner; use anyhow::bail; use anyhow::Result; -use ethers::prelude::abigen; -use ethers::prelude::Address; -use ethers::prelude::Http; -use ethers::prelude::Provider; -use ethers::prelude::SignerMiddleware; -use ethers::prelude::Wallet; -use ethers::prelude::U256; -use k256::ecdsa::SigningKey; +use delegation_manager::DelegationManager; use serde::Serialize; use tracing::info; +use zkmr_stake_registry::ZKMRStakeRegistry; pub use super::public_key::PublicKey; /// ZKMR service manager address as an argument (avs) to call the contract /// function `calculateOperatorAVSRegistrationDigestHash` -const HOLESKY_ZKMR_SERVICE_MANAGER_ADDR: &str = "0xf98D5De1014110C65c51b85Ea55f73863215CC10"; -const MAINNET_ZKMR_SERVICE_MANAGER_ADDR: &str = "0x22CAc0e6A1465F043428e8AeF737b3cb09D0eEDa"; +const HOLESKY_ZKMR_SERVICE_MANAGER_ADDR: Address = + address!("0xf98D5De1014110C65c51b85Ea55f73863215CC10"); +const MAINNET_ZKMR_SERVICE_MANAGER_ADDR: Address = + address!("0x22CAc0e6A1465F043428e8AeF737b3cb09D0eEDa"); /// ZKMRStakeRegistry contract address /// -const HOLESKY_ZKMR_STAKE_REGISTRY_ADDR: &str = "0xf724cDC7C40fd6B59590C624E8F0E5E3843b4BE4"; -const MAINNET_ZKMR_STAKE_REGISTRY_ADDR: &str = "0x8dcdCc50Cc00Fe898b037bF61cCf3bf9ba46f15C"; +const HOLESKY_ZKMR_STAKE_REGISTRY_ADDR: Address = + address!("0xf724cDC7C40fd6B59590C624E8F0E5E3843b4BE4"); +const MAINNET_ZKMR_STAKE_REGISTRY_ADDR: Address = + address!("0x8dcdCc50Cc00Fe898b037bF61cCf3bf9ba46f15C"); /// AVSDirectory contract address /// from https://github.com/Layr-Labs/eigenlayer-contracts?tab=readme-ov-file#deployments -const MAINNET_AVS_DIRECTORY_ADDR: &str = "0x135dda560e946695d6f155dacafc6f1f25c1f5af"; -const HOLESKY_AVS_DIRECTORY_ADDR: &str = "0x055733000064333CaDDbC92763c58BF0192fFeBf"; +const MAINNET_AVS_DIRECTORY_ADDR: Address = address!("0x135dda560e946695d6f155dacafc6f1f25c1f5af"); +const HOLESKY_AVS_DIRECTORY_ADDR: Address = address!("0x055733000064333CaDDbC92763c58BF0192fFeBf"); /// DelegationManager contract address /// from https://github.com/Layr-Labs/eigenlayer-contracts?tab=readme-ov-file#deployments -const MAINNET_DELEGATION_MANAGER_ADDR: &str = "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A"; -const HOLESKY_DELEGATION_MANAGER_ADDR: &str = "0xA44151489861Fe9e3055d95adC98FbD462B948e7"; - -abigen!( - AVSDirectory, - "$CARGO_MANIFEST_DIR/abis/AVSDirectoryABI.json" -); -abigen!( - DelegationManager, - "$CARGO_MANIFEST_DIR/abis/DelegationManagerABI.json" -); -abigen!( - ZKMRStakeRegistry, - "$CARGO_MANIFEST_DIR/abis/ZKMRStakeRegistryABI.json" -); +const MAINNET_DELEGATION_MANAGER_ADDR: Address = + address!("0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A"); +const HOLESKY_DELEGATION_MANAGER_ADDR: Address = + address!("0xA44151489861Fe9e3055d95adC98FbD462B948e7"); + +mod avs_directory { + use alloy::sol; + + sol!( + #[sol(rpc)] + AVSDirectory, + concat!(env!("CARGO_MANIFEST_DIR"), "/abis/AVSDirectoryABI.json") + ); +} + +mod delegation_manager { + use alloy::sol; + + sol!( + #[sol(rpc)] + DelegationManager, + concat!( + env!("CARGO_MANIFEST_DIR"), + "/abis/DelegationManagerABI.json" + ) + ); +} +mod zkmr_stake_registry { + use alloy::sol; + + sol!( + #[sol(rpc)] + ZKMRStakeRegistry, + concat!( + env!("CARGO_MANIFEST_DIR"), + "/abis/ZKMRStakeRegistryABI.json" + ) + ); +} #[derive(clap::ValueEnum, Clone, Default, Debug, Serialize)] #[serde(rename_all = "lowercase")] @@ -126,24 +153,23 @@ impl Network { .expect("invalid contract avs directory address") } } -pub type Client = SignerMiddleware>, Wallet>; /// Call DelegationManager contract function `isOperator` pub async fn is_operator( network: &Network, - provider: Arc>, + provider: Arc, operator: Address, ) -> Result { let contract_address: Address = network.eigen_delegation_manager_address(); let contract = DelegationManager::new(contract_address, provider); - Ok(contract.is_operator(operator).call().await?) + Ok(contract.isOperator(operator).call().await?) } /// Call AVSDirectory contract function `calculateOperatorAVSRegistrationDigestHash` pub async fn calculate_registration_digest_hash( network: &Network, - provider: Arc>, + provider: Arc, operator: Address, salt: [u8; 32], expiry: U256, @@ -151,36 +177,37 @@ pub async fn calculate_registration_digest_hash( let avs: Address = network.lagrange_service_manager_address(); let contract_address: Address = network.eigen_avs_directory(); - let contract = AVSDirectory::new(contract_address, provider); + let contract = avs_directory::AVSDirectory::new(contract_address, provider); let digest_hash = contract - .calculate_operator_avs_registration_digest_hash(operator, avs, salt, expiry) + .calculateOperatorAVSRegistrationDigestHash(operator, avs, salt.into(), expiry) .call() .await?; - Ok(digest_hash) + Ok(digest_hash.into()) } /// Call ZKMRStakeRegistry contract function `registerOperator` pub async fn register_operator( network: &Network, - client: Arc, + client: RootProvider, + signer: PrivateKeySigner, public_key: PublicKey, salt: [u8; 32], expiry: U256, signature: Vec, ) -> Result<()> { - let operator_address = client.address(); + let operator_address = signer.address(); let contract_address: Address = network.lagrange_registry_address(); let contract = ZKMRStakeRegistry::new(contract_address, client); - let public_key = zkmr_stake_registry::PublicKey { + let public_key = ZKMRStakeRegistry::PublicKey { x: public_key.x, y: public_key.y, }; - let signature = zkmr_stake_registry::SignatureWithSaltAndExpiry { + let signature = zkmr_stake_registry::ISignatureUtils::SignatureWithSaltAndExpiry { expiry, - salt, + salt: salt.into(), signature: signature.into(), }; // we first check if we are whitelist @@ -188,7 +215,7 @@ pub async fn register_operator( if !is_whitelisted { bail!("operator address {operator_address} is not whitelisted on the Lagrange contract. Contact Lagrange admin."); } - let is_registered = contract.is_registered(operator_address).call().await?; + let is_registered = contract.isRegistered(operator_address).call().await?; if is_registered { bail!( "operator address {operator_address} is already registered on our contract! Exiting." @@ -197,17 +224,14 @@ pub async fn register_operator( info!("Operator is whitelisted on Lagrange Network AVS contract. Moving on to registration."); - let receipt = contract - .register_operator(public_key, signature) + let transaction = contract + .registerOperator(public_key, signature) .send() - .await? .await?; info!( "Successfully registered on Lagrange AVS. Tx hash {:?}", - receipt - .expect("sucessful transaction but no receipt?") - .transaction_hash + transaction.tx_hash() ); Ok(()) @@ -216,17 +240,20 @@ pub async fn register_operator( /// Call ZKMRStakeRegistry contract function `evictOperator` pub async fn deregister_operator( network: &Network, - client: Arc, + client: &RootProvider, ) -> Result<()> { let contract_address: Address = network.lagrange_registry_address(); let contract = ZKMRStakeRegistry::new(contract_address, client); - let receipt = contract.deregister_operator().send().await?.await?; + let receipt = contract + .deregisterOperator() + .send() + .await? + .get_receipt() + .await?; info!( "Successfully de-registered from Lagrange AVS. Tx hash {:?}", - receipt - .expect("sucessful transaction but no receipt?") - .transaction_hash + receipt.transaction_hash ); Ok(()) @@ -239,19 +266,19 @@ mod test { fn test_network() { assert_eq!( Network::Holesky.eigen_avs_directory(), - HOLESKY_AVS_DIRECTORY_ADDR.to_string().parse().unwrap() + HOLESKY_AVS_DIRECTORY_ADDR ); assert_eq!( Network::Mainnet.eigen_avs_directory(), - MAINNET_AVS_DIRECTORY_ADDR.to_string().parse().unwrap() + MAINNET_AVS_DIRECTORY_ADDR ); assert_eq!( Network::Holesky.eigen_delegation_manager_address(), - HOLESKY_DELEGATION_MANAGER_ADDR.to_string().parse().unwrap() + HOLESKY_DELEGATION_MANAGER_ADDR ); assert_eq!( Network::Mainnet.eigen_delegation_manager_address(), - MAINNET_DELEGATION_MANAGER_ADDR.to_string().parse().unwrap() + MAINNET_DELEGATION_MANAGER_ADDR ); } } diff --git a/lgn-worker/src/avs/public_key.rs b/lgn-worker/src/avs/public_key.rs index 43959664..b23efda6 100644 --- a/lgn-worker/src/avs/public_key.rs +++ b/lgn-worker/src/avs/public_key.rs @@ -1,5 +1,5 @@ +use alloy::primitives::U256; use elliptic_curve::sec1::Coordinates; -use ethers::types::U256; use k256::ecdsa::VerifyingKey; #[derive(Debug)] @@ -10,10 +10,8 @@ pub struct PublicKey { impl PublicKey { pub fn to_hex(&self) -> String { - let mut xb = [0u8; 32]; - self.x.to_big_endian(&mut xb[..]); - let mut yb = [0u8; 32]; - self.y.to_big_endian(&mut yb[..]); + let xb: [_; 32] = self.x.to_be_bytes(); + let yb: [_; 32] = self.y.to_be_bytes(); let mut s1 = hex::encode(xb); let s2 = hex::encode(yb); s1.push_str(&s2); @@ -31,7 +29,7 @@ impl From<&VerifyingKey> for PublicKey { _ => unreachable!(), }; - let [x, y] = [x, y].map(|s| U256::from_big_endian(s)); + let [x, y] = [x, y].map(|s| U256::from_be_slice(s.as_slice())); Self { x, y } } diff --git a/lgn-worker/src/avs/utils.rs b/lgn-worker/src/avs/utils.rs index 6948b5ed..8ca7a034 100644 --- a/lgn-worker/src/avs/utils.rs +++ b/lgn-worker/src/avs/utils.rs @@ -1,17 +1,16 @@ use std::env; use std::path::Path; +use alloy::eips::BlockNumberOrTag; +use alloy::primitives::U256; +use alloy::providers::Provider; +use alloy::providers::RootProvider; +use alloy::signers::local::LocalSigner; +use alloy::signers::local::PrivateKeySigner; +use alloy::signers::SignerSync; use anyhow::anyhow; use anyhow::Context; use anyhow::Result; -use ethers::middleware::Middleware; -use ethers::providers::Http; -use ethers::providers::Provider; -use ethers::signers::Wallet; -use ethers::types::BlockNumber; -use ethers::types::U256; -// use ethers_core::k256::ecdsa::SigningKey; -use k256::ecdsa::SigningKey; use rand::thread_rng; use rand::Rng; @@ -22,13 +21,18 @@ const DEFAULT_EXPIRY_SECONDS: u64 = 300; /// Get the expiry seconds. /// -pub async fn expiry_timestamp(provider: &Provider) -> Result { - Ok(provider - .get_block(BlockNumber::Latest) - .await? - .ok_or(anyhow!("Failed to get latest block"))? - .timestamp - + DEFAULT_EXPIRY_SECONDS) +pub async fn expiry_timestamp(provider: &RootProvider) -> Result { + Ok(U256::from_be_slice( + &(provider + .get_block(BlockNumberOrTag::Latest.into()) + .await? + .ok_or(anyhow!("Failed to get latest block"))? + .header + .inner + .timestamp + + DEFAULT_EXPIRY_SECONDS) + .to_be_bytes(), + )) } /// Read the password from input. @@ -52,8 +56,8 @@ pub fn read_password( pub fn read_keystore, S: AsRef<[u8]>>( key_path: P, password: S, -) -> Result> { - let wallet = Wallet::::decrypt_keystore(&key_path, password) +) -> Result { + let wallet = LocalSigner::decrypt_keystore(&key_path, password) .with_context(|| anyhow!("trying to open `{}`", key_path.as_ref().display()))?; Ok(wallet) @@ -68,12 +72,12 @@ pub fn salt() -> [u8; 32] { /// Sign the hash. /// pub fn sign_hash( - wallet: &Wallet, + wallet: &PrivateKeySigner, data: [u8; 32], ) -> Result> { // Sign the hash, and it has already added `v` with 27. // - Ok(wallet.sign_hash(data.into())?.to_vec()) + Ok(wallet.sign_hash_sync(&data.into())?.as_bytes().to_vec()) } /// Prompt to input password diff --git a/lgn-worker/src/main.rs b/lgn-worker/src/main.rs index 00b769f4..123fa783 100755 --- a/lgn-worker/src/main.rs +++ b/lgn-worker/src/main.rs @@ -17,15 +17,14 @@ use std::sync::Arc; use std::time::SystemTime; use std::time::UNIX_EPOCH; +use alloy::signers::local::PrivateKeySigner; use anyhow::bail; use anyhow::Context; use backtrace::Backtrace; use checksum::fetch_checksums; use clap::Parser; -use ethers::signers::Wallet; use jwt::Claims; use jwt::RegisteredClaims; -use k256::ecdsa::SigningKey; use lagrange::worker_done::Reply; use lagrange::WorkerDone; use lagrange::WorkerToGwRequest; @@ -683,7 +682,7 @@ async fn process_message_from_gateway( } /// Build the node's wallet from the configuration file. -fn get_wallet(config: &Config) -> anyhow::Result> { +fn get_wallet(config: &Config) -> anyhow::Result { let res = match ( &config.avs.lagr_keystore, &config.avs.lagr_pwd, @@ -693,7 +692,7 @@ fn get_wallet(config: &Config) -> anyhow::Result> { read_keystore(keystore_path, password.expose_secret())? }, (Some(_), None, Some(pkey)) => { - Wallet::from_str(pkey.expose_secret()).context("Failed to create wallet")? + PrivateKeySigner::from_str(pkey.expose_secret()).context("Failed to create wallet")? }, _ => bail!("Must specify either keystore path w/ password OR private key"), }; diff --git a/rust-toolchain b/rust-toolchain index cec98510..5d56faf9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1,2 @@ -nightly-2024-10-15 \ No newline at end of file +[toolchain] +channel = "nightly"