diff --git a/.gitignore b/.gitignore index 5868362..a82f9f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/target - +.DS_Store +target *.env diff --git a/Cargo.lock b/Cargo.lock index 0818a8a..999c748 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", "once_cell", @@ -49,6 +49,11 @@ dependencies = [ "memchr", ] +[[package]] +name = "amcl" +version = "0.3.0" +source = "git+https://github.com/Snowfork/milagro_bls#2c9e8b383981308a8b4cbbc19e0b897dcf14534b" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -66,9 +71,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[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" @@ -100,9 +105,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.59" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +checksum = "eff18d764974428cf3a9328e23fc5c986f5fbed46e6cd4cdf42544df5d297ec1" dependencies = [ "proc-macro2", "quote", @@ -135,7 +140,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -204,6 +209,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "base64ct" version = "1.5.3" @@ -264,9 +275,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", ] @@ -310,19 +321,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "blst" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a30d0edd9dd1c60ddb42b80341c7852f6f985279a5c1a83659dcb65899dec99" -dependencies = [ - "cc", - "glob", - "threadpool", - "which", - "zeroize", -] - [[package]] name = "bs58" version = "0.4.0" @@ -331,18 +329,19 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.17" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" dependencies = [ "memchr", + "serde", ] [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -364,9 +363,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" [[package]] name = "byteorder" @@ -385,9 +384,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad0e1e3e88dd237a156ab9f571021b8a158caa0ae44b1968a241efb5144c1e" +checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" dependencies = [ "serde", ] @@ -409,7 +408,7 @@ checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", "thiserror", @@ -423,9 +422,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[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" @@ -552,6 +551,7 @@ dependencies = [ "execution", "eyre", "futures", + "gloo-timers", "hex", "jsonrpsee", "log", @@ -559,6 +559,7 @@ dependencies = [ "ssz-rs", "thiserror", "tokio", + "wasm-bindgen-futures", ] [[package]] @@ -680,7 +681,6 @@ name = "consensus" version = "0.1.3" dependencies = [ "async-trait", - "blst", "bytes", "chrono", "common", @@ -689,16 +689,16 @@ dependencies = [ "eyre", "hex", "log", + "milagro_bls", "openssl", "reqwest", - "reqwest-middleware", - "reqwest-retry", "serde", "serde_json", "ssz-rs", "thiserror", "tokio", "toml", + "wasm-timer", ] [[package]] @@ -913,19 +913,19 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.3" +version = "3.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173" +checksum = "1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71" dependencies = [ "nix", - "winapi", + "windows-sys", ] [[package]] name = "cxx" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e" dependencies = [ "cc", "cxxbridge-flags", @@ -935,9 +935,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200" dependencies = [ "cc", "codespan-reporting", @@ -950,15 +950,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" +checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea" [[package]] name = "cxxbridge-macro" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e" dependencies = [ "proc-macro2", "quote", @@ -967,9 +967,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", @@ -1242,9 +1242,8 @@ dependencies = [ [[package]] name = "ethers" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11f26f9d8d80da18ca72aca51804c65eb2153093af3bec74fd5ce32aa0c1f665" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1257,9 +1256,8 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4be54dd2260945d784e06ccdeb5ad573e8f1541838cee13a1ab885485eaa0b" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "ethers-core", "once_cell", @@ -1269,9 +1267,8 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c3c3e119a89f0a9a1e539e7faecea815f74ddcf7c90d0b00d1f524db2fdc9c" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -1288,9 +1285,8 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d4e5ad46aede34901f71afdb7bb555710ed9613d88d644245c657dc371aa228" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "Inflector", "cfg-if", @@ -1313,9 +1309,8 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f192e8e4cf2b038318aae01e94e7644e0659a76219e94bcd3203df744341d61f" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -1328,9 +1323,8 @@ dependencies = [ [[package]] name = "ethers-core" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade3e9c97727343984e1ceada4fdab11142d2ee3472d2c67027d56b1251d4f15" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "arrayvec 0.7.2", "bytes", @@ -1359,14 +1353,13 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9713f525348e5dde025d09b0a4217429f8074e8ff22c886263cc191e87d8216" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "ethers-core", "getrandom 0.2.8", "reqwest", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde-aux", "serde_json", @@ -1376,9 +1369,8 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e71df7391b0a9a51208ffb5c7f2d068900e99d6b3128d3a4849d138f194778b7" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "async-trait", "auto_impl 0.5.0", @@ -1402,9 +1394,8 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a9e0597aa6b2fdc810ff58bc95e4eeaa2c219b3e615ed025106ecb027407d8" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "async-trait", "auto_impl 1.0.1", @@ -1437,9 +1428,8 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f41ced186867f64773db2e55ffdd92959e094072a1d09a5e5e831d443204f98" +version = "1.0.0" +source = "git+https://github.com/gakonst/ethers-rs?rev=c17c0c3c956f12d205a5ede3176599d8a30ca739#c17c0c3c956f12d205a5ede3176599d8a30ca739" dependencies = [ "async-trait", "coins-bip32", @@ -1720,9 +1710,9 @@ dependencies = [ [[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", @@ -1841,17 +1831,11 @@ dependencies = [ "weezl", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "globset" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ "aho-corasick", "bstr", @@ -1862,9 +1846,9 @@ dependencies = [ [[package]] name = "gloo-net" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9050ff8617e950288d7bf7f300707639fdeda5ca0d0ecf380cff448cfd52f4a6" +checksum = "9902a044653b26b99f7e3693a42f171312d9be8b26b5697bd1e43ad1f8a35e10" dependencies = [ "futures-channel", "futures-core", @@ -1882,9 +1866,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", @@ -1955,11 +1939,12 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", + "serde", ] [[package]] @@ -2008,11 +1993,23 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hmac" @@ -2098,9 +2095,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", @@ -2189,7 +2186,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ - "parity-scale-codec 3.2.1", + "parity-scale-codec 3.2.2", ] [[package]] @@ -2293,9 +2290,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "itertools" @@ -2308,9 +2305,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 = "jpeg-decoder" @@ -2554,9 +2551,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" @@ -2570,9 +2567,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -2620,22 +2617,24 @@ dependencies = [ "autocfg", ] +[[package]] +name = "milagro_bls" +version = "1.5.0" +source = "git+https://github.com/Snowfork/milagro_bls#2c9e8b383981308a8b4cbbc19e0b897dcf14534b" +dependencies = [ + "amcl", + "hex", + "lazy_static", + "rand 0.8.5", + "zeroize", +] + [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.6.2" @@ -2654,7 +2653,7 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -2677,14 +2676,23 @@ dependencies = [ [[package]] name = "nix" -version = "0.25.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "autocfg", "bitflags", "cfg-if", "libc", + "static_assertions", +] + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", ] [[package]] @@ -2724,9 +2732,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] @@ -2775,11 +2783,11 @@ 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", + "hermit-abi 0.2.6", "libc", ] @@ -2806,9 +2814,9 @@ dependencies = [ [[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 = "oorandom" @@ -2855,9 +2863,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.43" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if", @@ -2896,9 +2904,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.78" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -2934,9 +2942,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "e7ab01d0f889e957861bc65888d5ccbe82c158d0270136ba46820d43837cdf72" dependencies = [ "arrayvec 0.7.2", "bitvec 1.0.1", @@ -2948,9 +2956,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2972,7 +2980,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -2982,14 +2990,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.5", + "parking_lot_core 0.9.6", ] [[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", @@ -3001,15 +3009,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -3085,9 +3093,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.1" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" +checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" dependencies = [ "thiserror", "ucd-trie", @@ -3253,13 +3261,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -3288,9 +3295,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" dependencies = [ "unicode-ident", ] @@ -3310,9 +3317,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", ] @@ -3402,20 +3409,19 @@ 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", ] [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -3445,9 +3451,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -3480,11 +3486,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "bytes", "encoding_rs", "futures-core", @@ -3499,7 +3505,6 @@ dependencies = [ "js-sys", "log", "mime", - "mime_guess", "native-tls", "once_cell", "percent-encoding", @@ -3521,53 +3526,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "reqwest-middleware" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69539cea4148dce683bec9dc95be3f0397a9bb2c248a49c8296a9d21659a8cdd" -dependencies = [ - "anyhow", - "async-trait", - "futures", - "http", - "reqwest", - "serde", - "task-local-extensions", - "thiserror", -] - -[[package]] -name = "reqwest-retry" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce246a729eaa6aff5e215aee42845bf5fed9893cc6cd51aeeb712f34e04dd9f3" -dependencies = [ - "anyhow", - "async-trait", - "chrono", - "futures", - "http", - "hyper", - "reqwest", - "reqwest-middleware", - "retry-policies", - "task-local-extensions", - "tokio", - "tracing", -] - -[[package]] -name = "retry-policies" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bbcb5003282bcb688f0bae741b278e9c7e8f378f561522c9806c58e075d9b" -dependencies = [ - "anyhow", - "chrono", - "rand 0.8.5", -] - [[package]] name = "revm" version = "2.3.1" @@ -3577,11 +3535,13 @@ dependencies = [ "arrayref", "auto_impl 1.0.1", "bytes", - "hashbrown 0.13.1", + "hashbrown 0.13.2", + "hex", "num_enum", "primitive-types 0.12.1", "revm_precompiles", "rlp 0.5.2", + "serde", "sha3", ] @@ -3592,12 +3552,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0353d456ef3e989dc9190f42c6020f09bc2025930c37895826029304413204b5" dependencies = [ "bytes", - "hashbrown 0.13.1", + "hashbrown 0.13.2", + "k256", "num", "once_cell", "primitive-types 0.12.1", "ripemd", - "secp256k1", "sha2 0.10.6", "sha3", "substrate-bn", @@ -3695,14 +3655,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", ] [[package]] name = "rustls" -version = "0.20.7" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" dependencies = [ "log", "ring", @@ -3724,24 +3684,24 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", ] [[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" @@ -3763,21 +3723,21 @@ 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", - "parity-scale-codec 3.2.1", + "parity-scale-codec 3.2.2", "scale-info-derive", ] [[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", @@ -3787,12 +3747,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] @@ -3803,9 +3762,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "scrypt" @@ -3843,29 +3802,11 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "7c4437699b6d34972de58652c68b98cb5b53a4199ab126db8e20ec8ded29a721" dependencies = [ "bitflags", "core-foundation", @@ -3876,9 +3817,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -3895,9 +3836,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", ] @@ -3925,9 +3866,9 @@ checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7" [[package]] name = "serde" -version = "1.0.148" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -3944,9 +3885,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.148" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -3955,9 +3896,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", @@ -3978,9 +3919,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.14" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da" +checksum = "8fb06d4b6cdaef0e0c51fa881acb721bed3c924cfaa71d9c94a3b771dfdf6567" dependencies = [ "indexmap", "itoa", @@ -4135,7 +4076,7 @@ dependencies = [ [[package]] name = "ssz-rs" version = "0.8.0" -source = "git+https://github.com/ralexstokes/ssz-rs?rev=cb08f18ca919cc1b685b861d0fa9e2daabe89737#cb08f18ca919cc1b685b861d0fa9e2daabe89737" +source = "git+https://github.com/ralexstokes/ssz-rs?rev=d09f55b4f8554491e3431e01af1c32347a8781cd#d09f55b4f8554491e3431e01af1c32347a8781cd" dependencies = [ "bitvec 1.0.1", "hex", @@ -4150,7 +4091,7 @@ dependencies = [ [[package]] name = "ssz-rs-derive" version = "0.8.0" -source = "git+https://github.com/ralexstokes/ssz-rs?rev=cb08f18ca919cc1b685b861d0fa9e2daabe89737#cb08f18ca919cc1b685b861d0fa9e2daabe89737" +source = "git+https://github.com/ralexstokes/ssz-rs?rev=d09f55b4f8554491e3431e01af1c32347a8781cd#d09f55b4f8554491e3431e01af1c32347a8781cd" dependencies = [ "proc-macro2", "quote", @@ -4212,42 +4153,21 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - [[package]] name = "tap" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "task-local-extensions" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4167afbec18ae012de40f8cf1b9bf48420abb390678c34821caa07d924941cc4" -dependencies = [ - "tokio", -] - [[package]] name = "tempfile" version = "3.3.0" @@ -4264,9 +4184,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] @@ -4279,18 +4199,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[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", @@ -4306,15 +4226,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.1.45" @@ -4371,9 +4282,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" dependencies = [ "autocfg", "bytes", @@ -4386,7 +4297,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys", ] [[package]] @@ -4449,13 +4360,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729bfd096e40da9c001f778f5cdecbd2957929a24e10e5883d9392220a751581" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -4579,9 +4507,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "ttf-parser" @@ -4591,9 +4519,9 @@ checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[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 = "ucd-trie" @@ -4645,15 +4573,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[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" @@ -4684,9 +4612,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" +checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" [[package]] name = "untrusted" @@ -4881,9 +4809,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", ] @@ -4894,17 +4822,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" -[[package]] -name = "which" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" -dependencies = [ - "either", - "libc", - "once_cell", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4936,19 +4853,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -4956,85 +4860,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winreg" @@ -5104,18 +4978,3 @@ name = "zeroize" version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/Cargo.toml b/Cargo.toml index 5d8db37..e578d2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helios" -version = "0.1.3" +version = "0.2.0" edition = "2021" autobenches = false @@ -21,11 +21,11 @@ common = { path = "./common" } consensus = { path = "./consensus" } execution = { path = "./execution" } -[dev-dependencies] +[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] tokio = { version = "1", features = ["full"] } eyre = "0.6.8" home = "0.5.4" -ethers = "1.0.2" +ethers = "1.0.0" env_logger = "0.9.0" log = "0.4.17" tracing-test = "0.2.3" @@ -34,6 +34,9 @@ plotters = "0.3.3" tempfile = "3.3.0" hex = "0.4.3" +[patch.crates-io] +ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "c17c0c3c956f12d205a5ede3176599d8a30ca739" } + [profile.release] strip = true opt-level = "z" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 3159f7a..478a40c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -2,7 +2,7 @@ cargo-features = ["different-binary-name"] [package] name = "cli" -version = "0.1.3" +version = "0.2.0" edition = "2021" [[bin]] diff --git a/cli/src/main.rs b/cli/src/main.rs index 270f777..bc8d09d 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,5 +1,4 @@ use std::{ - fs, path::PathBuf, process::exit, str::FromStr, @@ -104,10 +103,10 @@ struct Cli { impl Cli { fn as_cli_config(&self) -> CliConfig { - let checkpoint = match &self.checkpoint { - Some(checkpoint) => Some(hex_str_to_bytes(checkpoint).expect("invalid checkpoint")), - None => self.get_cached_checkpoint(), - }; + let checkpoint = self + .checkpoint + .as_ref() + .map(|c| hex_str_to_bytes(c).expect("invalid checkpoint")); CliConfig { checkpoint, @@ -121,21 +120,6 @@ impl Cli { } } - fn get_cached_checkpoint(&self) -> Option> { - let data_dir = self.get_data_dir(); - let checkpoint_file = data_dir.join("checkpoint"); - - if checkpoint_file.exists() { - let checkpoint_res = fs::read(checkpoint_file); - match checkpoint_res { - Ok(checkpoint) => Some(checkpoint), - Err(_) => None, - } - } else { - None - } - } - fn get_data_dir(&self) -> PathBuf { if let Some(dir) = &self.data_dir { PathBuf::from_str(dir).expect("cannot find data dir") diff --git a/client/Cargo.toml b/client/Cargo.toml index 95e91fd..4378611 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,16 +1,14 @@ [package] name = "client" -version = "0.1.3" +version = "0.2.0" edition = "2021" [dependencies] -tokio = { version = "1", features = ["full"] } eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" -ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } -ethers = "1.0.2" -jsonrpsee = { version = "0.15.1", features = ["full"] } +ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "d09f55b4f8554491e3431e01af1c32347a8781cd" } +ethers = "1.0.0" futures = "0.3.23" log = "0.4.17" thiserror = "1.0.37" @@ -19,3 +17,13 @@ common = { path = "../common" } consensus = { path = "../consensus" } execution = { path = "../execution" } config = { path = "../config" } + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +jsonrpsee = { version = "0.15.1", features = ["full"] } +tokio = { version = "1", features = ["full"] } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +gloo-timers = "0.2.6" +wasm-bindgen-futures = "0.4.33" +tokio = { version = "1", features = ["sync"] } + diff --git a/client/src/client.rs b/client/src/client.rs index f80e6ad..4cc7d45 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -1,4 +1,3 @@ -use std::path::PathBuf; use std::sync::Arc; use config::networks::Network; @@ -12,13 +11,25 @@ use config::{CheckpointFallback, Config}; use consensus::{types::Header, ConsensusClient}; use execution::types::{CallOpts, ExecutionBlock}; use log::{error, info, warn}; -use tokio::spawn; use tokio::sync::RwLock; + +#[cfg(not(target_arch = "wasm32"))] +use std::path::PathBuf; +#[cfg(not(target_arch = "wasm32"))] +use tokio::spawn; +#[cfg(not(target_arch = "wasm32"))] use tokio::time::sleep; -use crate::database::{Database, FileDB}; +#[cfg(target_arch = "wasm32")] +use gloo_timers::callback::Interval; +#[cfg(target_arch = "wasm32")] +use wasm_bindgen_futures::spawn_local; + +use crate::database::Database; use crate::errors::NodeError; use crate::node::Node; + +#[cfg(not(target_arch = "wasm32"))] use crate::rpc::Rpc; #[derive(Default)] @@ -27,7 +38,9 @@ pub struct ClientBuilder { consensus_rpc: Option, execution_rpc: Option, checkpoint: Option>, + #[cfg(not(target_arch = "wasm32"))] rpc_port: Option, + #[cfg(not(target_arch = "wasm32"))] data_dir: Option, config: Option, fallback: Option, @@ -62,11 +75,13 @@ impl ClientBuilder { self } + #[cfg(not(target_arch = "wasm32"))] pub fn rpc_port(mut self, port: u16) -> Self { self.rpc_port = Some(port); self } + #[cfg(not(target_arch = "wasm32"))] pub fn data_dir(mut self, data_dir: PathBuf) -> Self { self.data_dir = Some(data_dir); self @@ -92,7 +107,7 @@ impl ClientBuilder { self } - pub fn build(self) -> Result> { + pub fn build(self) -> Result> { let base_config = if let Some(network) = self.network { network.to_base_config() } else { @@ -127,6 +142,7 @@ impl ClientBuilder { base_config.checkpoint }; + #[cfg(not(target_arch = "wasm32"))] let rpc_port = if self.rpc_port.is_some() { self.rpc_port } else if let Some(config) = &self.config { @@ -135,6 +151,7 @@ impl ClientBuilder { None }; + #[cfg(not(target_arch = "wasm32"))] let data_dir = if self.data_dir.is_some() { self.data_dir } else if let Some(config) = &self.config { @@ -167,8 +184,14 @@ impl ClientBuilder { consensus_rpc, execution_rpc, checkpoint, + #[cfg(not(target_arch = "wasm32"))] rpc_port, + #[cfg(target_arch = "wasm32")] + rpc_port: None, + #[cfg(not(target_arch = "wasm32"))] data_dir, + #[cfg(target_arch = "wasm32")] + data_dir: None, chain: base_config.chain, forks: base_config.forks, max_checkpoint_age: base_config.max_checkpoint_age, @@ -183,35 +206,38 @@ impl ClientBuilder { pub struct Client { node: Arc>, + #[cfg(not(target_arch = "wasm32"))] rpc: Option, - db: Option, + db: DB, fallback: Option, load_external_fallback: bool, } -impl Client { - fn new(config: Config) -> Result { +impl Client { + fn new(mut config: Config) -> Result { + let db = DB::new(&config)?; + let checkpoint = db.load_checkpoint()?; + config.checkpoint = checkpoint; + let config = Arc::new(config); let node = Node::new(config.clone())?; let node = Arc::new(RwLock::new(node)); + #[cfg(not(target_arch = "wasm32"))] let rpc = config.rpc_port.map(|port| Rpc::new(node.clone(), port)); - let data_dir = config.data_dir.clone(); - let db = data_dir.map(FileDB::new); - Ok(Client { node, + #[cfg(not(target_arch = "wasm32"))] rpc, db, fallback: config.fallback.clone(), load_external_fallback: config.load_external_fallback, }) } -} -impl Client { pub async fn start(&mut self) -> Result<()> { + #[cfg(not(target_arch = "wasm32"))] if let Some(rpc) = &mut self.rpc { rpc.start().await?; } @@ -241,6 +267,13 @@ impl Client { } } + self.start_advance_thread(); + + Ok(()) + } + + #[cfg(not(target_arch = "wasm32"))] + fn start_advance_thread(&self) { let node = self.node.clone(); spawn(async move { loop { @@ -250,11 +283,25 @@ impl Client { } let next_update = node.read().await.duration_until_next_update(); + sleep(next_update).await; } }); + } - Ok(()) + #[cfg(target_arch = "wasm32")] + fn start_advance_thread(&self) { + let node = self.node.clone(); + Interval::new(12000, move || { + let node = node.clone(); + spawn_local(async move { + let res = node.write().await.advance().await; + if let Err(err) = res { + warn!("consensus error: {}", err); + } + }); + }) + .forget(); } async fn boot_from_fallback(&self) -> eyre::Result<()> { @@ -335,8 +382,8 @@ impl Client { }; info!("saving last checkpoint hash"); - let res = self.db.as_ref().map(|db| db.save_checkpoint(checkpoint)); - if res.is_some() && res.unwrap().is_err() { + let res = self.db.save_checkpoint(checkpoint); + if res.is_err() { warn!("checkpoint save failed"); } } diff --git a/client/src/database.rs b/client/src/database.rs index 3736f93..864cff8 100644 --- a/client/src/database.rs +++ b/client/src/database.rs @@ -1,27 +1,40 @@ +#[cfg(not(target_arch = "wasm32"))] use std::{ fs, io::{Read, Write}, path::PathBuf, }; +use config::Config; use eyre::Result; pub trait Database { + fn new(config: &Config) -> Result + where + Self: Sized; fn save_checkpoint(&self, checkpoint: Vec) -> Result<()>; fn load_checkpoint(&self) -> Result>; } +#[cfg(not(target_arch = "wasm32"))] pub struct FileDB { data_dir: PathBuf, + default_checkpoint: Vec, } -impl FileDB { - pub fn new(data_dir: PathBuf) -> Self { - FileDB { data_dir } - } -} - +#[cfg(not(target_arch = "wasm32"))] impl Database for FileDB { + fn new(config: &Config) -> Result { + if let Some(data_dir) = &config.data_dir { + return Ok(FileDB { + data_dir: data_dir.to_path_buf(), + default_checkpoint: config.checkpoint.clone(), + }); + } + + eyre::bail!("data dir not in config") + } + fn save_checkpoint(&self, checkpoint: Vec) -> Result<()> { fs::create_dir_all(&self.data_dir)?; @@ -44,6 +57,30 @@ impl Database for FileDB { let mut buf = Vec::new(); f.read_to_end(&mut buf)?; - Ok(buf) + if buf.len() == 32 { + Ok(buf) + } else { + Ok(self.default_checkpoint.clone()) + } + } +} + +pub struct ConfigDB { + checkpoint: Vec, +} + +impl Database for ConfigDB { + fn new(config: &Config) -> Result { + Ok(Self { + checkpoint: config.checkpoint.clone(), + }) + } + + fn load_checkpoint(&self) -> Result> { + Ok(self.checkpoint.clone()) + } + + fn save_checkpoint(&self, _checkpoint: Vec) -> Result<()> { + Ok(()) } } diff --git a/client/src/errors.rs b/client/src/errors.rs index 39a6679..f3226cc 100644 --- a/client/src/errors.rs +++ b/client/src/errors.rs @@ -37,6 +37,7 @@ pub enum NodeError { BlockNotFoundError(#[from] BlockNotFoundError), } +#[cfg(not(target_arch = "wasm32"))] impl NodeError { pub fn to_json_rpsee_error(self) -> jsonrpsee::core::Error { match self { diff --git a/client/src/lib.rs b/client/src/lib.rs index 99729fc..5aa1bf2 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -3,6 +3,8 @@ pub use crate::client::*; pub mod database; pub mod errors; + +#[cfg(not(target_arch = "wasm32"))] pub mod rpc; -mod node; +pub mod node; diff --git a/common/Cargo.toml b/common/Cargo.toml index 82f5a5f..deacb9b 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "common" -version = "0.1.3" +version = "0.2.0" edition = "2021" [dependencies] eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" -ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } -ethers = "1.0.2" +ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "d09f55b4f8554491e3431e01af1c32347a8781cd" } +ethers = "1.0.0" thiserror = "1.0.37" diff --git a/config/Cargo.toml b/config/Cargo.toml index ba17647..eee5ef3 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "config" -version = "0.1.3" +version = "0.2.0" edition = "2021" [dependencies] -tokio = { version = "1", features = ["full"] } eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } hex = "0.4.3" -ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } -ethers = "1.0.2" +ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "d09f55b4f8554491e3431e01af1c32347a8781cd" } +ethers = "1.0.0" figment = { version = "0.10.7", features = ["toml", "env"] } thiserror = "1.0.37" log = "0.4.17" - -common = { path = "../common" } reqwest = "0.11.13" serde_yaml = "0.9.14" strum = "0.24.1" futures = "0.3.25" +common = { path = "../common" } +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tokio = { version = "1", features = ["full"] } diff --git a/config/src/checkpoints.rs b/config/src/checkpoints.rs index 65fe45a..35a73be 100644 --- a/config/src/checkpoints.rs +++ b/config/src/checkpoints.rs @@ -136,26 +136,25 @@ impl CheckpointFallback { // Iterate over all mainnet checkpoint sync services and get the latest checkpoint slot for each. let tasks: Vec<_> = services .iter() - .map(|service| { + .map(|service| async move { let service = service.clone(); - tokio::spawn(async move { - match Self::query_service(&service.endpoint).await { - Some(raw) => { - if raw.data.slots.is_empty() { - return Err(eyre::eyre!("no slots")); - } - Ok(raw.data.slots[0].clone()) + match Self::query_service(&service.endpoint).await { + Some(raw) => { + if raw.data.slots.is_empty() { + return Err(eyre::eyre!("no slots")); } - None => Err(eyre::eyre!("failed to query service")), + Ok(raw.data.slots[0].clone()) } - }) + None => Err(eyre::eyre!("failed to query service")), + } }) .collect(); + let slots = futures::future::join_all(tasks) .await .iter() .filter_map(|slot| match &slot { - Ok(Ok(s)) => Some(s.clone()), + Ok(s) => Some(s.clone()), _ => None, }) .collect::>(); diff --git a/config/src/networks.rs b/config/src/networks.rs index 752a0ee..72d8bde 100644 --- a/config/src/networks.rs +++ b/config/src/networks.rs @@ -36,7 +36,7 @@ impl Network { pub fn mainnet() -> BaseConfig { BaseConfig { checkpoint: hex_str_to_bytes( - "0x428ce0b5f5bbed1fc2b3feb5d4152ae0fe98a80b1bfa8de36681868e81e9222a", + "0x766647f3c4e1fc91c0db9a9374032ae038778411fbff222974e11f2e3ce7dadf", ) .unwrap(), rpc_port: 8545, diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index 2c8b700..41e1a1c 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -1,27 +1,31 @@ [package] name = "consensus" -version = "0.1.3" +version = "0.2.0" edition = "2021" [dependencies] -tokio = { version = "1", features = ["full"] } eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } serde_json = "1.0.85" hex = "0.4.3" -ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } -blst = "0.3.10" -ethers = "1.0.2" +ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "d09f55b4f8554491e3431e01af1c32347a8781cd" } +milagro_bls = { git = "https://github.com/Snowfork/milagro_bls" } +ethers = "1.0.0" bytes = "1.2.1" toml = "0.5.9" async-trait = "0.1.57" log = "0.4.17" chrono = "0.4.22" thiserror = "1.0.37" -openssl = { version = "0.10", features = ["vendored"] } -reqwest = { version = "0.11.12", features = ["json"] } -reqwest-middleware = "0.1.6" -reqwest-retry = "0.1.5" +reqwest = { version = "0.11.13", features = ["json"] } common = { path = "../common" } config = { path = "../config" } + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +openssl = { version = "0.10", features = ["vendored"] } +tokio = { version = "1", features = ["full"] } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-timer = "0.2.5" + diff --git a/consensus/src/consensus.rs b/consensus/src/consensus.rs index b29905b..86c60a1 100644 --- a/consensus/src/consensus.rs +++ b/consensus/src/consensus.rs @@ -1,13 +1,12 @@ use std::cmp; use std::sync::Arc; -use std::time::UNIX_EPOCH; -use blst::min_pk::PublicKey; use chrono::Duration; use eyre::eyre; use eyre::Result; use log::warn; use log::{debug, info}; +use milagro_bls::PublicKey; use ssz_rs::prelude::*; use common::types::*; @@ -21,9 +20,20 @@ use super::rpc::ConsensusRpc; use super::types::*; use super::utils::*; +#[cfg(not(target_arch = "wasm32"))] +use std::time::SystemTime; +#[cfg(not(target_arch = "wasm32"))] +use std::time::UNIX_EPOCH; + +#[cfg(target_arch = "wasm32")] +use wasm_timer::SystemTime; +#[cfg(target_arch = "wasm32")] +use wasm_timer::UNIX_EPOCH; + // https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/sync-protocol.md // does not implement force updates +#[derive(Debug)] pub struct ConsensusClient { rpc: R, store: LightClientStore, @@ -480,18 +490,13 @@ impl ConsensusClient { fn age(&self, slot: u64) -> Duration { let expected_time = self.slot_timestamp(slot); - let now = std::time::SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap(); + let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); let delay = now - std::time::Duration::from_secs(expected_time); chrono::Duration::from_std(delay).unwrap() } pub fn expected_current_slot(&self) -> u64 { - let now = std::time::SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap(); - + let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); let genesis_time = self.config.chain.genesis_time; let since_genesis = now - std::time::Duration::from_secs(genesis_time); @@ -509,7 +514,7 @@ impl ConsensusClient { let next_slot = current_slot + 1; let next_slot_timestamp = self.slot_timestamp(next_slot); - let now = std::time::SystemTime::now() + let now = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs(); @@ -540,7 +545,7 @@ fn get_participating_keys( bitfield.iter().enumerate().for_each(|(i, bit)| { if bit == true { let pk = &committee.pubkeys[i]; - let pk = PublicKey::from_bytes(pk).unwrap(); + let pk = PublicKey::from_bytes_unchecked(pk).unwrap(); pks.push(pk); } }); diff --git a/consensus/src/rpc/mock_rpc.rs b/consensus/src/rpc/mock_rpc.rs index f4ac130..a887410 100644 --- a/consensus/src/rpc/mock_rpc.rs +++ b/consensus/src/rpc/mock_rpc.rs @@ -8,7 +8,8 @@ pub struct MockRpc { testdata: PathBuf, } -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] impl ConsensusRpc for MockRpc { fn new(path: &str) -> Self { MockRpc { diff --git a/consensus/src/rpc/mod.rs b/consensus/src/rpc/mod.rs index 9dc8874..03f46dd 100644 --- a/consensus/src/rpc/mod.rs +++ b/consensus/src/rpc/mod.rs @@ -7,7 +7,8 @@ use eyre::Result; use crate::types::{BeaconBlock, Bootstrap, FinalityUpdate, OptimisticUpdate, Update}; // implements https://github.com/ethereum/beacon-APIs/tree/master/apis/beacon/light_client -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] pub trait ConsensusRpc { fn new(path: &str) -> Self; async fn get_bootstrap(&self, block_root: &'_ [u8]) -> Result; diff --git a/consensus/src/rpc/nimbus_rpc.rs b/consensus/src/rpc/nimbus_rpc.rs index e4006fa..e0548fb 100644 --- a/consensus/src/rpc/nimbus_rpc.rs +++ b/consensus/src/rpc/nimbus_rpc.rs @@ -1,7 +1,5 @@ use async_trait::async_trait; use eyre::Result; -use reqwest_middleware::{ClientBuilder, ClientWithMiddleware}; -use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware}; use std::cmp; use super::ConsensusRpc; @@ -9,25 +7,17 @@ use crate::constants::MAX_REQUEST_LIGHT_CLIENT_UPDATES; use crate::types::*; use common::errors::RpcError; +#[derive(Debug)] pub struct NimbusRpc { rpc: String, - client: ClientWithMiddleware, } -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] impl ConsensusRpc for NimbusRpc { fn new(rpc: &str) -> Self { - let retry_policy = ExponentialBackoff::builder() - .backoff_exponent(1) - .build_with_max_retries(3); - - let client = ClientBuilder::new(reqwest::Client::new()) - .with(RetryTransientMiddleware::new_with_policy(retry_policy)) - .build(); - NimbusRpc { rpc: rpc.to_string(), - client, } } @@ -38,8 +28,8 @@ impl ConsensusRpc for NimbusRpc { self.rpc, root_hex ); - let res = self - .client + let client = reqwest::Client::new(); + let res = client .get(req) .send() .await @@ -58,8 +48,8 @@ impl ConsensusRpc for NimbusRpc { self.rpc, period, count ); - let res = self - .client + let client = reqwest::Client::new(); + let res = client .get(req) .send() .await @@ -73,10 +63,7 @@ impl ConsensusRpc for NimbusRpc { async fn get_finality_update(&self) -> Result { let req = format!("{}/eth/v1/beacon/light_client/finality_update", self.rpc); - let res = self - .client - .get(req) - .send() + let res = reqwest::get(req) .await .map_err(|e| RpcError::new("finality_update", e))? .json::() @@ -88,10 +75,7 @@ impl ConsensusRpc for NimbusRpc { async fn get_optimistic_update(&self) -> Result { let req = format!("{}/eth/v1/beacon/light_client/optimistic_update", self.rpc); - let res = self - .client - .get(req) - .send() + let res = reqwest::get(req) .await .map_err(|e| RpcError::new("optimistic_update", e))? .json::() @@ -103,10 +87,7 @@ impl ConsensusRpc for NimbusRpc { async fn get_block(&self, slot: u64) -> Result { let req = format!("{}/eth/v2/beacon/blocks/{}", self.rpc, slot); - let res = self - .client - .get(req) - .send() + let res = reqwest::get(req) .await .map_err(|e| RpcError::new("blocks", e))? .json::() @@ -118,10 +99,7 @@ impl ConsensusRpc for NimbusRpc { async fn chain_id(&self) -> Result { let req = format!("{}/eth/v1/config/spec", self.rpc); - let res = self - .client - .get(req) - .send() + let res = reqwest::get(req) .await .map_err(|e| RpcError::new("spec", e))? .json::() diff --git a/consensus/src/utils.rs b/consensus/src/utils.rs index 92dffed..2369fe2 100644 --- a/consensus/src/utils.rs +++ b/consensus/src/utils.rs @@ -1,9 +1,6 @@ -use blst::{ - min_pk::{PublicKey, Signature}, - BLST_ERROR, -}; use common::{types::Bytes32, utils::bytes32_to_node}; use eyre::Result; +use milagro_bls::{AggregateSignature, PublicKey}; use ssz_rs::prelude::*; use crate::types::{Header, SignatureBytes}; @@ -14,10 +11,9 @@ pub fn calc_sync_period(slot: u64) -> u64 { } pub fn is_aggregate_valid(sig_bytes: &SignatureBytes, msg: &[u8], pks: &[&PublicKey]) -> bool { - let dst: &[u8] = b"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_"; - let sig_res = Signature::from_bytes(sig_bytes); + let sig_res = AggregateSignature::from_bytes(sig_bytes); match sig_res { - Ok(sig) => sig.fast_aggregate_verify(true, msg, dst, pks) == BLST_ERROR::BLST_SUCCESS, + Ok(sig) => sig.fast_aggregate_verify(msg, pks), Err(_) => false, } } diff --git a/examples/basic.rs b/examples/basic.rs index 1c4d5ce..8958f00 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use env_logger::Env; use ethers::{types::Address, utils}; use eyre::Result; -use helios::{client::ClientBuilder, config::networks::Network, types::BlockTag}; +use helios::{config::networks::Network, prelude::*}; #[tokio::main] async fn main() -> Result<()> { @@ -15,12 +15,13 @@ async fn main() -> Result<()> { let consensus_rpc = "https://www.lightclientdata.org"; log::info!("Using consensus RPC URL: {}", consensus_rpc); - let mut client = ClientBuilder::new() + let mut client: Client = ClientBuilder::new() .network(Network::MAINNET) .consensus_rpc(consensus_rpc) .execution_rpc(untrusted_rpc_url) .load_external_fallback() .build()?; + log::info!( "Built client on network \"{}\" with external checkpoint fallbacks", Network::MAINNET diff --git a/examples/client.rs b/examples/client.rs index cbd3013..3914408 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -35,7 +35,7 @@ async fn main() -> Result<()> { builder = builder.load_external_fallback(); // Build the client - let _client = builder.build().unwrap(); + let _client: Client = builder.build().unwrap(); println!("Constructed client!"); Ok(()) diff --git a/execution/Cargo.toml b/execution/Cargo.toml index b0c46e5..cbe6eb8 100644 --- a/execution/Cargo.toml +++ b/execution/Cargo.toml @@ -1,18 +1,17 @@ [package] name = "execution" -version = "0.1.3" +version = "0.2.0" edition = "2021" [dependencies] reqwest = { version = "0.11", features = ["json"] } -tokio = { version = "1", features = ["full"] } eyre = "0.6.8" serde = { version = "1.0.143", features = ["derive"] } serde_json = "1.0.85" hex = "0.4.3" -ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } -ethers = "1.0.2" -revm = "2.1.0" +ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "d09f55b4f8554491e3431e01af1c32347a8781cd" } +revm = { version = "2.3", default-features = false, features = ["std", "k256", "with-serde"] } +ethers = "1.0.0" bytes = "1.2.1" futures = "0.3.23" toml = "0.5.9" @@ -20,7 +19,10 @@ triehash-ethereum = { git = "https://github.com/openethereum/parity-ethereum", r async-trait = "0.1.57" log = "0.4.17" thiserror = "1.0.37" -openssl = { version = "0.10", features = ["vendored"] } common = { path = "../common" } consensus = { path = "../consensus" } + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +openssl = { version = "0.10", features = ["vendored"] } +tokio = { version = "1", features = ["full"] } diff --git a/execution/src/evm.rs b/execution/src/evm.rs index f25ce69..33095fa 100644 --- a/execution/src/evm.rs +++ b/execution/src/evm.rs @@ -9,14 +9,13 @@ use bytes::Bytes; use common::{errors::BlockNotFoundError, types::BlockTag}; use ethers::{ abi::ethereum_types::BigEndianHash, - prelude::{Address, H160, H256, U256}, types::transaction::eip2930::AccessListItem, + types::{Address, H160, H256, U256}, }; use eyre::{Report, Result}; -use futures::future::join_all; +use futures::{executor::block_on, future::join_all}; use log::trace; use revm::{AccountInfo, Bytecode, Database, Env, TransactOut, TransactTo, EVM}; -use tokio::runtime::Runtime; use consensus::types::ExecutionPayload; @@ -225,8 +224,9 @@ impl<'a, R: ExecutionRpc> ProofDB<'a, R> { let handle = thread::spawn(move || { let account_fut = execution.get_account(&address, Some(&slots), &payload); - let runtime = Runtime::new()?; - runtime.block_on(account_fut) + // let runtime = Runtime::new()?; + // runtime.block_on(account_fut) + block_on(account_fut) }); handle.join().unwrap() diff --git a/execution/src/rpc/http_rpc.rs b/execution/src/rpc/http_rpc.rs index 05e4342..cc48953 100644 --- a/execution/src/rpc/http_rpc.rs +++ b/execution/src/rpc/http_rpc.rs @@ -27,13 +27,16 @@ impl Clone for HttpRpc { } } -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] impl ExecutionRpc for HttpRpc { fn new(rpc: &str) -> Result { let http = Http::from_str(rpc)?; let mut client = RetryClient::new(http, Box::new(HttpRateLimitRetryPolicy), 100, 50); client.set_compute_units(300); + let provider = Provider::new(client); + Ok(HttpRpc { url: rpc.to_string(), provider, diff --git a/execution/src/rpc/mock_rpc.rs b/execution/src/rpc/mock_rpc.rs index 3a4fd1e..e7ede3c 100644 --- a/execution/src/rpc/mock_rpc.rs +++ b/execution/src/rpc/mock_rpc.rs @@ -17,7 +17,8 @@ pub struct MockRpc { path: PathBuf, } -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] impl ExecutionRpc for MockRpc { fn new(rpc: &str) -> Result { let path = PathBuf::from(rpc); diff --git a/execution/src/rpc/mod.rs b/execution/src/rpc/mod.rs index 0c1b799..f2157a8 100644 --- a/execution/src/rpc/mod.rs +++ b/execution/src/rpc/mod.rs @@ -10,7 +10,8 @@ use crate::types::CallOpts; pub mod http_rpc; pub mod mock_rpc; -#[async_trait] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] pub trait ExecutionRpc: Send + Clone + Sync + 'static { fn new(rpc: &str) -> Result where