refactor: switch execution rpc to ethers (#13)
This commit is contained in:
parent
c64ba5839b
commit
a63d56a952
|
@ -4,14 +4,13 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "aes"
|
||||
version = "0.7.5"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
|
||||
checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"opaque-debug 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -27,18 +26,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
version = "0.7.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.62"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305"
|
||||
checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
|
@ -100,6 +99,18 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "auto_impl"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "auto_impl"
|
||||
version = "1.0.1"
|
||||
|
@ -154,9 +165,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.0.1"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
|
||||
checksum = "ea2b2456fd614d856680dcd9fcc660a51a820fa09daef2e49772b56a193c8474"
|
||||
|
||||
[[package]]
|
||||
name = "bech32"
|
||||
|
@ -242,9 +253,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.2"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
|
||||
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
@ -288,9 +299,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.10.0"
|
||||
version = "3.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
|
||||
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
|
||||
|
||||
[[package]]
|
||||
name = "byte-slice-cast"
|
||||
|
@ -349,18 +360,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.3.0"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
|
||||
checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
"crypto-common",
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.18"
|
||||
version = "3.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15f2ea93df33549dbe2e8eecd1ca55269d63ae0b3ba1f55db030817d1c2867f"
|
||||
checksum = "23b71c3ce99b7611011217b366d923f1d0a7e07a92bb2dbf1e84508c673ca3bd"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
|
@ -433,7 +445,7 @@ dependencies = [
|
|||
"k256",
|
||||
"lazy_static",
|
||||
"serde",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -448,9 +460,9 @@ dependencies = [
|
|||
"getrandom 0.2.7",
|
||||
"hex",
|
||||
"hmac",
|
||||
"pbkdf2 0.11.0",
|
||||
"pbkdf2",
|
||||
"rand 0.8.5",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -470,7 +482,7 @@ dependencies = [
|
|||
"ripemd",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"sha3",
|
||||
"thiserror",
|
||||
]
|
||||
|
@ -553,9 +565,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
|||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.2"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
|
||||
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -590,9 +602,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ctr"
|
||||
version = "0.8.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea"
|
||||
checksum = "0d14f329cfbaf5d0e06b5e87fff7e265d2673c5ea7d2c27691a2c107db1442a0"
|
||||
dependencies = [
|
||||
"cipher",
|
||||
]
|
||||
|
@ -631,7 +643,7 @@ version = "0.10.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.2",
|
||||
"block-buffer 0.10.3",
|
||||
"crypto-common",
|
||||
"subtle",
|
||||
]
|
||||
|
@ -670,9 +682,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be"
|
||||
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
|
||||
|
||||
[[package]]
|
||||
name = "elliptic-curve"
|
||||
|
@ -705,21 +717,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "eth-keystore"
|
||||
version = "0.4.2"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f65b750ac950f2f825b36d08bef4cda4112e19a7b1a68f6e2bb499413e12440"
|
||||
checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"ctr",
|
||||
"digest 0.10.3",
|
||||
"hex",
|
||||
"hmac",
|
||||
"pbkdf2 0.11.0",
|
||||
"pbkdf2",
|
||||
"rand 0.8.5",
|
||||
"scrypt",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"sha3",
|
||||
"thiserror",
|
||||
"uuid",
|
||||
|
@ -799,8 +811,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16142eeb3155cfa5aec6be3f828a28513a28bd995534f945fa70e7d608f16c10"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"ethers-addressbook",
|
||||
"ethers-contract",
|
||||
|
@ -814,8 +825,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-addressbook"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e23f8992ecf45ea9dd2983696aabc566c108723585f07f5dc8c9efb24e52d3db"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"ethers-core",
|
||||
"once_cell",
|
||||
|
@ -826,8 +836,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-contract"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e0010fffc97c5abcf75a30fd75676b1ed917b2b82beb8270391333618e2847d"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"ethers-core",
|
||||
"ethers-providers",
|
||||
|
@ -843,8 +852,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-core"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ebdd63c828f58aa067f40f9adcbea5e114fb1f90144b3a1e2858e0c9b1ff4e8"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"arrayvec 0.7.2",
|
||||
"bytes",
|
||||
|
@ -873,8 +881,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-etherscan"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b279a3d00bd219caa2f9a34451b4accbfa9a1eaafc26dcda9d572591528435f0"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"ethers-core",
|
||||
"getrandom 0.2.7",
|
||||
|
@ -890,10 +897,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-middleware"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1e7e8632d28175352b9454bbcb604643b6ca1de4d36dc99b3f86860d75c132b"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"auto_impl 0.5.0",
|
||||
"ethers-contract",
|
||||
"ethers-core",
|
||||
"ethers-etherscan",
|
||||
|
@ -915,11 +922,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-providers"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e46482e4d1e79b20c338fd9db9e166184eb387f0a4e7c05c5b5c0aa2e8c8900c"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"auto_impl",
|
||||
"auto_impl 1.0.1",
|
||||
"base64 0.13.0",
|
||||
"ethers-core",
|
||||
"futures-core",
|
||||
|
@ -950,8 +956,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ethers-signers"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73a72ecad124e8ccd18d6a43624208cab0199e59621b1f0fa6b776b2e0529107"
|
||||
source = "git+https://github.com/gakonst/ethers-rs#8c3e9985d51dfca0724c3a0800d5f790f49b92aa"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"coins-bip32",
|
||||
|
@ -961,7 +966,7 @@ dependencies = [
|
|||
"ethers-core",
|
||||
"hex",
|
||||
"rand 0.8.5",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -1025,7 +1030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "089263294bb1c38ac73649a6ad563dd9a5142c8dc0482be15b8b9acb22a1611e"
|
||||
dependencies = [
|
||||
"arrayvec 0.7.2",
|
||||
"auto_impl",
|
||||
"auto_impl 1.0.1",
|
||||
"bytes",
|
||||
"ethereum-types 0.13.1",
|
||||
"fastrlp-derive",
|
||||
|
@ -1116,9 +1121,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa"
|
||||
checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1131,9 +1136,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1"
|
||||
checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -1141,15 +1146,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115"
|
||||
checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528"
|
||||
checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -1158,9 +1163,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5"
|
||||
checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
|
||||
|
||||
[[package]]
|
||||
name = "futures-locks"
|
||||
|
@ -1175,9 +1180,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d"
|
||||
checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1186,15 +1191,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765"
|
||||
checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306"
|
||||
checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
|
||||
|
||||
[[package]]
|
||||
name = "futures-timer"
|
||||
|
@ -1208,9 +1213,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577"
|
||||
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1297,9 +1302,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gloo-net"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "351e6f94c76579cc9f9323a15f209086fc7bd428bff4288723d3a417851757b2"
|
||||
checksum = "ec897194fb9ac576c708f63d35604bc58f2a262b8cec0fabfed26f3991255f21"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1329,11 +1334,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gloo-utils"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "929c53c913bb7a88d75d9dc3e9705f963d8c2b9001510b25ddaf671b9fb7049d"
|
||||
checksum = "40913a05c8297adca04392f707b1e73b12ba7b8eab7244a4961580b1fd34063c"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
@ -1351,9 +1358,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.13"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57"
|
||||
checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -1446,9 +1453,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.7.1"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
|
@ -1601,6 +1608,15 @@ dependencies = [
|
|||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
|
||||
dependencies = [
|
||||
"generic-array 0.14.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
|
@ -1826,7 +1842,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"ecdsa",
|
||||
"elliptic-curve",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"sha3",
|
||||
]
|
||||
|
||||
|
@ -1858,9 +1874,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.129"
|
||||
version = "0.2.132"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7"
|
||||
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
|
||||
|
||||
[[package]]
|
||||
name = "lightclient"
|
||||
|
@ -1876,9 +1892,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
|
||||
checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
|
@ -2050,9 +2066,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.13.0"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||
checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
|
@ -2203,17 +2219,6 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "password-hash"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"rand_core 0.6.3",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "password-hash"
|
||||
version = "0.4.2"
|
||||
|
@ -2225,15 +2230,6 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.11.0"
|
||||
|
@ -2242,8 +2238,8 @@ checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
|
|||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
"hmac",
|
||||
"password-hash 0.4.2",
|
||||
"sha2 0.10.2",
|
||||
"password-hash",
|
||||
"sha2 0.10.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2582,7 +2578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ab402ae244afdd560b2aa710df5af557bc791b1cca6fec174ced0cf781e13134"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"auto_impl",
|
||||
"auto_impl 1.0.1",
|
||||
"bytes",
|
||||
"hashbrown",
|
||||
"num_enum",
|
||||
|
@ -2603,7 +2599,7 @@ dependencies = [
|
|||
"primitive-types 0.11.1",
|
||||
"ripemd",
|
||||
"secp256k1",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
"sha3",
|
||||
"substrate-bn",
|
||||
]
|
||||
|
@ -2752,9 +2748,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
|||
|
||||
[[package]]
|
||||
name = "salsa20"
|
||||
version = "0.9.0"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686"
|
||||
checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"
|
||||
dependencies = [
|
||||
"cipher",
|
||||
]
|
||||
|
@ -2777,15 +2773,14 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "scrypt"
|
||||
version = "0.8.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e73d6d7c6311ebdbd9184ad6c4447b2f36337e327bda107d3ba9e3c374f9d325"
|
||||
checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d"
|
||||
dependencies = [
|
||||
"hmac",
|
||||
"password-hash 0.3.2",
|
||||
"pbkdf2 0.10.1",
|
||||
"pbkdf2",
|
||||
"salsa20",
|
||||
"sha2 0.10.2",
|
||||
"sha2 0.10.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2832,9 +2827,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.6.1"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
|
||||
checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
|
@ -2873,18 +2868,18 @@ checksum = "930c0acf610d3fdb5e2ab6213019aaa04e227ebe9547b0649ba599b16d788bd7"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.143"
|
||||
version = "1.0.144"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553"
|
||||
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-aux"
|
||||
version = "3.1.0"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a77223b653fa95f3f9864f3eb25b93e4ed170687eb42d85b6b98af21d5e1de"
|
||||
checksum = "c79c1a5a310c28bf9f7a4b9bd848553051120d80a5952f993c7eb62f6ed6e4c5"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -2892,9 +2887,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.143"
|
||||
version = "1.0.144"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391"
|
||||
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2964,9 +2959,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.2"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
|
||||
checksum = "cf9db03534dff993187064c4e0c05a5708d2a9728ace9a8959b77bedf415dac5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
|
@ -2975,9 +2970,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sha3"
|
||||
version = "0.10.2"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a31480366ec990f395a61b7c08122d99bd40544fdb5abcfc1b06bb29994312c"
|
||||
checksum = "eaedf34ed289ea47c2b741bb72e5357a209512d67bcd4bda44359e5bf0470f56"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
"keccak",
|
||||
|
@ -3019,9 +3014,9 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.4"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
|
||||
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
|
@ -3061,7 +3056,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ssz-rs"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/ralexstokes/ssz-rs#bd7cfb5a836e28747e6ce5e570234d14df0b24f7"
|
||||
source = "git+https://github.com/ralexstokes/ssz-rs#cb08f18ca919cc1b685b861d0fa9e2daabe89737"
|
||||
dependencies = [
|
||||
"bitvec 1.0.1",
|
||||
"hex",
|
||||
|
@ -3076,7 +3071,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ssz-rs-derive"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/ralexstokes/ssz-rs#bd7cfb5a836e28747e6ce5e570234d14df0b24f7"
|
||||
source = "git+https://github.com/ralexstokes/ssz-rs#cb08f18ca919cc1b685b861d0fa9e2daabe89737"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3196,18 +3191,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.32"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994"
|
||||
checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.32"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21"
|
||||
checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3258,9 +3253,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.20.1"
|
||||
version = "1.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
|
@ -3660,13 +3655,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.2.5"
|
||||
version = "4.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
|
||||
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -8,3 +8,6 @@ members = [
|
|||
"consensus",
|
||||
"execution",
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
ethers = { git = "https://github.com/gakonst/ethers-rs" }
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
use std::sync::Arc;
|
||||
|
||||
use ethers::prelude::{Address, U256};
|
||||
use ethers::types::{Transaction, TransactionReceipt};
|
||||
use ethers::types::{Transaction, TransactionReceipt, H256};
|
||||
use eyre::Result;
|
||||
|
||||
use config::Config;
|
||||
|
@ -30,7 +30,7 @@ impl Client {
|
|||
|
||||
let consensus =
|
||||
ConsensusClient::new(consensus_rpc, checkpoint_hash, config.clone()).await?;
|
||||
let execution = ExecutionClient::new(execution_rpc);
|
||||
let execution = ExecutionClient::new(execution_rpc)?;
|
||||
|
||||
let payloads = HashMap::new();
|
||||
let block_hashes = HashMap::new();
|
||||
|
@ -97,7 +97,7 @@ impl Client {
|
|||
Ok(account.balance)
|
||||
}
|
||||
|
||||
pub async fn get_nonce(&self, address: &Address, block: &Option<u64>) -> Result<U256> {
|
||||
pub async fn get_nonce(&self, address: &Address, block: &Option<u64>) -> Result<u64> {
|
||||
let payload = self.get_payload(block)?;
|
||||
let account = self.execution.get_account(&address, None, &payload).await?;
|
||||
Ok(account.nonce)
|
||||
|
@ -108,7 +108,7 @@ impl Client {
|
|||
self.execution.get_code(&address, &payload).await
|
||||
}
|
||||
|
||||
pub async fn get_storage_at(&self, address: &Address, slot: U256) -> Result<U256> {
|
||||
pub async fn get_storage_at(&self, address: &Address, slot: H256) -> Result<U256> {
|
||||
let payload = self.get_payload(&None)?;
|
||||
let account = self
|
||||
.execution
|
||||
|
@ -121,20 +121,20 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<Vec<u8>> {
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<H256> {
|
||||
self.execution.send_raw_transaction(bytes).await
|
||||
}
|
||||
|
||||
pub async fn get_transaction_receipt(
|
||||
&self,
|
||||
tx_hash: &Vec<u8>,
|
||||
tx_hash: &H256,
|
||||
) -> Result<Option<TransactionReceipt>> {
|
||||
self.execution
|
||||
.get_transaction_receipt(tx_hash, &self.payloads)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_transaction_by_hash(&self, tx_hash: &Vec<u8>) -> Result<Option<Transaction>> {
|
||||
pub async fn get_transaction_by_hash(&self, tx_hash: &H256) -> Result<Option<Transaction>> {
|
||||
self.execution
|
||||
.get_transaction(tx_hash, &self.payloads)
|
||||
.await
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use ethers::{
|
||||
abi::AbiEncode,
|
||||
types::{Address, Transaction, TransactionReceipt},
|
||||
types::{Address, Transaction, TransactionReceipt, H256},
|
||||
};
|
||||
use eyre::Result;
|
||||
use std::{fmt::Display, net::SocketAddr, str::FromStr, sync::Arc};
|
||||
|
@ -183,7 +183,7 @@ impl EthRpcServer for RpcInner {
|
|||
|
||||
async fn get_transaction_receipt(&self, hash: &str) -> Result<TransactionReceipt, Error> {
|
||||
let client = self.client.lock().await;
|
||||
let hash = convert_err(hex_str_to_bytes(hash))?;
|
||||
let hash = H256::from_slice(&convert_err(hex_str_to_bytes(hash))?);
|
||||
let receipt = convert_err(client.get_transaction_receipt(&hash).await)?;
|
||||
|
||||
match receipt {
|
||||
|
@ -194,7 +194,7 @@ impl EthRpcServer for RpcInner {
|
|||
|
||||
async fn get_transaction_by_hash(&self, hash: &str) -> Result<Transaction, Error> {
|
||||
let client = self.client.lock().await;
|
||||
let hash = convert_err(hex_str_to_bytes(hash))?;
|
||||
let hash = H256::from_slice(&convert_err(hex_str_to_bytes(hash))?);
|
||||
let tx = convert_err(client.get_transaction_by_hash(&hash).await)?;
|
||||
|
||||
match tx {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use std::{str::FromStr, thread};
|
||||
use std::{fmt::Display, str::FromStr, thread};
|
||||
|
||||
use bytes::Bytes;
|
||||
use ethers::prelude::{Address, H160, H256, U256};
|
||||
use ethers::{
|
||||
abi::ethereum_types::BigEndianHash,
|
||||
prelude::{Address, H160, H256, U256},
|
||||
};
|
||||
use eyre::Result;
|
||||
use revm::{AccountInfo, Bytecode, Database, Env, TransactOut, TransactTo, EVM};
|
||||
use tokio::runtime::Runtime;
|
||||
|
@ -90,7 +93,7 @@ impl ProofDB {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn safe_unwrap<T: Default>(&mut self, res: Result<T>) -> T {
|
||||
pub fn safe_unwrap<T: Default, E: Display>(&mut self, res: Result<T, E>) -> T {
|
||||
match res {
|
||||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
|
@ -132,7 +135,7 @@ impl Database for ProofDB {
|
|||
let bytecode = self.safe_unwrap(handle.join().unwrap());
|
||||
let bytecode = Bytecode::new_raw(Bytes::from(bytecode));
|
||||
|
||||
AccountInfo::new(account.balance, account.nonce.as_u64(), bytecode)
|
||||
AccountInfo::new(account.balance, account.nonce, bytecode)
|
||||
}
|
||||
|
||||
fn block_hash(&mut self, _number: U256) -> H256 {
|
||||
|
@ -142,6 +145,7 @@ impl Database for ProofDB {
|
|||
fn storage(&mut self, address: H160, slot: U256) -> U256 {
|
||||
let execution = self.execution.clone();
|
||||
let addr = address.clone();
|
||||
let slot = H256::from_uint(&slot);
|
||||
let slots = [slot];
|
||||
let payload = self.payload.clone();
|
||||
|
||||
|
|
|
@ -22,15 +22,15 @@ pub struct ExecutionClient {
|
|||
}
|
||||
|
||||
impl ExecutionClient {
|
||||
pub fn new(rpc: &str) -> Self {
|
||||
let rpc = Rpc::new(rpc);
|
||||
ExecutionClient { rpc }
|
||||
pub fn new(rpc: &str) -> Result<Self> {
|
||||
let rpc = Rpc::new(rpc)?;
|
||||
Ok(ExecutionClient { rpc })
|
||||
}
|
||||
|
||||
pub async fn get_account(
|
||||
&self,
|
||||
address: &Address,
|
||||
slots: Option<&[U256]>,
|
||||
slots: Option<&[H256]>,
|
||||
payload: &ExecutionPayload,
|
||||
) -> Result<Account> {
|
||||
let slots = slots.unwrap_or(&[]);
|
||||
|
@ -78,7 +78,7 @@ impl ExecutionClient {
|
|||
|
||||
Ok(Account {
|
||||
balance: proof.balance,
|
||||
nonce: proof.nonce,
|
||||
nonce: proof.nonce.as_u64(),
|
||||
code_hash: proof.code_hash,
|
||||
storage_hash: proof.storage_hash,
|
||||
slots: slot_map,
|
||||
|
@ -98,7 +98,7 @@ impl ExecutionClient {
|
|||
Ok(code)
|
||||
}
|
||||
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<Vec<u8>> {
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<H256> {
|
||||
self.rpc.send_raw_transaction(bytes).await
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ impl ExecutionClient {
|
|||
|
||||
pub async fn get_transaction_receipt(
|
||||
&self,
|
||||
tx_hash: &Vec<u8>,
|
||||
tx_hash: &H256,
|
||||
payloads: &HashMap<u64, ExecutionPayload>,
|
||||
) -> Result<Option<TransactionReceipt>> {
|
||||
let receipt = self.rpc.get_transaction_receipt(tx_hash).await?;
|
||||
|
@ -163,11 +163,7 @@ impl ExecutionClient {
|
|||
|
||||
let mut receipts = vec![];
|
||||
for hash in tx_hashes {
|
||||
let receipt = self
|
||||
.rpc
|
||||
.get_transaction_receipt(&hash.as_bytes().to_vec())
|
||||
.await?
|
||||
.unwrap();
|
||||
let receipt = self.rpc.get_transaction_receipt(&hash).await?.unwrap();
|
||||
|
||||
receipts.push(receipt);
|
||||
}
|
||||
|
@ -190,7 +186,7 @@ impl ExecutionClient {
|
|||
|
||||
pub async fn get_transaction(
|
||||
&self,
|
||||
hash: &Vec<u8>,
|
||||
hash: &H256,
|
||||
payloads: &HashMap<u64, ExecutionPayload>,
|
||||
) -> Result<Option<Transaction>> {
|
||||
let tx = self.rpc.get_transaction(hash).await?;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use ethers::types::{Bytes, EIP1186ProofResponse};
|
||||
use ethers::utils::keccak256;
|
||||
use ethers::utils::rlp::{decode_list, RlpStream};
|
||||
|
||||
use super::types::Proof;
|
||||
|
||||
pub fn verify_proof(proof: &Vec<Vec<u8>>, root: &Vec<u8>, path: &Vec<u8>, value: &Vec<u8>) -> bool {
|
||||
pub fn verify_proof(proof: &Vec<Bytes>, root: &Vec<u8>, path: &Vec<u8>, value: &Vec<u8>) -> bool {
|
||||
let mut expected_hash = root.clone();
|
||||
let mut path_offset = 0;
|
||||
|
||||
|
@ -124,7 +123,7 @@ fn get_nibble(path: &Vec<u8>, offset: usize) -> u8 {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn encode_account(proof: &Proof) -> Vec<u8> {
|
||||
pub fn encode_account(proof: &EIP1186ProofResponse) -> Vec<u8> {
|
||||
let mut stream = RlpStream::new_list(4);
|
||||
stream.append(&proof.nonce);
|
||||
stream.append(&proof.balance);
|
||||
|
|
|
@ -1,75 +1,53 @@
|
|||
use ethers::abi::AbiEncode;
|
||||
use ethers::prelude::{Address, U256};
|
||||
use ethers::prelude::{Address, Http};
|
||||
use ethers::providers::{Middleware, Provider};
|
||||
use ethers::types::{Transaction, TransactionReceipt, H256};
|
||||
use ethers::types::{BlockId, Bytes, EIP1186ProofResponse, Transaction, TransactionReceipt, H256};
|
||||
use eyre::Result;
|
||||
use jsonrpsee::{
|
||||
core::client::ClientT,
|
||||
http_client::{HttpClient, HttpClientBuilder},
|
||||
rpc_params,
|
||||
};
|
||||
|
||||
use common::utils::{address_to_hex_string, hex_str_to_bytes, u64_to_hex_string};
|
||||
|
||||
use super::types::Proof;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Rpc {
|
||||
rpc: String,
|
||||
provider: Provider<Http>,
|
||||
}
|
||||
|
||||
impl Rpc {
|
||||
pub fn new(rpc: &str) -> Self {
|
||||
Rpc {
|
||||
rpc: rpc.to_string(),
|
||||
}
|
||||
pub fn new(rpc: &str) -> Result<Self> {
|
||||
let provider = Provider::try_from(rpc)?;
|
||||
Ok(Rpc { provider })
|
||||
}
|
||||
|
||||
pub async fn get_proof(&self, address: &Address, slots: &[U256], block: u64) -> Result<Proof> {
|
||||
let client = self.client()?;
|
||||
let block_hex = u64_to_hex_string(block);
|
||||
let addr_hex = address_to_hex_string(address);
|
||||
let slots = slots
|
||||
.iter()
|
||||
.map(|slot| slot.encode_hex())
|
||||
.collect::<Vec<String>>();
|
||||
let params = rpc_params!(addr_hex, slots.as_slice(), block_hex);
|
||||
Ok(client.request("eth_getProof", params).await?)
|
||||
pub async fn get_proof(
|
||||
&self,
|
||||
address: &Address,
|
||||
slots: &[H256],
|
||||
block: u64,
|
||||
) -> Result<EIP1186ProofResponse> {
|
||||
let block = Some(BlockId::from(block));
|
||||
let proof_response = self
|
||||
.provider
|
||||
.get_proof(*address, slots.to_vec(), block)
|
||||
.await?;
|
||||
Ok(proof_response)
|
||||
}
|
||||
|
||||
pub async fn get_code(&self, address: &Address, block: u64) -> Result<Vec<u8>> {
|
||||
let client = self.client()?;
|
||||
let block_hex = u64_to_hex_string(block);
|
||||
let addr_hex = address_to_hex_string(address);
|
||||
let params = rpc_params!(addr_hex, block_hex);
|
||||
let code: String = client.request("eth_getCode", params).await?;
|
||||
hex_str_to_bytes(&code)
|
||||
let block = Some(BlockId::from(block));
|
||||
let code = self.provider.get_code(*address, block).await?;
|
||||
Ok(code.to_vec())
|
||||
}
|
||||
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<Vec<u8>> {
|
||||
let client = self.client()?;
|
||||
let bytes_hex = format!("0x{}", hex::encode(bytes));
|
||||
let params = rpc_params!(bytes_hex);
|
||||
let tx_hash: String = client.request("eth_sendRawTransaction", params).await?;
|
||||
hex_str_to_bytes(&tx_hash)
|
||||
pub async fn send_raw_transaction(&self, bytes: &Vec<u8>) -> Result<H256> {
|
||||
let bytes = Bytes::from(bytes.as_slice().to_owned());
|
||||
Ok(self.provider.send_raw_transaction(bytes).await?.tx_hash())
|
||||
}
|
||||
|
||||
pub async fn get_transaction_receipt(
|
||||
&self,
|
||||
tx_hash: &Vec<u8>,
|
||||
tx_hash: &H256,
|
||||
) -> Result<Option<TransactionReceipt>> {
|
||||
let provider = Provider::try_from(&self.rpc)?;
|
||||
Ok(provider
|
||||
.get_transaction_receipt(H256::from_slice(tx_hash))
|
||||
.await?)
|
||||
let receipt = self.provider.get_transaction_receipt(*tx_hash).await?;
|
||||
Ok(receipt)
|
||||
}
|
||||
|
||||
pub async fn get_transaction(&self, tx_hash: &Vec<u8>) -> Result<Option<Transaction>> {
|
||||
let provider = Provider::try_from(&self.rpc)?;
|
||||
Ok(provider.get_transaction(H256::from_slice(tx_hash)).await?)
|
||||
}
|
||||
|
||||
fn client(&self) -> Result<HttpClient> {
|
||||
Ok(HttpClientBuilder::default().build(&self.rpc)?)
|
||||
pub async fn get_transaction(&self, tx_hash: &H256) -> Result<Option<Transaction>> {
|
||||
Ok(self.provider.get_transaction(*tx_hash).await?)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,40 +2,17 @@ use std::collections::HashMap;
|
|||
|
||||
use ethers::prelude::{Address, H256, U256};
|
||||
use eyre::Result;
|
||||
use serde::de::Error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use common::utils::{hex_str_to_bytes, u64_to_hex_string};
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Proof {
|
||||
pub address: Address,
|
||||
pub balance: U256,
|
||||
pub code_hash: H256,
|
||||
pub nonce: U256,
|
||||
pub storage_hash: H256,
|
||||
#[serde(deserialize_with = "proof_deserialize")]
|
||||
pub account_proof: Vec<Vec<u8>>,
|
||||
pub storage_proof: Vec<StorageProof>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct StorageProof {
|
||||
pub key: U256,
|
||||
pub value: U256,
|
||||
#[serde(deserialize_with = "proof_deserialize")]
|
||||
pub proof: Vec<Vec<u8>>,
|
||||
}
|
||||
use common::utils::u64_to_hex_string;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Account {
|
||||
pub balance: U256,
|
||||
pub nonce: U256,
|
||||
pub nonce: u64,
|
||||
pub code_hash: H256,
|
||||
pub storage_hash: H256,
|
||||
pub slots: HashMap<U256, U256>,
|
||||
pub slots: HashMap<H256, U256>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
|
@ -113,15 +90,3 @@ where
|
|||
let num_string = u64_to_hex_string(*x);
|
||||
s.serialize_str(&num_string)
|
||||
}
|
||||
|
||||
fn proof_deserialize<'de, D>(deserializer: D) -> Result<Vec<Vec<u8>>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
let branch: Vec<String> = serde::Deserialize::deserialize(deserializer)?;
|
||||
Ok(branch
|
||||
.iter()
|
||||
.map(|elem| hex_str_to_bytes(elem))
|
||||
.collect::<Result<_>>()
|
||||
.map_err(D::Error::custom)?)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue