diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a1b6ef..41cf848 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: run: rustup target add aarch64-apple-darwin - name: build - run: cargo build --all --release --target aarch64-apple-darwin + run: cargo build --package cli --release --target aarch64-apple-darwin - name: archive run: gtar -czvf "helios_darwin_arm64.tar.gz" -C ./target/aarch64-apple-darwin/release helios @@ -58,7 +58,7 @@ jobs: run: rustup target add x86_64-apple-darwin - name: build - run: cargo build --all --release --target x86_64-apple-darwin + run: cargo build --package cli --release --target x86_64-apple-darwin - name: archive run: gtar -czvf "helios_darwin_amd64.tar.gz" -C ./target/x86_64-apple-darwin/release helios @@ -101,7 +101,7 @@ jobs: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV - name: build - run: cargo build --all --release --target aarch64-unknown-linux-gnu + run: cargo build --package cli --release --target aarch64-unknown-linux-gnu - name: archive run: tar -czvf "helios_linux_arm64.tar.gz" -C ./target/aarch64-unknown-linux-gnu/release helios @@ -138,7 +138,7 @@ jobs: run: rustup target add x86_64-unknown-linux-gnu - name: build - run: cargo build --all --release --target x86_64-unknown-linux-gnu + run: cargo build --package cli --release --target x86_64-unknown-linux-gnu - name: archive run: tar -czvf "helios_linux_amd64.tar.gz" -C ./target/x86_64-unknown-linux-gnu/release helios diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b44235..8bcc18d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test + args: --all fmt: name: fmt diff --git a/Cargo.lock b/Cargo.lock index 79a0b63..81ebfb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if", "cipher", @@ -29,7 +29,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", "once_cell", "version_check", ] @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "arrayref" @@ -78,18 +78,19 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-lock" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" dependencies = [ "event-listener", + "futures-lite", ] [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -187,15 +188,15 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64ct" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2b2456fd614d856680dcd9fcc660a51a820fa09daef2e49772b56a193c8474" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bech32" @@ -327,9 +328,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-slice-cast" @@ -339,9 +340,9 @@ checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" [[package]] name = "byte-slice-cast" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byte-tools" @@ -398,9 +399,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" [[package]] name = "cfg-if" @@ -435,9 +436,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.20" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b71c3ce99b7611011217b366d923f1d0a7e07a92bb2dbf1e84508c673ca3bd" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -472,6 +473,23 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "cli" +version = "0.1.0" +dependencies = [ + "clap", + "client", + "common", + "config", + "ctrlc", + "dirs", + "env_logger", + "eyre", + "futures", + "log", + "tokio", +] + [[package]] name = "client" version = "0.1.0" @@ -497,6 +515,16 @@ dependencies = [ "toml", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "coins-bip32" version = "0.7.0" @@ -507,7 +535,7 @@ dependencies = [ "bs58", "coins-core", "digest 0.10.5", - "getrandom 0.2.7", + "getrandom 0.2.8", "hmac", "k256", "lazy_static", @@ -524,7 +552,7 @@ checksum = "2a11892bcac83b4c6e95ab84b5b06c76d9d70ad73548dd07418269c5c7977171" dependencies = [ "bitvec 0.17.4", "coins-bip32", - "getrandom 0.2.7", + "getrandom 0.2.8", "hex", "hmac", "pbkdf2", @@ -652,12 +680,12 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2b443d17d49dad5ef0ede301c3179cc923b8822f3393b4d2c28c269dd4a122" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -674,9 +702,9 @@ dependencies = [ [[package]] name = "ctr" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d14f329cfbaf5d0e06b5e87fff7e265d2673c5ea7d2c27691a2c107db1442a0" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] @@ -691,6 +719,50 @@ dependencies = [ "winapi", ] +[[package]] +name = "cxx" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "der" version = "0.6.0" @@ -769,9 +841,9 @@ checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" [[package]] name = "ecdsa" -version = "0.14.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e852f4174d2a8646a0fa8a34b55797856c722f86267deb0aa1e93f7f247f800e" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -799,7 +871,7 @@ dependencies = [ "generic-array 0.14.6", "group", "pkcs8", - "rand_core 0.6.3", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -816,9 +888,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" dependencies = [ "atty", "humantime", @@ -863,7 +935,7 @@ dependencies = [ "serde_json", "sha3", "thiserror", - "uint 0.9.3", + "uint 0.9.4", ] [[package]] @@ -921,13 +993,13 @@ dependencies = [ "impl-serde 0.3.2", "primitive-types 0.11.1", "scale-info", - "uint 0.9.3", + "uint 0.9.4", ] [[package]] name = "ethers" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -941,7 +1013,7 @@ dependencies = [ [[package]] name = "ethers-addressbook" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "ethers-core", "once_cell", @@ -952,7 +1024,7 @@ dependencies = [ [[package]] name = "ethers-contract" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "ethers-contract-abigen", "ethers-contract-derive", @@ -970,14 +1042,14 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "Inflector", "cfg-if", "dunce", "ethers-core", "eyre", - "getrandom 0.2.7", + "getrandom 0.2.8", "hex", "proc-macro2", "quote", @@ -993,7 +1065,7 @@ dependencies = [ [[package]] name = "ethers-contract-derive" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "ethers-contract-abigen", "ethers-core", @@ -1007,7 +1079,7 @@ dependencies = [ [[package]] name = "ethers-core" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "arrayvec 0.7.2", "bytes", @@ -1023,7 +1095,7 @@ dependencies = [ "open-fastrlp", "proc-macro2", "rand 0.8.5", - "rlp 0.5.1", + "rlp 0.5.2", "rlp-derive", "rust_decimal", "serde", @@ -1038,10 +1110,10 @@ dependencies = [ [[package]] name = "ethers-etherscan" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "ethers-core", - "getrandom 0.2.7", + "getrandom 0.2.8", "reqwest", "semver", "serde", @@ -1054,7 +1126,7 @@ dependencies = [ [[package]] name = "ethers-middleware" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "async-trait", "auto_impl 0.5.0", @@ -1079,16 +1151,16 @@ dependencies = [ [[package]] name = "ethers-providers" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "async-trait", "auto_impl 1.0.1", - "base64 0.13.0", + "base64 0.13.1", "ethers-core", "futures-core", "futures-timer", "futures-util", - "getrandom 0.2.7", + "getrandom 0.2.8", "hashers", "hex", "http", @@ -1113,7 +1185,7 @@ dependencies = [ [[package]] name = "ethers-signers" version = "1.0.0" -source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#14e038860b17807c148cad08192e0722c86753fb" +source = "git+https://github.com/ncitron/ethers-rs?branch=fix-retry#04e375470b7ef52d55075aff2f1f7d93daa12a93" dependencies = [ "async-trait", "coins-bip32", @@ -1186,19 +1258,19 @@ dependencies = [ [[package]] name = "ff" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df689201f395c6b90dfe87127685f8dbfc083a5e779e613575d8bd7314300c3e" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] [[package]] name = "figment" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bd154d9ae2f1bb0ada5b7eebd56529513efa5de7d2fc8c6adf33bc43260cf" +checksum = "4e56602b469b2201400dec66a66aec5a9b8761ee97cd1b8c96ab2483fcc16cc9" dependencies = [ "atomic", "pear", @@ -1270,9 +1342,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -1285,9 +1357,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -1295,15 +1367,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -1312,9 +1384,24 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-locks" @@ -1329,9 +1416,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", @@ -1340,15 +1427,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-timer" @@ -1362,9 +1449,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -1419,9 +1506,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "js-sys", @@ -1496,20 +1583,20 @@ dependencies = [ [[package]] name = "group" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7391856def869c1c81063a03457c676fbcd419709c3dfb33d8d319de484b154d" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -1556,19 +1643,13 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "helios" -version = "0.1.0" +version = "0.0.1" dependencies = [ - "clap", "client", "common", "config", - "ctrlc", - "dirs", - "env_logger", - "eyre", - "futures", - "log", - "tokio", + "consensus", + "execution", ] [[package]] @@ -1637,9 +1718,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" dependencies = [ "bytes", "futures-channel", @@ -1690,18 +1771,28 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.47" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c495f162af0bf17656d0014a0eded5f3cd2f365fdd204548c2869db89359dc7" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", - "once_cell", "wasm-bindgen", "winapi", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.3.0" @@ -1727,7 +1818,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ - "parity-scale-codec 3.1.5", + "parity-scale-codec 3.2.1", ] [[package]] @@ -1745,7 +1836,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" dependencies = [ - "rlp 0.5.1", + "rlp 0.5.2", ] [[package]] @@ -1828,15 +1919,15 @@ checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -2026,9 +2117,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.11.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2573d3fd3e4cc741affc9b5ce1a8ce36cf29f09f80f36da4309d0ae6d7854" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", "ecdsa", @@ -2065,15 +2156,24 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.132" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] [[package]] name = "lock_api" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg", "scopeguard", @@ -2102,21 +2202,21 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] name = "native-tls" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", @@ -2220,9 +2320,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", @@ -2294,9 +2394,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.41" +version = "0.10.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", "cfg-if", @@ -2335,9 +2435,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.75" +version = "0.9.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" dependencies = [ "autocfg", "cc", @@ -2349,9 +2449,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" [[package]] name = "parity-scale-codec" @@ -2367,13 +2467,13 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.1.5" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9182e4a71cae089267ab03e67c99368db7cd877baf50f931e5d6d4b71e195ac0" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" dependencies = [ "arrayvec 0.7.2", "bitvec 1.0.1", - "byte-slice-cast 1.2.1", + "byte-slice-cast 1.2.2", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2391,6 +2491,12 @@ dependencies = [ "syn", ] +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + [[package]] name = "parking_lot" version = "0.11.2" @@ -2409,7 +2515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", + "parking_lot_core 0.9.4", ] [[package]] @@ -2428,15 +2534,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -2446,7 +2552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -2545,9 +2651,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "plain_hasher" @@ -2588,7 +2694,7 @@ dependencies = [ "impl-rlp 0.3.0", "impl-serde 0.3.2", "scale-info", - "uint 0.9.3", + "uint 0.9.4", ] [[package]] @@ -2690,7 +2796,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -2710,7 +2816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -2724,11 +2830,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", ] [[package]] @@ -2755,7 +2861,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", "redox_syscall", "thiserror", ] @@ -2792,7 +2898,7 @@ version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytes", "encoding_rs", "futures-core", @@ -2830,9 +2936,9 @@ dependencies = [ [[package]] name = "revm" -version = "1.9.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab402ae244afdd560b2aa710df5af557bc791b1cca6fec174ced0cf781e13134" +checksum = "87344ffd3eec06b568e1fc69c225e4cbd8d68d8d9051b6d2652d596947efa1ce" dependencies = [ "arrayref", "auto_impl 1.0.1", @@ -2841,18 +2947,20 @@ dependencies = [ "num_enum", "primitive-types 0.11.1", "revm_precompiles", - "rlp 0.5.1", + "rlp 0.5.2", "sha3", ] [[package]] name = "revm_precompiles" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af88e7e9feb30cc4ed64645f09b966e84a1f6be56551ce5f1691105def45705d" +checksum = "00e68901326fe20437526cb6d64a2898d2976383b7d222329dfce1717902da50" dependencies = [ "bytes", + "hashbrown", "num", + "once_cell", "primitive-types 0.11.1", "ripemd", "secp256k1", @@ -2863,9 +2971,9 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88c86280f057430a52f4861551b092a01b419b8eacefc7c995eacb9dc132fe32" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", "hmac", @@ -2889,9 +2997,9 @@ dependencies = [ [[package]] name = "ripemd" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ "digest 0.10.5", ] @@ -2907,9 +3015,9 @@ dependencies = [ [[package]] name = "rlp" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "999508abb0ae792aabed2460c45b89106d97fe4adac593bdaef433c2605847b5" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", "rustc-hex", @@ -2960,9 +3068,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.6" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" dependencies = [ "log", "ring", @@ -2988,7 +3096,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", ] [[package]] @@ -3029,7 +3137,7 @@ checksum = "88d8a765117b237ef233705cc2cc4c6a27fccd46eea6ef0c8c6dae5f3ef407f8" dependencies = [ "cfg-if", "derive_more", - "parity-scale-codec 3.1.5", + "parity-scale-codec 3.2.1", "scale-info-derive", ] @@ -3052,7 +3160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -3061,6 +3169,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "scrypt" version = "0.10.0" @@ -3099,18 +3213,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ece73253dd9e1fb540ff324eae554113a31c25fb598d22fd13b088a6a03f90d" +checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7058dc8eaf3f2810d7828680320acda0b25a288f6d288e19278e249bbf74226b" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] @@ -3161,9 +3275,9 @@ checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] @@ -3180,9 +3294,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -3191,9 +3305,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -3263,9 +3377,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.4" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaedf34ed289ea47c2b741bb72e5357a209512d67bcd4bda44359e5bf0470f56" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ "digest 0.10.5", "keccak", @@ -3282,12 +3396,12 @@ dependencies = [ [[package]] name = "signature" -version = "1.6.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ea32af43239f0d353a7dd75a22d94c329c8cdaafdcb4c1c1335aa10c298a4a" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ "digest 0.10.5", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -3301,9 +3415,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" @@ -3321,7 +3435,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytes", "futures", "httparse", @@ -3478,9 +3592,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" @@ -3557,9 +3671,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.0" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ "autocfg", "bytes", @@ -3567,7 +3681,6 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", @@ -3610,9 +3723,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" dependencies = [ "futures-core", "pin-project-lite", @@ -3621,9 +3734,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes", "futures-core", @@ -3698,7 +3811,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" dependencies = [ "hash-db", - "rlp 0.5.1", + "rlp 0.5.2", ] [[package]] @@ -3737,9 +3850,9 @@ dependencies = [ [[package]] name = "uint" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" +checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" dependencies = [ "byteorder", "crunchy", @@ -3773,15 +3886,15 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] @@ -3792,6 +3905,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -3821,7 +3940,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", "serde", ] @@ -3837,6 +3956,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "walkdir" version = "2.3.2" @@ -3878,9 +4003,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "serde", @@ -3890,9 +4015,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", "log", @@ -3905,9 +4030,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.32" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ "cfg-if", "js-sys", @@ -3917,9 +4042,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3927,9 +4052,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -3940,9 +4065,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasm-timer" @@ -3961,9 +4086,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" dependencies = [ "js-sys", "wasm-bindgen", @@ -3981,9 +4106,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.4" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" +checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" dependencies = [ "webpki", ] @@ -4036,43 +4161,100 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "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" +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_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.36.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" + [[package]] name = "windows_i686_gnu" version = "0.36.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" + [[package]] name = "windows_i686_msvc" version = "0.36.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" + [[package]] name = "windows_x86_64_gnu" version = "0.36.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" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.36.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" + [[package]] name = "winreg" version = "0.10.1" diff --git a/Cargo.toml b/Cargo.toml index 5cacf46..6e020c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,8 @@ +[package] +name = "helios" +version = "0.0.1" +edition = "2021" + [workspace] members = [ @@ -9,5 +14,13 @@ members = [ "execution", ] +[dependencies] +client = { path = "./client" } +config = { path = "./config" } +common = { path = "./common" } +consensus = { path = "./consensus" } +execution = { path = "./execution" } + [patch.crates-io] ethers = { git = "https://github.com/ncitron/ethers-rs", branch = "fix-retry" } + diff --git a/README.md b/README.md index 89674b1..4eaca75 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Helios will now run a local RPC server at `http://127.0.0.1:8545`. `--rpc-port` or `-p` sets the port that the local RPC should run on. The default value is `8545`. +`--data-dir` or `d` sets the directory that Helios should use to store cached weak subjectivity checkpoints in. Each network only stores the latest checkpoint, which is just 32 bytes. + ### Configuration Files All configuration options can be set on a per-network level in `~/.helios/helios.toml`. Here is an example config file: ``` @@ -42,5 +44,39 @@ execution_rpc = "https://eth-goerli.g.alchemy.com/v2/XXXXX" checkpoint = "0xb5c375696913865d7c0e166d87bc7c772b6210dc9edf149f4c7ddc6da0dd4495" ``` +### Using Helios as a Library +Helios can be imported into any Rust project. Helios requires the Rust nightly toolchain to compile. + +```rust +use std::{str::FromStr, env}; + +use helios::{client::ClientBuilder, config::networks::Network, types::BlockTag}; +use ethers::{types::Address, utils}; +use eyre::Result; + +#[tokio::main] +async fn main() -> Result<()> { + let untrusted_rpc_url = env::var("UNTRUSTED_RPC_URL")?; + + let mut client = ClientBuilder::new() + .network(Network::MAINNET) + .consensus_rpc("https://www.lightclientdata.org") + .execution_rpc(&untrusted_rpc_url) + .build()?; + + client.start().await?; + + let head_block_num = client.get_block_number().await?; + let addr = Address::from_str("0x00000000219ab540356cBB839Cbe05303d7705Fa")?; + let block = BlockTag::Latest; + let balance = client.get_balance(&addr, block).await?; + + println!("synced up to block: {}", head_block_num); + println!("balance of deposit contract: {}", utils::format_ether(balance)); + + Ok(()) +} +``` + ## Contributing All contributions to Helios are welcome. Before opening a PR, please submit an issue detailing the bug or feature. When opening a PR, please ensure that your contribution builds on the nightly rust toolchain, has been linted with `cargo fmt`, and contains tests when applicable. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 5e9167b..9462629 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,8 +1,15 @@ +cargo-features = ["different-binary-name"] + [package] -name = "helios" +name = "cli" version = "0.1.0" edition = "2021" +[[bin]] +name = "cli" +filename = "helios" +path = "src/main.rs" + [dependencies] tokio = { version = "1", features = ["full"] } clap = { version = "3.2.18", features = ["derive", "env"] } diff --git a/client/Cargo.toml b/client/Cargo.toml index a62a245..d5cf9cb 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -15,7 +15,7 @@ ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1 blst = "0.3.10" ethers = "1.0.0" jsonrpsee = { version = "0.15.1", features = ["full"] } -revm = "1.9.0" +revm = "2.1.0" bytes = "1.2.1" futures = "0.3.23" toml = "0.5.9" diff --git a/client/src/client.rs b/client/src/client.rs index 5ba062c..21e2a95 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -22,7 +22,7 @@ use crate::rpc::Rpc; pub struct Client { node: Arc>, rpc: Option, - db: DB, + db: Option, } impl Client { @@ -38,7 +38,11 @@ impl Client { }; let data_dir = config.data_dir.clone(); - let db = FileDB::new(data_dir.ok_or(eyre!("data dir not found"))?); + let db = if let Some(dir) = data_dir { + Some(FileDB::new(dir)) + } else { + None + }; Ok(Client { node, rpc, db }) } @@ -114,29 +118,29 @@ impl ClientBuilder { config.to_base_config() }; - let consensus_rpc = self.consensus_rpc.unwrap_or( + let consensus_rpc = self.consensus_rpc.unwrap_or_else(|| { self.config .as_ref() - .ok_or(eyre!("missing consensus rpc"))? + .expect("missing consensus rpc") .consensus_rpc - .clone(), - ); + .clone() + }); - let execution_rpc = self.execution_rpc.unwrap_or( + let execution_rpc = self.execution_rpc.unwrap_or_else(|| { self.config .as_ref() - .ok_or(eyre!("missing execution rpc"))? + .expect("missing execution rpc") .execution_rpc - .clone(), - ); + .clone() + }); - let checkpoint = self.checkpoint.unwrap_or( - self.config - .as_ref() - .ok_or(eyre!("missing checkpoint"))? - .checkpoint - .clone(), - ); + let checkpoint = if let Some(checkpoint) = self.checkpoint { + checkpoint + } else if let Some(config) = &self.config { + config.checkpoint.clone() + } else { + base_config.checkpoint + }; let rpc_port = if self.rpc_port.is_some() { self.rpc_port @@ -170,15 +174,17 @@ impl ClientBuilder { impl Client { pub async fn start(&mut self) -> Result<()> { - self.rpc.as_mut().unwrap().start().await?; + if let Some(rpc) = &mut self.rpc { + rpc.start().await?; + } + + let res = self.node.write().await.sync().await; + if let Err(err) = res { + warn!("consensus error: {}", err); + } let node = self.node.clone(); spawn(async move { - let res = node.write().await.sync().await; - if let Err(err) = res { - warn!("consensus error: {}", err); - } - loop { let res = node.write().await.advance().await; if let Err(err) = res { @@ -202,13 +208,13 @@ impl Client { }; info!("saving last checkpoint hash"); - let res = self.db.save_checkpoint(checkpoint); - if res.is_err() { + let res = self.db.as_ref().map(|db| db.save_checkpoint(checkpoint)); + if res.is_some() && res.unwrap().is_err() { warn!("checkpoint save failed"); } } - pub async fn call(&self, opts: &CallOpts, block: &BlockTag) -> Result> { + pub async fn call(&self, opts: &CallOpts, block: BlockTag) -> Result> { self.node.read().await.call(opts, block).await } @@ -216,15 +222,15 @@ impl Client { self.node.read().await.estimate_gas(opts).await } - pub async fn get_balance(&self, address: &Address, block: &BlockTag) -> Result { + pub async fn get_balance(&self, address: &Address, block: BlockTag) -> Result { self.node.read().await.get_balance(address, block).await } - pub async fn get_nonce(&self, address: &Address, block: &BlockTag) -> Result { + pub async fn get_nonce(&self, address: &Address, block: BlockTag) -> Result { self.node.read().await.get_nonce(address, block).await } - pub async fn get_code(&self, address: &Address, block: &BlockTag) -> Result> { + pub async fn get_code(&self, address: &Address, block: BlockTag) -> Result> { self.node.read().await.get_code(address, block).await } @@ -269,7 +275,7 @@ impl Client { pub async fn get_block_by_number( &self, - block: &BlockTag, + block: BlockTag, full_tx: bool, ) -> Result> { self.node diff --git a/client/src/node.rs b/client/src/node.rs index e2282fe..5e47d1d 100644 --- a/client/src/node.rs +++ b/client/src/node.rs @@ -98,8 +98,8 @@ impl Node { Ok(()) } - pub async fn call(&self, opts: &CallOpts, block: &BlockTag) -> Result> { - self.check_blocktag_age(block)?; + pub async fn call(&self, opts: &CallOpts, block: BlockTag) -> Result> { + self.check_blocktag_age(&block)?; let payload = self.get_payload(block)?; let mut evm = Evm::new(self.execution.clone(), payload.clone(), self.chain_id()); @@ -109,29 +109,29 @@ impl Node { pub async fn estimate_gas(&self, opts: &CallOpts) -> Result { self.check_head_age()?; - let payload = self.get_payload(&BlockTag::Latest)?; + let payload = self.get_payload(BlockTag::Latest)?; let mut evm = Evm::new(self.execution.clone(), payload.clone(), self.chain_id()); evm.estimate_gas(opts).await } - pub async fn get_balance(&self, address: &Address, block: &BlockTag) -> Result { - self.check_blocktag_age(block)?; + pub async fn get_balance(&self, address: &Address, block: BlockTag) -> Result { + self.check_blocktag_age(&block)?; let payload = self.get_payload(block)?; let account = self.execution.get_account(&address, None, payload).await?; Ok(account.balance) } - pub async fn get_nonce(&self, address: &Address, block: &BlockTag) -> Result { - self.check_blocktag_age(block)?; + pub async fn get_nonce(&self, address: &Address, block: BlockTag) -> Result { + self.check_blocktag_age(&block)?; let payload = self.get_payload(block)?; let account = self.execution.get_account(&address, None, payload).await?; Ok(account.nonce) } - pub async fn get_code(&self, address: &Address, block: &BlockTag) -> Result> { - self.check_blocktag_age(block)?; + pub async fn get_code(&self, address: &Address, block: BlockTag) -> Result> { + self.check_blocktag_age(&block)?; let payload = self.get_payload(block)?; let account = self.execution.get_account(&address, None, payload).await?; @@ -141,7 +141,7 @@ impl Node { pub async fn get_storage_at(&self, address: &Address, slot: H256) -> Result { self.check_head_age()?; - let payload = self.get_payload(&BlockTag::Latest)?; + let payload = self.get_payload(BlockTag::Latest)?; let account = self .execution .get_account(address, Some(&[slot]), payload) @@ -177,7 +177,7 @@ impl Node { pub fn get_gas_price(&self) -> Result { self.check_head_age()?; - let payload = self.get_payload(&BlockTag::Latest)?; + let payload = self.get_payload(BlockTag::Latest)?; let base_fee = U256::from_little_endian(&payload.base_fee_per_gas.to_bytes_le()); let tip = U256::from(10_u64.pow(9)); Ok(base_fee + tip) @@ -192,16 +192,16 @@ impl Node { pub fn get_block_number(&self) -> Result { self.check_head_age()?; - let payload = self.get_payload(&BlockTag::Latest)?; + let payload = self.get_payload(BlockTag::Latest)?; Ok(payload.block_number) } pub async fn get_block_by_number( &self, - block: &BlockTag, + block: BlockTag, full_tx: bool, ) -> Result> { - self.check_blocktag_age(block)?; + self.check_blocktag_age(&block)?; match self.get_payload(block) { Ok(payload) => self @@ -247,7 +247,7 @@ impl Node { self.consensus.last_checkpoint.clone() } - fn get_payload(&self, block: &BlockTag) -> Result<&ExecutionPayload> { + fn get_payload(&self, block: BlockTag) -> Result<&ExecutionPayload> { match block { BlockTag::Latest => { let payload = self.payloads.last_key_value(); @@ -260,8 +260,8 @@ impl Node { .1) } BlockTag::Number(num) => { - let payload = self.payloads.get(num); - payload.ok_or(BlockNotFoundError::new(BlockTag::Number(*num)).into()) + let payload = self.payloads.get(&num); + payload.ok_or(BlockNotFoundError::new(BlockTag::Number(num)).into()) } } } diff --git a/client/src/rpc.rs b/client/src/rpc.rs index 5ff5521..73c7940 100644 --- a/client/src/rpc.rs +++ b/client/src/rpc.rs @@ -111,7 +111,7 @@ impl EthRpcServer for RpcInner { async fn get_balance(&self, address: &str, block: BlockTag) -> Result { let address = convert_err(Address::from_str(address))?; let node = self.node.read().await; - let balance = convert_err(node.get_balance(&address, &block).await)?; + let balance = convert_err(node.get_balance(&address, block).await)?; Ok(balance.encode_hex()) } @@ -119,7 +119,7 @@ impl EthRpcServer for RpcInner { async fn get_transaction_count(&self, address: &str, block: BlockTag) -> Result { let address = convert_err(Address::from_str(address))?; let node = self.node.read().await; - let nonce = convert_err(node.get_nonce(&address, &block).await)?; + let nonce = convert_err(node.get_nonce(&address, block).await)?; Ok(nonce.encode_hex()) } @@ -127,14 +127,14 @@ impl EthRpcServer for RpcInner { async fn get_code(&self, address: &str, block: BlockTag) -> Result { let address = convert_err(Address::from_str(address))?; let node = self.node.read().await; - let code = convert_err(node.get_code(&address, &block).await)?; + let code = convert_err(node.get_code(&address, block).await)?; Ok(hex::encode(code)) } async fn call(&self, opts: CallOpts, block: BlockTag) -> Result { let node = self.node.read().await; - let res = convert_err(node.call(&opts, &block).await)?; + let res = convert_err(node.call(&opts, block).await)?; Ok(format!("0x{}", hex::encode(res))) } @@ -176,7 +176,7 @@ impl EthRpcServer for RpcInner { full_tx: bool, ) -> Result, Error> { let node = self.node.read().await; - let block = convert_err(node.get_block_by_number(&block, full_tx).await)?; + let block = convert_err(node.get_block_by_number(block, full_tx).await)?; Ok(block) } diff --git a/common/src/types.rs b/common/src/types.rs index 9e375ca..af15ce9 100644 --- a/common/src/types.rs +++ b/common/src/types.rs @@ -5,7 +5,7 @@ use ssz_rs::Vector; pub type Bytes32 = Vector; -#[derive(Debug)] +#[derive(Debug, Clone, Copy)] pub enum BlockTag { Latest, Finalized, diff --git a/execution/Cargo.toml b/execution/Cargo.toml index 144b801..9d65098 100644 --- a/execution/Cargo.toml +++ b/execution/Cargo.toml @@ -15,7 +15,7 @@ hex = "0.4.3" ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "cb08f18ca919cc1b685b861d0fa9e2daabe89737" } blst = "0.3.10" ethers = "1.0.0" -revm = "1.9.0" +revm = "2.1.0" bytes = "1.2.1" futures = "0.3.23" toml = "0.5.9" diff --git a/execution/src/evm.rs b/execution/src/evm.rs index 41b625f..acf280c 100644 --- a/execution/src/evm.rs +++ b/execution/src/evm.rs @@ -1,4 +1,4 @@ -use std::{cmp, collections::HashMap, fmt::Display, str::FromStr, sync::Arc, thread}; +use std::{cmp, collections::HashMap, str::FromStr, sync::Arc, thread}; use bytes::Bytes; use ethers::{ @@ -6,7 +6,7 @@ use ethers::{ prelude::{Address, H160, H256, U256}, types::transaction::eip2930::AccessListItem, }; -use eyre::Result; +use eyre::{Report, Result}; use futures::future::join_all; use log::trace; use revm::{AccountInfo, Bytecode, Database, Env, TransactOut, TransactTo, EVM}; @@ -44,10 +44,9 @@ impl Evm { self.evm.db.as_mut().unwrap().set_accounts(account_map); self.evm.env = self.get_env(opts); - let tx = self.evm.transact(); - let output = tx.1; + let tx = self.evm.transact().0; - match tx.0 { + match tx.exit_reason { revm::Return::Revert => Err(eyre::eyre!("execution reverted")), revm::Return::OutOfGas => Err(eyre::eyre!("execution reverted: out of gas")), revm::Return::OutOfFund => Err(eyre::eyre!("not enough funds")), @@ -63,7 +62,7 @@ impl Evm { return Err(eyre::eyre!(err.clone())); } - match output { + match tx.out { TransactOut::None => Err(eyre::eyre!("Invalid Call")), TransactOut::Create(..) => Err(eyre::eyre!("Invalid Call")), TransactOut::Call(bytes) => Ok(bytes.to_vec()), @@ -77,10 +76,10 @@ impl Evm { self.evm.db.as_mut().unwrap().set_accounts(account_map); self.evm.env = self.get_env(opts); - let tx = self.evm.transact(); - let gas = tx.2; + let tx = self.evm.transact().0; + let gas = tx.gas_used; - match tx.0 { + match tx.exit_reason { revm::Return::Revert => Err(eyre::eyre!("execution reverted")), revm::Return::OutOfGas => Err(eyre::eyre!("execution reverted: out of gas")), revm::Return::OutOfFund => Err(eyre::eyre!("not enough funds")), @@ -211,21 +210,11 @@ impl ProofDB { } } - pub fn safe_unwrap(&mut self, res: Result) -> T { - match res { - Ok(value) => value, - Err(err) => { - self.error = Some(err.to_string()); - T::default() - } - } - } - pub fn set_accounts(&mut self, accounts: HashMap) { self.accounts = accounts; } - fn get_account(&mut self, address: Address, slots: &[H256]) -> Account { + fn get_account(&mut self, address: Address, slots: &[H256]) -> Result { let execution = self.execution.clone(); let addr = address.clone(); let payload = self.payload.clone(); @@ -237,14 +226,16 @@ impl ProofDB { runtime.block_on(account_fut) }); - self.safe_unwrap(handle.join().unwrap()) + handle.join().unwrap() } } impl Database for ProofDB { - fn basic(&mut self, address: H160) -> AccountInfo { + type Error = Report; + + fn basic(&mut self, address: H160) -> Result, Report> { if is_precompile(&address) { - return AccountInfo::default(); + return Ok(Some(AccountInfo::default())); } trace!( @@ -254,18 +245,22 @@ impl Database for ProofDB { let account = match self.accounts.get(&address) { Some(account) => account.clone(), - None => self.get_account(address, &[]), + None => self.get_account(address, &[])?, }; let bytecode = Bytecode::new_raw(Bytes::from(account.code.clone())); - AccountInfo::new(account.balance, account.nonce, bytecode) + Ok(Some(AccountInfo::new( + account.balance, + account.nonce, + bytecode, + ))) } - fn block_hash(&mut self, _number: U256) -> H256 { - H256::default() + fn block_hash(&mut self, _number: U256) -> Result { + Ok(H256::default()) } - fn storage(&mut self, address: H160, slot: U256) -> U256 { + fn storage(&mut self, address: H160, slot: U256) -> Result { trace!( "fetch evm state for address=0x{}, slot={}", hex::encode(address.as_bytes()), @@ -274,27 +269,27 @@ impl Database for ProofDB { let slot = H256::from_uint(&slot); - match self.accounts.get(&address) { + Ok(match self.accounts.get(&address) { Some(account) => match account.slots.get(&slot) { Some(slot) => slot.clone(), None => self - .get_account(address, &[slot]) + .get_account(address, &[slot])? .slots .get(&slot) .unwrap() .clone(), }, None => self - .get_account(address, &[slot]) + .get_account(address, &[slot])? .slots .get(&slot) .unwrap() .clone(), - } + }) } - fn code_by_hash(&mut self, _code_hash: H256) -> Bytecode { - panic!("should never be called"); + fn code_by_hash(&mut self, _code_hash: H256) -> Result { + Err(eyre::eyre!("should never be called")) } } diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..1b334ee --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,17 @@ +pub mod client { + pub use client::{database::FileDB, Client, ClientBuilder}; +} + +pub mod config { + pub use config::{networks, Config}; +} + +pub mod types { + pub use common::types::BlockTag; +} + +pub mod errors { + pub use common::errors::*; + pub use consensus::errors::*; + pub use execution::errors::*; +}