mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Migrate the deposit_contract crate to alloy (#8139)
https://github.com/sigp/lighthouse/issues/6022 Switches the `deposit_contract` crate to use the `alloy` ecosystem and removes the dependency on `ethabi` Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
300
Cargo.lock
generated
300
Cargo.lock
generated
@@ -177,6 +177,22 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-dyn-abi"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdff496dd4e98a81f4861e66f7eaf5f2488971848bb42d9c892f871730245c8"
|
||||
dependencies = [
|
||||
"alloy-json-abi",
|
||||
"alloy-primitives",
|
||||
"alloy-sol-type-parser",
|
||||
"alloy-sol-types",
|
||||
"itoa",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eip2124"
|
||||
version = "0.2.0"
|
||||
@@ -235,6 +251,18 @@ dependencies = [
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-abi"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5513d5e6bd1cba6bdcf5373470f559f320c05c8c59493b6e98912fbe6733943f"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-type-parser",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network-primitives"
|
||||
version = "1.0.42"
|
||||
@@ -274,7 +302,7 @@ dependencies = [
|
||||
"ruint",
|
||||
"rustc-hash 2.1.1",
|
||||
"serde",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
@@ -379,14 +407,26 @@ dependencies = [
|
||||
"syn-solidity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-type-parser"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "954d1b2533b9b2c7959652df3076954ecb1122a28cc740aa84e7b0a49f6ac0a9"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-sol-types"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70319350969a3af119da6fb3e9bddb1bce66c9ea933600cb297c8b1850ad2a3c"
|
||||
dependencies = [
|
||||
"alloy-json-abi",
|
||||
"alloy-primitives",
|
||||
"alloy-sol-macro",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1293,28 +1333,16 @@ dependencies = [
|
||||
"radium 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "0.20.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"
|
||||
dependencies = [
|
||||
"funty 1.1.0",
|
||||
"radium 0.6.2",
|
||||
"tap",
|
||||
"wyz 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||
dependencies = [
|
||||
"funty 2.0.0",
|
||||
"funty",
|
||||
"radium 0.7.0",
|
||||
"tap",
|
||||
"wyz 0.5.1",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1332,7 +1360,7 @@ version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
|
||||
dependencies = [
|
||||
"block-padding 0.1.5",
|
||||
"block-padding",
|
||||
"byte-tools",
|
||||
"byteorder",
|
||||
"generic-array 0.12.4",
|
||||
@@ -1344,7 +1372,6 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"block-padding 0.2.1",
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
@@ -1366,12 +1393,6 @@ dependencies = [
|
||||
"byte-tools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-padding"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
|
||||
|
||||
[[package]]
|
||||
name = "bls"
|
||||
version = "0.2.0"
|
||||
@@ -1867,7 +1888,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"sha2 0.10.8",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
@@ -2475,7 +2496,9 @@ dependencies = [
|
||||
name = "deposit_contract"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"ethabi 16.0.0",
|
||||
"alloy-dyn-abi",
|
||||
"alloy-json-abi",
|
||||
"alloy-primitives",
|
||||
"ethereum_ssz",
|
||||
"hex",
|
||||
"reqwest 0.11.27",
|
||||
@@ -3029,7 +3052,7 @@ dependencies = [
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@@ -3130,7 +3153,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.10.8",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
"thiserror 1.0.69",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
@@ -3269,51 +3292,23 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethabi"
|
||||
version = "16.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c98847055d934070b90e806e12d3936b787d0a115068981c1d8dfd5dfef5a5"
|
||||
dependencies = [
|
||||
"ethereum-types 0.12.1",
|
||||
"hex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3 0.9.1",
|
||||
"thiserror 1.0.69",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethabi"
|
||||
version = "18.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898"
|
||||
dependencies = [
|
||||
"ethereum-types 0.14.1",
|
||||
"ethereum-types",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
"thiserror 1.0.69",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethbloom"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfb684ac8fa8f6c5759f788862bb22ec6fe3cb392f6bfd08e3c64b603661e3f8"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"fixed-hash 0.7.0",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.3.2",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethbloom"
|
||||
version = "0.13.0"
|
||||
@@ -3321,40 +3316,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"fixed-hash 0.8.0",
|
||||
"impl-codec 0.6.0",
|
||||
"fixed-hash",
|
||||
"impl-codec",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.4.0",
|
||||
"impl-serde",
|
||||
"scale-info",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum-types"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05136f7057fe789f06e6d41d07b34e6f70d8c86e5693b60f97aaa6553553bdaf"
|
||||
dependencies = [
|
||||
"ethbloom 0.11.1",
|
||||
"fixed-hash 0.7.0",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.3.2",
|
||||
"primitive-types 0.10.1",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum-types"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
|
||||
dependencies = [
|
||||
"ethbloom 0.13.0",
|
||||
"fixed-hash 0.8.0",
|
||||
"impl-codec 0.6.0",
|
||||
"ethbloom",
|
||||
"fixed-hash",
|
||||
"impl-codec",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.4.0",
|
||||
"primitive-types 0.12.2",
|
||||
"impl-serde",
|
||||
"primitive-types",
|
||||
"scale-info",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
@@ -3439,7 +3420,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"convert_case 0.6.0",
|
||||
"elliptic-curve 0.12.3",
|
||||
"ethabi 18.0.0",
|
||||
"ethabi",
|
||||
"generic-array 0.14.7",
|
||||
"hex",
|
||||
"k256 0.11.6",
|
||||
@@ -3775,18 +3756,6 @@ dependencies = [
|
||||
"windows-acl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixed-hash"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"rand 0.8.5",
|
||||
"rustc-hex",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixed-hash"
|
||||
version = "0.8.0"
|
||||
@@ -3894,12 +3863,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "2.0.0"
|
||||
@@ -4987,22 +4950,13 @@ dependencies = [
|
||||
"xmltree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "impl-codec"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443"
|
||||
dependencies = [
|
||||
"parity-scale-codec 2.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "impl-codec"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f"
|
||||
dependencies = [
|
||||
"parity-scale-codec 3.7.4",
|
||||
"parity-scale-codec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5014,15 +4968,6 @@ dependencies = [
|
||||
"rlp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "impl-serde"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "impl-serde"
|
||||
version = "0.4.0"
|
||||
@@ -5262,7 +5207,7 @@ dependencies = [
|
||||
"ecdsa 0.14.8",
|
||||
"elliptic-curve 0.12.3",
|
||||
"sha2 0.10.8",
|
||||
"sha3 0.10.8",
|
||||
"sha3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5305,7 +5250,7 @@ version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c"
|
||||
dependencies = [
|
||||
"primitive-types 0.12.2",
|
||||
"primitive-types",
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
@@ -6910,7 +6855,7 @@ dependencies = [
|
||||
"arrayvec",
|
||||
"auto_impl 1.2.1",
|
||||
"bytes",
|
||||
"ethereum-types 0.14.1",
|
||||
"ethereum-types",
|
||||
"open-fastrlp-derive",
|
||||
]
|
||||
|
||||
@@ -7094,20 +7039,6 @@ dependencies = [
|
||||
"group 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitvec 0.20.4",
|
||||
"byte-slice-cast",
|
||||
"impl-trait-for-tuples",
|
||||
"parity-scale-codec-derive 2.3.1",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec"
|
||||
version = "3.7.4"
|
||||
@@ -7119,30 +7050,18 @@ dependencies = [
|
||||
"byte-slice-cast",
|
||||
"const_format",
|
||||
"impl-trait-for-tuples",
|
||||
"parity-scale-codec-derive 3.7.4",
|
||||
"parity-scale-codec-derive",
|
||||
"rustversion",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec-derive"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec-derive"
|
||||
version = "3.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.3.0",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
@@ -7472,50 +7391,27 @@ dependencies = [
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "primitive-types"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373"
|
||||
dependencies = [
|
||||
"fixed-hash 0.7.0",
|
||||
"impl-codec 0.5.1",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.3.2",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "primitive-types"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
|
||||
dependencies = [
|
||||
"fixed-hash 0.8.0",
|
||||
"impl-codec 0.6.0",
|
||||
"fixed-hash",
|
||||
"impl-codec",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.4.0",
|
||||
"impl-serde",
|
||||
"scale-info",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"toml_edit 0.19.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35"
|
||||
dependencies = [
|
||||
"toml_edit 0.22.24",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7858,12 +7754,6 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac"
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb"
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.7.0"
|
||||
@@ -8279,8 +8169,8 @@ dependencies = [
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"parity-scale-codec 3.7.4",
|
||||
"primitive-types 0.12.2",
|
||||
"parity-scale-codec",
|
||||
"primitive-types",
|
||||
"proptest",
|
||||
"rand 0.8.5",
|
||||
"rand 0.9.0",
|
||||
@@ -8608,7 +8498,7 @@ checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"derive_more 1.0.0",
|
||||
"parity-scale-codec 3.7.4",
|
||||
"parity-scale-codec",
|
||||
"scale-info-derive",
|
||||
]
|
||||
|
||||
@@ -8618,7 +8508,7 @@ version = "2.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf"
|
||||
dependencies = [
|
||||
"proc-macro-crate 3.3.0",
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.100",
|
||||
@@ -9005,18 +8895,6 @@ dependencies = [
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha3"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"digest 0.9.0",
|
||||
"keccak",
|
||||
"opaque-debug 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha3"
|
||||
version = "0.10.8"
|
||||
@@ -9956,17 +9834,6 @@ version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.19.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||
dependencies = [
|
||||
"indexmap 2.8.0",
|
||||
"toml_datetime",
|
||||
"winnow 0.5.40",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.24"
|
||||
@@ -9975,7 +9842,7 @@ checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
|
||||
dependencies = [
|
||||
"indexmap 2.8.0",
|
||||
"toml_datetime",
|
||||
"winnow 0.7.3",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11424,15 +11291,6 @@ version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.3"
|
||||
@@ -11500,12 +11358,6 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.5.1"
|
||||
|
||||
@@ -7,8 +7,11 @@ edition = { workspace = true }
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
ethabi = "16.0.0"
|
||||
alloy-dyn-abi = "1.4"
|
||||
alloy-json-abi = "1.4"
|
||||
alloy-primitives = { workspace = true }
|
||||
ethereum_ssz = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tree_hash = { workspace = true }
|
||||
types = { workspace = true }
|
||||
|
||||
|
||||
@@ -1,23 +1,44 @@
|
||||
use ethabi::{Contract, Token};
|
||||
use alloy_dyn_abi::{DynSolValue, JsonAbiExt};
|
||||
use alloy_json_abi::JsonAbi;
|
||||
use alloy_primitives::FixedBytes;
|
||||
use ssz::{Decode, DecodeError as SszDecodeError, Encode};
|
||||
use tree_hash::TreeHash;
|
||||
use types::{DepositData, Hash256, PublicKeyBytes, SignatureBytes};
|
||||
|
||||
pub use ethabi::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DecodeError {
|
||||
EthabiError(ethabi::Error),
|
||||
pub enum Error {
|
||||
AlloyCoreError(alloy_json_abi::Error),
|
||||
SerdeJsonError(serde_json::Error),
|
||||
DynAbiError(alloy_dyn_abi::Error),
|
||||
SszDecodeError(SszDecodeError),
|
||||
FunctionNotFound,
|
||||
MissingField,
|
||||
UnableToGetBytes,
|
||||
MissingToken,
|
||||
InadequateBytes,
|
||||
}
|
||||
|
||||
impl From<ethabi::Error> for DecodeError {
|
||||
fn from(e: ethabi::Error) -> DecodeError {
|
||||
DecodeError::EthabiError(e)
|
||||
impl From<alloy_json_abi::Error> for Error {
|
||||
fn from(e: alloy_json_abi::Error) -> Error {
|
||||
Error::AlloyCoreError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
fn from(e: serde_json::Error) -> Error {
|
||||
Error::SerdeJsonError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<alloy_dyn_abi::Error> for Error {
|
||||
fn from(e: alloy_dyn_abi::Error) -> Error {
|
||||
Error::DynAbiError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SszDecodeError> for Error {
|
||||
fn from(e: SszDecodeError) -> Error {
|
||||
Error::SszDecodeError(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,47 +57,57 @@ pub mod testnet {
|
||||
|
||||
pub fn encode_eth1_tx_data(deposit_data: &DepositData) -> Result<Vec<u8>, Error> {
|
||||
let params = vec![
|
||||
Token::Bytes(deposit_data.pubkey.as_ssz_bytes()),
|
||||
Token::Bytes(deposit_data.withdrawal_credentials.as_ssz_bytes()),
|
||||
Token::Bytes(deposit_data.signature.as_ssz_bytes()),
|
||||
Token::FixedBytes(deposit_data.tree_hash_root().as_ssz_bytes()),
|
||||
DynSolValue::Bytes(deposit_data.pubkey.as_ssz_bytes()),
|
||||
DynSolValue::Bytes(deposit_data.withdrawal_credentials.as_ssz_bytes()),
|
||||
DynSolValue::Bytes(deposit_data.signature.as_ssz_bytes()),
|
||||
DynSolValue::FixedBytes(
|
||||
FixedBytes::<32>::from_slice(&deposit_data.tree_hash_root().as_ssz_bytes()),
|
||||
32,
|
||||
),
|
||||
];
|
||||
|
||||
// Here we make an assumption that the `crate::testnet::ABI` has a superset of the features of
|
||||
// the crate::ABI`.
|
||||
let abi = Contract::load(ABI)?;
|
||||
let function = abi.function("deposit")?;
|
||||
function.encode_input(¶ms)
|
||||
let abi: JsonAbi = serde_json::from_slice(ABI)?;
|
||||
let function = abi
|
||||
.function("deposit")
|
||||
.and_then(|functions| functions.first())
|
||||
.ok_or(Error::FunctionNotFound)?;
|
||||
|
||||
function
|
||||
.abi_encode_input(¶ms)
|
||||
.map_err(Error::DynAbiError)
|
||||
}
|
||||
|
||||
pub fn decode_eth1_tx_data(
|
||||
bytes: &[u8],
|
||||
amount: u64,
|
||||
) -> Result<(DepositData, Hash256), DecodeError> {
|
||||
let abi = Contract::load(ABI)?;
|
||||
let function = abi.function("deposit")?;
|
||||
let mut tokens = function.decode_input(bytes.get(4..).ok_or(DecodeError::InadequateBytes)?)?;
|
||||
pub fn decode_eth1_tx_data(bytes: &[u8], amount: u64) -> Result<(DepositData, Hash256), Error> {
|
||||
let abi: JsonAbi = serde_json::from_slice(ABI)?;
|
||||
let function = abi
|
||||
.function("deposit")
|
||||
.and_then(|functions| functions.first())
|
||||
.ok_or(Error::FunctionNotFound)?;
|
||||
|
||||
let input_data = bytes.get(4..).ok_or(Error::InadequateBytes)?;
|
||||
let mut tokens = function.abi_decode_input(input_data)?;
|
||||
|
||||
macro_rules! decode_token {
|
||||
($type: ty, $to_fn: ident) => {
|
||||
<$type>::from_ssz_bytes(
|
||||
&tokens
|
||||
.pop()
|
||||
.ok_or_else(|| DecodeError::MissingToken)?
|
||||
.$to_fn()
|
||||
.ok_or_else(|| DecodeError::UnableToGetBytes)?,
|
||||
)
|
||||
.map_err(DecodeError::SszDecodeError)?
|
||||
};
|
||||
($type: ty) => {{
|
||||
let token = tokens.pop().ok_or(Error::MissingToken)?;
|
||||
let bytes_data = match token {
|
||||
DynSolValue::Bytes(b) => b,
|
||||
DynSolValue::FixedBytes(b, _) => b.to_vec(),
|
||||
_ => return Err(Error::UnableToGetBytes),
|
||||
};
|
||||
<$type>::from_ssz_bytes(&bytes_data)?
|
||||
}};
|
||||
}
|
||||
|
||||
let root = decode_token!(Hash256, into_fixed_bytes);
|
||||
let root = decode_token!(Hash256);
|
||||
|
||||
let deposit_data = DepositData {
|
||||
amount,
|
||||
signature: decode_token!(SignatureBytes, into_bytes),
|
||||
withdrawal_credentials: decode_token!(Hash256, into_bytes),
|
||||
pubkey: decode_token!(PublicKeyBytes, into_bytes),
|
||||
signature: decode_token!(SignatureBytes),
|
||||
withdrawal_credentials: decode_token!(Hash256),
|
||||
pubkey: decode_token!(PublicKeyBytes),
|
||||
};
|
||||
|
||||
Ok((deposit_data, root))
|
||||
|
||||
@@ -32,7 +32,7 @@ pub enum Error {
|
||||
UnableToReadDepositAmount(io::Error),
|
||||
UnableToParseDepositAmount(std::num::ParseIntError),
|
||||
DepositAmountIsNotUtf8(std::string::FromUtf8Error),
|
||||
UnableToParseDepositData(deposit_contract::DecodeError),
|
||||
UnableToParseDepositData(deposit_contract::Error),
|
||||
Eth1TxHashExists(PathBuf),
|
||||
UnableToWriteEth1TxHash(io::Error),
|
||||
/// The deposit root in the deposit data file does not match the one generated locally. This is
|
||||
|
||||
Reference in New Issue
Block a user