From cdb8b54a661ecefd9824882206dec50280ffbb38 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:28:14 +0100 Subject: [PATCH 1/6] chore: update deps --- Cargo.lock | 352 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 6 +- 2 files changed, 198 insertions(+), 160 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c33632d..b5eccfda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "arrayref" @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" dependencies = [ "proc-macro2", "quote", @@ -183,9 +183,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.5.17" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" +checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48" dependencies = [ "async-trait", "axum-core", @@ -201,9 +201,9 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", + "rustversion", "serde", "sync_wrapper", - "tokio", "tower", "tower-http", "tower-layer", @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.2.9" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" +checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" dependencies = [ "async-trait", "bytes", @@ -222,6 +222,7 @@ dependencies = [ "http", "http-body", "mime", + "rustversion", "tower-layer", "tower-service", ] @@ -260,6 +261,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" + [[package]] name = "base64ct" version = "1.5.3" @@ -335,9 +342,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest 0.10.6", ] @@ -463,9 +470,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-if" @@ -495,9 +502,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.27" +version = "4.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0acbd8d28a0a60d7108d7ae850af6ba34cf2d1257fc646980e5f97ce14275966" +checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" dependencies = [ "bitflags", "clap_derive", @@ -699,9 +706,9 @@ dependencies = [ [[package]] name = "der" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", "zeroize", @@ -870,6 +877,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "492a7e5fc2504d5fdce8e124d3e263b244a68b283cac67a69eda0cd43e0aebad" +dependencies = [ + "base64 0.13.1", + "bs58", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + [[package]] name = "enum-ordinalize" version = "3.1.12" @@ -962,7 +988,7 @@ dependencies = [ [[package]] name = "ethereum-interfaces" version = "0.1.0" -source = "git+https://github.com/ledgerwatch/interfaces#87d4311d40beec2e93cfff4102e775d559ba1ed6" +source = "git+https://github.com/ledgerwatch/interfaces#123179dc16ebabc0f368c568575774ebd1e91d10" dependencies = [ "arrayref", "ethereum-types", @@ -976,9 +1002,9 @@ dependencies = [ [[package]] name = "ethereum-types" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81224dc661606574f5a0f28c9947d0ee1d93ff11c5f1c4e7272f52e8c0b5483c" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ "ethbloom", "fixed-hash", @@ -992,9 +1018,8 @@ dependencies = [ [[package]] name = "ethers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d338f456cf5158d8cb630d39202cca4416ad2248193eadf9562bfb563d123176" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1008,9 +1033,8 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fb042cc02501fd7c1338d229ff2f10562efa430136ac8c467190c5cfe46eba" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "ethers-core", "once_cell", @@ -1020,9 +1044,8 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ce616689f073bdfbe317314abbe018f1baedf1209d32f1b01220a68ff120cf" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -1039,9 +1062,8 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c4c4cef2795a98b861ef4729556b3b4d72e6ef3f1d8c426cd78d9cf7d087e54" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "Inflector", "cfg-if", @@ -1064,9 +1086,8 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc9816ce5d707cff3a75d6cd2c96ae60e157eb83f6754438064e30873f2196e" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -1079,9 +1100,8 @@ dependencies = [ [[package]] name = "ethers-core" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e97a2dcf550b681966f9392f4e1389ffe54ebb1667e64583104ee4e01c058c" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "arrayvec", "bytes", @@ -1093,6 +1113,7 @@ dependencies = [ "generic-array 0.14.6", "hex", "k256", + "num_enum", "once_cell", "open-fastrlp", "proc-macro2", @@ -1110,11 +1131,11 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb8547a8b696795f027350be348c9a2faff94ad4e08103e7916360dd15da5919" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "ethers-core", + "ethers-solc", "getrandom", "reqwest", "semver", @@ -1127,9 +1148,8 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21af40f8e3808e165cb624704786656670d37dce73fec5eb8d3346d981f68e70" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "async-trait", "auto_impl 0.5.0", @@ -1153,13 +1173,13 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7405eaf127aec599f839799111315b8c2e7bfe767e2536412dbb16e284f2d8c" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "async-trait", "auto_impl 1.0.1", - "base64 0.13.1", + "base64 0.20.0", + "enr", "ethers-core", "futures-core", "futures-timer", @@ -1188,9 +1208,8 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "341b582c30f5949b63bd76b2a08b6b997d8fe08fbe8026bd6ae042f5f9190eb4" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "async-trait", "coins-bip32", @@ -1206,9 +1225,8 @@ dependencies = [ [[package]] name = "ethers-solc" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2671a3c0a1801e0d8c066940d26e263534515cb6e97bdfa5dbf396b8d54a3a4c" +version = "1.0.2" +source = "git+https://github.com/gakonst/ethers-rs?rev=b27c7b0#b27c7b0773d7ba329e0e1eebb37db652ac8fa601" dependencies = [ "cfg-if", "dunce", @@ -1376,9 +1394,9 @@ checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-locks" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eb42d4fb72227be5778429f9ef5240a38a358925a49f05b5cf702ce7c7e558a" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" dependencies = [ "futures-channel", "futures-task", @@ -1650,9 +1668,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", @@ -1760,9 +1778,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" dependencies = [ "libc", "windows-sys", @@ -1770,15 +1788,15 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" [[package]] name = "is-terminal" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ "hermit-abi 0.2.6", "io-lifetimes", @@ -1797,9 +1815,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" @@ -1812,9 +1830,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5af9646e616e37c61093ef85e25bd883ae0c22e2fa1e6eedfe590048247116e3" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", "jsonrpsee-proc-macros", @@ -1825,9 +1843,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673d68136e2f0f67323bab95b3a7177df26ac21ddbf395fc32d60f30fe5a1364" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", "arrayvec", @@ -1851,9 +1869,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ed8b96f9d2d6a984fd75784ac8bfed994ee40980626b85791782dcd13ffb7ac" +checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c" dependencies = [ "heck", "proc-macro-crate", @@ -1864,9 +1882,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78f34520019321bd466d00620606db2f40827362d0185b3b95040328eb502f6" +checksum = "1fb69dad85df79527c019659a992498d03f8495390496da2f07e6c24c2b356fc" dependencies = [ "futures-channel", "futures-util", @@ -1886,9 +1904,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7985a27ee315c7c8c5c5033ac133e9472aec881edfd947780f5a9970efb7cbbf" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" dependencies = [ "anyhow", "beef", @@ -1960,15 +1978,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "linux-raw-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -1991,9 +2009,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] name = "md-5" @@ -2091,19 +2109,40 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi 0.2.6", "libc", ] +[[package]] +name = "num_enum" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "opaque-debug" @@ -2188,7 +2227,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -2198,14 +2237,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.5", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", @@ -2217,9 +2256,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if", "libc", @@ -2389,9 +2428,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" dependencies = [ "proc-macro2", "syn", @@ -2448,24 +2487,24 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.19" +version = "0.5.20+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" +checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" dependencies = [ "bytes", "prost-derive", @@ -2473,9 +2512,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" +checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" dependencies = [ "bytes", "heck", @@ -2495,9 +2534,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" +checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" dependencies = [ "anyhow", "itertools", @@ -2508,9 +2547,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" +checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" dependencies = [ "bytes", "prost", @@ -2527,9 +2566,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2578,11 +2617,10 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "crossbeam-deque", "either", "rayon-core", ] @@ -2774,9 +2812,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.3" +version = "0.36.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" dependencies = [ "bitflags", "errno", @@ -2809,15 +2847,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "salsa20" @@ -2839,9 +2877,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" dependencies = [ "cfg-if", "derive_more", @@ -2851,9 +2889,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcd47b380d8c4541044e341dcd9475f55ba37ddc50c908d945fc036a8642496" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2905,9 +2943,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] @@ -2920,9 +2958,9 @@ checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -2939,9 +2977,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2950,9 +2988,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -3185,9 +3223,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -3242,18 +3280,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -3295,9 +3333,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -3310,7 +3348,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys", ] [[package]] @@ -3325,9 +3363,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", @@ -3373,18 +3411,18 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] [[package]] name = "tonic" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55b9af819e54b8f33d453655bef9b9acc171568fb49523078d0cc4e7484200ec" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" dependencies = [ "async-stream", "async-trait", @@ -3414,9 +3452,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c6fd7c2581e36d63388a9e04c350c21beb7a8b059580b2e93993c526899ddc" +checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" dependencies = [ "prettyplease", "proc-macro2", @@ -3447,9 +3485,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ "bitflags", "bytes", @@ -3553,15 +3591,15 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "uint" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ "byteorder", "crunchy", @@ -3577,9 +3615,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -3771,9 +3809,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ "webpki", ] diff --git a/Cargo.toml b/Cargo.toml index dedc856b..00ff8ada 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,13 @@ clap = { version = "4", features = ["derive"] } dirs = "4.0" educe = { version = "0.4", features = ["Debug", "Default"] } ethereum-interfaces = { git = "https://github.com/ledgerwatch/interfaces" } -ethers = "1.0.0" +ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "b27c7b0", features = ["ethers-solc"] } expanded-pathbuf = "0.1" hex = { version = "0.4.3", default-features = false, features = ["std"] } jsonrpsee = { version = "0.16", features = ["server", "macros"] } parking_lot = "0.12" prost = "0.11" +regex = "1" ron = "0.8" serde = "1" serde_json = "1" @@ -30,11 +31,10 @@ tonic = { version = "0.8", default-features = false, features = [ ] } tracing = "0.1" tracing-subscriber = "0.3" -regex = "1" [build-dependencies] anyhow = "1" -ethers = {version = "1.0.0", features = ["ethers-solc"]} +ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "b27c7b0", features = ["ethers-solc"] } protobuf-src = "1.1.0" prost-build = "0.11" tonic-build = "0.8" From 6c69a17cf9dfeeb2372b1df982b4e380a36078ba Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:31:03 +0100 Subject: [PATCH 2/6] chore: move parse functions to utils.rs --- src/bundler/mod.rs | 14 +++----------- src/lib.rs | 1 + src/utils.rs | 9 +++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 src/utils.rs diff --git a/src/bundler/mod.rs b/src/bundler/mod.rs index e67cb73a..e37fdde9 100644 --- a/src/bundler/mod.rs +++ b/src/bundler/mod.rs @@ -1,9 +1,7 @@ -use std::str::FromStr; - use clap::Parser; use ethers::types::{Address, U256}; -use crate::models::wallet::Wallet; +use crate::{models::wallet::Wallet, utils::{parse_address, parse_u256}}; #[derive(Debug, Parser, PartialEq)] pub struct BundlerOpts { @@ -26,14 +24,6 @@ pub struct BundlerOpts { pub bundler_grpc_listen_address: String, } -fn parse_address(s: &str) -> Result { - Address::from_str(s).map_err(|_| format!("Adress {} is not a valid address", s)) -} - -fn parse_u256(s: &str) -> Result { - U256::from_str_radix(s, 10).map_err(|_| format!("{} is not a valid U256", s)) -} - pub struct Bundler { pub wallet: Wallet, } @@ -46,6 +36,8 @@ impl Bundler { #[cfg(test)] mod test { + use std::str::FromStr; + use super::*; #[test] diff --git a/src/lib.rs b/src/lib.rs index 3dc2fa7d..ec888de7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,3 +4,4 @@ pub mod models; pub mod rpc; pub mod types; pub mod uopool; +pub mod utils; diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 00000000..46dfc16b --- /dev/null +++ b/src/utils.rs @@ -0,0 +1,9 @@ +use ethers::types::{Address, U256}; +use std::str::FromStr; + +pub fn parse_address(s: &str) -> Result { + Address::from_str(s).map_err(|_| format!("Adress {} is not a valid address", s)) +} +pub fn parse_u256(s: &str) -> Result { + U256::from_str_radix(s, 10).map_err(|_| format!("{} is not a valid U256", s)) +} From f2d965d43268f7917457d6145283893c308fc686 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:40:27 +0100 Subject: [PATCH 3/6] feat: accept multiple entry points --- Makefile | 4 ++-- README.md | 4 ++-- bin/bundler-uopool.rs | 11 +++++++---- bin/bundler.rs | 8 ++++++-- src/bundler/mod.rs | 11 ++++------- src/uopool/mod.rs | 3 ++- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 2060546c..3caafa9c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ run-bundler: - cargo run -- --mnemonic-file ${HOME}/.aa-bundler/0x129D197b2a989C6798601A49D89a4AEC822A17a3 --beneficiary 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990 --gas-factor 600 --min-balance 1 --entry-point 0x0000000000000000000000000000000000000000 --helper 0x0000000000000000000000000000000000000000 + cargo run -- --mnemonic-file ${HOME}/.aa-bundler/0x129D197b2a989C6798601A49D89a4AEC822A17a3 --beneficiary 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990 --gas-factor 600 --min-balance 1 --entry-points 0x0000000000000000000000000000000000000000 --helper 0x0000000000000000000000000000000000000000 run-bundler-uopool: - cargo run --bin bundler-uopool + cargo run --bin bundler-uopool -- --entry-points 0x0000000000000000000000000000000000000000 run-bundler-rpc: cargo run --bin bundler-rpc diff --git a/README.md b/README.md index c6c23747..69c797fc 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ cargo run --bin create-wallet -- --output-path ${HOME}/.aa-bundler Run bundler (with user operation pool and JSON-RPC API): ```bash -cargo run -- --mnemonic-file ${HOME}/.aa-bundler/0x129D197b2a989C6798601A49D89a4AEC822A17a3 --beneficiary 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990 --gas-factor 600 --min-balance 1 --entry-point 0x0000000000000000000000000000000000000000 --helper 0x0000000000000000000000000000000000000000 +cargo run -- --mnemonic-file ${HOME}/.aa-bundler/0x129D197b2a989C6798601A49D89a4AEC822A17a3 --beneficiary 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990 --gas-factor 600 --min-balance 1 --entry-points 0x0000000000000000000000000000000000000000 --helper 0x0000000000000000000000000000000000000000 ``` Run only user operation pool: ```bash -cargo run --bin bundler-uopool +cargo run --bin bundler-uopool -- --entry-points 0x0000000000000000000000000000000000000000 ``` Run only JSON-RPC API: diff --git a/bin/bundler-uopool.rs b/bin/bundler-uopool.rs index 9dfad590..d02455e8 100644 --- a/bin/bundler-uopool.rs +++ b/bin/bundler-uopool.rs @@ -1,17 +1,20 @@ +use aa_bundler::utils::parse_address; use anyhow::Result; use clap::Parser; -use educe::Educe; +use ethers::types::Address; use std::future::pending; -#[derive(Educe, Parser)] +#[derive(Parser)] #[clap( name = "aa-bundler-uopool", about = "User operation pool for EIP-4337 Account Abstraction Bundler" )] -#[educe(Debug)] pub struct Opt { #[clap(flatten)] pub uopool_opts: aa_bundler::uopool::UoPoolOpts, + + #[clap(long, value_delimiter=',', value_parser=parse_address)] + pub entry_points: Vec
, } #[tokio::main] @@ -20,7 +23,7 @@ async fn main() -> Result<()> { tracing_subscriber::fmt::init(); - aa_bundler::uopool::run(opt.uopool_opts).await?; + aa_bundler::uopool::run(opt.uopool_opts, opt.entry_points).await?; pending().await } diff --git a/bin/bundler.rs b/bin/bundler.rs index acead157..dfd5b90e 100644 --- a/bin/bundler.rs +++ b/bin/bundler.rs @@ -1,10 +1,11 @@ use aa_bundler::{ bundler::Bundler, models::wallet::Wallet, - rpc::{eth::EthApiServerImpl, eth_api::EthApiServer}, + rpc::{eth::EthApiServerImpl, eth_api::EthApiServer}, utils::parse_address, }; use anyhow::Result; use clap::Parser; +use ethers::types::Address; use expanded_pathbuf::ExpandedPathBuf; use jsonrpsee::{core::server::rpc_module::Methods, server::ServerBuilder, tracing::info}; use std::{future::pending, net::SocketAddr, panic}; @@ -18,6 +19,9 @@ pub struct Opt { #[clap(long)] pub mnemonic_file: ExpandedPathBuf, + #[clap(long, value_delimiter=',', value_parser=parse_address)] + pub entry_points: Vec
, + #[clap(long)] pub no_uopool: bool, @@ -60,7 +64,7 @@ fn main() -> Result<()> { let _bundler = Bundler::new(wallet); if !opt.no_uopool { - aa_bundler::uopool::run(opt.uopool_opts).await?; + aa_bundler::uopool::run(opt.uopool_opts, opt.entry_points).await?; } if !opt.no_rpc { diff --git a/src/bundler/mod.rs b/src/bundler/mod.rs index e37fdde9..1fe28be3 100644 --- a/src/bundler/mod.rs +++ b/src/bundler/mod.rs @@ -1,7 +1,10 @@ use clap::Parser; use ethers::types::{Address, U256}; -use crate::{models::wallet::Wallet, utils::{parse_address, parse_u256}}; +use crate::{ + models::wallet::Wallet, + utils::{parse_address, parse_u256}, +}; #[derive(Debug, Parser, PartialEq)] pub struct BundlerOpts { @@ -14,9 +17,6 @@ pub struct BundlerOpts { #[clap(long, value_parser=parse_u256)] pub min_balance: U256, - #[clap(long, value_parser=parse_address)] - pub entry_point: Address, - #[clap(long, value_parser=parse_address)] pub helper: Address, @@ -50,8 +50,6 @@ mod test { "600", "--min-balance", "1", - "--entry-point", - "0x0000000000000000000000000000000000000000", "--helper", "0x0000000000000000000000000000000000000000", "--bundler-grpc-listen-address", @@ -63,7 +61,6 @@ mod test { .unwrap(), gas_factor: U256::from(600), min_balance: U256::from(1), - entry_point: Address::from([0; 20]), helper: Address::from([0; 20]), bundler_grpc_listen_address: String::from("127.0.0.1:3000") }, diff --git a/src/uopool/mod.rs b/src/uopool/mod.rs index c8e6d113..2e74180c 100644 --- a/src/uopool/mod.rs +++ b/src/uopool/mod.rs @@ -5,6 +5,7 @@ use crate::{ use anyhow::Result; use clap::Parser; use educe::Educe; +use ethers::types::Address; use jsonrpsee::tracing::info; use parking_lot::RwLock; use std::{collections::HashMap, net::SocketAddr, sync::Arc, time::Duration}; @@ -39,7 +40,7 @@ pub struct UoPoolOpts { pub uopool_grpc_listen_address: SocketAddr, } -pub async fn run(opts: UoPoolOpts) -> Result<()> { +pub async fn run(opts: UoPoolOpts, _entry_points: Vec
) -> Result<()> { tokio::spawn(async move { let mut builder = tonic::transport::Server::builder(); let svc = UoPoolServer::new(UoPoolService::new(Arc::new(UserOperationPool::new()))); From 3e9eeb0b66696e7746fe1c2332be0585962b6896 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:43:44 +0100 Subject: [PATCH 4/6] chore: update Makefile --- Makefile | 4 ++-- bin/bundler.rs | 3 ++- src/bundler/mod.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3caafa9c..00ec4166 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ run-bundler-rpc: run-create-wallet: cargo run --bin create-wallet -- --output-path ${HOME}/.aa-bundler -cargo-fmt: +format: cargo fmt --all lint: @@ -20,7 +20,7 @@ lint: build: cargo build -cargo-test: +test: cargo test fetch-thirdparty: diff --git a/bin/bundler.rs b/bin/bundler.rs index dfd5b90e..a21abac9 100644 --- a/bin/bundler.rs +++ b/bin/bundler.rs @@ -1,7 +1,8 @@ use aa_bundler::{ bundler::Bundler, models::wallet::Wallet, - rpc::{eth::EthApiServerImpl, eth_api::EthApiServer}, utils::parse_address, + rpc::{eth::EthApiServerImpl, eth_api::EthApiServer}, + utils::parse_address, }; use anyhow::Result; use clap::Parser; diff --git a/src/bundler/mod.rs b/src/bundler/mod.rs index 1fe28be3..bc0f7b4b 100644 --- a/src/bundler/mod.rs +++ b/src/bundler/mod.rs @@ -35,7 +35,7 @@ impl Bundler { } #[cfg(test)] -mod test { +mod tests { use std::str::FromStr; use super::*; From eaa76cf3ba96f871cb34f99cbb3368d2e6a9c5a2 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:52:00 +0100 Subject: [PATCH 5/6] feat: update user operation --- src/contracts/gen.rs | 19 ------------------- src/contracts/mod.rs | 2 +- src/types/user_operation.rs | 38 ++++++++++++++++++++++++++++--------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/contracts/gen.rs b/src/contracts/gen.rs index 0c543faf..54cfb2e5 100644 --- a/src/contracts/gen.rs +++ b/src/contracts/gen.rs @@ -1,4 +1,3 @@ -use crate::types::user_operation::UserOperation as UserOp; use ethers::contract::abigen; abigen!(EntryPointAPI, "$OUT_DIR/IEntryPoint.sol/IEntryPoint.json"); @@ -23,21 +22,3 @@ abigen!(EntryPointAPI, "$OUT_DIR/IEntryPoint.sol/IEntryPoint.json"); // UserOperation, // "$OUT_DIR/UserOperation.sol/UserOperationLib.json" // ); - -impl From for entry_point_api::UserOperation { - fn from(value: UserOp) -> Self { - Self { - sender: value.sender, - nonce: value.nonce, - init_code: value.init_code, - call_data: value.call_data, - call_gas_limit: value.call_gas_limit, - verification_gas_limit: value.verification_gas_limit, - pre_verification_gas: value.pre_verification_gas, - max_fee_per_gas: value.max_fee_per_gas, - max_priority_fee_per_gas: value.max_priority_fee_per_gas, - paymaster_and_data: value.paymaster_and_data, - signature: value.signature, - } - } -} diff --git a/src/contracts/mod.rs b/src/contracts/mod.rs index 76713363..a120617f 100644 --- a/src/contracts/mod.rs +++ b/src/contracts/mod.rs @@ -1,4 +1,4 @@ mod entrypoint; -mod gen; +pub mod gen; pub use entrypoint::*; diff --git a/src/types/user_operation.rs b/src/types/user_operation.rs index 918e3302..c468c48f 100644 --- a/src/types/user_operation.rs +++ b/src/types/user_operation.rs @@ -1,8 +1,10 @@ +use crate::contracts::gen::entry_point_api; use ethers::abi::AbiEncode; use ethers::prelude::{EthAbiCodec, EthAbiType}; use ethers::types::{Address, Bytes, TransactionReceipt, H256, U256}; use ethers::utils::keccak256; use serde::{Deserialize, Serialize}; +use std::ops::Deref; use std::str::FromStr; pub type UserOperationHash = H256; @@ -23,12 +25,30 @@ pub struct UserOperation { pub signature: Bytes, } +impl From for entry_point_api::UserOperation { + fn from(user_operation: UserOperation) -> Self { + Self { + sender: user_operation.sender, + nonce: user_operation.nonce, + init_code: user_operation.init_code, + call_data: user_operation.call_data, + call_gas_limit: user_operation.call_gas_limit, + verification_gas_limit: user_operation.verification_gas_limit, + pre_verification_gas: user_operation.pre_verification_gas, + max_fee_per_gas: user_operation.max_fee_per_gas, + max_priority_fee_per_gas: user_operation.max_priority_fee_per_gas, + paymaster_and_data: user_operation.paymaster_and_data, + signature: user_operation.signature, + } + } +} + impl UserOperation { - pub fn pack(&self) -> Vec { - self.clone().encode_hex().into_bytes() + pub fn pack(&self) -> Bytes { + self.clone().encode_hex().parse::().unwrap() } - pub fn pack_for_signature(&self) -> Vec { + pub fn pack_for_signature(&self) -> Bytes { let mut encoded = String::from("0x"); let packed = hex::encode( UserOperation { @@ -38,14 +58,14 @@ impl UserOperation { .encode(), ); encoded.push_str(&packed[..packed.len() - 64]); - encoded.into_bytes() + encoded.parse::().unwrap() } pub fn hash(&self, entry_point_address: Address, chain_id: U256) -> UserOperationHash { H256::from_slice( keccak256( [ - keccak256(hex::decode(&self.pack_for_signature()[2..]).unwrap()).to_vec(), + keccak256(self.pack_for_signature().deref()).to_vec(), entry_point_address.encode(), chain_id.encode(), ] @@ -104,8 +124,8 @@ mod tests { signature: Bytes::from_str("0x7cb39607585dee8e297d0d7a669ad8c5e43975220b6773c10a138deadbc8ec864981de4b9b3c735288a217115fb33f8326a61ddabc60a534e3b5536515c70f931c").unwrap(), }, ]; - assert_eq!(user_operations[0].pack(), String::from("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into_bytes()); - assert_eq!(user_operations[1].pack(), String::from("0x000000000000000000000000663f3ad617193148711d28f5334ee4ed070166020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000520800000000000000000000000000000000000000000000000000000000b2d05e00000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000417cb39607585dee8e297d0d7a669ad8c5e43975220b6773c10a138deadbc8ec864981de4b9b3c735288a217115fb33f8326a61ddabc60a534e3b5536515c70f931c00000000000000000000000000000000000000000000000000000000000000").into_bytes()); + assert_eq!(user_operations[0].pack(), "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse::().unwrap()); + assert_eq!(user_operations[1].pack(), "0x000000000000000000000000663f3ad617193148711d28f5334ee4ed070166020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000520800000000000000000000000000000000000000000000000000000000b2d05e00000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000417cb39607585dee8e297d0d7a669ad8c5e43975220b6773c10a138deadbc8ec864981de4b9b3c735288a217115fb33f8326a61ddabc60a534e3b5536515c70f931c00000000000000000000000000000000000000000000000000000000000000".parse::().unwrap()); } #[test] @@ -138,8 +158,8 @@ mod tests { signature: Bytes::from_str("0x7cb39607585dee8e297d0d7a669ad8c5e43975220b6773c10a138deadbc8ec864981de4b9b3c735288a217115fb33f8326a61ddabc60a534e3b5536515c70f931c").unwrap(), }, ]; - assert_eq!(user_operations[0].pack_for_signature(), String::from("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into_bytes()); - assert_eq!(user_operations[1].pack_for_signature(), String::from("0x000000000000000000000000663f3ad617193148711d28f5334ee4ed070166020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000520800000000000000000000000000000000000000000000000000000000b2d05e00000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000").into_bytes()); + assert_eq!(user_operations[0].pack_for_signature(), "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse::().unwrap()); + assert_eq!(user_operations[1].pack_for_signature(), "0x000000000000000000000000663f3ad617193148711d28f5334ee4ed070166020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000520800000000000000000000000000000000000000000000000000000000b2d05e00000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".parse::().unwrap()); } #[test] From 1717800d77f9e2c9fe8dba0b1a6f1c9609816cc5 Mon Sep 17 00:00:00 2001 From: Vid Kersic Date: Tue, 3 Jan 2023 21:58:57 +0100 Subject: [PATCH 6/6] chore: update github ci --- .github/workflows/{CI.yml => ci.yml} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename .github/workflows/{CI.yml => ci.yml} (85%) diff --git a/.github/workflows/CI.yml b/.github/workflows/ci.yml similarity index 85% rename from .github/workflows/CI.yml rename to .github/workflows/ci.yml index 17e0c6d3..24c8a191 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/ci.yml @@ -4,11 +4,11 @@ on: - main pull_request: -name: CI +name: ci jobs: build_and_test: - name: Rust Abstract Account Bundler Project + name: Account Abstraction Bundler in Rust runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,7 +16,7 @@ jobs: with: toolchain: stable components: rustfmt, clippy - - name: Setup + - name: Setup third party dependencies run: | make fetch-thirdparty - name: Install solc @@ -33,6 +33,4 @@ jobs: make lint - name: Test run: | - make cargo-test - - + make test