diff --git a/Cargo.lock b/Cargo.lock
index a9a8aa3..e67a116 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,16 +2,6 @@
# It is not intended for manual editing.
version = 4
-[[package]]
-name = "Inflector"
-version = "0.11.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
-dependencies = [
- "lazy_static",
- "regex",
-]
-
[[package]]
name = "addchain"
version = "0.2.0"
@@ -53,23 +43,12 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
- "cfg-if 1.0.0",
- "cipher 0.3.0",
+ "cfg-if",
+ "cipher",
"cpufeatures",
"opaque-debug",
]
-[[package]]
-name = "aes"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
-dependencies = [
- "cfg-if 1.0.0",
- "cipher 0.4.4",
- "cpufeatures",
-]
-
[[package]]
name = "aes-gcm"
version = "0.9.4"
@@ -77,22 +56,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6"
dependencies = [
"aead",
- "aes 0.7.5",
- "cipher 0.3.0",
- "ctr 0.8.0",
+ "aes",
+ "cipher",
+ "ctr",
"ghash",
"subtle",
]
-[[package]]
-name = "ahash"
-version = "0.2.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29661b60bec623f0586702976ff4d0c9942dcb6723161c2df0eea78455cfedfb"
-dependencies = [
- "const-random",
-]
-
[[package]]
name = "ahash"
version = "0.7.8"
@@ -110,7 +80,7 @@ version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"const-random",
"once_cell",
"version_check",
@@ -133,513 +103,1082 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]]
-name = "android-tzdata"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
-
-[[package]]
-name = "android_system_properties"
-version = "0.1.5"
+name = "alloy"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+checksum = "0093d23bf026b580c1f66ed3a053d8209c104a446c5264d3ad99587f6edef24e"
dependencies = [
- "libc",
+ "alloy-consensus",
+ "alloy-contract",
+ "alloy-core",
+ "alloy-eips",
+ "alloy-genesis",
+ "alloy-network",
+ "alloy-provider",
+ "alloy-rpc-client",
+ "alloy-rpc-types",
+ "alloy-serde",
+ "alloy-signer",
+ "alloy-signer-local",
+ "alloy-transport",
+ "alloy-transport-http",
]
[[package]]
-name = "anstream"
-version = "0.6.15"
+name = "alloy-chains"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
+checksum = "517e5acbd38b6d4c59da380e8bbadc6d365bf001903ce46cf5521c53c647e07b"
dependencies = [
- "anstyle",
- "anstyle-parse",
- "anstyle-query",
- "anstyle-wincon",
- "colorchoice",
- "is_terminal_polyfill",
- "utf8parse",
+ "alloy-primitives",
+ "num_enum",
+ "strum 0.27.1",
]
[[package]]
-name = "anstyle"
-version = "1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
-
-[[package]]
-name = "anstyle-parse"
-version = "0.2.5"
+name = "alloy-consensus"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
+checksum = "ad451f9a70c341d951bca4e811d74dbe1e193897acd17e9dbac1353698cc430b"
dependencies = [
- "utf8parse",
+ "alloy-eips",
+ "alloy-primitives",
+ "alloy-rlp",
+ "alloy-serde",
+ "alloy-trie",
+ "auto_impl",
+ "c-kzg",
+ "derive_more",
+ "either",
+ "k256",
+ "once_cell",
+ "rand 0.8.5",
+ "secp256k1",
+ "serde",
+ "serde_with",
+ "thiserror 2.0.12",
]
[[package]]
-name = "anstyle-query"
-version = "1.1.1"
+name = "alloy-consensus-any"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
+checksum = "142daffb15d5be1a2b20d2cd540edbcef03037b55d4ff69dc06beb4d06286dba"
dependencies = [
- "windows-sys 0.52.0",
+ "alloy-consensus",
+ "alloy-eips",
+ "alloy-primitives",
+ "alloy-rlp",
+ "alloy-serde",
+ "serde",
]
[[package]]
-name = "anstyle-wincon"
-version = "3.0.4"
+name = "alloy-contract"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
+checksum = "ebf25443920ecb9728cb087fe4dc04a0b290bd6ac85638c58fe94aba70f1a44e"
dependencies = [
- "anstyle",
- "windows-sys 0.52.0",
+ "alloy-consensus",
+ "alloy-dyn-abi",
+ "alloy-json-abi",
+ "alloy-network",
+ "alloy-network-primitives",
+ "alloy-primitives",
+ "alloy-provider",
+ "alloy-rpc-types-eth",
+ "alloy-sol-types",
+ "alloy-transport",
+ "futures",
+ "futures-util",
+ "thiserror 2.0.12",
]
[[package]]
-name = "anyhow"
-version = "1.0.89"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
-
-[[package]]
-name = "app_dirs"
-version = "1.2.1"
+name = "alloy-core"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d"
+checksum = "a3c5a28f166629752f2e7246b813cdea3243cca59aab2d4264b1fd68392c10eb"
dependencies = [
- "ole32-sys",
- "shell32-sys",
- "winapi 0.2.8",
- "xdg",
+ "alloy-dyn-abi",
+ "alloy-json-abi",
+ "alloy-primitives",
+ "alloy-rlp",
+ "alloy-sol-types",
]
[[package]]
-name = "arbitrary"
-version = "1.3.2"
+name = "alloy-dyn-abi"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
+checksum = "18cc14d832bc3331ca22a1c7819de1ede99f58f61a7d123952af7dde8de124a6"
dependencies = [
- "derive_arbitrary",
+ "alloy-json-abi",
+ "alloy-primitives",
+ "alloy-sol-type-parser",
+ "alloy-sol-types",
+ "itoa",
+ "serde",
+ "serde_json",
+ "winnow 0.7.10",
]
[[package]]
-name = "ark-bn254"
-version = "0.4.0"
+name = "alloy-eip2124"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f"
+checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5"
dependencies = [
- "ark-ec",
- "ark-ff",
- "ark-std",
+ "alloy-primitives",
+ "alloy-rlp",
+ "crc",
+ "serde",
+ "thiserror 2.0.12",
]
[[package]]
-name = "ark-ec"
-version = "0.4.2"
+name = "alloy-eip2930"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba"
+checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd"
dependencies = [
- "ark-ff",
- "ark-poly",
- "ark-serialize",
- "ark-std",
- "derivative",
- "hashbrown 0.13.2",
- "itertools 0.10.5",
- "num-traits",
- "zeroize",
+ "alloy-primitives",
+ "alloy-rlp",
+ "serde",
]
[[package]]
-name = "ark-ff"
-version = "0.4.2"
+name = "alloy-eip7702"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba"
+checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16"
dependencies = [
- "ark-ff-asm",
- "ark-ff-macros",
- "ark-serialize",
- "ark-std",
- "derivative",
- "digest",
- "itertools 0.10.5",
- "num-bigint 0.4.6",
- "num-traits",
- "paste",
- "rustc_version 0.4.1",
- "zeroize",
+ "alloy-primitives",
+ "alloy-rlp",
+ "serde",
+ "thiserror 2.0.12",
]
[[package]]
-name = "ark-ff-asm"
-version = "0.4.2"
+name = "alloy-eips"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348"
+checksum = "3056872f6da48046913e76edb5ddced272861f6032f09461aea1a2497be5ae5d"
dependencies = [
- "quote",
- "syn 1.0.109",
+ "alloy-eip2124",
+ "alloy-eip2930",
+ "alloy-eip7702",
+ "alloy-primitives",
+ "alloy-rlp",
+ "alloy-serde",
+ "auto_impl",
+ "c-kzg",
+ "derive_more",
+ "either",
+ "serde",
+ "sha2",
]
[[package]]
-name = "ark-ff-macros"
-version = "0.4.2"
+name = "alloy-genesis"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565"
+checksum = "c98fb40f07997529235cc474de814cd7bd9de561e101716289095696c0e4639d"
dependencies = [
- "num-bigint 0.4.6",
- "num-traits",
- "proc-macro2",
- "quote",
- "syn 1.0.109",
+ "alloy-eips",
+ "alloy-primitives",
+ "alloy-serde",
+ "alloy-trie",
+ "serde",
]
[[package]]
-name = "ark-poly"
-version = "0.4.2"
+name = "alloy-json-abi"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf"
+checksum = "3ccaa79753d7bf15f06399ea76922afbfaf8d18bebed9e8fc452984b4a90dcc9"
dependencies = [
- "ark-ff",
- "ark-serialize",
- "ark-std",
- "derivative",
- "hashbrown 0.13.2",
+ "alloy-primitives",
+ "alloy-sol-type-parser",
+ "serde",
+ "serde_json",
]
[[package]]
-name = "ark-serialize"
-version = "0.4.2"
+name = "alloy-json-rpc"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5"
+checksum = "dc08b31ebf9273839bd9a01f9333cbb7a3abb4e820c312ade349dd18bdc79581"
dependencies = [
- "ark-serialize-derive",
- "ark-std",
- "digest",
- "num-bigint 0.4.6",
+ "alloy-primitives",
+ "alloy-sol-types",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.12",
+ "tracing",
]
[[package]]
-name = "ark-serialize-derive"
-version = "0.4.2"
+name = "alloy-network"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea"
+checksum = "ed117b08f0cc190312bf0c38c34cf4f0dabfb4ea8f330071c587cd7160a88cb2"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
+ "alloy-consensus",
+ "alloy-consensus-any",
+ "alloy-eips",
+ "alloy-json-rpc",
+ "alloy-network-primitives",
+ "alloy-primitives",
+ "alloy-rpc-types-any",
+ "alloy-rpc-types-eth",
+ "alloy-serde",
+ "alloy-signer",
+ "alloy-sol-types",
+ "async-trait",
+ "auto_impl",
+ "derive_more",
+ "futures-utils-wasm",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.12",
]
[[package]]
-name = "ark-std"
-version = "0.4.0"
+name = "alloy-network-primitives"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185"
+checksum = "c7162ff7be8649c0c391f4e248d1273e85c62076703a1f3ec7daf76b283d886d"
dependencies = [
- "num-traits",
- "rand 0.8.5",
+ "alloy-consensus",
+ "alloy-eips",
+ "alloy-primitives",
+ "alloy-serde",
+ "serde",
]
[[package]]
-name = "arrayvec"
-version = "0.5.2"
+name = "alloy-primitives"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
+checksum = "18c35fc4b03ace65001676358ffbbaefe2a2b27ee50fe777c345082c7c888be8"
+dependencies = [
+ "alloy-rlp",
+ "bytes",
+ "cfg-if",
+ "const-hex",
+ "derive_more",
+ "foldhash",
+ "getrandom 0.3.3",
+ "hashbrown 0.15.3",
+ "indexmap 2.6.0",
+ "itoa",
+ "k256",
+ "keccak-asm",
+ "paste",
+ "proptest",
+ "rand 0.9.1",
+ "ruint",
+ "rustc-hash",
+ "serde",
+ "sha3",
+ "tiny-keccak",
+]
[[package]]
-name = "arrayvec"
-version = "0.7.6"
+name = "alloy-provider"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+checksum = "d84eba1fd8b6fe8b02f2acd5dd7033d0f179e304bd722d11e817db570d1fa6c4"
+dependencies = [
+ "alloy-chains",
+ "alloy-consensus",
+ "alloy-eips",
+ "alloy-json-rpc",
+ "alloy-network",
+ "alloy-network-primitives",
+ "alloy-primitives",
+ "alloy-rpc-client",
+ "alloy-rpc-types-eth",
+ "alloy-signer",
+ "alloy-sol-types",
+ "alloy-transport",
+ "alloy-transport-http",
+ "async-stream",
+ "async-trait",
+ "auto_impl",
+ "dashmap",
+ "either",
+ "futures",
+ "futures-utils-wasm",
+ "lru",
+ "parking_lot",
+ "pin-project",
+ "reqwest 0.12.8",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.12",
+ "tokio",
+ "tracing",
+ "url",
+ "wasmtimer",
+]
[[package]]
-name = "ascii-canvas"
-version = "3.0.0"
+name = "alloy-rlp"
+version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6"
+checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4"
dependencies = [
- "term",
+ "alloy-rlp-derive",
+ "arrayvec",
+ "bytes",
]
[[package]]
-name = "async-trait"
-version = "0.1.83"
+name = "alloy-rlp-derive"
+version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
+checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
-name = "async_io_stream"
-version = "0.3.3"
+name = "alloy-rpc-client"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c"
+checksum = "518a699422a3eab800f3dac2130d8f2edba8e4fff267b27a9c7dc6a2b0d313ee"
dependencies = [
+ "alloy-json-rpc",
+ "alloy-primitives",
+ "alloy-transport",
+ "alloy-transport-http",
+ "async-stream",
"futures",
- "pharos",
- "rustc_version 0.4.1",
+ "pin-project",
+ "reqwest 0.12.8",
+ "serde",
+ "serde_json",
+ "tokio",
+ "tokio-stream",
+ "tower",
+ "tracing",
+ "tracing-futures",
+ "url",
+ "wasmtimer",
]
[[package]]
-name = "auto_impl"
-version = "1.2.0"
+name = "alloy-rpc-types"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
+checksum = "c000cab4ec26a4b3e29d144e999e1c539c2fa0abed871bf90311eb3466187ca8"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.79",
+ "alloy-primitives",
+ "alloy-rpc-types-eth",
+ "alloy-serde",
+ "serde",
]
[[package]]
-name = "autocfg"
-version = "0.1.8"
+name = "alloy-rpc-types-any"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"
+checksum = "508b2fbe66d952089aa694e53802327798806498cd29ff88c75135770ecaabfc"
dependencies = [
- "autocfg 1.4.0",
+ "alloy-consensus-any",
+ "alloy-rpc-types-eth",
+ "alloy-serde",
]
[[package]]
-name = "autocfg"
-version = "1.4.0"
+name = "alloy-rpc-types-eth"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+checksum = "fcaf7dff0fdd756a714d58014f4f8354a1706ebf9fa2cf73431e0aeec3c9431e"
+dependencies = [
+ "alloy-consensus",
+ "alloy-consensus-any",
+ "alloy-eips",
+ "alloy-network-primitives",
+ "alloy-primitives",
+ "alloy-rlp",
+ "alloy-serde",
+ "alloy-sol-types",
+ "itertools 0.13.0",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.12",
+]
[[package]]
-name = "backtrace"
-version = "0.3.74"
+name = "alloy-serde"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
+checksum = "730e8f2edf2fc224cabd1c25d090e1655fa6137b2e409f92e5eec735903f1507"
dependencies = [
- "addr2line",
- "cfg-if 1.0.0",
- "libc",
- "miniz_oxide",
- "object",
- "rustc-demangle",
- "windows-targets 0.52.6",
+ "alloy-primitives",
+ "serde",
+ "serde_json",
]
[[package]]
-name = "base16ct"
-version = "0.2.0"
+name = "alloy-signer"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
+checksum = "6b0d2428445ec13edc711909e023d7779618504c4800be055a5b940025dbafe3"
+dependencies = [
+ "alloy-primitives",
+ "async-trait",
+ "auto_impl",
+ "either",
+ "elliptic-curve",
+ "k256",
+ "thiserror 2.0.12",
+]
[[package]]
-name = "base64"
-version = "0.13.1"
+name = "alloy-signer-local"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+checksum = "e14fe6fedb7fe6e0dfae47fe020684f1d8e063274ef14bca387ddb7a6efa8ec1"
+dependencies = [
+ "alloy-consensus",
+ "alloy-network",
+ "alloy-primitives",
+ "alloy-signer",
+ "async-trait",
+ "k256",
+ "rand 0.8.5",
+ "thiserror 2.0.12",
+]
[[package]]
-name = "base64"
-version = "0.21.7"
+name = "alloy-sol-macro"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+checksum = "8612e0658964d616344f199ab251a49d48113992d81b92dab93ed855faa66383"
+dependencies = [
+ "alloy-sol-macro-expander",
+ "alloy-sol-macro-input",
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
[[package]]
-name = "base64"
-version = "0.22.1"
+name = "alloy-sol-macro-expander"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+checksum = "7a384edac7283bc4c010a355fb648082860c04b826bb7a814c45263c8f304c74"
+dependencies = [
+ "alloy-json-abi",
+ "alloy-sol-macro-input",
+ "const-hex",
+ "heck",
+ "indexmap 2.6.0",
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+ "syn-solidity",
+ "tiny-keccak",
+]
[[package]]
-name = "base64ct"
-version = "1.6.0"
+name = "alloy-sol-macro-input"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+checksum = "0dd588c2d516da7deb421b8c166dc60b7ae31bca5beea29ab6621fcfa53d6ca5"
+dependencies = [
+ "alloy-json-abi",
+ "const-hex",
+ "dunce",
+ "heck",
+ "macro-string",
+ "proc-macro2",
+ "quote",
+ "serde_json",
+ "syn 2.0.101",
+ "syn-solidity",
+]
[[package]]
-name = "bech32"
-version = "0.9.1"
+name = "alloy-sol-type-parser"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445"
+checksum = "e86ddeb70792c7ceaad23e57d52250107ebbb86733e52f4a25d8dc1abc931837"
+dependencies = [
+ "serde",
+ "winnow 0.7.10",
+]
[[package]]
-name = "bincode"
-version = "1.3.3"
+name = "alloy-sol-types"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+checksum = "584cb97bfc5746cb9dcc4def77da11694b5d6d7339be91b7480a6a68dc129387"
dependencies = [
+ "alloy-json-abi",
+ "alloy-primitives",
+ "alloy-sol-macro",
"serde",
]
[[package]]
-name = "bit-set"
-version = "0.5.3"
+name = "alloy-transport"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
+checksum = "a712bdfeff42401a7dd9518f72f617574c36226a9b5414537fedc34350b73bf9"
dependencies = [
- "bit-vec",
+ "alloy-json-rpc",
+ "alloy-primitives",
+ "base64 0.22.1",
+ "derive_more",
+ "futures",
+ "futures-utils-wasm",
+ "parking_lot",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.12",
+ "tokio",
+ "tower",
+ "tracing",
+ "url",
+ "wasmtimer",
]
[[package]]
-name = "bit-vec"
-version = "0.6.3"
+name = "alloy-transport-http"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
+checksum = "7ea5a76d7f2572174a382aedf36875bedf60bcc41116c9f031cf08040703a2dc"
+dependencies = [
+ "alloy-json-rpc",
+ "alloy-transport",
+ "reqwest 0.12.8",
+ "serde_json",
+ "tower",
+ "tracing",
+ "url",
+]
[[package]]
-name = "bitflags"
+name = "alloy-trie"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500"
+dependencies = [
+ "alloy-primitives",
+ "alloy-rlp",
+ "arrayvec",
+ "derive_more",
+ "nybbles",
+ "serde",
+ "smallvec",
+ "tracing",
+]
+
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "anstream"
+version = "0.6.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
+dependencies = [
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
+dependencies = [
+ "anstyle",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
+
+[[package]]
+name = "arbitrary"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110"
+dependencies = [
+ "derive_arbitrary",
+]
[[package]]
-name = "bitflags"
-version = "2.6.0"
+name = "ark-bn254"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f"
+dependencies = [
+ "ark-ec",
+ "ark-ff 0.4.2",
+ "ark-std 0.4.0",
+]
[[package]]
-name = "bitvec"
-version = "0.17.4"
+name = "ark-ec"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c"
+checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba"
dependencies = [
- "either",
- "radium 0.3.0",
+ "ark-ff 0.4.2",
+ "ark-poly",
+ "ark-serialize 0.4.2",
+ "ark-std 0.4.0",
+ "derivative",
+ "hashbrown 0.13.2",
+ "itertools 0.10.5",
+ "num-traits",
+ "zeroize",
]
[[package]]
-name = "bitvec"
-version = "1.0.1"
+name = "ark-ff"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
+checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6"
dependencies = [
- "funty",
- "radium 0.7.0",
- "tap",
- "wyz",
+ "ark-ff-asm 0.3.0",
+ "ark-ff-macros 0.3.0",
+ "ark-serialize 0.3.0",
+ "ark-std 0.3.0",
+ "derivative",
+ "num-bigint 0.4.6",
+ "num-traits",
+ "paste",
+ "rustc_version 0.3.3",
+ "zeroize",
]
[[package]]
-name = "block-buffer"
-version = "0.10.4"
+name = "ark-ff"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba"
dependencies = [
- "generic-array",
+ "ark-ff-asm 0.4.2",
+ "ark-ff-macros 0.4.2",
+ "ark-serialize 0.4.2",
+ "ark-std 0.4.0",
+ "derivative",
+ "digest 0.10.7",
+ "itertools 0.10.5",
+ "num-bigint 0.4.6",
+ "num-traits",
+ "paste",
+ "rustc_version 0.4.1",
+ "zeroize",
]
[[package]]
-name = "bs58"
-version = "0.5.1"
+name = "ark-ff-asm"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4"
+checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44"
dependencies = [
- "sha2",
- "tinyvec",
+ "quote",
+ "syn 1.0.109",
]
[[package]]
-name = "bumpalo"
-version = "3.16.0"
+name = "ark-ff-asm"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348"
+dependencies = [
+ "quote",
+ "syn 1.0.109",
+]
[[package]]
-name = "byte-slice-cast"
-version = "0.3.5"
+name = "ark-ff-macros"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3"
+checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20"
+dependencies = [
+ "num-bigint 0.4.6",
+ "num-traits",
+ "quote",
+ "syn 1.0.109",
+]
[[package]]
-name = "byte-slice-cast"
-version = "1.2.2"
+name = "ark-ff-macros"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
+checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565"
+dependencies = [
+ "num-bigint 0.4.6",
+ "num-traits",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
[[package]]
-name = "byteorder"
-version = "1.5.0"
+name = "ark-poly"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf"
+dependencies = [
+ "ark-ff 0.4.2",
+ "ark-serialize 0.4.2",
+ "ark-std 0.4.0",
+ "derivative",
+ "hashbrown 0.13.2",
+]
[[package]]
-name = "bytes"
-version = "1.7.2"
+name = "ark-serialize"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
+checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671"
+dependencies = [
+ "ark-std 0.3.0",
+ "digest 0.9.0",
+]
+
+[[package]]
+name = "ark-serialize"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5"
+dependencies = [
+ "ark-serialize-derive",
+ "ark-std 0.4.0",
+ "digest 0.10.7",
+ "num-bigint 0.4.6",
+]
+
+[[package]]
+name = "ark-serialize-derive"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "ark-std"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c"
+dependencies = [
+ "num-traits",
+ "rand 0.8.5",
+]
+
+[[package]]
+name = "ark-std"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185"
+dependencies = [
+ "num-traits",
+ "rand 0.8.5",
+]
+
+[[package]]
+name = "arrayvec"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
dependencies = [
"serde",
]
[[package]]
-name = "bzip2"
-version = "0.4.4"
+name = "async-stream"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476"
+dependencies = [
+ "async-stream-impl",
+ "futures-core",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-stream-impl"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "async-trait"
+version = "0.1.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
+checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "auto_impl"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+
+[[package]]
+name = "backtrace"
+version = "0.3.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
dependencies = [
- "bzip2-sys",
+ "addr2line",
+ "cfg-if",
"libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "base16ct"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
+
+[[package]]
+name = "base64"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+
+[[package]]
+name = "base64"
+version = "0.21.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64ct"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+
+[[package]]
+name = "bincode"
+version = "1.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
+dependencies = [
+ "bit-vec",
+]
+
+[[package]]
+name = "bit-vec"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
+
+[[package]]
+name = "bitcoin-io"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf"
+
+[[package]]
+name = "bitcoin_hashes"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16"
+dependencies = [
+ "bitcoin-io",
+ "hex-conservative",
]
[[package]]
-name = "bzip2-sys"
-version = "0.1.11+1.0.8"
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bitflags"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+
+[[package]]
+name = "bitvec"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
+checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
+dependencies = [
+ "funty",
+ "radium",
+ "tap",
+ "wyz",
+]
+
+[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "blst"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47c79a94619fade3c0b887670333513a67ac28a6a7e653eb260bf0d4103db38d"
dependencies = [
"cc",
- "libc",
- "pkg-config",
+ "glob",
+ "threadpool",
+ "zeroize",
]
[[package]]
-name = "camino"
-version = "1.1.9"
+name = "bumpalo"
+version = "3.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+
+[[package]]
+name = "byte-slice-cast"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3"
-dependencies = [
- "serde",
-]
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
-name = "cargo-platform"
-version = "0.1.8"
+name = "bytes"
+version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc"
+checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
dependencies = [
"serde",
]
[[package]]
-name = "cargo_metadata"
-version = "0.18.1"
+name = "c-kzg"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037"
+checksum = "7318cfa722931cb5fe0838b98d3ce5621e75f6a6408abc21721d80de9223f2e4"
dependencies = [
- "camino",
- "cargo-platform",
- "semver 1.0.23",
+ "blst",
+ "cc",
+ "glob",
+ "hex",
+ "libc",
+ "once_cell",
"serde",
- "serde_json",
- "thiserror",
]
[[package]]
name = "cc"
-version = "1.1.25"
+version = "1.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8d9e0b4957f635b8d3da819d0db5603620467ecf1f692d22a8c2717ce27e6d8"
+checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951"
dependencies = [
- "jobserver",
- "libc",
"shlex",
]
-[[package]]
-name = "cfg-if"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
-
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -656,6 +1195,7 @@ dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
+ "serde",
"wasm-bindgen",
"windows-targets 0.52.6",
]
@@ -669,16 +1209,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "cipher"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
-dependencies = [
- "crypto-common",
- "inout",
-]
-
[[package]]
name = "clap"
version = "4.5.19"
@@ -710,7 +1240,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -719,67 +1249,6 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
-[[package]]
-name = "cloudabi"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-dependencies = [
- "bitflags 1.3.2",
-]
-
-[[package]]
-name = "coins-bip32"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3"
-dependencies = [
- "bs58",
- "coins-core",
- "digest",
- "hmac",
- "k256",
- "serde",
- "sha2",
- "thiserror",
-]
-
-[[package]]
-name = "coins-bip39"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528"
-dependencies = [
- "bitvec 1.0.1",
- "coins-bip32",
- "hmac",
- "once_cell",
- "pbkdf2 0.12.2",
- "rand 0.8.5",
- "sha2",
- "thiserror",
-]
-
-[[package]]
-name = "coins-core"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979"
-dependencies = [
- "base64 0.21.7",
- "bech32",
- "bs58",
- "digest",
- "generic-array",
- "hex",
- "ripemd",
- "serde",
- "serde_derive",
- "sha2",
- "sha3",
- "thiserror",
-]
-
[[package]]
name = "colorchoice"
version = "1.0.2"
@@ -801,7 +1270,7 @@ dependencies = [
"rust-ini",
"serde",
"serde_json",
- "toml 0.5.11",
+ "toml",
"yaml-rust",
]
@@ -820,11 +1289,11 @@ dependencies = [
[[package]]
name = "const-hex"
-version = "1.13.1"
+version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586"
+checksum = "83e22e0ed40b96a48d3db274f72fd365bd78f67af39b6bbd47e8a15e1c6207ff"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"cpufeatures",
"hex",
"proptest",
@@ -841,807 +1310,477 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
name = "const-random"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
-dependencies = [
- "const-random-macro",
-]
-
-[[package]]
-name = "const-random-macro"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
-dependencies = [
- "getrandom 0.2.15",
- "once_cell",
- "tiny-keccak 2.0.2",
-]
-
-[[package]]
-name = "constant_time_eq"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
-
-[[package]]
-name = "core-foundation"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
-
-[[package]]
-name = "cpufeatures"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "crc32fast"
-version = "1.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
-dependencies = [
- "crossbeam-epoch",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
-dependencies = [
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
-
-[[package]]
-name = "crunchy"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
-
-[[package]]
-name = "crypto-bigint"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
-dependencies = [
- "generic-array",
- "rand_core 0.6.4",
- "subtle",
- "zeroize",
-]
-
-[[package]]
-name = "crypto-common"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
-dependencies = [
- "generic-array",
- "typenum",
-]
-
-[[package]]
-name = "ctr"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea"
-dependencies = [
- "cipher 0.3.0",
-]
-
-[[package]]
-name = "ctr"
-version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"
-dependencies = [
- "cipher 0.4.4",
-]
-
-[[package]]
-name = "curve25519-dalek"
-version = "4.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
-dependencies = [
- "cfg-if 1.0.0",
- "cpufeatures",
- "curve25519-dalek-derive",
- "digest",
- "fiat-crypto",
- "rustc_version 0.4.1",
- "subtle",
- "zeroize",
-]
-
-[[package]]
-name = "curve25519-dalek-derive"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.79",
-]
-
-[[package]]
-name = "data-encoding"
-version = "2.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
-
-[[package]]
-name = "der"
-version = "0.7.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
-dependencies = [
- "const-oid",
- "zeroize",
-]
-
-[[package]]
-name = "deranged"
-version = "0.3.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
-dependencies = [
- "powerfmt",
-]
-
-[[package]]
-name = "derivative"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "derive_arbitrary"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
+checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.79",
+ "const-random-macro",
]
[[package]]
-name = "derive_more"
-version = "0.99.18"
+name = "const-random-macro"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
+checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.79",
+ "getrandom 0.2.15",
+ "once_cell",
+ "tiny-keccak",
]
[[package]]
-name = "dialoguer"
-version = "0.11.0"
+name = "core-foundation"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
- "console",
- "shell-words",
- "tempfile",
- "thiserror",
- "zeroize",
+ "core-foundation-sys",
+ "libc",
]
[[package]]
-name = "digest"
-version = "0.10.7"
+name = "core-foundation-sys"
+version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
-dependencies = [
- "block-buffer",
- "const-oid",
- "crypto-common",
- "subtle",
-]
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
-name = "dir"
-version = "0.1.2"
+name = "cpufeatures"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbaaafd76867bdccfab7c7a5cc98b9321b515f8663072fd4b0fd9e2ceac3911e"
+checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
dependencies = [
- "app_dirs",
- "home 0.3.4",
- "journaldb",
- "vapory-types",
+ "libc",
]
[[package]]
-name = "dirs"
-version = "5.0.1"
+name = "crc"
+version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
+checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
dependencies = [
- "dirs-sys",
+ "crc-catalog",
]
[[package]]
-name = "dirs-next"
-version = "2.0.0"
+name = "crc-catalog"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if 1.0.0",
- "dirs-sys-next",
-]
+checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
-name = "dirs-sys"
-version = "0.4.1"
+name = "crc32fast"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
+checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
- "libc",
- "option-ext",
- "redox_users",
- "windows-sys 0.48.0",
+ "cfg-if",
]
[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
+name = "crossbeam-deque"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
+checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
- "libc",
- "redox_users",
- "winapi 0.3.9",
+ "crossbeam-epoch",
+ "crossbeam-utils",
]
[[package]]
-name = "displaydoc"
-version = "0.2.5"
+name = "crossbeam-epoch"
+version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.79",
+ "crossbeam-utils",
]
[[package]]
-name = "dlv-list"
-version = "0.3.0"
+name = "crossbeam-utils"
+version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
+checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
-name = "dotenv"
-version = "0.15.0"
+name = "crunchy"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
+checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
-name = "dunce"
-version = "1.0.5"
+name = "crypto-bigint"
+version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
+checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
+dependencies = [
+ "generic-array",
+ "rand_core 0.6.4",
+ "subtle",
+ "zeroize",
+]
[[package]]
-name = "ecdsa"
-version = "0.16.9"
+name = "crypto-common"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "der",
- "digest",
- "elliptic-curve",
- "rfc6979",
- "signature",
- "spki",
+ "generic-array",
+ "typenum",
]
[[package]]
-name = "ed25519"
-version = "2.2.3"
+name = "ctr"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
+checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea"
dependencies = [
- "pkcs8",
- "signature",
+ "cipher",
]
[[package]]
-name = "ed25519-dalek"
-version = "2.1.1"
+name = "curve25519-dalek"
+version = "4.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871"
+checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
dependencies = [
- "curve25519-dalek",
- "ed25519",
- "serde",
- "sha2",
- "signature",
+ "cfg-if",
+ "cpufeatures",
+ "curve25519-dalek-derive",
+ "digest 0.10.7",
+ "fiat-crypto",
+ "rustc_version 0.4.1",
"subtle",
"zeroize",
]
[[package]]
-name = "either"
-version = "1.13.0"
+name = "curve25519-dalek-derive"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
[[package]]
-name = "elliptic-curve"
-version = "0.13.8"
+name = "darling"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
+checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
- "base16ct",
- "crypto-bigint",
- "digest",
- "ff",
- "generic-array",
- "group",
- "pkcs8",
- "rand_core 0.6.4",
- "sec1",
- "subtle",
- "zeroize",
+ "darling_core",
+ "darling_macro",
]
[[package]]
-name = "ena"
-version = "0.14.3"
+name = "darling_core"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
+checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
dependencies = [
- "log",
+ "fnv",
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn 2.0.101",
]
[[package]]
-name = "encode_unicode"
-version = "0.3.6"
+name = "darling_macro"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
+dependencies = [
+ "darling_core",
+ "quote",
+ "syn 2.0.101",
+]
[[package]]
-name = "encoding_rs"
-version = "0.8.34"
+name = "dashmap"
+version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
+checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
+ "crossbeam-utils",
+ "hashbrown 0.14.5",
+ "lock_api",
+ "once_cell",
+ "parking_lot_core",
]
[[package]]
-name = "enr"
-version = "0.10.0"
+name = "der"
+version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4"
+checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
dependencies = [
- "base64 0.21.7",
- "bytes",
- "hex",
- "k256",
- "log",
- "rand 0.8.5",
- "rlp",
- "serde",
- "sha3",
+ "const-oid",
"zeroize",
]
[[package]]
-name = "env_filter"
-version = "0.1.2"
+name = "deranged"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
+checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
- "log",
- "regex",
+ "powerfmt",
+ "serde",
]
[[package]]
-name = "env_logger"
-version = "0.11.5"
+name = "derivative"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
+checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
- "anstream",
- "anstyle",
- "env_filter",
- "humantime",
- "log",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
]
[[package]]
-name = "equivalent"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
-
-[[package]]
-name = "errno"
-version = "0.3.9"
+name = "derive_arbitrary"
+version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
+checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
dependencies = [
- "libc",
- "windows-sys 0.52.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
]
[[package]]
-name = "eth-keystore"
-version = "0.5.0"
+name = "derive_more"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab"
+checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
dependencies = [
- "aes 0.8.4",
- "ctr 0.9.2",
- "digest",
- "hex",
- "hmac",
- "pbkdf2 0.11.0",
- "rand 0.8.5",
- "scrypt",
- "serde",
- "serde_json",
- "sha2",
- "sha3",
- "thiserror",
- "uuid",
+ "derive_more-impl",
]
[[package]]
-name = "ethabi"
-version = "18.0.0"
+name = "derive_more-impl"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898"
+checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
- "ethereum-types",
- "hex",
- "once_cell",
- "regex",
- "serde",
- "serde_json",
- "sha3",
- "thiserror",
- "uint",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+ "unicode-xid",
]
[[package]]
-name = "ethbloom"
-version = "0.13.0"
+name = "dialoguer"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60"
+checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
dependencies = [
- "crunchy",
- "fixed-hash 0.8.0",
- "impl-codec",
- "impl-rlp",
- "impl-serde",
- "scale-info",
- "tiny-keccak 2.0.2",
+ "console",
+ "shell-words",
+ "tempfile",
+ "thiserror 1.0.64",
+ "zeroize",
]
[[package]]
-name = "ethereum-types"
-version = "0.14.1"
+name = "digest"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
+checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
- "ethbloom",
- "fixed-hash 0.8.0",
- "impl-codec",
- "impl-rlp",
- "impl-serde",
- "primitive-types 0.12.2",
- "scale-info",
- "uint",
+ "generic-array",
]
[[package]]
-name = "ethers"
-version = "2.0.14"
+name = "digest"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
- "ethers-addressbook",
- "ethers-contract",
- "ethers-core",
- "ethers-etherscan",
- "ethers-middleware",
- "ethers-providers",
- "ethers-signers",
- "ethers-solc",
+ "block-buffer",
+ "const-oid",
+ "crypto-common",
+ "subtle",
]
[[package]]
-name = "ethers-addressbook"
-version = "2.0.14"
+name = "dirs"
+version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759"
+checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
dependencies = [
- "ethers-core",
- "once_cell",
- "serde",
- "serde_json",
+ "dirs-sys",
]
[[package]]
-name = "ethers-contract"
-version = "2.0.14"
+name = "dirs-sys"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa"
+checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
- "const-hex",
- "ethers-contract-abigen",
- "ethers-contract-derive",
- "ethers-core",
- "ethers-providers",
- "futures-util",
- "once_cell",
- "pin-project",
- "serde",
- "serde_json",
- "thiserror",
+ "libc",
+ "option-ext",
+ "redox_users",
+ "windows-sys 0.48.0",
]
[[package]]
-name = "ethers-contract-abigen"
-version = "2.0.14"
+name = "displaydoc"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b"
+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
- "Inflector",
- "const-hex",
- "dunce",
- "ethers-core",
- "ethers-etherscan",
- "eyre",
- "prettyplease",
"proc-macro2",
"quote",
- "regex",
- "reqwest 0.11.27",
- "serde",
- "serde_json",
- "syn 2.0.79",
- "toml 0.8.19",
- "walkdir",
+ "syn 2.0.101",
]
[[package]]
-name = "ethers-contract-derive"
-version = "2.0.14"
+name = "dlv-list"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
+
+[[package]]
+name = "dotenv"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
+
+[[package]]
+name = "dunce"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
+
+[[package]]
+name = "ecdsa"
+version = "0.16.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f"
+checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
dependencies = [
- "Inflector",
- "const-hex",
- "ethers-contract-abigen",
- "ethers-core",
- "proc-macro2",
- "quote",
- "serde_json",
- "syn 2.0.79",
+ "der",
+ "digest 0.10.7",
+ "elliptic-curve",
+ "rfc6979",
+ "serdect",
+ "signature",
+ "spki",
]
[[package]]
-name = "ethers-core"
-version = "2.0.14"
+name = "ed25519"
+version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f"
+checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
dependencies = [
- "arrayvec 0.7.6",
- "bytes",
- "cargo_metadata",
- "chrono",
- "const-hex",
- "elliptic-curve",
- "ethabi",
- "generic-array",
- "k256",
- "num_enum",
- "once_cell",
- "open-fastrlp",
- "rand 0.8.5",
- "rlp",
- "serde",
- "serde_json",
- "strum",
- "syn 2.0.79",
- "tempfile",
- "thiserror",
- "tiny-keccak 2.0.2",
- "unicode-xid",
+ "pkcs8",
+ "signature",
]
[[package]]
-name = "ethers-etherscan"
-version = "2.0.14"
+name = "ed25519-dalek"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649"
+checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871"
dependencies = [
- "chrono",
- "ethers-core",
- "reqwest 0.11.27",
- "semver 1.0.23",
+ "curve25519-dalek",
+ "ed25519",
"serde",
- "serde_json",
- "thiserror",
- "tracing",
+ "sha2",
+ "signature",
+ "subtle",
+ "zeroize",
]
[[package]]
-name = "ethers-middleware"
-version = "2.0.14"
+name = "either"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
dependencies = [
- "async-trait",
- "auto_impl",
- "ethers-contract",
- "ethers-core",
- "ethers-etherscan",
- "ethers-providers",
- "ethers-signers",
- "futures-channel",
- "futures-locks",
- "futures-util",
- "instant",
- "reqwest 0.11.27",
"serde",
- "serde_json",
- "thiserror",
- "tokio",
- "tracing",
- "tracing-futures",
- "url",
]
[[package]]
-name = "ethers-providers"
-version = "2.0.14"
+name = "elliptic-curve"
+version = "0.13.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2"
+checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
dependencies = [
- "async-trait",
- "auto_impl",
- "base64 0.21.7",
- "bytes",
- "const-hex",
- "enr",
- "ethers-core",
- "futures-core",
- "futures-timer",
- "futures-util",
- "hashers",
- "http 0.2.12",
- "instant",
- "jsonwebtoken",
- "once_cell",
- "pin-project",
- "reqwest 0.11.27",
- "serde",
- "serde_json",
- "thiserror",
- "tokio",
- "tokio-tungstenite",
- "tracing",
- "tracing-futures",
- "url",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "ws_stream_wasm",
+ "base16ct",
+ "crypto-bigint",
+ "digest 0.10.7",
+ "ff",
+ "generic-array",
+ "group",
+ "pkcs8",
+ "rand_core 0.6.4",
+ "sec1",
+ "serdect",
+ "subtle",
+ "zeroize",
]
[[package]]
-name = "ethers-signers"
-version = "2.0.14"
+name = "encode_unicode"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+
+[[package]]
+name = "encoding_rs"
+version = "0.8.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2"
+checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
dependencies = [
- "async-trait",
- "coins-bip32",
- "coins-bip39",
- "const-hex",
- "elliptic-curve",
- "eth-keystore",
- "ethers-core",
- "rand 0.8.5",
- "sha2",
- "thiserror",
- "tracing",
+ "cfg-if",
]
[[package]]
-name = "ethers-solc"
-version = "2.0.14"
+name = "env_filter"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66244a771d9163282646dbeffe0e6eca4dda4146b6498644e678ac6089b11edd"
+checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
dependencies = [
- "cfg-if 1.0.0",
- "const-hex",
- "dirs",
- "dunce",
- "ethers-core",
- "glob",
- "home 0.5.9",
- "md-5",
- "num_cpus",
- "once_cell",
- "path-slash",
- "rayon",
+ "log",
"regex",
- "semver 1.0.23",
- "serde",
- "serde_json",
- "solang-parser",
- "svm-rs",
- "thiserror",
- "tiny-keccak 2.0.2",
- "tokio",
- "tracing",
- "walkdir",
- "yansi",
]
[[package]]
-name = "eyre"
-version = "0.6.12"
+name = "env_logger"
+version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
+checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
dependencies = [
- "indenter",
- "once_cell",
+ "anstream",
+ "anstyle",
+ "env_filter",
+ "jiff",
+ "log",
]
[[package]]
-name = "fastmap"
-version = "0.1.0"
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
+[[package]]
+name = "errno"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59ea69bd8c9a9aa331b38daa335f7a672183c5281514c0d5c5c48ef63ef09a66"
+checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
- "tetsy-plain-hasher",
- "vapory-types",
+ "libc",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -1650,13 +1789,35 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
+[[package]]
+name = "fastrlp"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418"
+dependencies = [
+ "arrayvec",
+ "auto_impl",
+ "bytes",
+]
+
+[[package]]
+name = "fastrlp"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4"
+dependencies = [
+ "arrayvec",
+ "auto_impl",
+ "bytes",
+]
+
[[package]]
name = "ff"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
dependencies = [
- "bitvec 1.0.1",
+ "bitvec",
"byteorder",
"ff_derive",
"rand_core 0.6.4",
@@ -1670,7 +1831,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a"
dependencies = [
"addchain",
- "cfg-if 1.0.0",
+ "cfg-if",
"num-bigint 0.3.3",
"num-integer",
"num-traits",
@@ -1706,12 +1867,6 @@ dependencies = [
"static_assertions",
]
-[[package]]
-name = "fixedbitset"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
-
[[package]]
name = "flate2"
version = "1.0.34"
@@ -1728,6 +1883,12 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+[[package]]
+name = "foldhash"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+
[[package]]
name = "foreign-types"
version = "0.3.2"
@@ -1752,16 +1913,6 @@ dependencies = [
"percent-encoding",
]
-[[package]]
-name = "fs2"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
-
[[package]]
name = "funty"
version = "2.0.0"
@@ -1816,16 +1967,6 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
-[[package]]
-name = "futures-locks"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06"
-dependencies = [
- "futures-channel",
- "futures-task",
-]
-
[[package]]
name = "futures-macro"
version = "0.3.31"
@@ -1834,7 +1975,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -1849,16 +1990,6 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
-[[package]]
-name = "futures-timer"
-version = "3.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
-dependencies = [
- "gloo-timers",
- "send_wrapper 0.4.0",
-]
-
[[package]]
name = "futures-util"
version = "0.3.31"
@@ -1878,13 +2009,10 @@ dependencies = [
]
[[package]]
-name = "fxhash"
-version = "0.2.1"
+name = "futures-utils-wasm"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
-dependencies = [
- "byteorder",
-]
+checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9"
[[package]]
name = "generic-array"
@@ -1899,26 +2027,27 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.1.16"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
+ "js-sys",
"libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
+ "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasm-bindgen",
]
[[package]]
name = "getrandom"
-version = "0.2.15"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
+checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
dependencies = [
- "cfg-if 1.0.0",
- "js-sys",
+ "cfg-if",
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
- "wasm-bindgen",
+ "r-efi",
+ "wasi 0.14.2+wasi-0.2.4",
]
[[package]]
@@ -1943,18 +2072,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
-[[package]]
-name = "gloo-timers"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
-dependencies = [
- "futures-channel",
- "futures-core",
- "js-sys",
- "wasm-bindgen",
-]
-
[[package]]
name = "group"
version = "0.13.0"
@@ -1978,23 +2095,13 @@ dependencies = [
"futures-sink",
"futures-util",
"http 0.2.12",
- "indexmap",
+ "indexmap 2.6.0",
"slab",
"tokio",
"tokio-util",
"tracing",
]
-[[package]]
-name = "hashbrown"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead"
-dependencies = [
- "ahash 0.2.19",
- "autocfg 0.1.8",
-]
-
[[package]]
name = "hashbrown"
version = "0.12.3"
@@ -2027,17 +2134,14 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
-
-[[package]]
-name = "hashers"
-version = "1.0.1"
+version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30"
+checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3"
dependencies = [
- "fxhash",
+ "allocator-api2",
+ "equivalent",
+ "foldhash",
+ "serde",
]
[[package]]
@@ -2057,33 +2161,26 @@ name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
-
-[[package]]
-name = "hmac"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
- "digest",
+ "serde",
]
[[package]]
-name = "home"
-version = "0.3.4"
+name = "hex-conservative"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29302b90cfa76231a757a887d1e3153331a63c7f80b6c75f86366334cbe70708"
+checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd"
dependencies = [
- "scopeguard 0.3.3",
- "winapi 0.3.9",
+ "arrayvec",
]
[[package]]
-name = "home"
-version = "0.5.9"
+name = "hmac"
+version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
- "windows-sys 0.52.0",
+ "digest 0.10.7",
]
[[package]]
@@ -2154,12 +2251,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
-[[package]]
-name = "humantime"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
-
[[package]]
name = "hyper"
version = "0.14.30"
@@ -2198,25 +2289,11 @@ dependencies = [
"httparse",
"itoa",
"pin-project-lite",
- "smallvec 1.13.2",
+ "smallvec",
"tokio",
"want",
]
-[[package]]
-name = "hyper-rustls"
-version = "0.24.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
-dependencies = [
- "futures-util",
- "http 0.2.12",
- "hyper 0.14.30",
- "rustls",
- "tokio",
- "tokio-rustls",
-]
-
[[package]]
name = "hyper-tls"
version = "0.5.0"
@@ -2288,6 +2365,12 @@ dependencies = [
"cc",
]
+[[package]]
+name = "ident_case"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
+
[[package]]
name = "idna"
version = "0.5.0"
@@ -2307,35 +2390,6 @@ dependencies = [
"parity-scale-codec",
]
-[[package]]
-name = "impl-rlp"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808"
-dependencies = [
- "rlp",
-]
-
-[[package]]
-name = "impl-serde"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "impl-trait-for-tuples"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
[[package]]
name = "impl-trait-for-tuples"
version = "0.2.2"
@@ -2348,10 +2402,15 @@ dependencies = [
]
[[package]]
-name = "indenter"
-version = "0.3.3"
+name = "indexmap"
+version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
+dependencies = [
+ "autocfg",
+ "hashbrown 0.12.3",
+ "serde",
+]
[[package]]
name = "indexmap"
@@ -2360,7 +2419,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [
"equivalent",
- "hashbrown 0.15.0",
+ "hashbrown 0.15.3",
+ "serde",
]
[[package]]
@@ -2376,22 +2436,13 @@ dependencies = [
"unicode-width",
]
-[[package]]
-name = "inout"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
-dependencies = [
- "generic-array",
-]
-
[[package]]
name = "instant"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
]
[[package]]
@@ -2402,8 +2453,8 @@ dependencies = [
"anyhow",
"ark-bn254",
"ark-ec",
- "ark-ff",
- "ark-std",
+ "ark-ff 0.4.2",
+ "ark-std 0.4.0",
"ff",
"hashbrown 0.14.5",
"hex",
@@ -2461,6 +2512,15 @@ dependencies = [
"either",
]
+[[package]]
+name = "itertools"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "1.0.11"
@@ -2468,31 +2528,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
-name = "jobserver"
-version = "0.1.32"
+name = "jiff"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
+checksum = "a194df1107f33c79f4f93d02c80798520551949d59dfad22b6157048a88cca93"
dependencies = [
- "libc",
+ "jiff-static",
+ "log",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde",
]
[[package]]
-name = "journaldb"
-version = "0.2.0"
+name = "jiff-static"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b76a0abc6ebe6b53a2af01026ec5b2e56fa4579ac14a91acfa0a33858ce079c3"
+checksum = "6c6e1db7ed32c6c71b759497fae34bf7933636f75a251b9e736555da426f6442"
dependencies = [
- "fastmap",
- "log",
- "parking_lot 0.9.0",
- "tetsy-bytes",
- "tetsy-hash-db",
- "tetsy-keccak-hasher",
- "tetsy-kvdb",
- "tetsy-memory-db",
- "tetsy-rlp",
- "tetsy-util-mem 0.3.0",
- "vapory-types",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
]
[[package]]
@@ -2515,32 +2571,18 @@ dependencies = [
"serde",
]
-[[package]]
-name = "jsonwebtoken"
-version = "8.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378"
-dependencies = [
- "base64 0.21.7",
- "pem",
- "ring 0.16.20",
- "serde",
- "serde_json",
- "simple_asn1",
-]
-
[[package]]
name = "k256"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"ecdsa",
"elliptic-curve",
"once_cell",
+ "serdect",
"sha2",
- "signature",
]
[[package]]
@@ -2553,43 +2595,23 @@ dependencies = [
]
[[package]]
-name = "keccak-hash"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851"
-dependencies = [
- "primitive-types 0.10.1",
- "tiny-keccak 2.0.2",
-]
-
-[[package]]
-name = "lalrpop"
-version = "0.20.2"
+name = "keccak-asm"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca"
+checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6"
dependencies = [
- "ascii-canvas",
- "bit-set",
- "ena",
- "itertools 0.11.0",
- "lalrpop-util",
- "petgraph",
- "regex",
- "regex-syntax",
- "string_cache",
- "term",
- "tiny-keccak 2.0.2",
- "unicode-xid",
- "walkdir",
+ "digest 0.10.7",
+ "sha3-asm",
]
[[package]]
-name = "lalrpop-util"
-version = "0.20.2"
+name = "keccak-hash"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553"
+checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851"
dependencies = [
- "regex-automata",
+ "primitive-types 0.10.1",
+ "tiny-keccak",
]
[[package]]
@@ -2632,23 +2654,14 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
-[[package]]
-name = "lock_api"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
-dependencies = [
- "scopeguard 1.2.0",
-]
-
[[package]]
name = "lock_api"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
- "autocfg 1.4.0",
- "scopeguard 1.2.0",
+ "autocfg",
+ "scopeguard",
]
[[package]]
@@ -2665,27 +2678,22 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "lru"
-version = "0.4.3"
+version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0609345ddee5badacf857d4f547e0e5a2e987db77085c24cd887f73573a04237"
+checksum = "227748d55f2f0ab4735d87fd623798cb6b664512fe979705f829c9f81c934465"
dependencies = [
- "hashbrown 0.6.3",
+ "hashbrown 0.15.3",
]
[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
-[[package]]
-name = "md-5"
-version = "0.10.6"
+name = "macro-string"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
+checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3"
dependencies = [
- "cfg-if 1.0.0",
- "digest",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
]
[[package]]
@@ -2711,6 +2719,7 @@ name = "mining-cli"
version = "1.2.2"
dependencies = [
"aes-gcm",
+ "alloy",
"anyhow",
"bincode",
"chrono",
@@ -2718,10 +2727,10 @@ dependencies = [
"config",
"console",
"dialoguer",
- "dir",
"dirs",
"dotenv",
- "ethers",
+ "env_logger",
+ "futures",
"hex",
"intmax2-zkp",
"log",
@@ -2734,16 +2743,18 @@ dependencies = [
"rand_chacha 0.3.1",
"regex",
"reqwest 0.11.27",
- "rpassword",
"self_update",
"serde",
"serde_json",
+ "serde_qs",
+ "serde_with",
"sha3",
"simplelog",
- "strum",
- "strum_macros",
- "thiserror",
+ "strum 0.26.3",
+ "strum_macros 0.26.4",
+ "thiserror 1.0.64",
"tokio",
+ "tower",
]
[[package]]
@@ -2800,12 +2811,6 @@ dependencies = [
"tempfile",
]
-[[package]]
-name = "new_debug_unreachable"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
-
[[package]]
name = "nom"
version = "7.1.3"
@@ -2836,7 +2841,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
dependencies = [
- "autocfg 1.4.0",
+ "autocfg",
"num-integer",
"num-traits",
]
@@ -2883,7 +2888,7 @@ version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
- "autocfg 1.4.0",
+ "autocfg",
"num-integer",
"num-traits",
]
@@ -2905,7 +2910,7 @@ version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
- "autocfg 1.4.0",
+ "autocfg",
"libm",
]
@@ -2934,10 +2939,9 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
dependencies = [
- "proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -2956,29 +2960,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
-name = "object"
-version = "0.36.5"
+name = "nybbles"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
+checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307"
dependencies = [
- "memchr",
+ "alloy-rlp",
+ "const-hex",
+ "proptest",
+ "serde",
+ "smallvec",
]
[[package]]
-name = "ole32-sys"
-version = "0.2.0"
+name = "object"
+version = "0.36.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c"
+checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e"
dependencies = [
- "winapi 0.2.8",
- "winapi-build",
+ "memchr",
]
[[package]]
name = "once_cell"
-version = "1.20.2"
+version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "opaque-debug"
@@ -2986,31 +2993,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
-[[package]]
-name = "open-fastrlp"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce"
-dependencies = [
- "arrayvec 0.7.6",
- "auto_impl",
- "bytes",
- "ethereum-types",
- "open-fastrlp-derive",
-]
-
-[[package]]
-name = "open-fastrlp-derive"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c"
-dependencies = [
- "bytes",
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
[[package]]
name = "openssl"
version = "0.10.66"
@@ -3018,7 +3000,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
dependencies = [
"bitflags 2.6.0",
- "cfg-if 1.0.0",
+ "cfg-if",
"foreign-types",
"libc",
"once_cell",
@@ -3034,7 +3016,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -3045,9 +3027,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "300.3.2+3.3.2"
+version = "300.5.0+3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b"
+checksum = "e8ce546f549326b0e6052b649198487d91320875da901e7bd11a06d1ee3f9c2f"
dependencies = [
"cc",
]
@@ -3087,10 +3069,10 @@ version = "3.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee"
dependencies = [
- "arrayvec 0.7.6",
- "bitvec 1.0.1",
- "byte-slice-cast 1.2.2",
- "impl-trait-for-tuples 0.2.2",
+ "arrayvec",
+ "bitvec",
+ "byte-slice-cast",
+ "impl-trait-for-tuples",
"parity-scale-codec-derive",
"serde",
]
@@ -3107,114 +3089,40 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "parking_lot"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
-dependencies = [
- "lock_api 0.3.4",
- "parking_lot_core 0.6.3",
- "rustc_version 0.2.3",
-]
-
[[package]]
name = "parking_lot"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
- "lock_api 0.4.12",
- "parking_lot_core 0.9.10",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a"
-dependencies = [
- "cfg-if 0.1.10",
- "cloudabi",
- "libc",
- "redox_syscall 0.1.57",
- "rustc_version 0.2.3",
- "smallvec 0.6.14",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.9.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "redox_syscall 0.5.7",
- "smallvec 1.13.2",
- "windows-targets 0.52.6",
-]
-
-[[package]]
-name = "password-hash"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
-dependencies = [
- "base64ct",
- "rand_core 0.6.4",
- "subtle",
-]
-
-[[package]]
-name = "paste"
-version = "1.0.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
-
-[[package]]
-name = "path-slash"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42"
-
-[[package]]
-name = "pathdiff"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
-
-[[package]]
-name = "pbkdf2"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
-dependencies = [
- "digest",
- "hmac",
- "password-hash",
- "sha2",
+ "lock_api",
+ "parking_lot_core",
]
[[package]]
-name = "pbkdf2"
-version = "0.12.2"
+name = "parking_lot_core"
+version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
- "digest",
- "hmac",
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets 0.52.6",
]
[[package]]
-name = "pem"
-version = "1.1.1"
+name = "paste"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8"
-dependencies = [
- "base64 0.13.1",
-]
+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
+
+[[package]]
+name = "pathdiff"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "percent-encoding"
@@ -3229,7 +3137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9"
dependencies = [
"memchr",
- "thiserror",
+ "thiserror 1.0.64",
"ucd-trie",
]
@@ -3253,7 +3161,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -3267,77 +3175,6 @@ dependencies = [
"sha2",
]
-[[package]]
-name = "petgraph"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
-dependencies = [
- "fixedbitset",
- "indexmap",
-]
-
-[[package]]
-name = "pharos"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414"
-dependencies = [
- "futures",
- "rustc_version 0.4.1",
-]
-
-[[package]]
-name = "phf"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
-dependencies = [
- "phf_macros",
- "phf_shared 0.11.2",
-]
-
-[[package]]
-name = "phf_generator"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
-dependencies = [
- "phf_shared 0.11.2",
- "rand 0.8.5",
-]
-
-[[package]]
-name = "phf_macros"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
-dependencies = [
- "phf_generator",
- "phf_shared 0.11.2",
- "proc-macro2",
- "quote",
- "syn 2.0.79",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
-dependencies = [
- "siphasher",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
-dependencies = [
- "siphasher",
-]
-
[[package]]
name = "pin-project"
version = "1.1.6"
@@ -3355,7 +3192,7 @@ checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -3418,8 +3255,8 @@ dependencies = [
"anyhow",
"ark-bn254",
"ark-ec",
- "ark-ff",
- "ark-std",
+ "ark-ff 0.4.2",
+ "ark-std 0.4.0",
"env_logger",
"hashbrown 0.14.5",
"hex",
@@ -3462,7 +3299,7 @@ dependencies = [
"plonky2",
"rand 0.8.5",
"starky",
- "tiny-keccak 2.0.2",
+ "tiny-keccak",
]
[[package]]
@@ -3496,7 +3333,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"cpufeatures",
"opaque-debug",
"universal-hash",
@@ -3504,9 +3341,18 @@ dependencies = [
[[package]]
name = "portable-atomic"
-version = "1.9.0"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
+
+[[package]]
+name = "portable-atomic-util"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
+checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
+dependencies = [
+ "portable-atomic",
+]
[[package]]
name = "powerfmt"
@@ -3523,22 +3369,6 @@ dependencies = [
"zerocopy",
]
-[[package]]
-name = "precomputed-hash"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
-
-[[package]]
-name = "prettyplease"
-version = "0.2.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba"
-dependencies = [
- "proc-macro2",
- "syn 2.0.79",
-]
-
[[package]]
name = "primitive-types"
version = "0.10.1"
@@ -3557,9 +3387,6 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
dependencies = [
"fixed-hash 0.8.0",
"impl-codec",
- "impl-rlp",
- "impl-serde",
- "scale-info",
"uint",
]
@@ -3572,21 +3399,45 @@ dependencies = [
"toml_edit",
]
+[[package]]
+name = "proc-macro-error-attr2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
+[[package]]
+name = "proc-macro-error2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
+dependencies = [
+ "proc-macro-error-attr2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
+
[[package]]
name = "proc-macro2"
-version = "1.0.86"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "proptest"
-version = "1.5.0"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d"
+checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50"
dependencies = [
+ "bit-set",
+ "bit-vec",
"bitflags 2.6.0",
"lazy_static",
"num-traits",
@@ -3594,9 +3445,17 @@ dependencies = [
"rand_chacha 0.3.1",
"rand_xorshift",
"regex-syntax",
+ "rusty-fork",
+ "tempfile",
"unarray",
]
+[[package]]
+name = "quick-error"
+version = "1.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
+
[[package]]
name = "quick-xml"
version = "0.23.1"
@@ -3608,18 +3467,18 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.37"
+version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
-name = "radium"
-version = "0.3.0"
+name = "r-efi"
+version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac"
+checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
[[package]]
name = "radium"
@@ -3627,19 +3486,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
-[[package]]
-name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "getrandom 0.1.16",
- "libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc",
-]
-
[[package]]
name = "rand"
version = "0.8.5"
@@ -3649,16 +3495,18 @@ dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
+ "serde",
]
[[package]]
-name = "rand_chacha"
-version = "0.2.2"
+name = "rand"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
+checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
+ "rand_chacha 0.9.0",
+ "rand_core 0.9.3",
+ "serde",
]
[[package]]
@@ -3672,12 +3520,13 @@ dependencies = [
]
[[package]]
-name = "rand_core"
-version = "0.5.1"
+name = "rand_chacha"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
- "getrandom 0.1.16",
+ "ppv-lite86",
+ "rand_core 0.9.3",
]
[[package]]
@@ -3690,12 +3539,13 @@ dependencies = [
]
[[package]]
-name = "rand_hc"
-version = "0.2.0"
+name = "rand_core"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
- "rand_core 0.5.1",
+ "getrandom 0.3.3",
+ "serde",
]
[[package]]
@@ -3727,12 +3577,6 @@ dependencies = [
"crossbeam-utils",
]
-[[package]]
-name = "redox_syscall"
-version = "0.1.57"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
-
[[package]]
name = "redox_syscall"
version = "0.5.7"
@@ -3750,7 +3594,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [
"getrandom 0.2.15",
"libredox",
- "thiserror",
+ "thiserror 1.0.64",
]
[[package]]
@@ -3797,7 +3641,6 @@ dependencies = [
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.30",
- "hyper-rustls",
"hyper-tls 0.5.0",
"ipnet",
"js-sys",
@@ -3807,7 +3650,6 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
- "rustls",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
@@ -3816,13 +3658,11 @@ dependencies = [
"system-configuration",
"tokio",
"tokio-native-tls",
- "tokio-rustls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots",
"winreg",
]
@@ -3876,45 +3716,6 @@ dependencies = [
"subtle",
]
-[[package]]
-name = "ring"
-version = "0.16.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
-dependencies = [
- "cc",
- "libc",
- "once_cell",
- "spin 0.5.2",
- "untrusted 0.7.1",
- "web-sys",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "ring"
-version = "0.17.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
-dependencies = [
- "cc",
- "cfg-if 1.0.0",
- "getrandom 0.2.15",
- "libc",
- "spin 0.9.8",
- "untrusted 0.9.0",
- "windows-sys 0.52.0",
-]
-
-[[package]]
-name = "ripemd"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f"
-dependencies = [
- "digest",
-]
-
[[package]]
name = "rlp"
version = "0.5.2"
@@ -3922,21 +3723,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec"
dependencies = [
"bytes",
- "rlp-derive",
"rustc-hex",
]
-[[package]]
-name = "rlp-derive"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
[[package]]
name = "ron"
version = "0.7.1"
@@ -3949,22 +3738,45 @@ dependencies = [
]
[[package]]
-name = "rpassword"
-version = "5.0.1"
+name = "ruint"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb"
+checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4"
dependencies = [
- "libc",
- "winapi 0.3.9",
+ "alloy-rlp",
+ "ark-ff 0.3.0",
+ "ark-ff 0.4.2",
+ "bytes",
+ "fastrlp 0.3.1",
+ "fastrlp 0.4.0",
+ "num-bigint 0.4.6",
+ "num-integer",
+ "num-traits",
+ "parity-scale-codec",
+ "primitive-types 0.12.2",
+ "proptest",
+ "rand 0.8.5",
+ "rand 0.9.1",
+ "rlp",
+ "ruint-macro",
+ "serde",
+ "valuable",
+ "zeroize",
]
+[[package]]
+name = "ruint-macro"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18"
+
[[package]]
name = "rust-ini"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"ordered-multimap",
]
@@ -3974,6 +3786,15 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
+[[package]]
+name = "rustc-hash"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+dependencies = [
+ "rand 0.8.5",
+]
+
[[package]]
name = "rustc-hex"
version = "2.1.0"
@@ -3982,11 +3803,11 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6"
[[package]]
name = "rustc_version"
-version = "0.2.3"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
+checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
- "semver 0.9.0",
+ "semver 0.11.0",
]
[[package]]
@@ -4011,18 +3832,6 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "rustls"
-version = "0.21.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
-dependencies = [
- "log",
- "ring 0.17.8",
- "rustls-webpki",
- "sct",
-]
-
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
@@ -4047,16 +3856,6 @@ version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55"
-[[package]]
-name = "rustls-webpki"
-version = "0.101.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
-dependencies = [
- "ring 0.17.8",
- "untrusted 0.9.0",
-]
-
[[package]]
name = "rustversion"
version = "1.0.17"
@@ -4064,52 +3863,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
[[package]]
-name = "ryu"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
-
-[[package]]
-name = "salsa20"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"
-dependencies = [
- "cipher 0.4.4",
-]
-
-[[package]]
-name = "same-file"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "scale-info"
-version = "2.11.3"
+name = "rusty-fork"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024"
+checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
dependencies = [
- "cfg-if 1.0.0",
- "derive_more",
- "parity-scale-codec",
- "scale-info-derive",
+ "fnv",
+ "quick-error",
+ "tempfile",
+ "wait-timeout",
]
[[package]]
-name = "scale-info-derive"
-version = "2.11.3"
+name = "ryu"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62"
-dependencies = [
- "proc-macro-crate",
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
+checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
@@ -4120,12 +3889,6 @@ dependencies = [
"windows-sys 0.59.0",
]
-[[package]]
-name = "scopeguard"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
-
[[package]]
name = "scopeguard"
version = "1.2.0"
@@ -4133,39 +3896,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
-name = "scrypt"
-version = "0.10.0"
+name = "sec1"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d"
+checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
dependencies = [
- "hmac",
- "pbkdf2 0.11.0",
- "salsa20",
- "sha2",
+ "base16ct",
+ "der",
+ "generic-array",
+ "pkcs8",
+ "serdect",
+ "subtle",
+ "zeroize",
]
[[package]]
-name = "sct"
-version = "0.7.1"
+name = "secp256k1"
+version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
+checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252"
dependencies = [
- "ring 0.17.8",
- "untrusted 0.9.0",
+ "bitcoin_hashes",
+ "rand 0.8.5",
+ "secp256k1-sys",
+ "serde",
]
[[package]]
-name = "sec1"
-version = "0.7.3"
+name = "secp256k1-sys"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
+checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9"
dependencies = [
- "base16ct",
- "der",
- "generic-array",
- "pkcs8",
- "subtle",
- "zeroize",
+ "cc",
]
[[package]]
@@ -4219,15 +3982,15 @@ dependencies = [
"serde_json",
"tempfile",
"urlencoding",
- "zip 2.2.0",
+ "zip",
"zipsign-api",
]
[[package]]
name = "semver"
-version = "0.9.0"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
+checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
"semver-parser",
]
@@ -4237,27 +4000,15 @@ name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
-dependencies = [
- "serde",
-]
[[package]]
name = "semver-parser"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-
-[[package]]
-name = "send_wrapper"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
-
-[[package]]
-name = "send_wrapper"
-version = "0.6.0"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
+checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2"
+dependencies = [
+ "pest",
+]
[[package]]
name = "serde"
@@ -4276,7 +4027,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -4292,12 +4043,14 @@ dependencies = [
]
[[package]]
-name = "serde_spanned"
-version = "0.6.8"
+name = "serde_qs"
+version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
+checksum = "f3faaf9e727533a19351a43cc5a8de957372163c7d35cc48c90b75cdda13c352"
dependencies = [
+ "percent-encoding",
"serde",
+ "thiserror 2.0.12",
]
[[package]]
@@ -4313,14 +4066,43 @@ dependencies = [
]
[[package]]
-name = "sha1"
-version = "0.10.6"
+name = "serde_with"
+version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
+checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
dependencies = [
- "cfg-if 1.0.0",
- "cpufeatures",
- "digest",
+ "base64 0.22.1",
+ "chrono",
+ "hex",
+ "indexmap 1.9.3",
+ "indexmap 2.6.0",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "serde_with_macros",
+ "time",
+]
+
+[[package]]
+name = "serde_with_macros"
+version = "3.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
+dependencies = [
+ "darling",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "serdect"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177"
+dependencies = [
+ "base16ct",
+ "serde",
]
[[package]]
@@ -4329,9 +4111,9 @@ version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"cpufeatures",
- "digest",
+ "digest 0.10.7",
]
[[package]]
@@ -4340,25 +4122,25 @@ version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
dependencies = [
- "digest",
+ "digest 0.10.7",
"keccak",
]
[[package]]
-name = "shell-words"
-version = "1.1.0"
+name = "sha3-asm"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
+checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46"
+dependencies = [
+ "cc",
+ "cfg-if",
+]
[[package]]
-name = "shell32-sys"
-version = "0.1.2"
+name = "shell-words"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c"
-dependencies = [
- "winapi 0.2.8",
- "winapi-build",
-]
+checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "shlex"
@@ -4381,7 +4163,7 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
dependencies = [
- "digest",
+ "digest 0.10.7",
"rand_core 0.6.4",
]
@@ -4391,18 +4173,6 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
-[[package]]
-name = "simple_asn1"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085"
-dependencies = [
- "num-bigint 0.4.6",
- "num-traits",
- "thiserror",
- "time",
-]
-
[[package]]
name = "simplelog"
version = "0.12.2"
@@ -4414,28 +4184,13 @@ dependencies = [
"time",
]
-[[package]]
-name = "siphasher"
-version = "0.3.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
-
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
- "autocfg 1.4.0",
-]
-
-[[package]]
-name = "smallvec"
-version = "0.6.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0"
-dependencies = [
- "maybe-uninit",
+ "autocfg",
]
[[package]]
@@ -4443,6 +4198,9 @@ name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+dependencies = [
+ "serde",
+]
[[package]]
name = "socket2"
@@ -4454,32 +4212,6 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "solang-parser"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26"
-dependencies = [
- "itertools 0.11.0",
- "lalrpop",
- "lalrpop-util",
- "phf",
- "thiserror",
- "unicode-xid",
-]
-
-[[package]]
-name = "spin"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
-
-[[package]]
-name = "spin"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
-
[[package]]
name = "spki"
version = "0.7.3"
@@ -4512,19 +4244,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-[[package]]
-name = "string_cache"
-version = "0.8.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b"
-dependencies = [
- "new_debug_unreachable",
- "once_cell",
- "parking_lot 0.12.3",
- "phf_shared 0.10.0",
- "precomputed-hash",
-]
-
[[package]]
name = "strsim"
version = "0.11.1"
@@ -4536,8 +4255,14 @@ name = "strum"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
+
+[[package]]
+name = "strum"
+version = "0.27.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32"
dependencies = [
- "strum_macros",
+ "strum_macros 0.27.1",
]
[[package]]
@@ -4550,7 +4275,20 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 2.0.79",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "strum_macros"
+version = "0.27.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "rustversion",
+ "syn 2.0.101",
]
[[package]]
@@ -4560,30 +4298,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
-name = "svm-rs"
-version = "0.3.5"
+name = "syn"
+version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
- "dirs",
- "fs2",
- "hex",
- "once_cell",
- "reqwest 0.11.27",
- "semver 1.0.23",
- "serde",
- "serde_json",
- "sha2",
- "thiserror",
- "url",
- "zip 0.6.6",
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
]
[[package]]
name = "syn"
-version = "1.0.109"
+version = "2.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
dependencies = [
"proc-macro2",
"quote",
@@ -4591,14 +4320,15 @@ dependencies = [
]
[[package]]
-name = "syn"
-version = "2.0.79"
+name = "syn-solidity"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+checksum = "1b5d879005cc1b5ba4e18665be9e9501d9da3a9b95f625497c4cb7ee082b532e"
dependencies = [
+ "paste",
"proc-macro2",
"quote",
- "unicode-ident",
+ "syn 2.0.101",
]
[[package]]
@@ -4616,271 +4346,102 @@ dependencies = [
"futures-core",
]
-[[package]]
-name = "synstructure"
-version = "0.12.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
- "unicode-xid",
-]
-
[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "system-configuration-sys",
-]
-
-[[package]]
-name = "system-configuration-sys"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "tap"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
-
-[[package]]
-name = "tempfile"
-version = "3.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
-dependencies = [
- "cfg-if 1.0.0",
- "fastrand",
- "once_cell",
- "rustix",
- "windows-sys 0.59.0",
-]
-
-[[package]]
-name = "term"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
-dependencies = [
- "dirs-next",
- "rustversion",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "termcolor"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "tetsy-bytes"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b126714a30c5abc3fd13af622369d65945a91bf315ed555db109a7050abc9440"
-
-[[package]]
-name = "tetsy-fixed-hash"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1ed8b78ac3c63bc64d5f0ea6ef5841ccd214f4f007386ffe214086fa6eb803d"
-dependencies = [
- "byteorder",
- "rand 0.7.3",
- "rustc-hex",
- "static_assertions",
-]
-
-[[package]]
-name = "tetsy-hash-db"
-version = "0.15.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63bdafe780365bec794d716a51eb589d84c360514a125e9508c973f14991f4f5"
-
-[[package]]
-name = "tetsy-impl-codec"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf9fd308572d831c4b2fa619a617d2c6c6ec3ff34edae98266f9ee7c2815a05f"
-dependencies = [
- "tetsy-scale-codec",
-]
-
-[[package]]
-name = "tetsy-impl-rlp"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10d9894e9174ee77ec06e122256349fcccad3c1b0b3d34ed741c38fde7974c9a"
-dependencies = [
- "tetsy-rlp",
-]
-
-[[package]]
-name = "tetsy-impl-serde"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73849bf47bb3ea3423e6e6b53091cdbf6e47252b4be0ff83cb7e9eb47b0ab1e5"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "tetsy-keccak-hasher"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d628ecb0ccb5bf172a39084cf7e1e76173900485dd3db486e13672a411730e24"
-dependencies = [
- "tetsy-hash-db",
- "tetsy-plain-hasher",
- "tiny-keccak 1.5.0",
- "vapory-types",
-]
-
-[[package]]
-name = "tetsy-kvdb"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd005ae5a328e0ad832898850929b1a703c1c196989744eb894b34669fbcc061"
-dependencies = [
- "smallvec 1.13.2",
- "tetsy-bytes",
- "tetsy-util-mem 0.4.2",
-]
-
-[[package]]
-name = "tetsy-memory-db"
-version = "0.18.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9788a83f194d7eaff56a334af01fa832d833f4d5fa60271592ac0933b0f11253"
-dependencies = [
- "ahash 0.2.19",
- "hashbrown 0.6.3",
- "tetsy-hash-db",
- "tetsy-util-mem 0.3.0",
-]
-
-[[package]]
-name = "tetsy-plain-hasher"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26df2c3d8f8ffd558f0ac4ac592f2b3f43350b8f333573eefd55a54fe2ace738"
+checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
- "crunchy",
+ "bitflags 1.3.2",
+ "core-foundation",
+ "system-configuration-sys",
]
[[package]]
-name = "tetsy-primitive-types"
-version = "0.6.0"
+name = "system-configuration-sys"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bab7bd08ec411a022351f271cc69721ac7ce6be9f3cefaca201ade5b8f5b05fc"
+checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
- "tetsy-fixed-hash",
- "tetsy-impl-codec",
- "tetsy-impl-rlp",
- "tetsy-impl-serde",
- "uint-crate",
+ "core-foundation-sys",
+ "libc",
]
[[package]]
-name = "tetsy-rlp"
-version = "0.4.5"
+name = "tap"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7aa29cb060e6f816433b8a2956a27034059452a5d8c7493306f1e2e9d11a1a7b"
-dependencies = [
- "rustc-hex",
-]
+checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
-name = "tetsy-scale-codec"
-version = "1.3.0"
+name = "tempfile"
+version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afe48c9474a98c5af2796dccc6a228e9752ba87ad5912dacf23a0c8e696896ff"
+checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
dependencies = [
- "arrayvec 0.5.2",
- "bitvec 0.17.4",
- "byte-slice-cast 0.3.5",
- "serde",
+ "cfg-if",
+ "fastrand",
+ "once_cell",
+ "rustix",
+ "windows-sys 0.59.0",
]
[[package]]
-name = "tetsy-util-mem"
-version = "0.3.0"
+name = "termcolor"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9dcb4de95856e89362585321f053820f3aaae0cda29ecda57af2654f6dd1e5f3"
+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
- "cfg-if 0.1.10",
- "hashbrown 0.6.3",
- "impl-trait-for-tuples 0.1.3",
- "lru",
- "parking_lot 0.9.0",
- "smallvec 1.13.2",
- "tetsy-util-mem-derive",
- "vapory-types",
- "winapi 0.3.9",
+ "winapi-util",
]
[[package]]
-name = "tetsy-util-mem"
-version = "0.4.2"
+name = "thiserror"
+version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb5247c86d5290b9aa3b126f7993b0b561b1419ca3fa1dab334a0c74ebdd8f5d"
+checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
dependencies = [
- "cfg-if 0.1.10",
- "hashbrown 0.6.3",
- "impl-trait-for-tuples 0.1.3",
- "lru",
- "parking_lot 0.9.0",
- "smallvec 1.13.2",
- "tetsy-primitive-types",
- "tetsy-util-mem-derive",
- "vapory-types",
- "winapi 0.3.9",
+ "thiserror-impl 1.0.64",
]
[[package]]
-name = "tetsy-util-mem-derive"
-version = "0.1.1"
+name = "thiserror"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a5ba230d73eac389b2a43327e90e857ccee06c2c734726067555708164cbd19"
+checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
dependencies = [
- "proc-macro2",
- "syn 1.0.109",
- "synstructure",
+ "thiserror-impl 2.0.12",
]
[[package]]
-name = "thiserror"
+name = "thiserror-impl"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
+checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
- "thiserror-impl",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.101",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.64"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
+checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
+]
+
+[[package]]
+name = "threadpool"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
+dependencies = [
+ "num_cpus",
]
[[package]]
@@ -4916,15 +4477,6 @@ dependencies = [
"time-core",
]
-[[package]]
-name = "tiny-keccak"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2"
-dependencies = [
- "crunchy",
-]
-
[[package]]
name = "tiny-keccak"
version = "2.0.2"
@@ -4959,7 +4511,7 @@ dependencies = [
"bytes",
"libc",
"mio",
- "parking_lot 0.12.3",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
@@ -4975,7 +4527,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -4989,28 +4541,15 @@ dependencies = [
]
[[package]]
-name = "tokio-rustls"
-version = "0.24.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
-dependencies = [
- "rustls",
- "tokio",
-]
-
-[[package]]
-name = "tokio-tungstenite"
-version = "0.20.1"
+name = "tokio-stream"
+version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
+checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
dependencies = [
- "futures-util",
- "log",
- "rustls",
+ "futures-core",
+ "pin-project-lite",
"tokio",
- "tokio-rustls",
- "tungstenite",
- "webpki-roots",
+ "tokio-util",
]
[[package]]
@@ -5035,26 +4574,11 @@ dependencies = [
"serde",
]
-[[package]]
-name = "toml"
-version = "0.8.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
-dependencies = [
- "serde",
- "serde_spanned",
- "toml_datetime",
- "toml_edit",
-]
-
[[package]]
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
-dependencies = [
- "serde",
-]
[[package]]
name = "toml_edit"
@@ -5062,13 +4586,31 @@ version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
- "indexmap",
- "serde",
- "serde_spanned",
+ "indexmap 2.6.0",
"toml_datetime",
- "winnow",
+ "winnow 0.6.20",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper 1.0.1",
+ "tower-layer",
+ "tower-service",
]
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
[[package]]
name = "tower-service"
version = "0.3.3"
@@ -5094,7 +4636,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -5112,6 +4654,8 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
+ "futures",
+ "futures-task",
"pin-project",
"tracing",
]
@@ -5122,26 +4666,6 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
-[[package]]
-name = "tungstenite"
-version = "0.20.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
-dependencies = [
- "byteorder",
- "bytes",
- "data-encoding",
- "http 0.2.12",
- "httparse",
- "log",
- "rand 0.8.5",
- "rustls",
- "sha1",
- "thiserror",
- "url",
- "utf-8",
-]
-
[[package]]
name = "typenum"
version = "1.17.0"
@@ -5166,18 +4690,6 @@ dependencies = [
"static_assertions",
]
-[[package]]
-name = "uint-crate"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a54e7d173b20bb6938b878aa29ccdf294c23202c384bd096bc5cfd162eee77a2"
-dependencies = [
- "byteorder",
- "crunchy",
- "rustc-hex",
- "static_assertions",
-]
-
[[package]]
name = "unarray"
version = "0.1.4"
@@ -5237,18 +4749,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "untrusted"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
-
-[[package]]
-name = "untrusted"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
-
[[package]]
name = "url"
version = "2.5.2"
@@ -5266,12 +4766,6 @@ version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
-[[package]]
-name = "utf-8"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-
[[package]]
name = "utf8parse"
version = "0.2.2"
@@ -5279,41 +4773,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
-name = "uuid"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
-dependencies = [
- "getrandom 0.2.15",
- "serde",
-]
-
-[[package]]
-name = "vapbloom"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae5cf5523abfbbc0ee98ac9ec1c8e8339dede2963bf82bdb8e84d4c8251e4091"
-dependencies = [
- "crunchy",
- "tetsy-fixed-hash",
- "tetsy-impl-rlp",
- "tetsy-impl-serde",
- "tiny-keccak 1.5.0",
-]
-
-[[package]]
-name = "vapory-types"
-version = "0.8.0"
+name = "valuable"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06968740059dd4ddf354280f706f2a207b49537b79b0341b765d1bceeaf8d7c4"
-dependencies = [
- "tetsy-fixed-hash",
- "tetsy-impl-rlp",
- "tetsy-impl-serde",
- "tetsy-primitive-types",
- "uint-crate",
- "vapbloom",
-]
+checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "vcpkg"
@@ -5328,13 +4791,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
-name = "walkdir"
-version = "2.5.0"
+name = "wait-timeout"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
dependencies = [
- "same-file",
- "winapi-util",
+ "libc",
]
[[package]]
@@ -5348,15 +4810,18 @@ dependencies = [
[[package]]
name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
+version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasi"
-version = "0.11.0+wasi-snapshot-preview1"
+version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
+dependencies = [
+ "wit-bindgen-rt",
+]
[[package]]
name = "wasm-bindgen"
@@ -5364,7 +4829,7 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"once_cell",
"wasm-bindgen-macro",
]
@@ -5380,7 +4845,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
"wasm-bindgen-shared",
]
@@ -5390,7 +4855,7 @@ version = "0.4.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
@@ -5414,7 +4879,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -5425,6 +4890,20 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
+[[package]]
+name = "wasmtimer"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23"
+dependencies = [
+ "futures",
+ "js-sys",
+ "parking_lot",
+ "pin-utils",
+ "slab",
+ "wasm-bindgen",
+]
+
[[package]]
name = "web-sys"
version = "0.3.70"
@@ -5445,40 +4924,6 @@ dependencies = [
"wasm-bindgen",
]
-[[package]]
-name = "webpki-roots"
-version = "0.25.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
-
-[[package]]
-name = "winapi"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
[[package]]
name = "winapi-util"
version = "0.1.9"
@@ -5488,12 +4933,6 @@ dependencies = [
"windows-sys 0.59.0",
]
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
[[package]]
name = "windows-core"
version = "0.52.0"
@@ -5690,33 +5129,32 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "winnow"
+version = "0.7.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
- "cfg-if 1.0.0",
+ "cfg-if",
"windows-sys 0.48.0",
]
[[package]]
-name = "ws_stream_wasm"
-version = "0.7.4"
+name = "wit-bindgen-rt"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5"
+checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
- "async_io_stream",
- "futures",
- "js-sys",
- "log",
- "pharos",
- "rustc_version 0.4.1",
- "send_wrapper 0.6.0",
- "thiserror",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
+ "bitflags 2.6.0",
]
[[package]]
@@ -5728,12 +5166,6 @@ dependencies = [
"tap",
]
-[[package]]
-name = "xdg"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
-
[[package]]
name = "yaml-rust"
version = "0.4.5"
@@ -5743,12 +5175,6 @@ dependencies = [
"linked-hash-map",
]
-[[package]]
-name = "yansi"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
-
[[package]]
name = "zerocopy"
version = "0.7.35"
@@ -5767,7 +5193,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
+ "syn 2.0.101",
]
[[package]]
@@ -5787,27 +5213,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.79",
-]
-
-[[package]]
-name = "zip"
-version = "0.6.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
-dependencies = [
- "aes 0.8.4",
- "byteorder",
- "bzip2",
- "constant_time_eq",
- "crc32fast",
- "crossbeam-utils",
- "flate2",
- "hmac",
- "pbkdf2 0.11.0",
- "sha1",
- "time",
- "zstd",
+ "syn 2.0.101",
]
[[package]]
@@ -5821,9 +5227,9 @@ dependencies = [
"crossbeam-utils",
"displaydoc",
"flate2",
- "indexmap",
+ "indexmap 2.6.0",
"memchr",
- "thiserror",
+ "thiserror 1.0.64",
"time",
"zopfli",
]
@@ -5835,7 +5241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6413a546ada9dbcd0b9a3e0b0880581279e35047bce9797e523b3408e1df607c"
dependencies = [
"ed25519-dalek",
- "thiserror",
+ "thiserror 1.0.64",
]
[[package]]
@@ -5851,32 +5257,3 @@ dependencies = [
"once_cell",
"simd-adler32",
]
-
-[[package]]
-name = "zstd"
-version = "0.11.2+zstd.1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
-dependencies = [
- "zstd-safe",
-]
-
-[[package]]
-name = "zstd-safe"
-version = "5.0.2+zstd.1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
-dependencies = [
- "libc",
- "zstd-sys",
-]
-
-[[package]]
-name = "zstd-sys"
-version = "2.0.13+zstd.1.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa"
-dependencies = [
- "cc",
- "pkg-config",
-]
diff --git a/Cargo.toml b/Cargo.toml
index ab10d22..b20bf40 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,17 +8,15 @@ edition = "2021"
[dependencies]
anyhow = "1.0.88"
bincode = "1.3.3"
-plonky2 = { git="https://github.com/InternetMaximalism/polygon-plonky2.git", branch="intmax2-dev"}
-intmax2-zkp = {git ="https://github.com/InternetMaximalism/intmax2-zkp", branch = "dev"}
-mining_circuit_v1 ={git ="https://github.com/InternetMaximalism/intmax2-mining.git"}
+plonky2 = { git = "https://github.com/InternetMaximalism/polygon-plonky2.git", branch = "intmax2-dev" }
+intmax2-zkp = { git = "https://github.com/InternetMaximalism/intmax2-zkp", branch = "dev" }
+mining_circuit_v1 = { git = "https://github.com/InternetMaximalism/intmax2-mining.git" }
num-bigint = "0.4.6"
-serde = {version="1.0.210", features = ["derive"]}
+serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.128"
config = "0.13"
reqwest = { version = "0.11", features = ["json"] }
-ethers = "2.0"
tokio = { version = "1", features = ["full"] }
-rpassword = "5.0"
aes-gcm = "0.9"
sha3 = "0.10.0"
dialoguer = "0.11.0"
@@ -28,7 +26,6 @@ simplelog = "0.12.2"
log = "0.4.22"
chrono = "0.4.38"
regex = "1.10.6"
-dir = "0.1.2"
dirs = "5.0.1"
clap = { version = "4.5.18", features = ["derive"] }
dotenv = "0.15.0"
@@ -38,6 +35,15 @@ strum = "0.26.3"
strum_macros = "0.26.4"
openssl = { version = "0.10", features = ["vendored"] }
openssl-sys = { version = "0.9", features = ["vendored"] }
-self_update = {version="0.41.0", features=["archive-zip", "compression-zip-deflate"]}
+self_update = { version = "0.41.0", features = [
+ "archive-zip",
+ "compression-zip-deflate",
+] }
rand_chacha = "0.3.1"
+alloy = { version = "1.0.1", features = ["rand"] }
+futures = "0.3.31"
+serde_with = "3.12.0"
+tower = "0.5.2"
+serde_qs = "0.15.0"
+env_logger = "0.11.8"
diff --git a/abi/ERC20.json b/abi/ERC20.json
new file mode 100644
index 0000000..668d697
--- /dev/null
+++ b/abi/ERC20.json
@@ -0,0 +1,222 @@
+[
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "balance",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ }
+]
\ No newline at end of file
diff --git a/config/config.base-sepolia.toml b/config/config.base-sepolia.toml
index d1dace6..4daf218 100644
--- a/config/config.base-sepolia.toml
+++ b/config/config.base-sepolia.toml
@@ -2,17 +2,18 @@
availability_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/availability"
withdrawal_gnark_prover_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/gnark-withdraw-circuit"
claim_gnark_prover_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/gnark-claim-circuit"
-withdrawal_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/withdrawal"
-circulation_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining"
-gas_server_url="https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining/gas-fee/estimate"
-tree_data_repository="InternetMaximalism/intmax2-v1-mining-mock"
-tree_data_directory="base-sepolia-data"
-tree_data_branch="main"
+withdrawal_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/withdrawal"
+circulation_server_url = "https://base-sepolia.v1.mining-gateway.intmax.xyz/v1/mining"
+tree_data_repository = "InternetMaximalism/intmax2-v1-mining-mock"
+tree_data_directory = "base-sepolia-data"
+tree_data_branch = "main"
sync_tree_data_interval_in_sec = 3600
gnark_get_proof_cooldown_in_sec = 60
[blockchain]
chain_id = 84532
+graph_url = "https://base-sepolia.graph.intmax.xyz/subgraphs/name/stage-int1"
+graph_health_check_timeout_in_sec = 60
int1_address = "0x5dfa05aAdbE75a92f6153508950533fC1bed98BE"
minter_address = "0xeF9CBc6F2f602AF19b0fEc2cc4F217177730858E"
token_address = "0x2699CD7f883DecC464171a7A92f4CcC4eF220fa2"
@@ -22,12 +23,12 @@ single_claim_gas = 600000
[service]
repository_url = "https://github.com/InternetMaximalism/intmax2-mining-cli"
-mining_min_cooldown_in_sec = 20
-mining_max_cooldown_in_sec = 200
-loop_cooldown_in_sec = 10
-high_gas_retry_inverval_in_sec = 10
+mining_min_cooldown_in_sec = 20
+mining_max_cooldown_in_sec = 200
+loop_cooldown_in_sec = 60
+high_gas_retry_interval_in_sec = 30
[env]
-default_max_gas_price ="100"
-default_mining_times="5"
-default_mining_unit="0.1"
\ No newline at end of file
+default_max_gas_price = "100"
+default_mining_times = "5"
+default_mining_unit = "0.1"
diff --git a/config/config.base.toml b/config/config.base.toml
index 34bcd88..6fb07a3 100644
--- a/config/config.base.toml
+++ b/config/config.base.toml
@@ -2,17 +2,18 @@
availability_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/availability"
withdrawal_gnark_prover_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/gnark-withdraw-circuit"
claim_gnark_prover_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/gnark-claim-circuit"
-withdrawal_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/withdrawal"
-circulation_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining"
-gas_server_url="https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining/gas-fee/estimate"
-tree_data_repository="InternetMaximalism/intmax2-mining"
-tree_data_directory="base-data"
-tree_data_branch="main"
+withdrawal_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/withdrawal"
+circulation_server_url = "https://v1.base-prod.mining-gateway.intmax.xyz/v1/mining"
+tree_data_repository = "InternetMaximalism/intmax2-mining"
+tree_data_directory = "base-data"
+tree_data_branch = "main"
sync_tree_data_interval_in_sec = 3600
gnark_get_proof_cooldown_in_sec = 60
[blockchain]
chain_id = 8453
+graph_url = "https://v1.base-prod.graph.intmax.xyz/subgraphs/name/prod-int1"
+graph_health_check_timeout_in_sec = 60
int1_address = "0x195F9b5F42435bB71E9765E66a9bdFE40d44A895"
minter_address = "0x1f5a5Eb6C3894351425BD51ea2AE1ef3FEC93976"
token_address = "0xf95117e3a5B7968703CeD3B66A9CbE0Bc9e1D8bf"
@@ -22,12 +23,12 @@ single_claim_gas = 600000
[service]
repository_url = "https://github.com/InternetMaximalism/intmax2-mining-cli"
-mining_min_cooldown_in_sec = 3600 # 1 hour
-mining_max_cooldown_in_sec = 21600 # 6 hours
-loop_cooldown_in_sec = 10
-high_gas_retry_inverval_in_sec = 10
+mining_min_cooldown_in_sec = 3600 # 1 hour
+mining_max_cooldown_in_sec = 21600 # 6 hours
+loop_cooldown_in_sec = 60
+high_gas_retry_interval_in_sec = 30
[env]
-default_max_gas_price ="10"
-default_mining_times="10"
-default_mining_unit="0.1"
\ No newline at end of file
+default_max_gas_price = "10"
+default_mining_times = "10"
+default_mining_unit = "0.1"
diff --git a/config/config.mainnet.toml b/config/config.mainnet.toml
index fd0a7bf..063b3a0 100644
--- a/config/config.mainnet.toml
+++ b/config/config.mainnet.toml
@@ -2,17 +2,18 @@
availability_server_url = "https://v1.mining-gateway.intmax.xyz/v1/availability"
withdrawal_gnark_prover_url = "https://v1.mining-gateway.intmax.xyz/v1/gnark-withdraw-circuit"
claim_gnark_prover_url = "https://v1.mining-gateway.intmax.xyz/v1/gnark-claim-circuit"
-withdrawal_server_url="https://v1.mining-gateway.intmax.xyz/v1/withdrawal"
-circulation_server_url="https://v1.mining-gateway.intmax.xyz/v1/mining"
-gas_server_url=""
-tree_data_repository="InternetMaximalism/intmax2-mining"
-tree_data_directory="data"
-tree_data_branch="main"
-sync_tree_data_interval_in_sec = 3600 # 60 minutes
+withdrawal_server_url = "https://v1.mining-gateway.intmax.xyz/v1/withdrawal"
+circulation_server_url = "https://v1.mining-gateway.intmax.xyz/v1/mining"
+tree_data_repository = "InternetMaximalism/intmax2-mining"
+tree_data_directory = "data"
+tree_data_branch = "main"
+sync_tree_data_interval_in_sec = 3600 # 60 minutes
gnark_get_proof_cooldown_in_sec = 60
[blockchain]
chain_id = 1
+graph_url = "https://mainnet.graph.intmax.xyz/subgraphs/name/legacy-int1"
+graph_health_check_timeout_in_sec = 60
int1_address = "0x0Ac498bCA32B00E2584171844fb9A5943398D9c1"
minter_address = "0x38DE07d2526Ae929f1903E5F109B70C50e12A8E0"
token_address = "0xe24e207c6156241cAfb41D025B3b5F0677114C81"
@@ -22,12 +23,12 @@ single_claim_gas = 600000
[service]
repository_url = "https://github.com/InternetMaximalism/intmax2-mining-cli"
-mining_min_cooldown_in_sec = 3600 # 1 hour
-mining_max_cooldown_in_sec = 21600 # 6 hours
-loop_cooldown_in_sec = 10
-high_gas_retry_inverval_in_sec = 10
+mining_min_cooldown_in_sec = 3600 # 1 hour
+mining_max_cooldown_in_sec = 21600 # 6 hours
+loop_cooldown_in_sec = 60
+high_gas_retry_interval_in_sec = 30
[env]
-default_max_gas_price ="30"
-default_mining_times="10"
-default_mining_unit="0.1"
\ No newline at end of file
+default_max_gas_price = "30"
+default_mining_times = "10"
+default_mining_unit = "0.1"
diff --git a/docs/base_mainnet_quickstart.md b/docs/base_mainnet_quickstart.md
index 7fd7771..e95e24d 100644
--- a/docs/base_mainnet_quickstart.md
+++ b/docs/base_mainnet_quickstart.md
@@ -224,14 +224,14 @@ To claim ITX token, select `Claim`. You can check whether an deposit address is
2. **Claim ITX Token To Withdrawal Address**:
- If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availablity time reaches. To see the tokens in your wallet, ensure to add the ITX mainnet token contract address to your wallet using this [guide](./add_token_to_wallet.md).
+ If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availability time reaches. To see the tokens in your wallet, ensure to add the ITX mainnet token contract address to your wallet using this [guide](./add_token_to_wallet.md).
Check wallet to see tokens.
-After claiming process is done, you can proceed to retreiving available ETH in the Intmax2 Network back to your withdrawal address. Proceed by pressing any key as instructed by CLI.
+After claiming process is done, you can proceed to retrieving available ETH in the Intmax2 Network back to your withdrawal address. Proceed by pressing any key as instructed by CLI.
## Withdraw ETH
diff --git a/docs/base_sepolia_quickstart.md b/docs/base_sepolia_quickstart.md
index 0cfd1eb..8815024 100644
--- a/docs/base_sepolia_quickstart.md
+++ b/docs/base_sepolia_quickstart.md
@@ -211,7 +211,7 @@ To claim ITX token, select `Claim`. You can check whether an deposit address is
2. **Claim ITX Token To Withdrawal Address**:
-If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availablity time reaches. To see the tokens in your wallet, ensure to add the ITX token contract address to your wallet using the Network [guide](./add_token_to_wallet.md).
+If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availability time reaches. To see the tokens in your wallet, ensure to add the ITX token contract address to your wallet using the Network [guide](./add_token_to_wallet.md).
diff --git a/docs/faq.md b/docs/faq.md
index 58a8207..0fa3909 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -2,11 +2,11 @@
### 1. Why can’t I find my ETH after depositing to the CLI address
-You probably sent ETH in the wrong network, you can retreive ETH back and send to the right network
+You probably sent ETH in the wrong network, you can retrieve ETH back and send to the right network
### 2. How to recover funds when sent to the wrong network
-Export private key first and import the wallet account in an external wallet(e.g, INTMAX Wallet or Metamask). You cannow transfer the funds and send using the corrrect network.
+Export private key first and import the wallet account in an external wallet(e.g, INTMAX Wallet or Metamask). You cannow transfer the funds and send using the correct network.
### 3. Error: Internal error: Failed to claim: Error sending transaction: Revert (bytes(0x)) ERROR: Internal error: Failed to claim: Error sending transaction: MiddlewareError...(JsonRpcError { code: -32003, message: "insufficient funds for gas * price + value: have 13090885838070 want 2612337489
diff --git a/docs/migrate.md b/docs/migrate.md
index bea5815..b86ac80 100644
--- a/docs/migrate.md
+++ b/docs/migrate.md
@@ -22,7 +22,7 @@ Before you begin, please ensure you have the following:
### Upgrading CLI Version
-1. **Lauching the CLI** Double-click on the mining-cli shown in this image to launch.
+1. **Launching the CLI** Double-click on the mining-cli shown in this image to launch.
@@ -84,14 +84,14 @@ To claim ITX token, select `Claim`. You can check whether an deposit address is
2. **Claim ITX Token To Withdrawal Address**:
-If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availablity time reaches. To see the tokens in your wallet, ensure to add the ITX mainnet token contract address to your wallet using the Network [guide](./add_token_to_wallet.md).
+If `Claim` was selected and your address qualifies for ITX tokens, the CLI automatically transfers your available ITX tokens to your withdrawal wallet immediately or when the token availability time reaches. To see the tokens in your wallet, ensure to add the ITX mainnet token contract address to your wallet using the Network [guide](./add_token_to_wallet.md).
Check wallet to see tokens.
-After claiming process is done, you can proceed to retreiving available ETH in the INTMAX2 Network back to your withdrawal address. Proceed by pressing any key as instructed by CLI.
+After claiming process is done, you can proceed to retrieving available ETH in the INTMAX2 Network back to your withdrawal address. Proceed by pressing any key as instructed by CLI.
### Withdraw ETH
diff --git a/docs/windows_guide.md b/docs/windows_guide.md
index d8795ab..b4e0781 100644
--- a/docs/windows_guide.md
+++ b/docs/windows_guide.md
@@ -56,7 +56,7 @@ Double click the mining CLI to run as you normally would after adding the exclus
-11. **Runing The Mining CLI**: Windows Defender will proceed to show file name and publisher. Scroll down the screen and select *Run anyway*.
+11. **Running The Mining CLI**: Windows Defender will proceed to show file name and publisher. Scroll down the screen and select *Run anyway*.
diff --git a/src/cli/accounts_status.rs b/src/cli/accounts_status.rs
index aa15bce..06a8644 100644
--- a/src/cli/accounts_status.rs
+++ b/src/cli/accounts_status.rs
@@ -1,12 +1,8 @@
-use ethers::types::{H256, U256};
+use alloy::{primitives::{B256, U256}, providers::Provider as _};
use crate::{
external_api::{
- contracts::{
- token::get_token_balance,
- utils::{get_address, get_balance},
- },
- intmax::circulation::get_circulation,
+ contracts::utils::get_address_from_private_key, intmax::circulation::get_circulation
},
services::utils::{is_address_used, pretty_format_u256},
state::{key::Key, state::State},
@@ -18,25 +14,32 @@ use crate::{
pub async fn accounts_status(
state: &mut State,
mining_times: u64,
- withdrawal_private_key: H256,
+ withdrawal_private_key: B256,
) -> anyhow::Result<()> {
println!("Network: {}", get_network());
- let withdrawal_address = get_address(withdrawal_private_key);
- let withdrawal_balance = get_balance(withdrawal_address).await?;
- let withdrawal_token_balance = get_token_balance(withdrawal_address).await?;
+ let withdrawal_address = get_address_from_private_key(withdrawal_private_key);
+
+ let withdrawal_str = withdrawal_address.to_string();
+ let withdrawal_abr_str = format!(
+ "{}...{}",
+ &withdrawal_str[0..6],
+ &withdrawal_str[withdrawal_str.len() - 4..]
+ );
+ let withdrawal_balance = state.provider.get_balance(withdrawal_address).await?;
+ let withdrawal_token_balance = state.token.get_token_balance(withdrawal_address).await?;
println!(
- "Withdrawal address(don’t deposit Ether to this): {} {} ETH {} ITX",
- withdrawal_address,
+ "Withdrawal address (don’t deposit Ether to this): {} {} ETH {} ITX",
+ withdrawal_abr_str,
pretty_format_u256(withdrawal_balance),
pretty_format_u256(withdrawal_token_balance),
);
let mut key_number = 0;
- let mut total_short_term_claimable_amount = U256::zero();
- let mut total_long_term_claimable_amount = U256::zero();
+ let mut total_short_term_claimable_amount = U256::default();
+ let mut total_long_term_claimable_amount = U256::default();
loop {
let key = Key::new(withdrawal_private_key, key_number);
- if !is_address_used(key.deposit_address).await {
+ if !is_address_used(&state.provider,key.deposit_address).await? {
println!(
"Total short term claimable amount: {} ITX",
pretty_format_u256(total_short_term_claimable_amount)
@@ -49,7 +52,7 @@ pub async fn accounts_status(
}
let assets_status = state.sync_and_fetch_assets(&key).await?;
let is_qualified = !get_circulation(key.deposit_address).await?.is_excluded;
- let deposit_balance = get_balance(key.deposit_address).await?;
+ let deposit_balance = state.provider.get_balance(key.deposit_address).await?;
println!(
"Deposit address #{}: {:?} {} ETH. Qualified: {}. Deposits: {}/{}. Claimable Short: {} ITX, Claimable Long: {} ITX",
key_number,
diff --git a/src/cli/availability.rs b/src/cli/availability.rs
index e6136ae..fe13332 100644
--- a/src/cli/availability.rs
+++ b/src/cli/availability.rs
@@ -4,7 +4,7 @@ use crate::external_api::intmax::{availability::get_availability, error::IntmaxE
use super::console::print_error;
-pub async fn check_avaliability() -> anyhow::Result<()> {
+pub async fn check_availability() -> anyhow::Result<()> {
match get_availability().await {
Ok(output) => {
if !output.is_available {
diff --git a/src/cli/balance_validation.rs b/src/cli/balance_validation.rs
index 3ffc940..6fb3c44 100644
--- a/src/cli/balance_validation.rs
+++ b/src/cli/balance_validation.rs
@@ -1,14 +1,18 @@
-use ethers::types::{Address, U256};
+use alloy::{
+ primitives::{Address, U256},
+ providers::Provider,
+};
use crate::{
- external_api::contracts::utils::get_gas_price,
+ external_api::contracts::utils::NormalProvider,
services::{
- assets_status::AssetsStatus, claim::MAX_CLAIMS, utils::insuffient_balance_instruction,
+ assets_status::AssetsStatus, claim::MAX_CLAIMS, utils::insufficient_balance_instruction,
},
utils::config::Settings,
};
pub async fn validate_deposit_address_balance(
+ provider: &NormalProvider,
assets_status: &AssetsStatus,
deposit_address: Address,
mining_unit: U256,
@@ -21,24 +25,26 @@ pub async fn validate_deposit_address_balance(
0
};
let settings = Settings::load()?;
- let gas_price = get_gas_price().await?;
- let single_deposit_gas: U256 = settings.blockchain.single_deposit_gas.into();
+ let gas_price = U256::from(provider.get_gas_price().await?);
+ let single_deposit_gas = U256::from(settings.blockchain.single_deposit_gas);
let min_balance =
(mining_unit + gas_price * single_deposit_gas) * U256::from(remaining_deposits);
- insuffient_balance_instruction(deposit_address, min_balance, "deposit").await?;
+ insufficient_balance_instruction(provider, deposit_address, min_balance, "deposit").await?;
Ok(())
}
pub async fn validate_withdrawal_address_balance(
+ provider: &NormalProvider,
assets_status: &AssetsStatus,
withdrawal_address: Address,
) -> anyhow::Result<()> {
let remaining_claims = assets_status.short_term_not_claimed_indices.len();
let num_claim_tx = remaining_claims.div_ceil(MAX_CLAIMS);
let settings = Settings::load()?;
- let gas_price = get_gas_price().await?;
- let single_claim_gas: U256 = settings.blockchain.single_claim_gas.into();
+ let gas_price = U256::from(provider.get_gas_price().await?);
+ let single_claim_gas = U256::from(settings.blockchain.single_claim_gas);
let min_balance = single_claim_gas * gas_price * U256::from(num_claim_tx);
- insuffient_balance_instruction(withdrawal_address, min_balance, "withdrawal").await?;
+ insufficient_balance_instruction(provider, withdrawal_address, min_balance, "withdrawal")
+ .await?;
Ok(())
}
diff --git a/src/cli/configure.rs b/src/cli/configure.rs
index 92efc5e..79c8eca 100644
--- a/src/cli/configure.rs
+++ b/src/cli/configure.rs
@@ -1,13 +1,19 @@
use std::{collections::HashMap, str::FromStr};
+use alloy::{
+ primitives::{
+ utils::{format_units, parse_ether, parse_units},
+ Address, B256, U256,
+ },
+ providers::Provider as _,
+};
use anyhow::bail;
use console::style;
use dialoguer::{Confirm, Input, Password, Select};
-use ethers::types::{Address, H256, U256};
use strum::IntoEnumIterator as _;
use crate::{
- external_api::contracts::utils::{get_address, get_balance_with_rpc},
+ external_api::contracts::utils::{get_address_from_private_key, get_provider},
utils::{
config::Settings,
encryption::{decrypt, encrypt},
@@ -42,10 +48,10 @@ pub async fn new_config(network: Network) -> anyhow::Result {
.interact()?;
let (max_gas_price, mining_unit, mining_times) = if use_default {
(
- ethers::utils::parse_units(default_env.default_max_gas_price, "gwei")
+ parse_units(&default_env.default_max_gas_price, "gwei")
.unwrap()
.into(),
- ethers::utils::parse_ether(default_env.default_mining_unit).unwrap(),
+ parse_ether(&default_env.default_mining_unit).unwrap(),
default_env.default_mining_times,
)
} else {
@@ -54,8 +60,8 @@ pub async fn new_config(network: Network) -> anyhow::Result {
let mining_times = input_mining_times()?;
(max_gas_price, mining_unit, mining_times)
};
- let withdrawal_private_key: H256 = input_withdrawal_private_key(&rpc_url).await?;
- let withdrawal_address = get_address(withdrawal_private_key);
+ let withdrawal_private_key: B256 = input_withdrawal_private_key(&rpc_url).await?;
+ let withdrawal_address = get_address_from_private_key(withdrawal_private_key);
let (encrypt, keys, encrypted_keys) = input_encryption(withdrawal_private_key)?;
let config = EnvConfig {
network,
@@ -85,7 +91,7 @@ pub async fn modify_config(config: &EnvConfig) -> anyhow::Result {
let modify_max_gas_price = Confirm::new()
.with_prompt(format!(
"Modify max gas price {} GWei?",
- ethers::utils::format_units(config.max_gas_price, "gwei").unwrap()
+ format_units(config.max_gas_price, "gwei").unwrap()
))
.default(false)
.interact()?;
@@ -96,7 +102,10 @@ pub async fn modify_config(config: &EnvConfig) -> anyhow::Result {
};
let modify_withdrawal_address = Confirm::new()
- .with_prompt(format!("Modify withdrawal account {:?}?", get_address(key)))
+ .with_prompt(format!(
+ "Modify withdrawal account {:?}?",
+ get_address_from_private_key(key)
+ ))
.default(false)
.interact()?;
let withdrawal_private_key = if modify_withdrawal_address {
@@ -105,7 +114,7 @@ pub async fn modify_config(config: &EnvConfig) -> anyhow::Result {
key
};
let (encrypt, keys, encrypted_keys) = input_encryption(withdrawal_private_key)?;
- let withdrawal_address = get_address(withdrawal_private_key);
+ let withdrawal_address = get_address_from_private_key(withdrawal_private_key);
let config = EnvConfig {
network: config.network,
rpc_url,
@@ -137,8 +146,7 @@ async fn input_rpc_url() -> anyhow::Result {
match validate_rpc_url(&rpc_url).await {
Ok(_) => break Ok(rpc_url),
Err(e) => {
- let colored_message =
- format!("{}: {}", style("Invalid RPC URL").red(), e.to_string());
+ let colored_message = format!("{}: {}", style("Invalid RPC URL").red(), e);
println!("{}", colored_message);
}
}
@@ -149,25 +157,17 @@ async fn input_alchemy_url() -> anyhow::Result {
let alchemy_api_key: String = Password::new().with_prompt("Alchemy API Key").interact()?;
match get_network() {
Network::Localnet => bail!("Localnet is not supported"),
- Network::Sepolia => {
- let alchemy_url = format!("https://eth-sepolia.g.alchemy.com/v2/{}", alchemy_api_key);
- return Ok(alchemy_url);
- }
- Network::Holesky => {
- let alchemy_url = format!("https://eth-holesky.g.alchemy.com/v2/{}", alchemy_api_key);
- return Ok(alchemy_url);
- }
Network::BaseSepolia => {
let alchemy_url = format!("https://base-sepolia.g.alchemy.com/v2/{}", alchemy_api_key);
- return Ok(alchemy_url);
+ Ok(alchemy_url)
}
Network::Mainnet => {
let alchemy_url = format!("https://eth-mainnet.g.alchemy.com/v2/{}", alchemy_api_key);
- return Ok(alchemy_url);
+ Ok(alchemy_url)
}
Network::Base => {
let alchemy_url = format!("https://base-mainnet.g.alchemy.com/v2/{}", alchemy_api_key);
- return Ok(alchemy_url);
+ Ok(alchemy_url)
}
}
}
@@ -178,25 +178,17 @@ async fn input_infura_url() -> anyhow::Result {
.interact()?;
match get_network() {
Network::Localnet => bail!("Localnet is not supported"),
- Network::Sepolia => {
- let infura_url = format!("https://sepolia.infura.io/v3/{}", infura_project_id);
- return Ok(infura_url);
- }
- Network::Holesky => {
- let infura_url = format!("https://holesky.infura.io/v3/{}", infura_project_id);
- return Ok(infura_url);
- }
Network::BaseSepolia => {
let infura_url = format!("https://base-sepolia.infura.io/v3/{}", infura_project_id);
- return Ok(infura_url);
+ Ok(infura_url)
}
Network::Mainnet => {
let infura_url = format!("https://mainnet.infura.io/v3/{}", infura_project_id);
- return Ok(infura_url);
+ Ok(infura_url)
}
Network::Base => {
let infura_url = format!("https://base-mainnet.infura.io/v3/{}", infura_project_id);
- return Ok(infura_url);
+ Ok(infura_url)
}
}
}
@@ -221,9 +213,9 @@ fn input_max_gas_price() -> anyhow::Result {
.with_prompt("Max gas price for transactions in GWei")
.default(default_max_gas_price)
.validate_with(|max_gas_price: &String| {
- let result = ethers::utils::parse_units(max_gas_price, "gwei");
+ let result = parse_units(max_gas_price, "gwei");
if let Ok(x) = result {
- if x > ethers::utils::parse_units("210", "gwei").unwrap() {
+ if x > parse_units("210", "gwei").unwrap() {
return Err("Gas price too high (>210 GWei)");
}
Ok(())
@@ -232,9 +224,7 @@ fn input_max_gas_price() -> anyhow::Result {
}
})
.interact()?;
- let max_gas_price = ethers::utils::parse_units(max_gas_price, "gwei")
- .unwrap()
- .into();
+ let max_gas_price = parse_units(&max_gas_price, "gwei").unwrap().into();
Ok(max_gas_price)
}
@@ -246,8 +236,8 @@ fn input_mining_unit() -> anyhow::Result {
.default(0)
.interact()?;
let mining_unit = match selection {
- 0 => ethers::utils::parse_ether("0.1").unwrap(),
- 1 => ethers::utils::parse_ether("1").unwrap(),
+ 0 => parse_ether("0.1").unwrap(),
+ 1 => parse_ether("1").unwrap(),
_ => unreachable!(),
};
Ok(mining_unit)
@@ -267,14 +257,14 @@ fn input_mining_times() -> anyhow::Result {
Ok(mining_times)
}
-async fn input_withdrawal_private_key(rpc_url: &str) -> anyhow::Result {
+async fn input_withdrawal_private_key(rpc_url: &str) -> anyhow::Result {
loop {
let withdrawal_private_key: String = Password::new()
.with_prompt(format!("Withdrawal private key of {}", get_network()))
.validate_with(|input: &String| validate_private_key_with_duplication_check(&[], input))
.interact()?;
- let withdrawal_private_key: H256 = withdrawal_private_key.parse().unwrap();
- let withdrawal_address = get_address(withdrawal_private_key);
+ let withdrawal_private_key: B256 = withdrawal_private_key.parse()?;
+ let withdrawal_address = get_address_from_private_key(withdrawal_private_key);
println!("Withdrawal Address: {:?}", withdrawal_address);
// duplication check
@@ -284,8 +274,9 @@ async fn input_withdrawal_private_key(rpc_url: &str) -> anyhow::Result {
// non-balance check
{
- let balance = get_balance_with_rpc(rpc_url, withdrawal_address).await?;
- if balance != U256::zero() {
+ let provider = get_provider(rpc_url)?;
+ let balance = provider.get_balance(withdrawal_address).await?;
+ if balance != U256::default() {
let colored_message = format!(
"{} {}",
style("WARNING:").yellow().bold(),
@@ -306,7 +297,7 @@ async fn input_withdrawal_private_key(rpc_url: &str) -> anyhow::Result {
}
}
-fn is_withdrawal_address_duplicated(withdrawal_addres: Address) -> anyhow::Result {
+fn is_withdrawal_address_duplicated(withdrawal_address: Address) -> anyhow::Result {
let mut address_to_network = HashMap::::new();
for network in Network::iter() {
for config_index in EnvConfig::get_existing_indices(network) {
@@ -314,7 +305,8 @@ fn is_withdrawal_address_duplicated(withdrawal_addres: Address) -> anyhow::Resul
address_to_network.insert(config.withdrawal_address, (network, config_index));
}
}
- if let Some((duplicated_network, duplicated_index)) = address_to_network.get(&withdrawal_addres)
+ if let Some((duplicated_network, duplicated_index)) =
+ address_to_network.get(&withdrawal_address)
{
let message = format!(
"Withdrawal address is duplicated as {} config #{}. Please use a different address.",
@@ -328,8 +320,8 @@ fn is_withdrawal_address_duplicated(withdrawal_addres: Address) -> anyhow::Resul
}
fn input_encryption(
- withdrawal_private_key: H256,
-) -> anyhow::Result<(bool, Option, Option>)> {
+ withdrawal_private_key: B256,
+) -> anyhow::Result<(bool, Option, Option>)> {
let do_encrypt = Confirm::new()
.with_prompt("Do you set password to encrypt private keys?")
.default(true)
@@ -353,13 +345,13 @@ fn input_encryption(
}
fn validate_private_key_with_duplication_check(
- private_keys: &[H256],
+ private_keys: &[B256],
input: &str,
) -> Result<(), &'static str> {
- let result: Result = input.parse();
+ let result: Result = input.parse();
match result {
Ok(x) => {
- if x == H256::zero() {
+ if x == B256::default() {
return Err("Invalid private key");
}
if private_keys.contains(&x) {
@@ -367,13 +359,13 @@ fn validate_private_key_with_duplication_check(
}
Ok(())
}
- Err(_) => return Err("Invalid private key"),
+ Err(_) => Err("Invalid private key"),
}
}
-pub fn recover_withdrawal_private_key(config: &EnvConfig) -> anyhow::Result {
+pub fn recover_withdrawal_private_key(config: &EnvConfig) -> anyhow::Result {
let key = if !config.encrypt {
- config.withdrawal_private_key.clone().unwrap()
+ config.withdrawal_private_key.unwrap()
} else {
loop {
let password = Password::new().with_prompt("Password").interact()?;
diff --git a/src/cli/console.rs b/src/cli/console.rs
index c76706a..a877300 100644
--- a/src/cli/console.rs
+++ b/src/cli/console.rs
@@ -1,7 +1,7 @@
use console::{style, Term};
use log::{error, info, warn};
-pub fn initialize_console() {
+pub fn clear_console() {
let term = Term::stdout();
term.write_line("").unwrap();
}
@@ -32,7 +32,7 @@ pub fn print_log(message: S) {
style(message.to_string()).blue()
);
term.write_line(&colored_message).unwrap();
- initialize_console();
+ clear_console();
info!("{}", message.to_string());
}
@@ -50,8 +50,6 @@ pub fn print_warning(message: S) {
warn!("{}", message.to_string());
}
-
-
pub fn print_assets_status(assets_status: &crate::services::assets_status::AssetsStatus) {
print_status(format!(
"Deposits: {} (success: {} pending: {} rejected: {} cancelled: {}) Withdrawn: {}",
diff --git a/src/cli/export_deposit_accounts.rs b/src/cli/export_deposit_accounts.rs
index 74ce51e..d1daa48 100644
--- a/src/cli/export_deposit_accounts.rs
+++ b/src/cli/export_deposit_accounts.rs
@@ -1,8 +1,11 @@
+use alloy::{
+ primitives::{Address, B256},
+ providers::Provider as _,
+};
use dialoguer::{Confirm, Select};
-use ethers::types::{Address, H256};
use crate::{
- external_api::contracts::utils::get_balance,
+ external_api::contracts::utils::NormalProvider,
services::{
balance_transfer::balance_transfer,
utils::{is_address_used, pretty_format_u256},
@@ -10,14 +13,23 @@ use crate::{
state::key::Key,
};
-pub async fn export_deposit_accounts(withdrawal_private_key: H256) -> anyhow::Result<()> {
+pub async fn export_deposit_accounts(
+ provider: &NormalProvider,
+ withdrawal_private_key: B256,
+) -> anyhow::Result<()> {
let key = Key::new(withdrawal_private_key, 0);
- let balance = get_balance(key.deposit_address).await?;
+ println!();
+ println!(
+ "Withdrawal Address: {:?} ({} ETH)",
+ key.withdrawal_address,
+ pretty_format_u256(provider.get_balance(key.withdrawal_address).await?)
+ );
+ println!("Withdrawal Private Key: {:?}", withdrawal_private_key);
println!();
println!(
"Deposit Address: {:?} ({} ETH)",
key.deposit_address,
- pretty_format_u256(balance),
+ pretty_format_u256(provider.get_balance(key.deposit_address).await?),
);
println!("Private Key: {:?}", key.deposit_private_key);
@@ -26,12 +38,15 @@ pub async fn export_deposit_accounts(withdrawal_private_key: H256) -> anyhow::Re
.default(true)
.interact()?;
if do_transfer {
- transfer_instruction(withdrawal_private_key).await?;
+ transfer_instruction(provider, withdrawal_private_key).await?;
}
Ok(())
}
-async fn transfer_instruction(withdrawal_private_key: H256) -> anyhow::Result<()> {
+async fn transfer_instruction(
+ provider: &NormalProvider,
+ withdrawal_private_key: B256,
+) -> anyhow::Result<()> {
let key = Key::new(withdrawal_private_key, 0);
let to_address: Address = dialoguer::Input::::new()
.with_prompt("Enter the address to transfer to")
@@ -62,23 +77,26 @@ async fn transfer_instruction(withdrawal_private_key: H256) -> anyhow::Result<()
if !is_ok {
return Ok(());
} else {
- balance_transfer(key.deposit_private_key, to_address).await?;
+ balance_transfer(provider, key.deposit_private_key, to_address).await?;
}
Ok(())
}
-pub async fn legacy_export_deposit_accounts(withdrawal_private_key: H256) -> anyhow::Result<()> {
+pub async fn legacy_export_deposit_accounts(
+ provider: &NormalProvider,
+ withdrawal_private_key: B256,
+) -> anyhow::Result<()> {
let mut key_number = 0;
loop {
let key = Key::new(withdrawal_private_key, key_number);
- if !is_address_used(key.deposit_address).await {
+ if !is_address_used(provider, key.deposit_address).await? {
if key_number == 0 {
println!("No deposit accounts found.");
return Ok(());
}
break;
}
- let balance = get_balance(key.deposit_address).await?;
+ let balance = provider.get_balance(key.deposit_address).await?;
println!();
println!(
"Deposit Address #{}: {:?} ({} ETH)",
@@ -96,13 +114,14 @@ pub async fn legacy_export_deposit_accounts(withdrawal_private_key: H256) -> any
.interact()?;
if do_transfer {
- legacy_transfer_instruction(withdrawal_private_key, key_number).await?;
+ legacy_transfer_instruction(provider, withdrawal_private_key, key_number).await?;
}
Ok(())
}
async fn legacy_transfer_instruction(
- withdrawal_private_key: H256,
+ provider: &NormalProvider,
+ withdrawal_private_key: B256,
up_to_key_number: u64,
) -> anyhow::Result<()> {
let deposit_addresses = (0..up_to_key_number)
@@ -153,7 +172,7 @@ async fn legacy_transfer_instruction(
if !is_ok {
continue;
} else {
- balance_transfer(key.deposit_private_key, to_address).await?;
+ balance_transfer(provider, key.deposit_private_key, to_address).await?;
}
let do_more = Confirm::new()
.with_prompt("Do you want to make more transfers?")
diff --git a/src/cli/interactive.rs b/src/cli/interactive.rs
index 909d4db..0221e2d 100644
--- a/src/cli/interactive.rs
+++ b/src/cli/interactive.rs
@@ -1,8 +1,8 @@
use std::collections::HashMap;
+use alloy::primitives::Address;
use console::style;
use dialoguer::Select;
-use ethers::types::Address;
use strum::IntoEnumIterator;
use crate::utils::{
@@ -27,7 +27,9 @@ fn address_duplication_check() -> anyhow::Result<()> {
for network in Network::iter() {
for config_index in EnvConfig::get_existing_indices(network) {
let config = EnvConfig::load_from_file(network, config_index)?;
- if address_to_network.get(&config.withdrawal_address).is_some() {
+ if let std::collections::hash_map::Entry::Vacant(e) = address_to_network.entry(config.withdrawal_address) {
+ e.insert((network, config_index));
+ } else {
let (duplicated_network, duplicated_index) =
address_to_network.get(&config.withdrawal_address).unwrap();
anyhow::bail!(
@@ -38,12 +40,9 @@ fn address_duplication_check() -> anyhow::Result<()> {
duplicated_network,
duplicated_index,
);
- } else {
- address_to_network.insert(config.withdrawal_address, (network, config_index));
}
}
}
-
Ok(())
}
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index be9c10d..22c217c 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1,14 +1,14 @@
use std::io::{self, Read as _};
use ::console::{style, Term};
+use alloy::primitives::B256;
use configure::recover_withdrawal_private_key;
-use console::initialize_console;
-use ethers::types::H256;
+use console::clear_console;
use mode_selection::{legacy_select_mode, select_mode};
use term_of_use::make_agreement;
use crate::{
- external_api::contracts::utils::get_address,
+ external_api::contracts::utils::get_address_from_private_key,
services::{claim_loop, exit_loop, legacy_claim_loop, mining_loop},
state::{mode::RunMode, state::State},
utils::{
@@ -40,7 +40,7 @@ pub async fn run(mode: Option) -> anyhow::Result<()> {
let config = EnvConfig::import_from_env()?;
let withdrawal_private_key = recover_withdrawal_private_key(&config)?;
- if config.withdrawal_address != get_address(withdrawal_private_key) {
+ if config.withdrawal_address != get_address_from_private_key(withdrawal_private_key) {
anyhow::bail!("Withdrawal address does not match the address derived from the private key");
}
validate_env_config(&config).await?;
@@ -61,14 +61,14 @@ pub async fn run(mode: Option) -> anyhow::Result<()> {
mode.unwrap()
};
- let mut state = State::new();
+ let mut state = State::new(&config.rpc_url);
// prints the status of the accounts if mutable mode
if mode == RunMode::Mining || mode == RunMode::Claim || mode == RunMode::Exit {
accounts_status::accounts_status(&mut state, config.mining_times, withdrawal_private_key)
.await?;
}
- initialize_console();
+ clear_console();
mode_loop(
&mut mode,
&mut state,
@@ -84,7 +84,7 @@ async fn mode_loop(
mode: &mut RunMode,
state: &mut State,
config: &EnvConfig,
- withdrawal_private_key: H256,
+ withdrawal_private_key: B256,
is_interactive: bool,
) -> anyhow::Result<()> {
loop {
@@ -113,11 +113,17 @@ async fn mode_loop(
}
RunMode::Export => {
if is_legacy() {
- export_deposit_accounts::legacy_export_deposit_accounts(withdrawal_private_key)
- .await?;
+ export_deposit_accounts::legacy_export_deposit_accounts(
+ &state.provider,
+ withdrawal_private_key,
+ )
+ .await?;
} else {
- export_deposit_accounts::export_deposit_accounts(withdrawal_private_key)
- .await?;
+ export_deposit_accounts::export_deposit_accounts(
+ &state.provider,
+ withdrawal_private_key,
+ )
+ .await?;
}
press_enter_to_continue();
}
diff --git a/src/external_api/contracts/convert.rs b/src/external_api/contracts/convert.rs
new file mode 100644
index 0000000..e9ac882
--- /dev/null
+++ b/src/external_api/contracts/convert.rs
@@ -0,0 +1,37 @@
+use alloy::primitives::{Address as AlloyAddress, TxHash, B256, U256 as AlloyU256};
+use intmax2_zkp::ethereum_types::{
+ address::Address as IntmaxAddress, bytes32::Bytes32, u256::U256 as IntmaxU256,
+ u32limb_trait::U32LimbTrait,
+};
+
+pub fn convert_u256_to_alloy(input: IntmaxU256) -> AlloyU256 {
+ AlloyU256::from_be_slice(&input.to_bytes_be())
+}
+
+pub fn convert_u256_to_intmax(input: AlloyU256) -> IntmaxU256 {
+ IntmaxU256::from_bytes_be(&input.to_be_bytes_vec())
+}
+
+pub fn convert_address_to_alloy(input: IntmaxAddress) -> AlloyAddress {
+ AlloyAddress::from_slice(&input.to_bytes_be())
+}
+
+pub fn convert_address_to_intmax(input: AlloyAddress) -> IntmaxAddress {
+ IntmaxAddress::from_bytes_be(&input.0 .0)
+}
+
+pub fn convert_b256_to_bytes32(input: B256) -> Bytes32 {
+ Bytes32::from_bytes_be(&input.0)
+}
+
+pub fn convert_tx_hash_to_bytes32(input: TxHash) -> Bytes32 {
+ Bytes32::from_bytes_be(&input.0)
+}
+
+pub fn convert_bytes32_to_tx_hash(input: Bytes32) -> TxHash {
+ TxHash::from_slice(&input.to_bytes_be())
+}
+
+pub fn convert_bytes32_to_b256(input: Bytes32) -> B256 {
+ B256::from_slice(&input.to_bytes_be())
+}
diff --git a/src/external_api/contracts/error.rs b/src/external_api/contracts/error.rs
index 210fea7..50aaf74 100644
--- a/src/external_api/contracts/error.rs
+++ b/src/external_api/contracts/error.rs
@@ -1,13 +1,46 @@
-use thiserror::Error;
+use alloy::{
+ primitives::B256,
+ transports::{RpcError, TransportErrorKind},
+};
-#[derive(Error, Debug)]
+#[derive(Debug, thiserror::Error)]
pub enum BlockchainError {
- #[error("Network error: {0}")]
- NetworkError(String),
+ #[error("Contract error: {0}")]
+ ContractError(#[from] alloy::contract::Error),
+
+ #[error("Insufficient funds: {0}")]
+ InsufficientFunds(String),
+
+ #[error("Transaction failed: {0}")]
+ TransactionFailed(String),
+
+ #[error("RPC error: {0}")]
+ RPCError(#[from] RpcError),
+
+ #[error("Join error: {0}")]
+ JoinError(String),
+
+ #[error("Decode call data error: {0}")]
+ DecodeCallDataError(String),
+
+ #[error("Token not found")]
+ TokenNotFound,
+
+ #[error("Transaction not found: {0:?}")]
+ TxNotFound(B256),
+
+ #[error("Transaction not found in batch")]
+ TxNotFoundBatch,
+
+ #[error("Transaction error: {0}")]
+ TransactionError(String),
+
+ #[error("Max tx retries reached")]
+ MaxTxRetriesReached,
+
+ #[error("Parse error: {0}")]
+ ParseError(String),
+
#[error("Env error: {0}")]
EnvError(String),
- #[error("Internal error: {0}")]
- InternalError(String),
- #[error("Tx not found: {0}")]
- TxNotFound(String),
}
diff --git a/src/external_api/contracts/events.rs b/src/external_api/contracts/events.rs
index 1b7823f..69e4c54 100644
--- a/src/external_api/contracts/events.rs
+++ b/src/external_api/contracts/events.rs
@@ -1,22 +1,8 @@
-use ethers::{providers::Middleware as _, types::Address};
+use alloy::primitives::Address;
use intmax2_zkp::{
common::deposit::Deposit,
- ethereum_types::{bytes32::Bytes32, u256::U256, u32limb_trait::U32LimbTrait},
+ ethereum_types::{bytes32::Bytes32, u256::U256},
};
-use log::info;
-
-use crate::{
- external_api::contracts::utils::{get_block, get_latest_block_number},
- utils::retry::with_retry,
-};
-
-use super::{
- error::BlockchainError,
- int1::get_int1_contract,
- utils::{get_client, u256_as_bytes_be},
-};
-
-const EVENT_BLOCK_RANGE: u64 = 100000;
#[derive(Clone, Debug)]
pub struct Deposited {
@@ -26,6 +12,7 @@ pub struct Deposited {
pub token_index: u32,
pub amount: U256,
pub tx_nonce: u64,
+ pub timestamp: u64,
}
impl Deposited {
@@ -38,217 +25,9 @@ impl Deposited {
}
}
-pub async fn get_deposited_event_by_sender(
- sender: Address,
-) -> Result, BlockchainError> {
- info!("get_deposited_event_by_sender");
- let int1 = get_int1_contract().await?;
-
- let settings = crate::utils::config::Settings::load().unwrap();
- let mut events = Vec::new();
- let mut from_block = settings.blockchain.int1_deployed_block;
- loop {
- info!("get_deposited_event_by_sender: from_block={}", from_block);
- let new_events = with_retry(|| async {
- int1.deposited_filter()
- .address(int1.address().into())
- .topic2(sender)
- .from_block(from_block)
- .to_block(from_block + EVENT_BLOCK_RANGE)
- .query_with_meta()
- .await
- })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get deposited event".to_string()))?;
- events.extend(new_events);
- let latest_block_number = get_latest_block_number().await?;
- from_block += EVENT_BLOCK_RANGE;
- if from_block > latest_block_number {
- break;
- }
- }
-
- let client = get_client().await?;
- let mut deposited_events = Vec::new();
- let mut seen_deposit_id = std::collections::HashSet::new();
- for (event, meta) in events {
- // skip duplicated deposit
- let deposit_id = event.deposit_id;
- if seen_deposit_id.contains(&deposit_id) {
- continue;
- } else {
- seen_deposit_id.insert(deposit_id);
- }
-
- let tx_hash = meta.transaction_hash;
- let tx = with_retry(|| async { client.get_transaction(tx_hash).await })
- .await
- .map_err(|_| BlockchainError::TxNotFound(tx_hash.to_string()))?
- .expect("tx not found"); // this should not happen
- let tx_nonce = tx.nonce.as_u64();
- deposited_events.push(Deposited {
- deposit_id: event.deposit_id.try_into().unwrap(),
- sender: event.sender,
- recipient_salt_hash: Bytes32::from_bytes_be(&event.recipient_salt_hash),
- token_index: event.token_index,
- amount: U256::from_bytes_be(&u256_as_bytes_be(event.amount)),
- tx_nonce,
- });
- }
- deposited_events.sort_by_key(|event| event.deposit_id);
- Ok(deposited_events)
-}
-
#[derive(Clone, Debug)]
pub struct DepositLeafInserted {
pub deposit_index: u32,
pub deposit_hash: Bytes32,
pub block_number: u64,
}
-
-pub async fn get_deposit_leaf_inserted_event(
- from_block: u64,
-) -> Result, BlockchainError> {
- log::info!("get_deposit_leaf_inserted_event");
-
- let mut events = Vec::new();
- let mut from_block = from_block;
- loop {
- log::info!("get_deposit_leaf_inserted_event: from_block={}", from_block);
- let int1 = get_int1_contract().await?;
- let new_events = with_retry(|| async {
- int1.deposit_leaf_inserted_filter()
- .address(int1.address().into())
- .from_block(from_block)
- .to_block(from_block + EVENT_BLOCK_RANGE)
- .query_with_meta()
- .await
- })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to get deposit leaf inserted event".to_string())
- })?;
- events.extend(new_events);
- let latest_block_number = get_latest_block_number().await?;
- from_block += EVENT_BLOCK_RANGE;
- if from_block > latest_block_number {
- break;
- }
- }
- let mut deposit_leaf_inserted_events = Vec::new();
- let mut seen_deposit_indices = std::collections::HashSet::new();
- for (event, meta) in events {
- // skip duplicated deposit
- let deposit_index = event.deposit_index;
- if seen_deposit_indices.contains(&deposit_index) {
- continue;
- } else {
- seen_deposit_indices.insert(deposit_index);
- }
- deposit_leaf_inserted_events.push(DepositLeafInserted {
- deposit_index: event.deposit_index,
- deposit_hash: Bytes32::from_bytes_be(&event.deposit_hash),
- block_number: meta.block_number.as_u64(),
- });
- }
-
- deposit_leaf_inserted_events.sort_by_key(|event| event.deposit_index);
-
- Ok(deposit_leaf_inserted_events)
-}
-
-pub async fn get_latest_deposit_timestamp(sender: Address) -> Result, BlockchainError> {
- log::info!("get_latest_deposit_timestamp");
- let int1 = get_int1_contract().await?;
-
- let mut to_block = get_latest_block_number().await?;
- let int1_deployed_block = crate::utils::config::Settings::load()
- .unwrap()
- .blockchain
- .int1_deployed_block;
- loop {
- let events = with_retry(|| async {
- int1.deposited_filter()
- .from_block(to_block.saturating_sub(EVENT_BLOCK_RANGE))
- .to_block(to_block)
- .address(int1.address().into())
- .topic2(sender)
- .query_with_meta()
- .await
- })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get deposited event".to_string()))?;
- let max_block_number: Option = events
- .into_iter()
- .map(|(_, meta)| meta.block_number.as_u64())
- .max();
- if let Some(max_block_number) = max_block_number {
- let block = get_block(max_block_number).await?;
- return Ok(Some(block.unwrap().timestamp.as_u64()));
- }
- to_block = to_block.saturating_sub(EVENT_BLOCK_RANGE);
- if to_block < int1_deployed_block {
- return Ok(None);
- }
- }
-}
-
-pub async fn get_latest_withdrawal_timestamp(
- recipient: Address,
-) -> Result, BlockchainError> {
- log::info!("get_latest_withdrawal_timestamp");
- let int1 = get_int1_contract().await?;
-
- let mut to_block = get_latest_block_number().await?;
- let int1_deployed_block = crate::utils::config::Settings::load()
- .unwrap()
- .blockchain
- .int1_deployed_block;
- loop {
- let events = with_retry(|| async {
- int1.withdrawn_filter()
- .from_block(to_block.saturating_sub(EVENT_BLOCK_RANGE))
- .to_block(to_block)
- .address(int1.address().into())
- .topic1(recipient)
- .query_with_meta()
- .await
- })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get withdrawn event".to_string()))?;
- let max_block_number: Option = events
- .into_iter()
- .map(|(_, meta)| meta.block_number.as_u64())
- .max();
- if let Some(max_block_number) = max_block_number {
- let block = get_block(max_block_number).await?;
- return Ok(Some(block.unwrap().timestamp.as_u64()));
- }
- to_block = to_block.saturating_sub(EVENT_BLOCK_RANGE);
- if to_block < int1_deployed_block {
- return Ok(None);
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use ethers::types::Address;
-
- use super::*;
-
- #[tokio::test]
- async fn test_get_deposited_event() {
- let sender: Address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
- .parse()
- .unwrap();
- let events = get_deposited_event_by_sender(sender).await.unwrap();
- dbg!(events);
- }
-
- #[tokio::test]
- async fn test_get_deposit_leaf_inserted_event() {
- let events = get_deposit_leaf_inserted_event(0).await.unwrap();
- dbg!(events);
- }
-}
diff --git a/src/external_api/contracts/handlers.rs b/src/external_api/contracts/handlers.rs
new file mode 100644
index 0000000..fc02f72
--- /dev/null
+++ b/src/external_api/contracts/handlers.rs
@@ -0,0 +1,190 @@
+use crate::{cli::console::print_status, services::utils::insufficient_balance_instruction};
+
+use super::{
+ error::BlockchainError,
+ utils::{NormalProvider, ProviderWithSigner},
+};
+use alloy::{
+ consensus::{Transaction as _, TxEip1559},
+ primitives::{TxHash, U256},
+ providers::{PendingTransactionError, Provider as _, WalletProvider},
+ rpc::types::TransactionRequest,
+};
+use std::time::Duration;
+
+const TIMEOUT: Duration = Duration::from_secs(120);
+const MAX_GAS_BUMP_ATTEMPTS: u32 = 3;
+const GAS_BUMP_PERCENTAGE: u64 = 25; // Should be above 10 to avoid replacement transaction underpriced error
+
+pub async fn send_transaction_with_gas_bump(
+ provider: &NormalProvider,
+ signer: ProviderWithSigner,
+ tx_request: TransactionRequest,
+ tx_name: &str,
+ from_name: &str,
+) -> Result {
+ let sendable_tx = signer.fill(tx_request.clone()).await?;
+ let tx_envelope = sendable_tx.try_into_envelope().unwrap();
+ let tx_hash = *tx_envelope.hash();
+ // make tx eip1559 object to get parameters
+ let tx_eip1559 = tx_envelope.as_eip1559().unwrap().tx().clone();
+ log::info!(
+ "Sending transaction: {} with nonce {}, gas limit {}, value {}, max fee per gas {:?}, max priority fee per gas {:?}",
+ tx_name,
+ tx_eip1559.nonce,
+ tx_eip1559.gas_limit,
+ tx_eip1559.value,
+ tx_eip1559.max_fee_per_gas,
+ tx_eip1559.max_priority_fee_per_gas
+ );
+ match signer
+ .send_tx_envelope(tx_envelope)
+ .await?
+ .with_timeout(Some(TIMEOUT))
+ .watch()
+ .await
+ {
+ Ok(tx_hash) => {
+ log::info!(
+ "Transaction sent: {:?} with tx hash: {:?}",
+ tx_name.to_string(),
+ tx_hash
+ );
+ print_status(format!(
+ "{} transaction sent successfully with hash: {:?}",
+ tx_name.to_string(),
+ tx_hash
+ ));
+ Ok(tx_hash)
+ }
+ Err(PendingTransactionError::TxWatcher(_)) => {
+ // timeout, so we need to bump the gas
+ let tx_hash = resend_tx_with_gas_bump(signer, tx_hash, &tx_eip1559, tx_name).await?;
+ print_status(format!(
+ "{} transaction sent successfully with hash: {:?}",
+ tx_name.to_string(),
+ tx_hash
+ ));
+ Ok(tx_hash)
+ }
+ Err(e) => {
+ if e.to_string().contains("insufficient funds") {
+ let estimate_gas = provider.estimate_gas(tx_request.clone()).await?;
+ let gas_price = provider.get_gas_price().await?;
+ let value = tx_request.value.unwrap_or_default();
+ let necessary_balance = U256::from(estimate_gas) * U256::from(gas_price) + value;
+ insufficient_balance_instruction(
+ provider,
+ signer.default_signer_address(),
+ necessary_balance,
+ from_name,
+ )
+ .await
+ .map_err(|e| {
+ BlockchainError::TransactionError(format!(
+ "Failed to check balance for {}: {}",
+ tx_name, e
+ ))
+ })?;
+ print_status(format!("Retrying {} transaction...", tx_name.to_string()));
+ }
+ Err(BlockchainError::TransactionError(format!(
+ "{} failed with error: {:?}",
+ tx_name, e
+ )))
+ }
+ }
+}
+
+async fn resend_tx_with_gas_bump(
+ signer: ProviderWithSigner,
+ initial_tx_hash: TxHash,
+ tx_eip1559: &TxEip1559,
+ tx_name: &str,
+) -> Result {
+ log::info!("Resending transaction: {tx_name}");
+ let mut pending_tx_hashes = vec![initial_tx_hash];
+
+ let mut current_tx = tx_eip1559.clone();
+
+ for attempt in 1..=MAX_GAS_BUMP_ATTEMPTS {
+ // check if previous tx succeeded
+ for tx_hash in pending_tx_hashes.iter().rev() {
+ let tx_receipt = signer.get_transaction_receipt(*tx_hash).await?;
+ if let Some(tx_receipt) = tx_receipt {
+ log::info!(
+ "Previous tx settled with hash: {:?}",
+ tx_receipt.transaction_hash
+ );
+ if tx_receipt.status() {
+ return Ok(tx_receipt.transaction_hash);
+ } else {
+ return Err(BlockchainError::TransactionFailed(format!(
+ "Transaction {} failed with tx hash: {:?}",
+ tx_name, tx_receipt.transaction_hash
+ )));
+ }
+ }
+ }
+ // bump gas
+ let fee_estimation = signer.estimate_eip1559_fees().await?;
+
+ let (new_max_priority_fee_per_gas, new_max_fee_per_gas) =
+ if fee_estimation.max_priority_fee_per_gas > current_tx.max_priority_fee_per_gas {
+ // use the estimated fee which is higher than the current fee
+ (
+ fee_estimation.max_priority_fee_per_gas,
+ fee_estimation.max_fee_per_gas,
+ )
+ } else {
+ // bump the gas by a percentage
+ (
+ current_tx.max_priority_fee_per_gas * (100 + GAS_BUMP_PERCENTAGE as u128) / 100,
+ current_tx.max_fee_per_gas * (100 + GAS_BUMP_PERCENTAGE as u128) / 100,
+ )
+ };
+
+ let new_tx_request = TransactionRequest::default()
+ .max_priority_fee_per_gas(new_max_priority_fee_per_gas)
+ .max_fee_per_gas(new_max_fee_per_gas)
+ .nonce(current_tx.nonce)
+ .to(current_tx.to().unwrap())
+ .nonce(current_tx.nonce)
+ .gas_limit(current_tx.gas_limit)
+ .input(current_tx.input.into())
+ .value(current_tx.value);
+
+ // send the new transaction
+ let sendable_tx = signer.fill(new_tx_request).await?;
+ let tx_envelope = sendable_tx.try_into_envelope().unwrap();
+ log::info!(
+ "Sending bumped gas tx {tx_name} attempt: {attempt} with new max_fee_per_gas: {new_max_fee_per_gas:?}, new max_priority_fee_per_gas: {new_max_priority_fee_per_gas:?}",
+ );
+
+ match signer
+ .send_tx_envelope(tx_envelope.clone())
+ .await?
+ .with_timeout(Some(TIMEOUT))
+ .watch()
+ .await
+ {
+ Ok(tx_hash) => {
+ println!("Transaction sent: {tx_hash:?}");
+ return Ok(tx_hash);
+ }
+ Err(PendingTransactionError::TxWatcher(_)) => {
+ // timeout, so we need to bump the gas again
+ log::info!("Transaction timed out, bumping gas again");
+ }
+ Err(e) => {
+ return Err(BlockchainError::TransactionError(format!(
+ "{tx_name} failed with error: {e:?}"
+ )));
+ }
+ }
+ // update the current transaction
+ current_tx = tx_envelope.as_eip1559().unwrap().tx().clone();
+ pending_tx_hashes.push(*tx_envelope.tx_hash());
+ }
+ Err(BlockchainError::MaxTxRetriesReached)
+}
diff --git a/src/external_api/contracts/int1.rs b/src/external_api/contracts/int1.rs
index fea9632..a0fdbdd 100644
--- a/src/external_api/contracts/int1.rs
+++ b/src/external_api/contracts/int1.rs
@@ -1,61 +1,28 @@
-use std::sync::Arc;
-
-use ethers::{
- contract::abigen,
- core::k256::ecdsa::SigningKey,
- middleware::SignerMiddleware,
- providers::{Http, Provider},
- signers::Wallet,
- types::{Address, H256, U256},
-};
-use intmax2_zkp::ethereum_types::{bytes32::Bytes32, u32limb_trait::U32LimbTrait};
-
-use crate::utils::retry::with_retry;
-
use super::{
+ convert::{convert_address_to_alloy, convert_bytes32_to_b256, convert_u256_to_alloy},
error::BlockchainError,
- utils::{get_client, get_client_with_signer},
+ handlers::send_transaction_with_gas_bump,
+ utils::{get_provider_with_signer, NormalProvider},
};
+use alloy::{
+ primitives::{Address, TxHash, B256, U256},
+ sol,
+};
+use intmax2_zkp::ethereum_types::{bytes32::Bytes32, u32limb_trait::U32LimbTrait};
+use mining_circuit_v1::withdrawal::simple_withraw_circuit::SimpleWithdrawalPublicInputs;
+use DepositLib::Deposit;
+use IInt1::WithdrawalPublicInputs;
-abigen!(Int1, "abi/Int1L.json",);
-
-pub async fn get_int1_contract() -> Result>, BlockchainError> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let int1_address: Address = settings.blockchain.int1_address.parse().unwrap();
- let client = get_client().await?;
- let contract = Int1::new(int1_address, client);
- Ok(contract)
-}
-
-pub async fn get_int1_contract_with_signer(
- private_key: H256,
-) -> Result, Wallet>>, BlockchainError> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let client = get_client_with_signer(private_key).await?;
- let int1_address: Address = settings.blockchain.int1_address.parse().unwrap();
- let contract = Int1::new(int1_address, Arc::new(client));
- Ok(contract)
-}
-
-pub async fn get_deposit_root() -> Result {
- let int1 = get_int1_contract().await?;
- let root = with_retry(|| async { int1.get_deposit_root().call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call get_deposit_root in int1".to_string())
- })?;
- Ok(Bytes32::from_bytes_be(&root))
-}
+sol!(
+ #[sol(rpc)]
+ Int1,
+ "abi/Int1L.json",
+);
-pub async fn get_deposit_root_exits(root: Bytes32) -> Result {
- let int1 = get_int1_contract().await?;
- let root: [u8; 32] = root.to_bytes_be().try_into().unwrap();
- let block_number: U256 = with_retry(|| async { int1.deposit_roots(root).call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call deposit_roots in int1".to_string())
- })?;
- Ok(block_number != 0.into())
+#[derive(Debug, Clone)]
+pub struct Int1Contract {
+ pub provider: NormalProvider,
+ pub address: Address,
}
#[derive(Debug, Clone, Default, PartialEq)]
@@ -65,45 +32,129 @@ pub struct DepositData {
pub is_rejected: bool,
}
-pub async fn get_deposit_data(deposit_id: u64) -> Result {
- let int1 = get_int1_contract().await?;
- let data = with_retry(|| async {
- int1.get_deposit_data(ethers::types::U256::from(deposit_id))
- .call()
- .await
- })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call get_deposit_data in int1".to_string())
- })?;
- let data = DepositData {
- deposit_hash: Bytes32::from_bytes_be(&data.deposit_hash),
- sender: data.sender,
- is_rejected: data.is_rejected,
- };
- Ok(data)
-}
+impl Int1Contract {
+ pub fn new(provider: NormalProvider, address: Address) -> Self {
+ Self { provider, address }
+ }
-pub async fn get_withdrawal_nullifier_exists(nullifier: Bytes32) -> Result {
- let int1 = get_int1_contract().await?;
- let nullifier: [u8; 32] = nullifier.to_bytes_be().try_into().unwrap();
- let block_number = with_retry(|| async { int1.nullifiers(nullifier).call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call nullifiers in int1".to_string())
- })?;
- let exists = block_number != 0.into();
- Ok(exists)
-}
+ pub async fn get_deposit_root(&self) -> Result {
+ let int1 = Int1::new(self.address, self.provider.clone());
+ let root = int1.getDepositRoot().call().await?;
+ Ok(Bytes32::from_bytes_be(root.as_ref()))
+ }
+
+ pub async fn get_deposit_root_exits(&self, root: Bytes32) -> Result {
+ let int1 = Int1::new(self.address, self.provider.clone());
+ let root = convert_bytes32_to_b256(root);
+ let block_number = int1.depositRoots(root).call().await?;
+ Ok(!block_number.is_zero())
+ }
+
+ pub async fn get_deposit_data(&self, deposit_id: u64) -> Result {
+ let int1 = Int1::new(self.address, self.provider.clone());
+ let data = int1.getDepositData(U256::from(deposit_id)).call().await?;
+ let data = DepositData {
+ deposit_hash: Bytes32::from_bytes_be(data.depositHash.as_ref()),
+ sender: data.sender,
+ is_rejected: data.isRejected,
+ };
+ Ok(data)
+ }
+
+ pub async fn get_withdrawal_nullifier_exists(
+ &self,
+ nullifier: Bytes32,
+ ) -> Result {
+ let int1 = Int1::new(self.address, self.provider.clone());
+ let nullifier = convert_bytes32_to_b256(nullifier);
+ let block_number = int1.nullifiers(nullifier).call().await?;
+ Ok(!block_number.is_zero())
+ }
+
+ pub async fn get_last_processed_deposit_id(&self) -> Result {
+ let int1 = Int1::new(self.address, self.provider.clone());
+ let id = int1.getLastProcessedDepositId().call().await?;
+ Ok(id.to())
+ }
+
+ pub async fn withdrawal(
+ &self,
+ signer_private_key: B256,
+ pis: &SimpleWithdrawalPublicInputs,
+ proof: Vec,
+ ) -> Result {
+ let signer = get_provider_with_signer(&self.provider, signer_private_key);
+ let contract = Int1::new(self.address, signer.clone());
+ let public_inputs = WithdrawalPublicInputs {
+ depositRoot: convert_bytes32_to_b256(pis.deposit_root),
+ nullifier: convert_bytes32_to_b256(pis.nullifier),
+ recipient: convert_address_to_alloy(pis.recipient),
+ tokenIndex: pis.token_index,
+ amount: convert_u256_to_alloy(pis.amount),
+ };
+ let tx_request = contract
+ .withdraw(public_inputs, proof.into())
+ .into_transaction_request();
+ let tx_hash = send_transaction_with_gas_bump(
+ &self.provider,
+ signer,
+ tx_request,
+ "withdrawal",
+ "withdrawer",
+ )
+ .await?;
+ Ok(tx_hash)
+ }
+
+ pub async fn cancel_deposit(
+ &self,
+ signer_private_key: B256,
+ deposit_id: u64,
+ recipient_salt_hash: Bytes32,
+ token_index: u32,
+ amount: U256,
+ ) -> Result {
+ let signer = get_provider_with_signer(&self.provider, signer_private_key);
+ let contract = Int1::new(self.address, signer.clone());
+ let deposit = Deposit {
+ recipientSaltHash: convert_bytes32_to_b256(recipient_salt_hash),
+ tokenIndex: token_index,
+ amount,
+ };
+ let tx_request = contract
+ .cancelDeposit(U256::from(deposit_id), deposit)
+ .into_transaction_request();
+ let tx_hash = send_transaction_with_gas_bump(
+ &self.provider,
+ signer,
+ tx_request,
+ "cancel_deposit",
+ "depositor",
+ )
+ .await?;
+ Ok(tx_hash)
+ }
-pub async fn get_last_processed_deposit_id() -> Result {
- let int1 = get_int1_contract().await?;
- let id = with_retry(|| async { int1.get_last_processed_deposit_id().call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError(
- "failed to call get_last_processed_deposit_id in int1".to_string(),
- )
- })?;
- Ok(id.as_u64())
+ pub async fn deposit_native_token(
+ &self,
+ signer_private_key: B256,
+ recipient_salt_hash: Bytes32,
+ value: U256,
+ ) -> Result {
+ let signer = get_provider_with_signer(&self.provider, signer_private_key);
+ let contract = Int1::new(self.address, signer.clone());
+ let tx_request = contract
+ .depositNativeToken(convert_bytes32_to_b256(recipient_salt_hash))
+ .value(value)
+ .into_transaction_request();
+ let tx_hash = send_transaction_with_gas_bump(
+ &self.provider,
+ signer,
+ tx_request,
+ "deposit_native_token",
+ "depositor",
+ )
+ .await?;
+ Ok(tx_hash)
+ }
}
diff --git a/src/external_api/contracts/minter.rs b/src/external_api/contracts/minter.rs
index e54beed..1a44c74 100644
--- a/src/external_api/contracts/minter.rs
+++ b/src/external_api/contracts/minter.rs
@@ -1,87 +1,102 @@
-use std::sync::Arc;
-
-use ethers::{
- contract::abigen,
- core::k256::ecdsa::SigningKey,
- middleware::SignerMiddleware,
- providers::{Http, Provider},
- signers::Wallet,
- types::{Address, H256},
+use crate::external_api::contracts::{
+ convert::{convert_address_to_alloy, convert_u256_to_alloy},
+ utils::get_provider_with_signer,
};
-use intmax2_zkp::ethereum_types::{bytes32::Bytes32, u32limb_trait::U32LimbTrait};
-
-use crate::utils::retry::with_retry;
use super::{
- error::BlockchainError,
- utils::{get_client, get_client_with_signer},
+ convert::convert_bytes32_to_b256, error::BlockchainError,
+ handlers::send_transaction_with_gas_bump, utils::NormalProvider,
};
+use alloy::{
+ primitives::{Address, Bytes, B256},
+ sol,
+};
+use intmax2_zkp::ethereum_types::{bytes32::Bytes32, u32limb_trait::U32LimbTrait};
+use mining_circuit_v1::claim::{claim_circuit::ClaimPublicInputs, mining_claim::MiningClaim};
-abigen!(MinterV1, "abi/MinterV1L.json",);
+sol!(
+ #[sol(rpc)]
+ MinterV1,
+ "abi/MinterV1L.json",
+);
-pub async fn get_minter_contract() -> Result>, BlockchainError> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let client = get_client().await?;
- let minter_address: Address = settings.blockchain.minter_address.parse().unwrap();
- let contract = MinterV1::new(minter_address, client);
- Ok(contract)
+#[derive(Debug, Clone)]
+pub struct MinterContract {
+ pub provider: NormalProvider,
+ pub address: Address,
}
-pub async fn get_minter_contract_with_signer(
- private_key: H256,
-) -> Result<
- minter_v1::MinterV1, Wallet>>,
- BlockchainError,
-> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let client = get_client_with_signer(private_key).await?;
- let minter_address: Address = settings.blockchain.minter_address.parse().unwrap();
- let contract = MinterV1::new(minter_address, Arc::new(client));
- Ok(contract)
-}
+impl MinterContract {
+ pub fn new(provider: NormalProvider, address: Address) -> Self {
+ Self { provider, address }
+ }
-pub async fn get_short_term_eligible_root() -> Result {
- let minter = get_minter_contract().await?;
- let root = with_retry(|| async { minter.short_term_eligible_tree_root().call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call eligible_tree_root in minter".to_string())
- })?;
- Ok(Bytes32::from_bytes_be(&root))
-}
+ pub async fn get_short_term_eligible_root(&self) -> Result {
+ let minter = MinterV1::new(self.address, self.provider.clone());
+ let root = minter.shortTermEligibleTreeRoot().call().await?;
+ Ok(Bytes32::from_bytes_be(root.as_ref()))
+ }
-pub async fn get_long_term_eligible_root() -> Result {
- let minter = get_minter_contract().await?;
- let root = with_retry(|| async { minter.long_term_eligible_tree_root().call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call eligible_tree_root in minter".to_string())
- })?;
- Ok(Bytes32::from_bytes_be(&root))
-}
+ pub async fn get_long_term_eligible_root(&self) -> Result {
+ let minter = MinterV1::new(self.address, self.provider.clone());
+ let root = minter.longTermEligibleTreeRoot().call().await?;
+ Ok(Bytes32::from_bytes_be(root.as_ref()))
+ }
-pub async fn get_short_term_claim_nullifier_exists(
- nullifier: Bytes32,
-) -> Result {
- let minter = get_minter_contract().await?;
- let nullifier: [u8; 32] = nullifier.to_bytes_be().try_into().unwrap();
- let exists = with_retry(|| async { minter.short_term_nullifiers(nullifier).call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call nullifiers in minter".to_string())
- })?;
- Ok(exists)
-}
+ pub async fn get_short_term_claim_nullifier_exists(
+ &self,
+ nullifier: Bytes32,
+ ) -> Result {
+ let minter = MinterV1::new(self.address, self.provider.clone());
+ let nullifier = convert_bytes32_to_b256(nullifier);
+ let exists = minter.shortTermNullifiers(nullifier).call().await?;
+ Ok(exists)
+ }
+
+ pub async fn get_long_term_claim_nullifier_exists(
+ &self,
+ nullifier: Bytes32,
+ ) -> Result {
+ let minter = MinterV1::new(self.address, self.provider.clone());
+ let nullifier = convert_bytes32_to_b256(nullifier);
+ let exists = minter.longTermNullifiers(nullifier).call().await?;
+ Ok(exists)
+ }
-pub async fn get_long_term_claim_nullifier_exists(
- nullifier: Bytes32,
-) -> Result {
- let minter = get_minter_contract().await?;
- let nullifier: [u8; 32] = nullifier.to_bytes_be().try_into().unwrap();
- let exists = with_retry(|| async { minter.long_term_nullifiers(nullifier).call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call nullifiers in minter".to_string())
- })?;
- Ok(exists)
+ pub async fn claim_tokens(
+ &self,
+ signer_private_key: B256,
+ is_short_term: bool,
+ claims: &[MiningClaim],
+ pis: &ClaimPublicInputs,
+ proof: Bytes,
+ ) -> Result<(), BlockchainError> {
+ let signer = get_provider_with_signer(&self.provider, signer_private_key);
+ let contract = MinterV1::new(self.address, signer.clone());
+ let claims = claims
+ .iter()
+ .map(|claim| IMinterV1L::MintClaim {
+ recipient: convert_address_to_alloy(claim.recipient),
+ nullifier: convert_bytes32_to_b256(claim.nullifier),
+ amount: convert_u256_to_alloy(claim.amount),
+ })
+ .collect::>();
+ let pis = IMinterV1L::ClaimPublicInputs {
+ depositTreeRoot: convert_bytes32_to_b256(pis.deposit_tree_root),
+ eligibleTreeRoot: convert_bytes32_to_b256(pis.eligible_tree_root),
+ lastClaimHash: convert_bytes32_to_b256(pis.last_claim_hash),
+ };
+ let tx_request = contract
+ .claimTokens(is_short_term, claims, pis, proof)
+ .into_transaction_request();
+ send_transaction_with_gas_bump(
+ &self.provider,
+ signer,
+ tx_request,
+ "claim_tokens",
+ "claim address",
+ )
+ .await?;
+ Ok(())
+ }
}
diff --git a/src/external_api/contracts/mod.rs b/src/external_api/contracts/mod.rs
index 37aba05..c44fe00 100644
--- a/src/external_api/contracts/mod.rs
+++ b/src/external_api/contracts/mod.rs
@@ -1,5 +1,7 @@
+pub mod convert;
pub mod error;
pub mod events;
+pub mod handlers;
pub mod int1;
pub mod minter;
pub mod token;
diff --git a/src/external_api/contracts/token.rs b/src/external_api/contracts/token.rs
index a6973d9..06db769 100644
--- a/src/external_api/contracts/token.rs
+++ b/src/external_api/contracts/token.rs
@@ -1,43 +1,27 @@
-use ethers::{
- contract::abigen,
- providers::{Http, Provider},
- types::{Address, U256},
+use super::{error::BlockchainError, utils::NormalProvider};
+use alloy::{
+ primitives::{Address, U256},
+ sol,
};
-use log::info;
-use crate::utils::retry::with_retry;
-
-use super::{error::BlockchainError, utils::get_client};
-
-abigen!(
- IERC20,
- r#"[
- function totalSupply() external view returns (uint256)
- function balanceOf(address account) external view returns (uint256)
- function transfer(address recipient, uint256 amount) external returns (bool)
- function allowance(address owner, address spender) external view returns (uint256)
- function approve(address spender, uint256 amount) external returns (bool)
- function transferFrom( address sender, address recipient, uint256 amount) external returns (bool)
- event Transfer(address indexed from, address indexed to, uint256 value)
- event Approval(address indexed owner, address indexed spender, uint256 value)
- ]"#,
+sol!(
+ #[sol(rpc)]
+ ERC20,
+ "abi/ERC20.json",
);
-
-pub async fn get_token_contract() -> Result>, BlockchainError> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let client = get_client().await?;
- let token_address: Address = settings.blockchain.token_address.parse().unwrap();
- let contract = IERC20::new(token_address, client);
- Ok(contract)
+pub struct TokenContract {
+ pub provider: NormalProvider,
+ pub address: Address,
}
-pub async fn get_token_balance(address: Address) -> Result {
- info!("get_token_balance");
- let contract = get_token_contract().await?;
- let balance = with_retry(|| async { contract.balance_of(address).call().await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("failed to call balance_of in token".to_string())
- })?;
- Ok(balance)
+impl TokenContract {
+ pub fn new(provider: NormalProvider, address: Address) -> Self {
+ Self { provider, address }
+ }
+
+ pub async fn get_token_balance(&self, address: Address) -> Result {
+ let contract = ERC20::new(self.address, self.provider.clone());
+ let balance = contract.balanceOf(address).call().await?;
+ Ok(balance)
+ }
}
diff --git a/src/external_api/contracts/utils.rs b/src/external_api/contracts/utils.rs
index 22f4140..23c4c23 100644
--- a/src/external_api/contracts/utils.rs
+++ b/src/external_api/contracts/utils.rs
@@ -1,197 +1,168 @@
-use std::{env, sync::Arc};
-
-use ethers::{
- core::k256::{ecdsa::SigningKey, SecretKey},
- middleware::SignerMiddleware,
- providers::{Http, Middleware, Provider},
- signers::{LocalWallet, Signer, Wallet},
- types::{Address, Block, H256, U256},
- utils::hex::ToHex,
-};
-use log::info;
-
-use crate::utils::{retry::with_retry, time::sleep_for};
-
use super::error::BlockchainError;
-
-fn get_rpc_url() -> Result {
- let rpc_url = env::var("RPC_URL")
- .map_err(|_| BlockchainError::EnvError("RPC_URL is not set".to_string()))?;
- Ok(rpc_url)
-}
-
-async fn get_provider() -> Result, BlockchainError> {
- let rpc_url = get_rpc_url()?;
- let provider = Provider::::try_from(rpc_url)
- .map_err(|_| BlockchainError::EnvError("Failed to parse RPC_URL".to_string()))?;
+use alloy::{
+ network::EthereumWallet,
+ primitives::{Address, TxHash, B256},
+ providers::{
+ fillers::{
+ ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SimpleNonceManager,
+ WalletFiller,
+ },
+ Identity, Provider, ProviderBuilder,
+ },
+ rpc::{client::RpcClient, types::Transaction},
+ signers::local::PrivateKeySigner,
+ transports::{
+ http::Http,
+ layers::{FallbackLayer, RetryBackoffLayer},
+ },
+};
+use futures::{stream, StreamExt as _};
+use reqwest::Url;
+use std::{collections::HashMap, env};
+use tower::ServiceBuilder;
+
+// Use simple nonce manager for the nonce filler because it's easier to handle nonce errors.
+pub type JoinedRecommendedFillersWithSimpleNonce = JoinFill<
+ JoinFill, NonceFiller>,
+ ChainIdFiller,
+>;
+
+pub type NormalProvider =
+ FillProvider;
+
+pub type ProviderWithSigner = FillProvider<
+ JoinFill>,
+ alloy::providers::RootProvider,
+>;
+
+// alloy does not support fallback transport in WASM, so we use a provider without fallback transport in WASM.
+pub fn get_provider(rpc_urls: &str) -> Result {
+ let retry_layer = RetryBackoffLayer::new(5, 1000, 100);
+ let url: Url = rpc_urls
+ .parse()
+ .map_err(|e| BlockchainError::ParseError(format!("Failed to parse URL {rpc_urls}: {e}")))?;
+ let client = RpcClient::builder().layer(retry_layer).http(url);
+ let provider = ProviderBuilder::default()
+ .with_gas_estimation()
+ .with_simple_nonce_management()
+ .fetch_chain_id()
+ .connect_client(client);
Ok(provider)
}
-pub async fn get_client() -> Result>, BlockchainError> {
- let provider = get_provider().await?;
- let client = Arc::new(provider);
- Ok(client)
-}
-
-pub async fn get_latest_block_number() -> Result {
- info!("get_latest_block_number");
- let client = get_client().await?;
- let block_number = with_retry(|| async { client.get_block_number().await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get block number".to_string()))?;
- Ok(block_number.as_u64())
-}
-
-pub async fn get_client_with_rpc_url(
- rpc_url: &str,
-) -> Result>, BlockchainError> {
- let provider = Provider::::try_from(rpc_url)
- .map_err(|e| BlockchainError::InternalError(e.to_string()))?;
- Ok(Arc::new(provider))
-}
-
-pub async fn get_client_with_signer(
- private_key: H256,
-) -> Result, Wallet>, BlockchainError> {
- let provider = get_provider().await?;
- let wallet = get_wallet(private_key).await?;
- let client = SignerMiddleware::new(provider, wallet);
- Ok(client)
-}
-
-pub async fn get_wallet(private_key: H256) -> Result, BlockchainError> {
- let settings = crate::utils::config::Settings::load().unwrap();
- let key = SecretKey::from_bytes(private_key.as_bytes().into()).unwrap();
- let wallet = Wallet::from(key).with_chain_id(settings.blockchain.chain_id);
- Ok(wallet)
-}
-
-pub fn get_address(private_key: H256) -> Address {
- let wallet = private_key
- .encode_hex::()
- .parse::()
- .unwrap();
- wallet.address()
-}
-
-pub async fn get_account_nonce(address: Address) -> Result {
- info!("get_account_nonce");
- let client = get_client().await?;
- let nonce = with_retry(|| async { client.get_transaction_count(address, None).await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get nonce".to_string()))?;
- Ok(nonce.as_u64())
-}
-
-pub async fn get_balance(address: Address) -> Result {
- info!("get_balance");
- let client = get_client().await?;
- let balance = with_retry(|| async { client.get_balance(address, None).await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get balance".to_string()))?;
- Ok(balance)
-}
-
-pub async fn get_balance_with_rpc(
- rpc_url: &str,
- address: Address,
-) -> Result {
- info!("get_balance");
- let client = get_client_with_rpc_url(rpc_url).await?;
- let balance = with_retry(|| async { client.get_balance(address, None).await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get balance".to_string()))?;
- Ok(balance)
-}
-
-pub async fn get_gas_price() -> Result {
- info!("get_gas_price");
- let client = get_client().await?;
- let gas_price = with_retry(|| async { client.get_gas_price().await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get gas price".to_string()))?;
- Ok(gas_price)
-}
-
-pub async fn get_eip1559_fees() -> Result<(U256, U256), BlockchainError> {
- let client = get_client().await?;
- let (max_gas_price, max_priority_fee_per_gas) =
- with_retry(|| async { client.estimate_eip1559_fees(None).await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("Failed to estimate EIP1559 fees".to_string())
+pub fn get_provider_with_fallback(rpc_urls: &[String]) -> Result {
+ let retry_layer = RetryBackoffLayer::new(5, 1000, 100);
+ let transports = rpc_urls
+ .iter()
+ .map(|url| {
+ let url: Url = url.parse().map_err(|e| {
+ BlockchainError::ParseError(format!("Failed to parse URL {url}: {e}"))
})?;
- Ok((max_gas_price, max_priority_fee_per_gas))
+ Ok(Http::new(url))
+ })
+ .collect::, BlockchainError>>()?;
+ let fallback_layer =
+ FallbackLayer::default().with_active_transport_count(transports.len().try_into().unwrap());
+ let transport = ServiceBuilder::new()
+ .layer(fallback_layer)
+ .service(transports);
+ let client = RpcClient::builder()
+ .layer(retry_layer)
+ .transport(transport, false);
+ let provider = ProviderBuilder::default()
+ .with_gas_estimation()
+ .with_simple_nonce_management()
+ .fetch_chain_id()
+ .connect_client(client);
+ Ok(provider)
}
-pub async fn get_tx_receipt(
- tx_hash: H256,
-) -> Result {
- info!("get_tx_receipt");
- let client = get_client().await?;
- let mut loop_count = 0;
- loop {
- if loop_count > 20 {
- return Err(BlockchainError::TxNotFound(tx_hash.to_string()));
+pub fn get_provider_with_signer(
+ provider: &NormalProvider,
+ private_key: B256,
+) -> ProviderWithSigner {
+ let signer = PrivateKeySigner::from_bytes(&private_key).unwrap();
+ let wallet = EthereumWallet::new(signer);
+ let wallet_filler = WalletFiller::new(wallet);
+ provider.clone().join_with(wallet_filler)
+}
+
+pub fn get_address_from_private_key(private_key: B256) -> Address {
+ let signer = PrivateKeySigner::from_bytes(&private_key).unwrap();
+ signer.address()
+}
+
+pub async fn get_batch_transaction(
+ provider: &NormalProvider,
+ tx_hashes: &[TxHash],
+) -> Result, BlockchainError> {
+ let mut target_tx_hashes = tx_hashes.to_vec();
+ let mut fetched_txs = HashMap::new();
+ let mut retry_count = 0;
+ let max_tries = std::env::var("MAX_TRIES")
+ .ok()
+ .and_then(|s| s.parse().ok())
+ .unwrap_or(10);
+ while !target_tx_hashes.is_empty() {
+ let (partial_fetched_txs, failed_tx_hashes) =
+ get_batch_transaction_inner(provider, &target_tx_hashes).await?;
+ fetched_txs.extend(partial_fetched_txs);
+ if failed_tx_hashes.is_empty() {
+ break;
}
- let receipt = with_retry(|| async { client.get_transaction_receipt(tx_hash).await })
- .await
- .map_err(|_| {
- BlockchainError::NetworkError("faied to get transaction receipt".to_string())
- })?;
- if receipt.is_some() {
- return Ok(receipt.unwrap());
+ target_tx_hashes = failed_tx_hashes;
+ retry_count += 1;
+ if retry_count > max_tries {
+ return Err(BlockchainError::TxNotFoundBatch);
}
- sleep_for(10);
- loop_count += 1;
+ tokio::time::sleep(std::time::Duration::from_secs(2)).await;
}
-}
-
-pub async fn get_block(block_number: u64) -> Result>, BlockchainError> {
- info!("get_block");
- let client = get_client().await.unwrap();
- let block = with_retry(|| async { client.get_block(block_number).await })
- .await
- .map_err(|_| BlockchainError::NetworkError("failed to get block".to_string()))?;
- Ok(block)
-}
-
-pub fn u256_as_bytes_be(u256: ethers::types::U256) -> [u8; 32] {
- let mut bytes = [0u8; 32];
- u256.to_big_endian(&mut bytes);
- bytes
-}
-
-#[cfg(test)]
-mod tests {
- use ethers::types::Address;
-
- use crate::{external_api::contracts::token::get_token_balance, utils::config::Settings};
-
- #[tokio::test]
- async fn test_get_minter_token_balance() -> anyhow::Result<()> {
- dotenv::dotenv().ok();
- let settings = Settings::load()?;
- let minter_address: Address = settings.blockchain.minter_address.parse()?;
- let balance = get_token_balance(minter_address).await?;
- println!("{}", balance);
- Ok(())
+ let mut txs = Vec::new();
+ for tx_hash in tx_hashes {
+ txs.push(fetched_txs.get(tx_hash).unwrap().clone());
}
-
- #[tokio::test]
- async fn test_get_gas_price() -> anyhow::Result<()> {
- dotenv::dotenv().ok();
- let gas_price = super::get_gas_price().await?;
- println!("{}", gas_price);
- Ok(())
+ Ok(txs)
+}
+
+async fn get_batch_transaction_inner(
+ provider: &NormalProvider,
+ tx_hashes: &[TxHash],
+) -> Result<(HashMap, Vec), BlockchainError> {
+ let max_parallel_requests = env::var("MAX_PARALLEL_REQUESTS")
+ .ok()
+ .and_then(|s| s.parse().ok())
+ .unwrap_or(20);
+
+ let results = stream::iter(tx_hashes)
+ .map(|&tx_hash| {
+ let provider = provider.clone();
+ async move {
+ match provider.get_transaction_by_hash(tx_hash).await {
+ Ok(Some(tx)) => Ok((tx_hash, Ok(tx))),
+ Ok(None) => Ok((tx_hash, Err(BlockchainError::TxNotFound(tx_hash)))),
+ Err(e) => Err(e),
+ }
+ }
+ })
+ .buffer_unordered(max_parallel_requests)
+ .collect::>()
+ .await;
+
+ let mut fetched_txs = HashMap::new();
+ let mut failed_tx_hashes = Vec::new();
+
+ for result in results {
+ match result {
+ Ok((tx_hash, Ok(tx))) => {
+ fetched_txs.insert(tx_hash, tx);
+ }
+ Ok((tx_hash, Err(BlockchainError::TxNotFound(_)))) => {
+ failed_tx_hashes.push(tx_hash);
+ }
+ Ok((_, Err(e))) => return Err(e),
+ Err(e) => return Err(BlockchainError::JoinError(e.to_string())),
+ }
}
- #[tokio::test]
- async fn test_get_eip1559_fees() -> anyhow::Result<()> {
- dotenv::dotenv().ok();
- let (max_gas_price, max_priority_fee_per_gas) = super::get_eip1559_fees().await?;
- println!("max_gas_price: {}", max_gas_price);
- println!("max_priority_fee_per_gas: {}", max_priority_fee_per_gas);
- Ok(())
- }
+ Ok((fetched_txs, failed_tx_hashes))
}
diff --git a/src/external_api/github.rs b/src/external_api/github.rs
index 2167966..78f2abb 100644
--- a/src/external_api/github.rs
+++ b/src/external_api/github.rs
@@ -3,10 +3,12 @@ use log::info;
use regex::Regex;
use reqwest::{self};
use serde_json::Value;
+use sha3::Digest as _;
use crate::utils::{
bin_parser::{BinDepositTree, BinEligibleTree},
config::Settings,
+ file::{create_file_with_content, get_data_path},
};
#[derive(Debug, thiserror::Error)]
@@ -15,6 +17,8 @@ pub enum Error {
NetworkError,
#[error("Failed to deserialize data {}", _0)]
DeserializeError(String),
+ #[error("Cache error: {}", _0)]
+ CacheError(String),
}
#[derive(Debug)]
@@ -64,7 +68,13 @@ pub async fn fetch_latest_tree_from_github(last_update: NaiveDate) -> Result Result Result Result, Error> {
- let download_url = file["download_url"]
- .as_str()
- .ok_or(Error::DeserializeError(
- "no download_url filed in github files".to_string(),
- ))?;
+async fn fetch_content(client: &reqwest::Client, download_url: &str) -> Result, Error> {
+ if let Some(cached_content) = read_cache(download_url)
+ .await
+ .map_err(|e| Error::CacheError(format!("failed to read cache: {}", e)))?
+ {
+ info!("Using cached content for {}", download_url);
+ return Ok(cached_content);
+ }
let content = client
.get(download_url)
.header("User-Agent", "Rust-GitHub-File-Reader")
@@ -161,9 +183,32 @@ async fn fetch_content(client: &reqwest::Client, file: &Value) -> Result
.bytes()
.await
.map_err(|_| Error::DeserializeError("failed to deserialize files as bytes".to_string()))?;
+ write_cache(download_url, &content)
+ .await
+ .map_err(|e| Error::CacheError(format!("failed to write cache: {}", e)))?;
Ok(content.into())
}
+async fn read_cache(download_url: &str) -> anyhow::Result>> {
+ if let Ok(content) = std::fs::read(cache_path(download_url)?) {
+ return Ok(Some(content));
+ } else {
+ return Ok(None);
+ }
+}
+
+async fn write_cache(download_url: &str, content: &[u8]) -> anyhow::Result<()> {
+ create_file_with_content(&cache_path(download_url)?, content)?;
+ Ok(())
+}
+
+fn cache_path(download_url: &str) -> anyhow::Result {
+ let hex_str = hex::encode(sha3::Keccak256::digest(download_url.as_bytes()));
+ let data_path = get_data_path()?;
+ let cache_path = data_path.join("github_cache").join(hex_str);
+ Ok(cache_path)
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/external_api/graph/client.rs b/src/external_api/graph/client.rs
new file mode 100644
index 0000000..f5c0cd6
--- /dev/null
+++ b/src/external_api/graph/client.rs
@@ -0,0 +1,414 @@
+use alloy::consensus::Transaction;
+use alloy::primitives::{Address, TxHash};
+use intmax2_zkp::ethereum_types::bytes32::Bytes32;
+use intmax2_zkp::ethereum_types::u256::U256;
+use reqwest::Client;
+use serde::{Deserialize, Serialize};
+use serde_json::json;
+use serde_with::serde_as;
+use serde_with::DisplayFromStr;
+
+use crate::external_api::contracts::utils::get_batch_transaction;
+use crate::external_api::{
+ contracts::{
+ events::{DepositLeafInserted, Deposited},
+ utils::NormalProvider,
+ },
+ query::post_request_with_bearer_token,
+};
+
+use super::error::GraphClientError;
+
+// A wrapper around TheGraphClient that provides additional functionality for interacting with the L1 and L2 providers.
+#[derive(Clone, Debug)]
+pub struct GraphClient {
+ pub url: String,
+ pub bearer_token: Option,
+ pub client: Client,
+ pub provider: NormalProvider,
+ pub health_check_timeout: u64,
+}
+
+impl GraphClient {
+ pub fn new(
+ provider: NormalProvider,
+ url: &str,
+ bearer_token: Option,
+ health_check_timeout: u64,
+ ) -> Self {
+ let client = Client::new();
+ GraphClient {
+ client,
+ provider,
+ url: url.to_string(),
+ bearer_token,
+ health_check_timeout,
+ }
+ }
+
+ // get all deposited events by sender address
+ pub async fn get_deposited_event_by_sender(
+ &self,
+ deposit_address: Address,
+ ) -> Result, GraphClientError> {
+ let query = r#"
+ query MyQuery($senderAddress: String!) {
+ depositeds(
+ where: { sender: $senderAddress },
+ orderBy: blockTimestamp,
+ orderDirection: asc
+ ) {
+ sender
+ tokenIndex
+ transactionHash
+ blockTimestamp
+ depositId
+ recipientSaltHash
+ amount
+ }
+ }
+ "#;
+ let request = json!({
+ "query": query,
+ "variables": {
+ "senderAddress": deposit_address,
+ }
+ });
+ let response: GraphQLResponse = post_request_with_bearer_token(
+ &self.url,
+ "",
+ self.bearer_token.clone(),
+ Some(&request),
+ )
+ .await?;
+
+ let tx_hashes = response
+ .data
+ .depositeds
+ .iter()
+ .map(|entry| entry.transaction_hash)
+ .collect::>();
+ let txs = get_batch_transaction(&self.provider, &tx_hashes).await?;
+
+ let mut deposited = Vec::new();
+ for (event, tx) in response.data.depositeds.iter().zip(txs.iter()) {
+ deposited.push(Deposited {
+ sender: event.sender,
+ token_index: event.token_index,
+ deposit_id: event.deposit_id,
+ recipient_salt_hash: event.recipient_salt_hash,
+ amount: event.amount,
+ tx_nonce: tx.nonce(),
+ timestamp: event.block_timestamp,
+ });
+ }
+
+ Ok(deposited)
+ }
+
+ pub async fn get_deposit_leaf_inserted_event(
+ &self,
+ next_deposit_index: u32,
+ ) -> Result, GraphClientError> {
+ let limit = 1000; // Adjust the limit as needed
+ let mut deposit_leaf_inserteds = Vec::new();
+ let mut current_index = next_deposit_index;
+ loop {
+ let entries = self
+ .get_deposit_leaf_inserted_event_inner(current_index, limit)
+ .await?;
+ if entries.is_empty() {
+ break;
+ }
+ deposit_leaf_inserteds.extend(entries);
+ current_index = deposit_leaf_inserteds.last().unwrap().deposit_index + 1;
+ }
+ Ok(deposit_leaf_inserteds)
+ }
+
+ async fn get_deposit_leaf_inserted_event_inner(
+ &self,
+ next_deposit_index: u32,
+ limit: u64,
+ ) -> Result, GraphClientError> {
+ let query = r#"
+ query MyQuery($nextDepositIndex: BigInt!, $limit: Int!) {
+ depositLeafInserteds(
+ where: { depositIndex_gte: $nextDepositIndex },
+ orderBy: depositIndex,
+ orderDirection: asc,
+ first: $limit
+ ) {
+ blockNumber
+ depositIndex
+ depositHash
+ }
+ }
+ "#;
+ let request = json!({
+ "query": query,
+ "variables": {
+ "nextDepositIndex": next_deposit_index,
+ "limit": limit,
+ }
+ });
+ let response: GraphQLResponse = post_request_with_bearer_token(
+ &self.url,
+ "",
+ self.bearer_token.clone(),
+ Some(&request),
+ )
+ .await?;
+
+ let deposit_leaf_inserteds = response
+ .data
+ .deposit_leaf_inserteds
+ .into_iter()
+ .map(|entry| DepositLeafInserted {
+ deposit_index: entry.deposit_index,
+ deposit_hash: entry.deposit_hash,
+ block_number: entry.block_number,
+ })
+ .collect::>();
+ Ok(deposit_leaf_inserteds)
+ }
+
+ pub async fn get_latest_deposit_timestamp(
+ &self,
+ sender: Address,
+ ) -> Result, GraphClientError> {
+ let mut depositeds = self.get_deposited_event_by_sender(sender).await?;
+ depositeds.sort_by_key(|d| d.timestamp);
+ if let Some(latest_deposit) = depositeds.last() {
+ Ok(Some(latest_deposit.timestamp))
+ } else {
+ Ok(None)
+ }
+ }
+
+ pub async fn get_latest_withdrawal_timestamp(
+ &self,
+ recipient: Address,
+ ) -> Result , GraphClientError> {
+ let query = r#"
+ query MyQuery($recipientAddress: String!) {
+ withdrawns(
+ where: { recipient: $recipientAddress },
+ orderBy: blockTimestamp,
+ orderDirection: desc,
+ first: 1
+ ) {
+ blockTimestamp
+ }
+ }
+ "#;
+ let request = json!({
+ "query": query,
+ "variables": {
+ "recipientAddress": recipient,
+ }
+ });
+ let response: GraphQLResponse = post_request_with_bearer_token(
+ &self.url,
+ "",
+ self.bearer_token.clone(),
+ Some(&request),
+ )
+ .await?;
+ let timestamp = response
+ .data
+ .withdrawns
+ .first()
+ .map(|entry| entry.block_timestamp);
+ Ok(timestamp)
+ }
+
+ pub async fn health_check(&self) -> Result<(), GraphClientError> {
+ let query = r#"
+ query MyQuery {
+ _meta {
+ block {
+ timestamp
+ }
+ hasIndexingErrors
+ }
+ }
+ "#;
+ let request = json!({
+ "query": query,
+ });
+ let response: GraphQLResponse = post_request_with_bearer_token(
+ &self.url,
+ "",
+ self.bearer_token.clone(),
+ Some(&request),
+ )
+ .await?;
+
+ if response.data.meta.has_indexing_errors {
+ return Err(GraphClientError::HealthCheckError(
+ "Graph has indexing errors".to_string(),
+ ));
+ }
+ let timestamp = response.data.meta.block.timestamp;
+ let current_timestamp = chrono::Utc::now().timestamp() as u64;
+ if current_timestamp.saturating_sub(timestamp) > self.health_check_timeout {
+ return Err(GraphClientError::HealthCheckError(format!(
+ "Graph is not up to date. Last update was at {} seconds ago",
+ current_timestamp.saturating_sub(timestamp)
+ )));
+ }
+ Ok(())
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GraphQLResponse {
+ pub data: T,
+}
+
+#[derive(Debug, Deserialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct DepositedsData {
+ pub depositeds: Vec,
+}
+
+#[serde_as]
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DepositedEntry {
+ #[serde_as(as = "DisplayFromStr")]
+ pub deposit_id: u64,
+ pub sender: Address,
+ pub recipient_salt_hash: Bytes32,
+ #[serde_as(as = "DisplayFromStr")]
+ pub token_index: u32,
+ pub amount: U256,
+ pub transaction_hash: TxHash,
+ #[serde_as(as = "DisplayFromStr")]
+ pub block_timestamp: u64,
+}
+
+#[derive(Debug, Deserialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct DepositLeafInsertedsData {
+ pub deposit_leaf_inserteds: Vec,
+}
+
+#[serde_as]
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DepositLeafInsertedEntry {
+ #[serde_as(as = "DisplayFromStr")]
+ pub deposit_index: u32,
+ pub deposit_hash: Bytes32,
+ #[serde_as(as = "DisplayFromStr")]
+ pub block_number: u64,
+}
+
+#[derive(Debug, Deserialize, Clone)]
+#[serde(rename_all = "camelCase")]
+pub struct WithdrawnData {
+ pub withdrawns: Vec,
+}
+
+#[serde_as]
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WithdrawnEntry {
+ #[serde_as(as = "DisplayFromStr")]
+ pub block_timestamp: u64,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct MetaData {
+ #[serde(rename = "_meta")]
+ meta: MetaEntry,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct MetaEntry {
+ block: Block,
+ has_indexing_errors: bool,
+}
+
+#[serde_as]
+#[derive(Debug, Deserialize, Serialize)]
+struct Block {
+ timestamp: u64,
+}
+
+#[cfg(test)]
+mod tests {
+ use std::env;
+
+ use super::*;
+ use crate::external_api::contracts::utils::get_provider;
+
+ fn get_client() -> Result {
+ let graph_url =
+ env::var("GRAPH_URL").unwrap_or_else(|_| "http://example.com/graphql".to_string());
+ let rpc_url = env::var("RPC_URL").unwrap_or_else(|_| "http://localhost:8545".to_string());
+ let provider = get_provider(&rpc_url).unwrap();
+
+ Ok(GraphClient::new(provider, &graph_url, None, 60))
+ }
+
+ #[tokio::test]
+ async fn test_graph_client_get_deposited_event_by_sender() {
+ let client = get_client().unwrap();
+ let result = client
+ .get_deposited_event_by_sender(
+ "0x4c5187eea6df32a4a2eadb3459a395c83309f0be"
+ .parse()
+ .unwrap(),
+ )
+ .await
+ .unwrap();
+ dbg!(&result);
+ }
+
+ #[tokio::test]
+ async fn test_graph_client_deposit_leaf_inserted_event() {
+ let client = get_client().unwrap();
+ let result = client.get_deposit_leaf_inserted_event(0).await.unwrap();
+ dbg!(&result.len());
+ }
+
+ #[tokio::test]
+ async fn test_graph_client_get_latest_deposit_timestamp() {
+ let client = get_client().unwrap();
+ let result = client
+ .get_latest_deposit_timestamp(
+ "0x4c5187eea6df32a4a2eadb3459a395c83309f0be"
+ .parse()
+ .unwrap(),
+ )
+ .await
+ .unwrap();
+ dbg!(&result);
+ }
+
+ #[tokio::test]
+ async fn test_graph_client_get_latest_withdrawal_timestamp() {
+ let client = get_client().unwrap();
+ let result = client
+ .get_latest_withdrawal_timestamp(
+ "0xC2233d8937d2581F374caB4C2E89257828bB1BF8"
+ .parse()
+ .unwrap(),
+ )
+ .await
+ .unwrap();
+ dbg!(&result);
+ }
+
+ #[tokio::test]
+ async fn test_graph_client_health_check() {
+ let client = get_client().unwrap();
+ let result = client.health_check().await;
+ assert!(result.is_ok(), "Health check failed: {:?}", result);
+ }
+}
diff --git a/src/external_api/graph/error.rs b/src/external_api/graph/error.rs
new file mode 100644
index 0000000..4f16742
--- /dev/null
+++ b/src/external_api/graph/error.rs
@@ -0,0 +1,13 @@
+use crate::external_api::{contracts::error::BlockchainError, query::RequestError};
+
+#[derive(Debug, thiserror::Error)]
+pub enum GraphClientError {
+ #[error("Blockchain error: {0}")]
+ BlockchainError(#[from] BlockchainError),
+
+ #[error("Request error: {0}")]
+ RequestError(#[from] RequestError),
+
+ #[error("Health check error: {0}")]
+ HealthCheckError(String),
+}
diff --git a/src/external_api/graph/mod.rs b/src/external_api/graph/mod.rs
new file mode 100644
index 0000000..f27e761
--- /dev/null
+++ b/src/external_api/graph/mod.rs
@@ -0,0 +1,2 @@
+pub mod client;
+pub mod error;
diff --git a/src/external_api/intmax/availability.rs b/src/external_api/intmax/availability.rs
index 39380f7..d4c69aa 100644
--- a/src/external_api/intmax/availability.rs
+++ b/src/external_api/intmax/availability.rs
@@ -10,19 +10,19 @@ use super::error::{IntmaxError, IntmaxErrorResponse};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
-pub struct AvaliabilityServerSuccessResponse {
+pub struct AvailabilityServerSuccessResponse {
pub is_available: bool,
pub message: String,
}
#[derive(Serialize, Deserialize)]
#[serde(untagged)]
-enum AvaliabilityServerResponse {
- Success(AvaliabilityServerSuccessResponse),
+enum AvailabilityServerResponse {
+ Success(AvailabilityServerSuccessResponse),
Error(IntmaxErrorResponse),
}
-pub async fn get_availability() -> Result {
+pub async fn get_availability() -> Result {
info!("get_availability");
let version = env!("CARGO_PKG_VERSION");
let settings = Settings::load().unwrap();
@@ -38,13 +38,13 @@ pub async fn get_availability() -> Result Ok(success),
- AvaliabilityServerResponse::Error(error) => Err(IntmaxError::ServerError(error)),
+ AvailabilityServerResponse::Success(success) => Ok(success),
+ AvailabilityServerResponse::Error(error) => Err(IntmaxError::ServerError(error)),
}
}
diff --git a/src/external_api/intmax/circulation.rs b/src/external_api/intmax/circulation.rs
index f49707e..c27fb2c 100644
--- a/src/external_api/intmax/circulation.rs
+++ b/src/external_api/intmax/circulation.rs
@@ -1,4 +1,4 @@
-use ethers::types::Address;
+use alloy::primitives::Address;
use log::info;
use serde::{Deserialize, Serialize};
@@ -38,7 +38,7 @@ pub async fn get_circulation(address: Address) -> Result Ok(success),
diff --git a/src/external_api/intmax/error.rs b/src/external_api/intmax/error.rs
index f3f0440..a7d8272 100644
--- a/src/external_api/intmax/error.rs
+++ b/src/external_api/intmax/error.rs
@@ -1,6 +1,8 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;
+use crate::external_api::contracts::error::BlockchainError;
+
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IntmaxErrorResponse {
@@ -11,6 +13,8 @@ pub struct IntmaxErrorResponse {
#[derive(thiserror::Error, Debug)]
pub enum IntmaxError {
+ #[error("Blockchain error: {0}")]
+ BlockchainError(#[from] BlockchainError),
#[error("Network error: {0}")]
NetworkError(String),
#[error("Serialization error: {0}")]
diff --git a/src/external_api/intmax/gas_estimation.rs b/src/external_api/intmax/gas_estimation.rs
deleted file mode 100644
index 008604b..0000000
--- a/src/external_api/intmax/gas_estimation.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-use log::info;
-use serde::{Deserialize, Serialize};
-
-use crate::{
- external_api::intmax::header::VersionHeader as _,
- utils::{config::Settings, retry::with_retry},
-};
-
-use super::error::{IntmaxError, IntmaxErrorResponse};
-
-#[derive(Clone, Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct GasPriceSuccessResponse {
- pub max_fee_per_gas: u64,
- pub max_priority_fee_per_gas: u64,
-}
-
-#[derive(Serialize, Deserialize)]
-#[serde(untagged)]
-enum GasPriceResponse {
- Success(GasPriceSuccessResponse),
- Error(IntmaxErrorResponse),
-}
-
-pub async fn get_gas_estimation() -> Result {
- info!("Getting gas price");
- let settings = Settings::load().unwrap();
- let response = with_retry(|| async {
- reqwest::Client::new()
- .get(settings.api.gas_server_url.clone())
- .with_version_header()
- .send()
- .await
- })
- .await
- .map_err(|_| IntmaxError::NetworkError("failed to request circulation server".to_string()))?;
- let response_json: GasPriceResponse = response.json().await.map_err(|e| {
- IntmaxError::SerializeError(format!("failed to parse response: {}", e.to_string()))
- })?;
- match response_json {
- GasPriceResponse::Success(success) => Ok(success),
- GasPriceResponse::Error(error) => Err(IntmaxError::ServerError(error)),
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[tokio::test]
- async fn test_get_gas_price() {
- dotenv::dotenv().ok();
- let response = get_gas_estimation().await.unwrap();
- dbg!(response);
- }
-}
diff --git a/src/external_api/intmax/gnark.rs b/src/external_api/intmax/gnark.rs
index 079553e..3f91468 100644
--- a/src/external_api/intmax/gnark.rs
+++ b/src/external_api/intmax/gnark.rs
@@ -1,4 +1,4 @@
-use ethers::types::Address;
+use alloy::primitives::Address;
use intmax2_zkp::wrapper_config::plonky2_config::PoseidonBN128GoldilocksConfig;
use log::info;
@@ -43,13 +43,13 @@ impl GnarkStartProofInput {
#[derive(Serialize, Deserialize)]
#[serde(untagged)]
enum GnarkStartProofResponse {
- Success(GnarkStartProofSucessResponse),
+ Success(GnarkStartProofSuccessResponse),
Error(IntmaxErrorResponse),
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
-pub struct GnarkStartProofSucessResponse {
+pub struct GnarkStartProofSuccessResponse {
pub job_id: String,
pub status: String,
pub estimated_time: Option, // in milliseconds
@@ -58,13 +58,13 @@ pub struct GnarkStartProofSucessResponse {
#[derive(Serialize, Deserialize)]
#[serde(untagged)]
enum GnarkGetProofResponse {
- Success(GnarkGetProofSucessResponse),
+ Success(GnarkGetProofSuccessResponse),
Error(IntmaxErrorResponse),
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
-pub struct GnarkGetProofSucessResponse {
+pub struct GnarkGetProofSuccessResponse {
pub job_id: String,
pub status: String,
pub result: Option,
@@ -81,7 +81,7 @@ pub async fn gnark_start_prove(
base_url: &str,
address: Address,
plonky2_proof: ProofWithPublicInputs,
-) -> Result {
+) -> Result {
info!(
"gnark_start_prove with args address: {}, pis: {:?}",
address, plonky2_proof.public_inputs
@@ -98,7 +98,7 @@ pub async fn gnark_start_prove(
.await
.map_err(|_| IntmaxError::NetworkError("failed to request gnark server".to_string()))?;
let output: GnarkStartProofResponse = response.json().await.map_err(|e| {
- IntmaxError::SerializeError(format!("failed to parse response: {}", e.to_string()))
+ IntmaxError::SerializeError(format!("failed to parse response: {}", e))
})?;
match output {
GnarkStartProofResponse::Success(success) => Ok(success),
@@ -109,7 +109,7 @@ pub async fn gnark_start_prove(
pub async fn gnark_get_proof(
base_url: &str,
job_id: &str,
-) -> Result {
+) -> Result {
info!("gnark_get_proof with arg job_id: {}", job_id);
let response = with_retry(|| async {
reqwest::Client::new()
@@ -121,7 +121,7 @@ pub async fn gnark_get_proof(
.await
.map_err(|_| IntmaxError::NetworkError("failed to request gnark server".to_string()))?;
let output: GnarkGetProofResponse = response.json().await.map_err(|e| {
- IntmaxError::SerializeError(format!("failed to parse response: {}", e.to_string()))
+ IntmaxError::SerializeError(format!("failed to parse response: {}", e))
})?;
match output {
GnarkGetProofResponse::Success(success) => Ok(success),
diff --git a/src/external_api/intmax/mod.rs b/src/external_api/intmax/mod.rs
index bf9c54d..eba5323 100644
--- a/src/external_api/intmax/mod.rs
+++ b/src/external_api/intmax/mod.rs
@@ -1,7 +1,6 @@
pub mod availability;
pub mod circulation;
pub mod error;
-pub mod gas_estimation;
pub mod gnark;
pub mod withdrawal;
pub mod header;
\ No newline at end of file
diff --git a/src/external_api/intmax/withdrawal.rs b/src/external_api/intmax/withdrawal.rs
index 420344c..11d311f 100644
--- a/src/external_api/intmax/withdrawal.rs
+++ b/src/external_api/intmax/withdrawal.rs
@@ -1,19 +1,12 @@
-use ethers::{
- providers::{Http, PendingTransaction},
- types::{Address, Bytes, H256, U256},
-};
-use intmax2_zkp::ethereum_types::u32limb_trait::U32LimbTrait;
+use alloy::primitives::{Bytes, TxHash, B256};
use log::info;
use mining_circuit_v1::withdrawal::simple_withraw_circuit::SimpleWithdrawalPublicInputs;
use serde::{Deserialize, Serialize};
use serde_json::Value;
-use std::str::FromStr;
+use std::str::FromStr as _;
use crate::{
- external_api::{
- contracts::int1::{get_int1_contract_with_signer, int_1},
- intmax::header::VersionHeader as _,
- },
+ external_api::{contracts::int1::Int1Contract, intmax::header::VersionHeader as _},
utils::{
config::Settings,
network::{get_network, Network},
@@ -39,8 +32,8 @@ pub struct SubmitWithdrawalSuccess {
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
-enum SumbitWithdrawalResponse {
- Sucess(SubmitWithdrawalSuccess),
+enum SubmitWithdrawalResponse {
+ Success(SubmitWithdrawalSuccess),
Error(IntmaxErrorResponse),
}
@@ -48,13 +41,13 @@ enum SumbitWithdrawalResponse {
#[serde(rename_all = "camelCase")]
pub struct QueryWithdrawalSuccess {
pub status: String,
- pub transaction_hash: Option,
+ pub transaction_hash: Option,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
enum QueryWithdrawalResponse {
- Sucess(QueryWithdrawalSuccess),
+ Success(QueryWithdrawalSuccess),
Error(IntmaxErrorResponse),
}
@@ -82,17 +75,17 @@ async fn start_withdrawal(
let response: Value = response.json().await.map_err(|e| {
IntmaxError::SerializeError(format!(
"failed to parse response as json: {}",
- e.to_string()
+ e
))
})?;
- let response: SumbitWithdrawalResponse =
+ let response: SubmitWithdrawalResponse =
serde_json::from_value(response.clone()).map_err(|_| {
IntmaxError::SerializeError(format!("failed to parse response: {}", response))
})?;
match response {
- SumbitWithdrawalResponse::Sucess(success) => Ok(success.withdrawal_id),
- SumbitWithdrawalResponse::Error(error) => Err(IntmaxError::ServerError(error)),
+ SubmitWithdrawalResponse::Success(success) => Ok(success.withdrawal_id),
+ SubmitWithdrawalResponse::Error(error) => Err(IntmaxError::ServerError(error)),
}
}
@@ -114,7 +107,7 @@ async fn query_withdrawal(withdrawal_id: &str) -> Result Result Ok(success),
+ QueryWithdrawalResponse::Success(success) => Ok(success),
QueryWithdrawalResponse::Error(error) => Err(IntmaxError::ServerError(error)),
}
}
pub async fn submit_withdrawal(
+ int1: &Int1Contract,
pis: SimpleWithdrawalPublicInputs,
proof: &str,
-) -> Result {
+) -> Result {
info!("submit_withdrawal with args {:?} proof {}", pis, proof);
- let tx_hash = if get_network() == Network::Localnet {
- let tx_hash = localnet_withdrawal(pis, proof).await.unwrap();
- tx_hash
+ if get_network() == Network::Localnet {
+ let local_private_key: B256 =
+ "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
+ .parse()
+ .unwrap();
+ let proof_hex = Bytes::from_str(proof).unwrap();
+ let tx_hash = int1
+ .withdrawal(local_private_key, &pis, proof_hex.to_vec())
+ .await?;
+ Ok(tx_hash)
} else {
let withdrawal_id = start_withdrawal(pis, proof).await?;
let max_try = 5;
@@ -156,10 +157,7 @@ pub async fn submit_withdrawal(
info!("withdrawal is processing");
sleep_for(cooldown);
}
- "completed" => {
- let tx_hash = H256::from_str(&status.transaction_hash.unwrap()).unwrap();
- break tx_hash;
- }
+ "completed" => return Ok(status.transaction_hash.unwrap()),
"failed" => {
return Err(IntmaxError::InternalError(format!(
"withdrawal failed: {}",
@@ -180,57 +178,5 @@ pub async fn submit_withdrawal(
}
}
}
- };
- Ok(tx_hash)
-}
-
-async fn localnet_withdrawal(
- pis: SimpleWithdrawalPublicInputs,
- proof: &str,
-) -> anyhow::Result {
- // Hardhat's default private key for withdrawal
- let local_private_key =
- H256::from_str("0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a")
- .unwrap();
- let int1 = get_int1_contract_with_signer(local_private_key).await?;
- let public_inputs = int_1::WithdrawalPublicInputs {
- deposit_root: pis.deposit_root.to_bytes_be().try_into().unwrap(),
- nullifier: pis.nullifier.to_bytes_be().try_into().unwrap(),
- recipient: Address::from_slice(&pis.recipient.to_bytes_be()),
- token_index: pis.token_index,
- amount: U256::from_big_endian(&pis.amount.to_bytes_be()),
- };
- let proof = Bytes::from_str(proof)?;
- let tx = int1.withdraw(public_inputs, proof);
- let pending_tx: PendingTransaction = match tx.send().await {
- Ok(tx) => {
- sleep_for(5);
- tx
- }
- Err(e) => {
- return Err(anyhow::anyhow!("Error sending transaction: {:?}", e));
- }
- };
- Ok(pending_tx.tx_hash())
-}
-
-#[cfg(test)]
-mod tests {
- use intmax2_zkp::ethereum_types::{address::Address, bytes32::Bytes32, u256::U256};
-
- #[tokio::test]
- #[ignore]
- async fn test_submit_withdrawal() {
- let pis =
- mining_circuit_v1::withdrawal::simple_withraw_circuit::SimpleWithdrawalPublicInputs {
- deposit_root: Bytes32::default(),
- nullifier: Bytes32::default(),
- recipient: Address::default(),
- token_index: 0,
- amount: U256::default(),
- };
- let proof = "0x12345678";
- let tx_hash = super::submit_withdrawal(pis, proof).await.unwrap();
- println!("tx_hash: {:?}", tx_hash);
}
}
diff --git a/src/external_api/mod.rs b/src/external_api/mod.rs
index b63b57d..6d20559 100644
--- a/src/external_api/mod.rs
+++ b/src/external_api/mod.rs
@@ -1,3 +1,5 @@
pub mod contracts;
pub mod github;
+pub mod graph;
pub mod intmax;
+pub mod query;
diff --git a/src/external_api/query.rs b/src/external_api/query.rs
new file mode 100644
index 0000000..9dabe50
--- /dev/null
+++ b/src/external_api/query.rs
@@ -0,0 +1,163 @@
+use reqwest::{header, Response, Url};
+use serde::{de::DeserializeOwned, Deserialize, Serialize};
+
+use crate::utils::retry::with_retry;
+
+#[derive(Debug, Deserialize)]
+struct ErrorResponse {
+ error: String,
+ #[serde(default)]
+ message: Option,
+}
+
+#[derive(thiserror::Error, Debug)]
+pub enum RequestError {
+ #[error("Malformed URL: {0}")]
+ MalformedUrl(String),
+
+ #[error("Network error: {0}")]
+ NetworkError(String),
+
+ #[error("Serialization error: {0}")]
+ SerializeError(String),
+
+ #[error("Deserialization error: {0}")]
+ DeserializationError(String),
+
+ #[error("Request error: {0} - {1} - URL: {2} - Request: {3}")]
+ RequestError(
+ reqwest::StatusCode,
+ String,
+ String, // URL
+ String, // Request string
+ ),
+}
+
+pub async fn post_request(
+ base_url: &str,
+ endpoint: &str,
+ body: Option<&B>,
+) -> Result {
+ post_request_with_bearer_token(base_url, endpoint, None, body).await
+}
+
+pub async fn post_request_with_bearer_token(
+ base_url: &str,
+ endpoint: &str,
+ bearer_token: Option,
+ body: Option<&B>,
+) -> Result {
+ let url = format!("{base_url}{endpoint}");
+ let _ = Url::parse(&url)
+ .map_err(|e| RequestError::MalformedUrl(format!("Failed to parse URL {url}: {e}")))?;
+ let client = reqwest::Client::new();
+ let mut request = client.post(url.clone());
+ if let Some(token) = bearer_token {
+ request = request.header(header::AUTHORIZATION, token);
+ }
+ if let Some(body) = body {
+ request = request.json(body);
+ }
+ let response = with_retry(|| async { request.try_clone().unwrap().send().await })
+ .await
+ .map_err(|e| RequestError::NetworkError(e.to_string()))?;
+
+ // Serialize the body to a string for logging
+ let body_str = if let Some(body) = &body {
+ let body_str = serde_json::to_string(body)
+ .map_err(|e| RequestError::SerializeError(format!("Failed to serialize body: {e}")))?;
+ Some(body_str)
+ } else {
+ None
+ };
+ let body_size = body_str.as_ref().map(|s| s.len()).unwrap_or(0);
+ log::debug!("POST request url: {url} body size: {body_size} bytes");
+
+ handle_response(response, &url, &body_str).await
+}
+
+pub async fn get_request(
+ base_url: &str,
+ endpoint: &str,
+ query: Option,
+) -> Result
+where
+ Q: Serialize,
+ R: DeserializeOwned,
+{
+ let mut url = format!("{base_url}{endpoint}");
+ let _ = Url::parse(&url)
+ .map_err(|e| RequestError::MalformedUrl(format!("Failed to parse URL {url}: {e}")))?;
+ let query_str = query
+ .as_ref()
+ .map(|q| {
+ serde_qs::to_string(&q).map_err(|e| {
+ RequestError::SerializeError(format!("Failed to serialize query: {e}"))
+ })
+ })
+ .transpose()?;
+ if query_str.is_some() {
+ url = format!("{}?{}", url, query_str.as_ref().unwrap());
+ }
+ let client = reqwest::Client::new();
+ let response = with_retry(|| async { client.get(&url).send().await })
+ .await
+ .map_err(|e| RequestError::NetworkError(e.to_string()))?;
+ log::debug!("GET request url: {url}");
+ handle_response(response, &url, &query_str).await
+}
+
+async fn handle_response(
+ response: Response,
+ url: &str,
+ request_str: &Option,
+) -> Result {
+ let status = response.status();
+ if !status.is_success() {
+ let error_text = response
+ .text()
+ .await
+ .unwrap_or_else(|_| "Failed to read error response".to_string());
+ let error_message = match serde_json::from_str::(&error_text) {
+ Ok(error_resp) => error_resp.message.unwrap_or(error_resp.error),
+ Err(_) => error_text,
+ };
+ let abr_request = if log::log_enabled!(log::Level::Debug) {
+ // full request string
+ request_str.clone().unwrap_or_default()
+ } else {
+ // Truncate the request string to 500 characters if it is too long
+ request_str
+ .as_ref()
+ .map(|s| s.chars().take(500).collect::())
+ .unwrap_or_default()
+ };
+ return Err(RequestError::RequestError(
+ status,
+ error_message,
+ url.to_string(),
+ abr_request,
+ ));
+ }
+
+ let response_text = response
+ .text()
+ .await
+ .map_err(|e| RequestError::DeserializationError(format!("Failed to read response: {e}")))?;
+
+ match serde_json::from_str::(&response_text) {
+ Ok(result) => Ok(result),
+ Err(e) => {
+ let abr_response = if log::log_enabled!(log::Level::Debug) {
+ // full request string
+ response_text
+ } else {
+ // Truncate the response string to 500 characters if it is too long
+ response_text.chars().take(500).collect::()
+ };
+ Err(RequestError::DeserializationError(format!(
+ "Failed to deserialize response of url:{url} response:{abr_response}, error:{e}"
+ )))
+ }
+ }
+}
diff --git a/src/main.rs b/src/main.rs
index 28995c8..f3c5090 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
use clap::{arg, command, Parser};
use cli::{
- availability::check_avaliability, configure::select_network, console::print_error,
+ availability::check_availability, configure::select_network, console::print_error,
press_enter_to_continue, run,
};
use dotenv::dotenv;
@@ -43,7 +43,7 @@ async fn main() {
match set_up(is_interactive).await {
Ok(_) => {}
Err(e) => {
- print_error(format!("Error during setup: {}", e.to_string()));
+ print_error(format!("Error during setup: {}", e));
press_enter_to_continue();
return;
}
@@ -53,7 +53,7 @@ async fn main() {
match run(mode).await {
Ok(_) => {}
Err(e) => {
- print_error(format!("{}", e.to_string()));
+ print_error(format!("{:?}", e));
if is_interactive {
// Because Windows closes the console window immediately, we need to wait for the user to see the error message
press_enter_to_continue();
@@ -87,6 +87,6 @@ async fn set_up(is_interactive: bool) -> anyhow::Result<()> {
serde_json::to_string_pretty(&settings)?
);
- check_avaliability().await?;
+ check_availability().await?;
Ok(())
}
diff --git a/src/services/assets_status.rs b/src/services/assets_status.rs
index 6389e09..2296f8c 100644
--- a/src/services/assets_status.rs
+++ b/src/services/assets_status.rs
@@ -1,19 +1,11 @@
-use ethers::types::{Address, H256, U256};
-use intmax2_zkp::{
- common::deposit::get_pubkey_salt_hash, ethereum_types::u32limb_trait::U32LimbTrait,
- utils::leafable::Leafable as _,
-};
+use alloy::primitives::{Address, B256, U256};
+use intmax2_zkp::{common::deposit::get_pubkey_salt_hash, utils::leafable::Leafable as _};
use log::warn;
use mining_circuit_v1::claim::claim_inner_circuit::get_deposit_nullifier;
use crate::{
external_api::contracts::{
- events::{get_deposited_event_by_sender, Deposited},
- int1::{
- get_deposit_data, get_last_processed_deposit_id, get_withdrawal_nullifier_exists,
- DepositData,
- },
- minter::{get_long_term_claim_nullifier_exists, get_short_term_claim_nullifier_exists},
+ convert::convert_u256_to_alloy, events::Deposited, int1::DepositData,
},
state::state::State,
utils::derive_key::derive_salt_from_private_key_nonce,
@@ -41,10 +33,15 @@ pub struct AssetsStatus {
pub async fn fetch_assets_status(
state: &State,
deposit_address: Address,
- deposit_private_key: H256,
+ deposit_private_key: B256,
) -> anyhow::Result {
- let senders_deposits = get_deposited_event_by_sender(deposit_address).await?;
+ let graph_client = &state.graph_client;
+ let int1 = &state.int1;
+ let minter = &state.minter;
+ let senders_deposits = graph_client
+ .get_deposited_event_by_sender(deposit_address)
+ .await?;
let mut contained_indices = Vec::new();
let mut not_contained_indices = Vec::new();
for (index, event) in senders_deposits.iter().enumerate() {
@@ -64,13 +61,13 @@ pub async fn fetch_assets_status(
let mut pending_indices = Vec::new();
for &index in ¬_contained_indices {
let event = &senders_deposits[index];
- let deposit_data = get_deposit_data(event.deposit_id).await?;
+ let deposit_data = int1.get_deposit_data(event.deposit_id).await?;
if deposit_data.is_rejected {
rejected_indices.push(index);
} else if deposit_data == DepositData::default() {
cancelled_indices.push(index);
} else {
- let last_processed_deposit_id = get_last_processed_deposit_id().await?;
+ let last_processed_deposit_id = int1.get_last_processed_deposit_id().await?;
// this may occur because of the delay of the event log
if event.deposit_id < last_processed_deposit_id {
warn!(
@@ -89,7 +86,7 @@ pub async fn fetch_assets_status(
let salt = derive_salt_from_private_key_nonce(deposit_private_key, event.tx_nonce);
let nullifier =
get_pubkey_salt_hash(intmax2_zkp::ethereum_types::u256::U256::default(), salt);
- let is_exists = get_withdrawal_nullifier_exists(nullifier).await?;
+ let is_exists = int1.get_withdrawal_nullifier_exists(nullifier).await?;
if is_exists {
withdrawn_indices.push(index);
} else {
@@ -113,7 +110,7 @@ pub async fn fetch_assets_status(
.tree
.get_leaf(leaf_index as usize);
short_term_eligible_amounts.push(leaf.amount);
- short_term_eligible_indices.push(index as usize);
+ short_term_eligible_indices.push(index);
}
if let Some(leaf_index) = state.long_term_eligible_tree.get_leaf_index(deposit_index) {
let leaf = state
@@ -121,23 +118,25 @@ pub async fn fetch_assets_status(
.tree
.get_leaf(leaf_index as usize);
long_term_eligible_amounts.push(leaf.amount);
- long_term_eligible_indices.push(index as usize);
+ long_term_eligible_indices.push(index);
}
}
let mut short_term_claimed_indices = Vec::new();
let mut short_term_not_claimed_indices = Vec::new();
- let mut short_term_claimable_amount = U256::zero();
+ let mut short_term_claimable_amount = U256::default();
for (&index, &amount) in short_term_eligible_indices
.iter()
.zip(short_term_eligible_amounts.iter())
{
let event = &senders_deposits[index];
- let eligible_amount = U256::from_big_endian(&amount.to_bytes_be());
+ let eligible_amount = convert_u256_to_alloy(amount);
let salt = derive_salt_from_private_key_nonce(deposit_private_key, event.tx_nonce);
let nullifier = get_deposit_nullifier(&event.deposit(), salt);
- let is_exists = get_short_term_claim_nullifier_exists(nullifier).await?;
+ let is_exists = minter
+ .get_short_term_claim_nullifier_exists(nullifier)
+ .await?;
if is_exists {
short_term_claimed_indices.push(index);
} else {
@@ -149,17 +148,19 @@ pub async fn fetch_assets_status(
let mut long_term_claimed_indices = Vec::new();
let mut long_term_not_claimed_indices = Vec::new();
- let mut long_term_claimable_amount = U256::zero();
+ let mut long_term_claimable_amount = U256::default();
for (&index, &amount) in long_term_eligible_indices
.iter()
.zip(long_term_eligible_amounts.iter())
{
let event = &senders_deposits[index];
- let eligible_amount = U256::from_big_endian(&amount.to_bytes_be());
+ let eligible_amount = convert_u256_to_alloy(amount);
let salt = derive_salt_from_private_key_nonce(deposit_private_key, event.tx_nonce);
let nullifier = get_deposit_nullifier(&event.deposit(), salt);
- let is_exists = get_long_term_claim_nullifier_exists(nullifier).await?;
+ let is_exists = minter
+ .get_long_term_claim_nullifier_exists(nullifier)
+ .await?;
if is_exists {
long_term_claimed_indices.push(index);
} else {
@@ -209,10 +210,10 @@ impl AssetsStatus {
}
}
- /// Retruns the times of deposits that are not cancelled
+ /// Returns the times of deposits that are not cancelled
pub fn effective_deposit_times(&self) -> usize {
assert!(self.senders_deposits.len() >= self.cancelled_indices.len());
- self.senders_deposits.len() - self.cancelled_indices.len() // this never underflows
+ self.senders_deposits.len() - self.cancelled_indices.len() // this never undertows
}
pub fn no_remaining(&self) -> bool {
@@ -224,10 +225,18 @@ impl AssetsStatus {
#[cfg(test)]
mod tests {
+ use crate::utils::env_config::EnvConfig;
+
#[tokio::test]
#[ignore]
async fn test_assets_status() {
- let mut state = crate::test::get_dummy_state().await;
+ dotenv::dotenv().ok();
+ let _ = env_logger::builder()
+ .filter_level(log::LevelFilter::Info)
+ .try_init();
+
+ let env_config = EnvConfig::import_from_env().unwrap();
+ let mut state = crate::test::get_dummy_state(&env_config.rpc_url).await;
state.sync_trees().await.unwrap();
let dummy_key = crate::test::get_dummy_keys();
diff --git a/src/services/balance_transfer.rs b/src/services/balance_transfer.rs
index 6737895..bf70044 100644
--- a/src/services/balance_transfer.rs
+++ b/src/services/balance_transfer.rs
@@ -1,61 +1,45 @@
-use ethers::{
- providers::Middleware,
- types::{Address, Eip1559TransactionRequest, H256},
+use alloy::{
+ primitives::{Address, B256, U256},
+ providers::Provider as _,
+ rpc::types::TransactionRequest,
};
-use log::info;
use crate::{
- cli::console::{print_status, print_warning},
+ cli::console::print_warning,
external_api::contracts::{
error::BlockchainError,
- utils::{
- get_address, get_balance, get_client_with_signer, get_eip1559_fees, get_tx_receipt,
- },
+ handlers::send_transaction_with_gas_bump,
+ utils::{get_address_from_private_key, get_provider_with_signer, NormalProvider},
},
- utils::retry::with_retry,
};
pub async fn balance_transfer(
- deposit_private_key: H256,
+ provider: &NormalProvider,
+ deposit_private_key: B256,
to_address: Address,
) -> Result<(), BlockchainError> {
- let deposit_address = get_address(deposit_private_key);
- let balance = get_balance(deposit_address).await?;
- let client = get_client_with_signer(deposit_private_key).await?;
- let gas_limit = {
- with_retry(|| async {
- let tx = Eip1559TransactionRequest::new()
- .to(to_address)
- .value(balance);
- client.estimate_gas(&tx.into(), None).await
- })
- .await
- .map_err(|_| BlockchainError::NetworkError("Failed to estimate gas".to_string()))?
- };
- info!("Estimated gas limit: {}", gas_limit);
- let (max_gas_price, max_priority_fee_per_gas) = get_eip1559_fees().await?;
- let gas_price = max_gas_price + max_priority_fee_per_gas;
+ let signer = get_provider_with_signer(provider, deposit_private_key);
+ let deposit_address = get_address_from_private_key(deposit_private_key);
+ let balance = provider.get_balance(deposit_address).await?;
+ // todo: use estimate gas
+ let gas_limit = U256::from(10000);
+ let gas_price = U256::from(provider.get_gas_price().await?);
if balance < gas_price * gas_limit {
print_warning("Insufficient balance to transfer");
return Ok(());
}
let transfer_amount = balance - gas_price * gas_limit;
- let signer = get_client_with_signer(deposit_private_key).await?;
- let tx = Eip1559TransactionRequest::new()
+ let tx_request = TransactionRequest::default()
.to(to_address)
- .value(transfer_amount)
- .max_fee_per_gas(max_gas_price)
- .max_priority_fee_per_gas(max_priority_fee_per_gas);
- let pending_tx = signer
- .send_transaction(tx, None)
- .await
- .map_err(|_| BlockchainError::NetworkError("Failed to send transaction".to_string()))?;
- print_status(format!("Transfer tx hash: {:?}", pending_tx.tx_hash()));
- let reciept = get_tx_receipt(pending_tx.tx_hash()).await?;
- if reciept.status.unwrap() != 1.into() {
- print_warning("Transfer failed. Please retry.");
- }
- print_status("Transfer successful");
+ .value(transfer_amount);
+ send_transaction_with_gas_bump(
+ provider,
+ signer,
+ tx_request,
+ "send balance",
+ "deposit address",
+ )
+ .await?;
Ok(())
}
diff --git a/src/services/claim/claim.rs b/src/services/claim/claim.rs
index cf83cb8..a1a82d3 100644
--- a/src/services/claim/claim.rs
+++ b/src/services/claim/claim.rs
@@ -1,7 +1,7 @@
-use std::time::UNIX_EPOCH;
+use std::{str::FromStr, time::UNIX_EPOCH};
+use alloy::primitives::Bytes;
use anyhow::ensure;
-use contract::claim_tokens;
use mining_circuit_v1::claim::claim_circuit::ClaimPublicInputs;
use crate::{
@@ -10,6 +10,7 @@ use crate::{
contracts::events::Deposited,
intmax::gnark::{fetch_gnark_proof, gnark_start_prove},
},
+ services::utils::await_until_low_gas_price,
state::{key::Key, state::State},
utils::config::Settings,
};
@@ -129,7 +130,7 @@ async fn from_step4(state: &State, key: &Key) -> anyhow::Result<()> {
}
// Call contract
-async fn from_step5(_state: &State, key: &Key) -> anyhow::Result<()> {
+async fn from_step5(state: &State, key: &Key) -> anyhow::Result<()> {
print_status("Claim: calling contract");
let status = temp::ClaimStatus::new()?;
ensure!(status.next_step == temp::ClaimStep::ContractCall);
@@ -144,34 +145,39 @@ async fn from_step5(_state: &State, key: &Key) -> anyhow::Result<()> {
last_claim_hash,
};
temp::ClaimStatus::delete()?;
- claim_tokens(
- key.withdrawal_private_key,
- status.is_short_term,
- &claims,
- pis,
- &status.gnark_proof.unwrap(),
- )
- .await?;
+ let proof = Bytes::from_str(&status.gnark_proof.unwrap())?;
+ await_until_low_gas_price(&state.provider).await?;
+ state
+ .minter
+ .claim_tokens(
+ key.withdrawal_private_key,
+ status.is_short_term,
+ &claims,
+ &pis,
+ proof,
+ )
+ .await?;
Ok(())
}
#[cfg(test)]
mod tests {
- use crate::test::{get_dummy_keys, get_dummy_state};
+ use crate::{test::get_dummy_keys, utils::env_config::EnvConfig};
use super::*;
#[tokio::test]
#[ignore]
async fn test_claim_task() {
+ dotenv::dotenv().ok();
+ let env_config = EnvConfig::import_from_env().unwrap();
+ let mut state = crate::test::get_dummy_state(&env_config.rpc_url).await;
let dummy_key = get_dummy_keys();
-
- let mut state = get_dummy_state().await;
let assets_status = state.sync_and_fetch_assets(&dummy_key).await.unwrap();
let is_short_term = true;
let not_claimed_events = assets_status.get_not_claimed_events(is_short_term);
- assert!(not_claimed_events.len() > 0);
+ assert!(!not_claimed_events.is_empty());
single_claim_task(&mut state, &dummy_key, is_short_term, ¬_claimed_events)
.await
diff --git a/src/services/claim/contract.rs b/src/services/claim/contract.rs
deleted file mode 100644
index 11c5081..0000000
--- a/src/services/claim/contract.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-use std::str::FromStr;
-
-use ethers::{
- signers::Signer as _,
- types::{Address, Bytes, H256, U256},
-};
-use intmax2_zkp::ethereum_types::u32limb_trait::U32LimbTrait;
-use log::info;
-use mining_circuit_v1::claim::{claim_circuit::ClaimPublicInputs, mining_claim::MiningClaim};
-
-use crate::{
- cli::console::{print_log, print_status},
- external_api::contracts::{
- minter::{get_minter_contract_with_signer, minter_v1},
- utils::get_wallet,
- },
- services::utils::{await_until_low_gas_price, handle_contract_call, set_gas_price},
-};
-
-pub async fn claim_tokens(
- claim_key: H256,
- is_short_term: bool,
- claims: &[MiningClaim],
- pis: ClaimPublicInputs,
- proof: &str,
-) -> anyhow::Result<()> {
- info!(
- "Calling claim_tokens: claims {:?}, pis {:?}, proof {:?}",
- claims, pis, proof
- );
- let mut mint_claims = Vec::::new();
- for claim in claims {
- mint_claims.push(minter_v1::MintClaim {
- recipient: Address::from_slice(&claim.recipient.to_bytes_be()),
- nullifier: claim.nullifier.to_bytes_be().try_into().unwrap(),
- amount: U256::from_big_endian(&claim.amount.to_bytes_be()),
- });
- }
- let pis = minter_v1::ClaimPublicInputs {
- deposit_tree_root: pis.deposit_tree_root.to_bytes_be().try_into().unwrap(),
- eligible_tree_root: pis.eligible_tree_root.to_bytes_be().try_into().unwrap(),
- last_claim_hash: pis.last_claim_hash.to_bytes_be().try_into().unwrap(),
- };
- let proof = Bytes::from_str(proof).unwrap();
- let claim_address = get_wallet(claim_key).await?.address();
- print_status(format!("Claiming tokens for address: {}", claim_address));
-
- await_until_low_gas_price().await?;
- let minter = get_minter_contract_with_signer(claim_key).await?;
- let mut tx = minter.claim_tokens(
- is_short_term,
- mint_claims.clone(),
- pis.clone(),
- proof.clone(),
- );
- set_gas_price(&mut tx).await?;
- info!("Calling claim_tokens: tx {:?}", tx);
- let _tx_hash = handle_contract_call(tx, claim_address, "claim", "claim").await?;
- print_log(format!("Successfully claimed"));
- Ok(())
-}
diff --git a/src/services/claim/mod.rs b/src/services/claim/mod.rs
index eee5e81..41db3cb 100644
--- a/src/services/claim/mod.rs
+++ b/src/services/claim/mod.rs
@@ -7,8 +7,8 @@ use crate::{
use super::assets_status::AssetsStatus;
+#[allow(clippy::module_inception)]
pub mod claim;
-pub mod contract;
pub mod temp;
pub mod witness_generation;
@@ -24,7 +24,7 @@ pub async fn claim_task(
.get_not_claimed_events(is_short_term)
.chunks(MAX_CLAIMS)
{
- single_claim_task(state, key, is_short_term, &events)
+ single_claim_task(state, key, is_short_term, events)
.await
.map_err(|e| CLIError::InternalError(format!("Failed to claim: {:#}", e)))?;
}
diff --git a/src/services/claim/witness_generation.rs b/src/services/claim/witness_generation.rs
index 31640c9..efd129d 100644
--- a/src/services/claim/witness_generation.rs
+++ b/src/services/claim/witness_generation.rs
@@ -1,13 +1,10 @@
use anyhow::{ensure, Ok};
-use intmax2_zkp::{
- ethereum_types::{address::Address, bytes32::Bytes32, u32limb_trait::U32LimbTrait},
- utils::leafable::Leafable,
-};
+use intmax2_zkp::{ethereum_types::bytes32::Bytes32, utils::leafable::Leafable};
use log::info;
use mining_circuit_v1::claim::claim_inner_circuit::ClaimInnerValue;
use crate::{
- external_api::contracts::events::Deposited,
+ external_api::contracts::{convert::convert_address_to_intmax, events::Deposited},
services::claim::MAX_CLAIMS,
state::{key::Key, state::State},
utils::derive_key::{derive_pubkey_from_private_key, derive_salt_from_private_key_nonce},
@@ -23,7 +20,7 @@ pub async fn generate_claim_witness(
"Generating claim witness for {:?}. is_short_term = {}",
events, is_short_term
);
- ensure!(events.len() > 0, "No event to generate witness");
+ ensure!(!events.is_empty(), "No event to generate witness");
ensure!(
events.len() <= MAX_CLAIMS,
format!("Max {} events to generate witness", MAX_CLAIMS)
@@ -35,9 +32,9 @@ pub async fn generate_claim_witness(
&state.long_term_eligible_tree
};
- let eligible_tree_root: Bytes32 = eligible_tree.get_root().into();
+ let eligible_tree_root: Bytes32 = eligible_tree.get_root();
let pubkey = derive_pubkey_from_private_key(key.deposit_private_key);
- let recipient = Address::from_bytes_be(&key.withdrawal_address.as_bytes());
+ let recipient = convert_address_to_intmax(key.withdrawal_address);
let mut witnesses = Vec::new();
let mut prev_claim_hash = Bytes32::default();
for event in events {
diff --git a/src/services/mining/cancel.rs b/src/services/mining/cancel.rs
deleted file mode 100644
index 6b55ed2..0000000
--- a/src/services/mining/cancel.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use intmax2_zkp::ethereum_types::u32limb_trait::U32LimbTrait as _;
-
-use crate::{
- cli::console::print_log,
- external_api::contracts::{
- events::Deposited,
- int1::{get_int1_contract_with_signer, int_1},
- },
- services::utils::{await_until_low_gas_price, handle_contract_call, set_gas_price},
- state::{key::Key, state::State},
-};
-
-pub async fn cancel_task(_state: &State, key: &Key, event: Deposited) -> anyhow::Result<()> {
- let deposit = int_1::Deposit {
- recipient_salt_hash: event.recipient_salt_hash.to_bytes_be().try_into().unwrap(),
- token_index: event.token_index,
- amount: ethers::types::U256::from_big_endian(&event.amount.to_bytes_be()),
- };
- let deposit_address = key.deposit_address;
-
- await_until_low_gas_price().await?;
- let int1 = get_int1_contract_with_signer(key.deposit_private_key).await?;
- let mut tx = int1.cancel_deposit(event.deposit_id.into(), deposit.clone());
- set_gas_price(&mut tx).await?;
- let tx_hash = handle_contract_call(tx, deposit_address, "deposit", "cancel").await?;
- print_log(format!(
- "Cancelled deposit id {:?} with tx hash {:?}",
- event.deposit_id, tx_hash,
- ));
- Ok(())
-}
diff --git a/src/services/mining/deposit.rs b/src/services/mining/deposit.rs
deleted file mode 100644
index 57d9ffc..0000000
--- a/src/services/mining/deposit.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-use ethers::types::U256;
-use intmax2_zkp::{
- common::deposit::get_pubkey_salt_hash, ethereum_types::u32limb_trait::U32LimbTrait as _,
-};
-
-use crate::{
- cli::console::print_log,
- external_api::contracts::{int1::get_int1_contract_with_signer, utils::get_account_nonce},
- services::utils::{await_until_low_gas_price, handle_contract_call, set_gas_price},
- state::{key::Key, state::State},
- utils::derive_key::{derive_pubkey_from_private_key, derive_salt_from_private_key_nonce},
-};
-
-pub async fn deposit_task(_state: &State, key: &Key, mining_unit: U256) -> anyhow::Result<()> {
- let deposit_address = key.deposit_address;
- let nonce = get_account_nonce(deposit_address).await?;
- let salt = derive_salt_from_private_key_nonce(key.deposit_private_key, nonce);
- let pubkey = derive_pubkey_from_private_key(key.deposit_private_key);
- let pubkey_salt_hash: [u8; 32] = get_pubkey_salt_hash(pubkey, salt)
- .to_bytes_be()
- .try_into()
- .unwrap();
-
- let deposit_address = key.deposit_address;
-
- await_until_low_gas_price().await?;
- let int1 = get_int1_contract_with_signer(key.deposit_private_key).await?;
- let mut tx = int1
- .deposit_native_token(pubkey_salt_hash)
- .value(mining_unit);
- set_gas_price(&mut tx).await?;
- tx.tx.set_nonce(nonce);
- let _tx_hash = handle_contract_call(tx, deposit_address, "deposit", "deposit").await?;
- print_log(format!("Successfully deposited"));
- Ok(())
-}
-
-#[cfg(test)]
-mod tests {
- use crate::test::{get_dummy_keys, get_dummy_state};
-
- #[tokio::test]
- #[ignore]
- async fn test_deposit() {
- let state = get_dummy_state().await;
- let dummy_key = get_dummy_keys();
-
- let mining_uint = 100_000_000_000_000_000u128.into();
- super::deposit_task(&state, &dummy_key, mining_uint)
- .await
- .unwrap();
- }
-}
diff --git a/src/services/mining/deterministic_sleep.rs b/src/services/mining/deterministic_sleep.rs
index 4f870d1..d810fff 100644
--- a/src/services/mining/deterministic_sleep.rs
+++ b/src/services/mining/deterministic_sleep.rs
@@ -1,39 +1,47 @@
-use ethers::types::Address;
+use alloy::primitives::Address;
use log::info;
use rand::{Rng as _, SeedableRng as _};
use rand_chacha::ChaCha20Rng;
use crate::{
cli::console::print_log,
- external_api::contracts::events::{
- get_latest_deposit_timestamp, get_latest_withdrawal_timestamp,
- },
+ external_api::graph::client::GraphClient,
utils::{config::Settings, encryption::keccak256_hash, time::sleep_for},
};
/// Random sleep before deposit to improve privacy.
-pub async fn sleep_before_deposit(withdrawal_address: Address) -> anyhow::Result<()> {
- let last_withdrawal_time = get_latest_withdrawal_timestamp(withdrawal_address).await?;
+pub async fn sleep_before_deposit(
+ graph_client: &GraphClient,
+ withdrawal_address: Address,
+) -> anyhow::Result<()> {
+ let last_withdrawal_time = graph_client
+ .get_latest_withdrawal_timestamp(withdrawal_address)
+ .await?;
info!("last_withdrawal_time: {:?}", last_withdrawal_time);
if last_withdrawal_time.is_none() {
return Ok(()); // no withdrawal yet
}
let last_withdrawal_time = last_withdrawal_time.unwrap();
- let sleep_time = determin_sleep_time(last_withdrawal_time, withdrawal_address, "deposit");
+ let sleep_time = determine_sleep_time(last_withdrawal_time, withdrawal_address, "deposit");
let target_time = last_withdrawal_time + sleep_time;
sleep_if_needed(target_time, true).await;
Ok(())
}
/// Random sleep before withdrawal to improve privacy.
-pub async fn sleep_before_withdrawal(deposit_address: Address) -> anyhow::Result<()> {
- let last_deposit_time = get_latest_deposit_timestamp(deposit_address).await?;
+pub async fn sleep_before_withdrawal(
+ graph_client: &GraphClient,
+ deposit_address: Address,
+) -> anyhow::Result<()> {
+ let last_deposit_time: Option = graph_client
+ .get_latest_deposit_timestamp(deposit_address)
+ .await?;
info!("last_deposit_time: {:?}", last_deposit_time);
if last_deposit_time.is_none() {
return Ok(()); // no deposit yet
}
let last_deposit_time = last_deposit_time.unwrap();
- let sleep_time = determin_sleep_time(last_deposit_time, deposit_address, "withdrawal");
+ let sleep_time = determine_sleep_time(last_deposit_time, deposit_address, "withdrawal");
let target_time = last_deposit_time + sleep_time;
sleep_if_needed(target_time, false).await;
Ok(())
@@ -62,7 +70,7 @@ async fn sleep_if_needed(target_time: u64, is_deposit: bool) {
sleep_for(sleep_from_now);
}
-fn determin_sleep_time(last_time: u64, address: Address, random_nonce: &'static str) -> u64 {
+fn determine_sleep_time(last_time: u64, address: Address, random_nonce: &'static str) -> u64 {
let seed_str = format!("{}{}{}", last_time, address, random_nonce);
let seed_hash = keccak256_hash(&seed_str);
let mut rng = ChaCha20Rng::from_seed(seed_hash);
diff --git a/src/services/mining/mod.rs b/src/services/mining/mod.rs
index 4e24169..980d626 100644
--- a/src/services/mining/mod.rs
+++ b/src/services/mining/mod.rs
@@ -1,19 +1,21 @@
-use cancel::cancel_task;
-use deposit::deposit_task;
+use alloy::{primitives::U256, providers::Provider};
+use anyhow::Context;
use deterministic_sleep::{sleep_before_deposit, sleep_before_withdrawal};
-use ethers::types::U256;
+use intmax2_zkp::common::deposit::get_pubkey_salt_hash;
use withdrawal::withdrawal_task;
use crate::{
cli::console::print_warning,
+ external_api::contracts::convert::convert_u256_to_alloy,
state::{key::Key, state::State},
- utils::errors::CLIError,
+ utils::{
+ derive_key::{derive_pubkey_from_private_key, derive_salt_from_private_key_nonce},
+ errors::CLIError,
+ },
};
-use super::assets_status::AssetsStatus;
+use super::{assets_status::AssetsStatus, utils::await_until_low_gas_price};
-pub mod cancel;
-pub mod deposit;
pub mod deterministic_sleep;
pub mod withdrawal;
@@ -29,9 +31,18 @@ pub async fn mining_task(
if cancel_pending_deposits {
for &index in assets_status.pending_indices.iter() {
let event = assets_status.senders_deposits[index].clone();
- cancel_task(state, key, event).await.map_err(|e| {
- CLIError::InternalError(format!("Failed to cancel a pending deposit: {:#}", e))
- })?;
+ await_until_low_gas_price(&state.provider).await?;
+ state
+ .int1
+ .cancel_deposit(
+ key.deposit_private_key,
+ event.deposit_id,
+ event.recipient_salt_hash,
+ event.token_index,
+ convert_u256_to_alloy(event.amount),
+ )
+ .await
+ .context("Failed to cancel deposit")?;
}
}
@@ -39,19 +50,30 @@ pub async fn mining_task(
for &index in assets_status.rejected_indices.iter() {
print_warning(format!(
"Deposit address {:?} is rejected because of AML check. For more information, please refer to the documentation.",
- key.deposit_address
+ key.deposit_address
));
let event = assets_status.senders_deposits[index].clone();
- cancel_task(state, key, event).await.map_err(|e| {
- CLIError::InternalError(format!("Failed to cancel a rejected deposit: {:#}", e))
- })?;
+ await_until_low_gas_price(&state.provider).await?;
+ state
+ .int1
+ .cancel_deposit(
+ key.deposit_private_key,
+ event.deposit_id,
+ event.recipient_salt_hash,
+ event.token_index,
+ convert_u256_to_alloy(event.amount),
+ )
+ .await
+ .context("Failed to cancel rejected deposit")?;
+ }
+ if !assets_status.rejected_indices.is_empty() {
// Halt the CLI if a deposit is rejected to prevent further deposits
return Err(CLIError::InternalError("Deposit is rejected".to_string()).into());
}
// withdrawal
if !assets_status.not_withdrawn_indices.is_empty() {
- sleep_before_withdrawal(key.deposit_address).await?;
+ sleep_before_withdrawal(&state.graph_client, key.deposit_address).await?;
for &index in assets_status.not_withdrawn_indices.iter() {
let event = assets_status.senders_deposits[index].clone();
withdrawal_task(state, key, event)
@@ -64,10 +86,27 @@ pub async fn mining_task(
// deposit
if new_deposit {
- sleep_before_deposit(key.withdrawal_address).await?;
- deposit_task(state, key, mining_unit)
+ sleep_before_deposit(&state.graph_client, key.withdrawal_address).await?;
+ let deposit_address = key.deposit_address;
+ let nonce = state
+ .provider
+ .get_transaction_count(deposit_address)
+ .await?;
+ let salt = derive_salt_from_private_key_nonce(key.deposit_private_key, nonce);
+ let pubkey = derive_pubkey_from_private_key(key.deposit_private_key);
+ let pubkey_salt_hash = get_pubkey_salt_hash(pubkey, salt);
+ // execute deposit task
+ await_until_low_gas_price(&state.provider).await?;
+ state
+ .int1
+ .deposit_native_token(key.deposit_private_key, pubkey_salt_hash, mining_unit)
.await
- .map_err(|e| CLIError::InternalError(format!("Failed to deposit: {:#}", e)))?;
+ .with_context(|| {
+ format!(
+ "Failed to deposit to address {:?} with nonce {}",
+ key.deposit_address, nonce
+ )
+ })?;
return Ok(());
}
diff --git a/src/services/mining/withdrawal/mod.rs b/src/services/mining/withdrawal/mod.rs
index 08e6b2c..7248dbf 100644
--- a/src/services/mining/withdrawal/mod.rs
+++ b/src/services/mining/withdrawal/mod.rs
@@ -1,18 +1,18 @@
use std::time::UNIX_EPOCH;
+use alloy::providers::Provider as _;
use anyhow::ensure;
use mining_circuit_v1::withdrawal::simple_withraw_circuit::SimpleWithdrawalPublicInputs;
use crate::{
cli::console::print_status,
external_api::{
- contracts::{events::Deposited, utils::get_tx_receipt},
+ contracts::events::Deposited,
intmax::{
gnark::{fetch_gnark_proof, gnark_start_prove},
withdrawal::submit_withdrawal,
},
},
- services::utils::await_until_low_gas_price,
state::{key::Key, state::State},
utils::config::Settings,
};
@@ -43,7 +43,7 @@ pub async fn resume_withdrawal_task(state: &State, key: &Key) -> anyhow::Result<
// Generate witness
async fn from_step1(state: &State, key: &Key, event: Deposited) -> anyhow::Result<()> {
print_status("Withdrawal: generating withdrawal witness");
- let witness = witness_generation::generate_withdrawa_witness(state, key, event)?;
+ let witness = witness_generation::generate_withdrawal_witness(state, key, event)?;
let status = temp::WithdrawalStatus {
next_step: temp::WithdrawalStep::Plonky2Prove,
witness: witness.clone(),
@@ -116,7 +116,7 @@ async fn from_step4(state: &State, key: &Key) -> anyhow::Result<()> {
}
// Call contract
-async fn from_step5(_state: &State, _key: &Key) -> anyhow::Result<()> {
+async fn from_step5(state: &State, _key: &Key) -> anyhow::Result<()> {
print_status("Withdrawal: calling contract");
let status = temp::WithdrawalStatus::new()?;
ensure!(status.next_step == temp::WithdrawalStep::ContractCall);
@@ -127,34 +127,32 @@ async fn from_step5(_state: &State, _key: &Key) -> anyhow::Result<()> {
token_index: status.witness.deposit_leaf.token_index,
amount: status.witness.deposit_leaf.amount,
};
- await_until_low_gas_price().await?;
- let tx_hash = submit_withdrawal(pis, status.gnark_proof.as_ref().unwrap()).await?;
+ let tx_hash = submit_withdrawal(&state.int1, pis, status.gnark_proof.as_ref().unwrap()).await?;
// delete here because get_tx_receipt may fail, and we don't want to retry this step
temp::WithdrawalStatus::delete()?;
-
- print_status(format!("Withdral tx hash: {:?}", tx_hash));
- let tx_reciept = get_tx_receipt(tx_hash).await?;
- ensure!(
- tx_reciept.status == Some(ethers::types::U64::from(1)),
- "Withdrawal transaction failed"
- );
- print_status(format!("Succsesfully withdrawn"));
+ let receipt = state.provider.get_transaction_receipt(tx_hash).await?;
+ ensure!(receipt.is_some(), "Transaction receipt not found");
+ let receipt = receipt.unwrap();
+ ensure!(receipt.status(), "Transaction failed");
+ print_status("Successfully withdrawn".to_string());
Ok(())
}
#[cfg(test)]
mod tests {
- use crate::test::{get_dummy_keys, get_dummy_state};
+ use crate::{test::get_dummy_keys, utils::env_config::EnvConfig};
#[tokio::test]
#[ignore]
async fn test_withdrawal() {
- let mut state = get_dummy_state().await;
+ dotenv::dotenv().ok();
+ let env_config = EnvConfig::import_from_env().unwrap();
+ let mut state = crate::test::get_dummy_state(&env_config.rpc_url).await;
let dummy_key = get_dummy_keys();
let assets_status = state.sync_and_fetch_assets(&dummy_key).await.unwrap();
let events = assets_status.get_not_withdrawn_events();
- assert!(events.len() > 0);
+ assert!(!events.is_empty());
super::withdrawal_task(&mut state, &dummy_key, events[0].clone())
.await
@@ -164,7 +162,9 @@ mod tests {
#[tokio::test]
#[ignore]
async fn test_resume_withdrawal() {
- let mut state = get_dummy_state().await;
+ dotenv::dotenv().ok();
+ let env_config = EnvConfig::import_from_env().unwrap();
+ let mut state = crate::test::get_dummy_state(&env_config.rpc_url).await;
state.sync_trees().await.unwrap();
let dummy_key = get_dummy_keys();
super::resume_withdrawal_task(&state, &dummy_key)
diff --git a/src/services/mining/withdrawal/witness_generation.rs b/src/services/mining/withdrawal/witness_generation.rs
index de9aeb6..ae96586 100644
--- a/src/services/mining/withdrawal/witness_generation.rs
+++ b/src/services/mining/withdrawal/witness_generation.rs
@@ -1,17 +1,14 @@
-use intmax2_zkp::{
- ethereum_types::{address::Address, u32limb_trait::U32LimbTrait as _},
- utils::leafable::Leafable as _,
-};
+use intmax2_zkp::utils::leafable::Leafable as _;
use log::info;
use mining_circuit_v1::withdrawal::simple_withraw_circuit::SimpleWithdrawalValue;
use crate::{
- external_api::contracts::events::Deposited,
+ external_api::contracts::{convert::convert_address_to_intmax, events::Deposited},
state::{key::Key, state::State},
utils::derive_key::{derive_pubkey_from_private_key, derive_salt_from_private_key_nonce},
};
-pub fn generate_withdrawa_witness(
+pub fn generate_withdrawal_witness(
state: &State,
key: &Key,
event: Deposited,
@@ -23,7 +20,7 @@ pub fn generate_withdrawa_witness(
.get_index(event.deposit().hash())
.unwrap();
let deposit_merkle_proof = state.deposit_hash_tree.prove(deposit_index);
- let recipient = Address::from_bytes_be(key.withdrawal_address.as_bytes());
+ let recipient = convert_address_to_intmax(key.withdrawal_address);
let pubkey = derive_pubkey_from_private_key(key.deposit_private_key);
let salt = derive_salt_from_private_key_nonce(key.deposit_private_key, event.tx_nonce);
let deposit_leaf = event.deposit();
diff --git a/src/services/mod.rs b/src/services/mod.rs
index 9ca725c..7d65b0f 100644
--- a/src/services/mod.rs
+++ b/src/services/mod.rs
@@ -1,6 +1,6 @@
use crate::{
cli::{
- availability::check_avaliability,
+ availability::check_availability,
balance_validation::{
validate_deposit_address_balance, validate_withdrawal_address_balance,
},
@@ -10,10 +10,10 @@ use crate::{
state::{key::Key, state::State},
utils::{config::Settings, time::sleep_for},
};
+use alloy::primitives::{B256, U256};
use claim::claim_task;
-use ethers::types::{H256, U256};
use mining::mining_task;
-use utils::is_address_used;
+use utils::{await_until_graph_syncs, is_address_used};
pub mod assets_status;
pub mod balance_transfer;
@@ -25,7 +25,7 @@ pub mod utils;
// note: in legacy environment, there is no mining loop
pub async fn mining_loop(
state: &mut State,
- withdrawal_private_key: H256,
+ withdrawal_private_key: B256,
mining_unit: U256,
mining_times: u64,
) -> anyhow::Result<()> {
@@ -36,6 +36,7 @@ pub async fn mining_loop(
));
let assets_status = state.sync_and_fetch_assets(&key).await?;
validate_deposit_address_balance(
+ &state.provider,
&assets_status,
key.deposit_address,
mining_unit,
@@ -43,7 +44,8 @@ pub async fn mining_loop(
)
.await?;
loop {
- check_avaliability().await?;
+ check_availability().await?;
+ await_until_graph_syncs(&state.graph_client).await?;
let assets_status = state.sync_and_fetch_assets(&key).await?;
let is_qualified = !get_circulation(key.deposit_address).await?.is_excluded;
let will_deposit = assets_status.effective_deposit_times() < mining_times as usize
@@ -89,11 +91,12 @@ pub async fn mining_loop(
Ok(())
}
-pub async fn exit_loop(state: &mut State, withdrawal_private_key: H256) -> anyhow::Result<()> {
+pub async fn exit_loop(state: &mut State, withdrawal_private_key: B256) -> anyhow::Result<()> {
let key = Key::new(withdrawal_private_key, 0);
print_log(format!("Exit for deposit address{:?}", key.deposit_address));
loop {
- check_avaliability().await?;
+ check_availability().await?;
+ await_until_graph_syncs(&state.graph_client).await?;
let assets_status = state.sync_and_fetch_assets(&key).await?;
if assets_status.pending_indices.is_empty()
&& assets_status.rejected_indices.is_empty()
@@ -101,7 +104,7 @@ pub async fn exit_loop(state: &mut State, withdrawal_private_key: H256) -> anyho
{
break;
}
- mining_task(state, &key, &assets_status, false, true, 0.into()).await?;
+ mining_task(state, &key, &assets_status, false, true, U256::default()).await?;
common_loop_cool_down();
}
print_status(format!(
@@ -113,13 +116,14 @@ pub async fn exit_loop(state: &mut State, withdrawal_private_key: H256) -> anyho
pub async fn legacy_exit_loop(
state: &mut State,
- withdrawal_private_key: H256,
+ withdrawal_private_key: B256,
) -> anyhow::Result<()> {
let mut key_number = 0;
loop {
- check_avaliability().await?;
+ check_availability().await?;
+ await_until_graph_syncs(&state.graph_client).await?;
let key = Key::new(withdrawal_private_key, key_number);
- if !is_address_used(key.deposit_address).await {
+ if !is_address_used(&state.provider, key.deposit_address).await? {
print_status("exit loop finished".to_string());
return Ok(());
}
@@ -140,18 +144,19 @@ pub async fn legacy_exit_loop(
key_number += 1;
break;
}
- mining_task(state, &key, &assets_status, false, true, 0.into()).await?;
+ mining_task(state, &key, &assets_status, false, true, U256::default()).await?;
common_loop_cool_down();
}
}
}
-pub async fn claim_loop(state: &mut State, withdrawal_private_key: H256) -> anyhow::Result<()> {
+pub async fn claim_loop(state: &mut State, withdrawal_private_key: B256) -> anyhow::Result<()> {
let key = Key::new(withdrawal_private_key, 0);
for is_short_term in [true, false] {
- check_avaliability().await?;
- if !is_address_used(key.deposit_address).await {
+ check_availability().await?;
+ await_until_graph_syncs(&state.graph_client).await?;
+ if !is_address_used(&state.provider, key.deposit_address).await? {
print_status("claim loop finished".to_string());
return Ok(());
}
@@ -160,7 +165,12 @@ pub async fn claim_loop(state: &mut State, withdrawal_private_key: H256) -> anyh
if is_short_term { "short" } else { "long" }
));
let assets_status = state.sync_and_fetch_assets(&key).await?;
- validate_withdrawal_address_balance(&assets_status, key.withdrawal_address).await?;
+ validate_withdrawal_address_balance(
+ &state.provider,
+ &assets_status,
+ key.withdrawal_address,
+ )
+ .await?;
claim_task(state, &key, is_short_term, &assets_status).await?;
common_loop_cool_down();
}
@@ -173,14 +183,15 @@ pub async fn claim_loop(state: &mut State, withdrawal_private_key: H256) -> anyh
pub async fn legacy_claim_loop(
state: &mut State,
- withdrawal_private_key: H256,
+ withdrawal_private_key: B256,
) -> anyhow::Result<()> {
let mut key_number = 0;
loop {
for is_short_term in [true, false] {
- check_avaliability().await?;
+ check_availability().await?;
+ await_until_graph_syncs(&state.graph_client).await?;
let key = Key::new(withdrawal_private_key, key_number);
- if !is_address_used(key.deposit_address).await {
+ if !is_address_used(&state.provider, key.deposit_address).await? {
print_status("claim loop finished".to_string());
return Ok(());
}
@@ -191,7 +202,12 @@ pub async fn legacy_claim_loop(
if is_short_term { "short" } else { "long" }
));
let assets_status = state.sync_and_fetch_assets(&key).await?;
- validate_withdrawal_address_balance(&assets_status, key.withdrawal_address).await?;
+ validate_withdrawal_address_balance(
+ &state.provider,
+ &assets_status,
+ key.withdrawal_address,
+ )
+ .await?;
let assets_status = state.sync_and_fetch_assets(&key).await?;
claim_task(state, &key, is_short_term, &assets_status).await?;
common_loop_cool_down();
diff --git a/src/services/sync.rs b/src/services/sync.rs
index 8b40121..d8c8f6f 100644
--- a/src/services/sync.rs
+++ b/src/services/sync.rs
@@ -1,10 +1,8 @@
use crate::{
external_api::{
- contracts::{
- events::get_deposit_leaf_inserted_event,
- int1::{get_deposit_root, get_deposit_root_exits},
- },
+ contracts::{int1::Int1Contract, minter::MinterContract},
github::{fetch_latest_tree_from_github, BinTrees},
+ graph::client::GraphClient,
},
utils::{
bin_parser::{BinDepositTree, BinEligibleTree, DepositTreeInfo, EligibleTreeInfo},
@@ -14,7 +12,6 @@ use crate::{
time::sleep_for,
},
};
-
use anyhow::ensure;
use chrono::{NaiveDateTime, Utc};
use log::{info, warn};
@@ -36,7 +33,9 @@ pub enum Error {
const MAX_TRY_FETCH_TREE: usize = 10;
pub async fn sync_trees(
- last_deposit_block_number: &mut u64,
+ graph_client: &GraphClient,
+ int1: &Int1Contract,
+ minter: &MinterContract,
last_update: &mut NaiveDateTime,
deposit_hash_tree: &mut DepositHashTree,
short_term_eligible_tree: &mut EligibleTreeWithMap,
@@ -67,36 +66,41 @@ pub async fn sync_trees(
.map_err(|e| {
Error::NetworkError(format!("Failed to fetch latest tree from github: {}", e))
})?;
+ log::info!("fetched bin trees from github");
// retry if TreeRootSyncError occurs
let update = || async {
if let Some(bin_deposit_tree) = bin_deposit_tree {
- let (new_deposit_hash_tree, new_block_number) =
- parse_and_validate_bin_deposit_tree(bin_deposit_tree).await?;
+ let new_deposit_hash_tree =
+ parse_and_validate_bin_deposit_tree(int1, bin_deposit_tree).await?;
log::info!(
- "Fetched deposit tree with {} leaves from block {}",
+ "Fetched deposit tree with {} leaves",
new_deposit_hash_tree.tree.len(),
- new_block_number
);
*deposit_hash_tree = new_deposit_hash_tree;
- *last_deposit_block_number = new_block_number;
}
if let Some(bin_short_term_eligible_tree) = bin_short_term_eligible_tree {
- *short_term_eligible_tree =
- parse_and_validate_bin_eligible_tree(true, bin_short_term_eligible_tree)
- .await?;
+ *short_term_eligible_tree = parse_and_validate_bin_eligible_tree(
+ minter,
+ true,
+ bin_short_term_eligible_tree,
+ )
+ .await?;
}
if let Some(bin_long_term_eligible_tree) = bin_long_term_eligible_tree {
- *long_term_eligible_tree =
- parse_and_validate_bin_eligible_tree(false, bin_long_term_eligible_tree)
- .await?;
+ *long_term_eligible_tree = parse_and_validate_bin_eligible_tree(
+ minter,
+ false,
+ bin_long_term_eligible_tree,
+ )
+ .await?;
}
Result::<(), Error>::Ok(())
};
match update().await {
Ok(()) => break,
Err(e) => {
- warn!("Feched tree is invalid in try {}: {}", try_number, e);
+ warn!("Fetched tree is invalid in try {}: {}", try_number, e);
try_number += 1;
sleep_for(30);
}
@@ -104,24 +108,24 @@ pub async fn sync_trees(
}
}
// sync deposit tree only
- *last_deposit_block_number =
- sync_to_latest_deposit_tree(deposit_hash_tree, *last_deposit_block_number)
- .await
- .map_err(|e| {
- Error::SyncDepositTreeFromEventsError(format!("Failed to sync deposit tree: {}", e))
- })?;
+ sync_to_latest_deposit_tree(graph_client, int1, deposit_hash_tree)
+ .await
+ .map_err(|e| {
+ Error::SyncDepositTreeFromEventsError(format!("Failed to sync deposit tree: {}", e))
+ })?;
*last_update = now; // update last_update to now
Ok(())
}
async fn parse_and_validate_bin_deposit_tree(
+ int1: &Int1Contract,
bin_deposit_tree: BinDepositTree,
-) -> Result<(DepositHashTree, u64), Error> {
+) -> Result {
let deposit_tree_info: DepositTreeInfo = bin_deposit_tree
.try_into()
.map_err(|e: anyhow::Error| Error::TreeDeserializationError(e.to_string()))?;
- // check roots
- let deposit_root_exists = get_deposit_root_exits(deposit_tree_info.root)
+ let deposit_root_exists = int1
+ .get_deposit_root_exits(deposit_tree_info.root)
.await
.map_err(|e| Error::NetworkError(format!("Failed to get deposit root: {}", e)))?;
if !deposit_root_exists {
@@ -130,10 +134,11 @@ async fn parse_and_validate_bin_deposit_tree(
deposit_tree_info.root
)));
}
- Ok((deposit_tree_info.tree, deposit_tree_info.block_number))
+ Ok(deposit_tree_info.tree)
}
async fn parse_and_validate_bin_eligible_tree(
+ minter: &MinterContract,
is_short_term: bool,
bin_eligible_tree: BinEligibleTree,
) -> Result {
@@ -141,17 +146,13 @@ async fn parse_and_validate_bin_eligible_tree(
.try_into()
.map_err(|e: anyhow::Error| Error::TreeDeserializationError(e.to_string()))?;
let onchain_eligible_root = if is_short_term {
- crate::external_api::contracts::minter::get_short_term_eligible_root()
- .await
- .map_err(|e| {
- Error::NetworkError(format!("Failed to get short term eligible root: {}", e))
- })?
+ minter.get_short_term_eligible_root().await.map_err(|e| {
+ Error::NetworkError(format!("Failed to get short term eligible root: {}", e))
+ })?
} else {
- crate::external_api::contracts::minter::get_long_term_eligible_root()
- .await
- .map_err(|e| {
- Error::NetworkError(format!("Failed to get long term eligible root: {}", e))
- })?
+ minter.get_long_term_eligible_root().await.map_err(|e| {
+ Error::NetworkError(format!("Failed to get long term eligible root: {}", e))
+ })?
};
if onchain_eligible_root != eligible_tree_info.root {
return Err(Error::TreeRootSyncError(format!(
@@ -163,26 +164,25 @@ async fn parse_and_validate_bin_eligible_tree(
}
async fn sync_to_latest_deposit_tree(
+ graph_client: &GraphClient,
+ int1: &Int1Contract,
deposit_hash_tree: &mut DepositHashTree,
- from_block: u64,
-) -> anyhow::Result {
- log::info!("Syncing deposit tree from block {}", from_block);
- let events = get_deposit_leaf_inserted_event(from_block).await?;
+) -> anyhow::Result<()> {
+ let next_deposit_index = deposit_hash_tree.tree.len();
+ let events = graph_client
+ .get_deposit_leaf_inserted_event(next_deposit_index as u32)
+ .await?;
info!(
- "Syncing deposit tree from block {}, got {} events. Latest deposit_index={}",
- from_block,
+ "Syncing deposit tree, got {} events. Latest deposit_index={}",
events.len(),
events.last().map(|event| event.deposit_index).unwrap_or(0)
);
-
- let next_deposit_index = deposit_hash_tree.tree.len();
let mut to_append = events
.iter()
.filter(|event| event.deposit_index as usize >= next_deposit_index)
.collect::>();
to_append.sort_by_key(|event| event.deposit_index);
- let mut to_block_number = from_block;
for event in to_append {
ensure!(
event.deposit_index as usize == deposit_hash_tree.tree.len(),
@@ -191,17 +191,20 @@ async fn sync_to_latest_deposit_tree(
event.deposit_index
);
deposit_hash_tree.push(event.deposit_hash);
- to_block_number = event.block_number;
}
let local_root = deposit_hash_tree.get_root();
- let is_exists = get_deposit_root_exits(local_root).await?;
+ log::info!(
+ "Local deposit root: {}, total leaves: {}",
+ local_root,
+ deposit_hash_tree.tree.len()
+ );
+ let is_exists = int1.get_deposit_root_exits(local_root).await?;
ensure!(
is_exists,
"Local deposit root does not exist on chain: {}",
local_root
);
- let current_root = get_deposit_root().await?;
-
+ let current_root = int1.get_deposit_root().await?;
// this may occur because of the delay of the event log
if local_root != current_root {
warn!(
@@ -209,33 +212,39 @@ async fn sync_to_latest_deposit_tree(
local_root, current_root
);
}
- Ok(to_block_number)
+ Ok(())
}
#[cfg(test)]
mod tests {
- use crate::utils::{
- deposit_hash_tree::DepositHashTree, eligible_tree_with_map::EligibleTreeWithMap,
- };
+ use crate::utils::env_config::EnvConfig;
#[tokio::test]
#[ignore]
async fn sync_to_latest_deposit_tree() {
- let mut deposit_hash_tree = DepositHashTree::new();
- let mut short_term_eligible_tree = EligibleTreeWithMap::new();
- let mut long_term_eligible_tree = EligibleTreeWithMap::new();
- let mut last_deposit_block_number = 0;
+ dotenv::dotenv().ok();
+ let _ = env_logger::builder()
+ .filter_level(log::LevelFilter::Info)
+ .try_init();
+
+ let env_config = EnvConfig::import_from_env().unwrap();
+ dbg!(&env_config);
+
+ let mut state = crate::test::get_dummy_state(&env_config.rpc_url).await;
+
let mut last_update = chrono::NaiveDateTime::default();
super::sync_trees(
- &mut last_deposit_block_number,
+ &state.graph_client,
+ &state.int1,
+ &state.minter,
&mut last_update,
- &mut deposit_hash_tree,
- &mut short_term_eligible_tree,
- &mut long_term_eligible_tree,
+ &mut state.deposit_hash_tree,
+ &mut state.short_term_eligible_tree,
+ &mut state.long_term_eligible_tree,
)
.await
.unwrap();
- dbg!(deposit_hash_tree.tree.len());
+ dbg!(state.deposit_hash_tree.tree.len());
}
}
diff --git a/src/services/utils.rs b/src/services/utils.rs
index 639aa70..87ba4a0 100644
--- a/src/services/utils.rs
+++ b/src/services/utils.rs
@@ -1,106 +1,21 @@
-use anyhow::ensure;
-use ethers::{
- core::k256::ecdsa::SigningKey,
- middleware::SignerMiddleware,
- providers::{Http, Middleware, Provider},
- signers::Wallet,
- types::{Address, H256, U256},
+use alloy::{
+ primitives::{utils::format_units, Address, U256},
+ providers::Provider as _,
};
use crate::{
cli::console::{print_status, print_warning},
- external_api::{
- contracts::utils::{get_account_nonce, get_balance, get_client, get_gas_price},
- intmax::gas_estimation::get_gas_estimation,
- },
- utils::{config::Settings, env_config::EnvConfig, network::is_legacy, time::sleep_for},
+ external_api::{contracts::utils::NormalProvider, graph::client::GraphClient},
+ utils::{config::Settings, env_config::EnvConfig, time::sleep_for},
};
-pub async fn set_gas_price(
- tx: &mut ethers::contract::builders::ContractCall<
- SignerMiddleware, Wallet>,
- (),
- >,
-) -> anyhow::Result<()> {
- if is_legacy() {
- return Ok(()); // gas server does not support legacy environment.
- }
- let result = get_gas_estimation().await?;
- let inner_tx = tx
- .tx
- .as_eip1559_mut()
- .ok_or(anyhow::anyhow!("EIP-1559 tx expected"))?;
- *inner_tx = inner_tx
- .clone()
- .max_priority_fee_per_gas(result.max_priority_fee_per_gas)
- .max_fee_per_gas(result.max_fee_per_gas);
- Ok(())
-}
-
-pub async fn handle_contract_call(
- tx: ethers::contract::builders::ContractCall<
- SignerMiddleware, Wallet>,
- (),
- >,
- from_address: Address,
- from_name: S,
- tx_name: S,
-) -> anyhow::Result {
- loop {
- let result = tx.send().await;
- match result {
- Ok(tx) => {
- let pending_tx = tx;
- print_status(format!(
- "{} tx hash: {:?}",
- tx_name.to_string(),
- pending_tx.tx_hash()
- ));
- match pending_tx.await? {
- Some(tx_receipt) => {
- ensure!(
- tx_receipt.status.unwrap() == 1.into(),
- "{} tx failed",
- from_name.to_string()
- );
- return Ok(tx_receipt.transaction_hash);
- }
- None => {
- return Err(anyhow::anyhow!(
- "Transaction receipt is None. The transaction may not have been mined."
- ));
- }
- }
- }
- Err(e) => {
- let error_message = e.to_string();
- // insufficient balance
- if error_message.contains("-32000") {
- let estimate_gas = tx.estimate_gas().await?;
- let gas_price = get_client().await?.get_gas_price().await?;
- let value = tx.tx.value().cloned().unwrap_or_default();
- let necessary_balance = estimate_gas * gas_price + value;
- insuffient_balance_instruction(
- from_address,
- necessary_balance,
- &from_name.to_string(),
- )
- .await?;
- print_status(format!("Retrying {} transaction...", tx_name.to_string()));
- } else {
- return Err(anyhow::anyhow!("Error sending transaction: {:?}", e));
- }
- }
- }
- }
-}
-
-pub async fn insuffient_balance_instruction(
+pub async fn insufficient_balance_instruction(
+ provider: &NormalProvider,
address: Address,
required_balance: U256,
name: &str,
) -> anyhow::Result<()> {
- let balance = get_balance(address).await?;
+ let mut balance = provider.get_balance(address).await?;
if required_balance <= balance {
return Ok(());
}
@@ -112,62 +27,96 @@ pub async fn insuffient_balance_instruction(
pretty_format_u256(required_balance)
));
loop {
- let new_balance = get_balance(address).await?;
+ let new_balance = provider.get_balance(address).await?;
if new_balance > required_balance {
print_status("Balance updated");
sleep_for(10);
break;
+ } else if new_balance != balance {
+ print_warning(format!(
+ "Balance is still insufficient: {} ETH < {} ETH. Waiting for your deposit...",
+ pretty_format_u256(new_balance),
+ pretty_format_u256(required_balance)
+ ));
+ balance = new_balance;
}
sleep_for(10);
}
Ok(())
}
-pub async fn await_until_low_gas_price() -> anyhow::Result<()> {
+pub async fn await_until_low_gas_price(provider: &NormalProvider) -> anyhow::Result<()> {
let max_gas_price = EnvConfig::import_from_env()?.max_gas_price;
let settings = Settings::load()?;
- let high_gas_retry_inverval_in_sec = settings.service.high_gas_retry_inverval_in_sec;
+ let high_gas_retry_interval_in_sec = settings.service.high_gas_retry_interval_in_sec;
let _url = settings.service.repository_url;
loop {
- let current_gas_price = get_gas_price().await?;
+ let current_gas_price = U256::from(provider.get_gas_price().await?);
if current_gas_price <= max_gas_price {
log::info!(
"Current gas price: {} GWei is lower than max gas price: {} GWei",
- ethers::utils::format_units(current_gas_price.clone(), "gwei").unwrap(),
- ethers::utils::format_units(max_gas_price.clone(), "gwei").unwrap(),
+ format_units(current_gas_price, "gwei").unwrap(),
+ format_units(max_gas_price, "gwei").unwrap(),
);
break;
}
print_warning(format!(
"Current gas price: {} Gwei > max gas price: {} Gwei. Waiting for gas price to drop...",
- ethers::utils::format_units(current_gas_price.clone(), "gwei").unwrap(),
- ethers::utils::format_units(max_gas_price.clone(), "gwei").unwrap(),
+ format_units(current_gas_price, "gwei").unwrap(),
+ format_units(max_gas_price, "gwei").unwrap(),
));
- sleep_for(high_gas_retry_inverval_in_sec);
+ sleep_for(high_gas_retry_interval_in_sec);
+ }
+ Ok(())
+}
+
+pub async fn await_until_graph_syncs(graph: &GraphClient) -> anyhow::Result<()> {
+ let mut retries = 0;
+ loop {
+ match graph.health_check().await {
+ Ok(()) => {
+ log::info!("Graph is synced and healthy");
+ break;
+ }
+ Err(e) => {
+ print_warning(format!("Graph is not synced yet: {}. Retrying...", e));
+ sleep_for(10);
+ }
+ }
+ if retries >= 10 {
+ return Err(anyhow::anyhow!("Graph is not synced after 10 attempts"));
+ }
+ retries += 1;
}
Ok(())
}
-pub async fn is_address_used(deposit_address: Address) -> bool {
- get_account_nonce(deposit_address).await.unwrap() > 0
- || get_balance(deposit_address).await.unwrap() > 0.into()
+pub async fn is_address_used(
+ provider: &NormalProvider,
+ deposit_address: Address,
+) -> anyhow::Result {
+ let nonce = provider.get_transaction_count(deposit_address).await?;
+ let balance = provider.get_balance(deposit_address).await?;
+ Ok(nonce > 0 || balance > U256::default())
}
pub fn pretty_format_u256(value: U256) -> String {
- let s = ethers::utils::format_units(value, "ether").unwrap();
+ let s = format_units(value, "ether").unwrap();
let s = s.trim_end_matches('0').trim_end_matches('.');
s.to_string()
}
#[cfg(test)]
mod tests {
+ use alloy::primitives::utils::parse_ether;
+
#[test]
fn test_pretty_format() {
- let value = ethers::utils::parse_ether("1.01000000000000000").unwrap();
+ let value = parse_ether("1.01000000000000000").unwrap();
let pretty = super::pretty_format_u256(value);
assert_eq!(pretty, "1.01");
- let value = ethers::utils::parse_ether("1.00000000000000000").unwrap();
+ let value = parse_ether("1.00000000000000000").unwrap();
let pretty = super::pretty_format_u256(value);
assert_eq!(pretty, "1");
}
diff --git a/src/state/key.rs b/src/state/key.rs
index ea46d86..46fa9eb 100644
--- a/src/state/key.rs
+++ b/src/state/key.rs
@@ -1,22 +1,23 @@
-use ethers::types::{Address, H256};
+use alloy::primitives::{Address, B256};
use crate::{
- external_api::contracts::utils::get_address, utils::derive_key::derive_deposit_private_key,
+ external_api::contracts::utils::get_address_from_private_key,
+ utils::derive_key::derive_deposit_private_key,
};
#[derive(Debug, Clone)]
pub struct Key {
- pub deposit_private_key: H256,
+ pub deposit_private_key: B256,
pub deposit_address: Address,
- pub withdrawal_private_key: H256,
+ pub withdrawal_private_key: B256,
pub withdrawal_address: Address,
}
impl Key {
- pub fn new(withdrawal_private_key: H256, number: u64) -> Self {
- let withdrawal_address = get_address(withdrawal_private_key);
+ pub fn new(withdrawal_private_key: B256, number: u64) -> Self {
+ let withdrawal_address = get_address_from_private_key(withdrawal_private_key);
let deposit_private_key = derive_deposit_private_key(withdrawal_private_key, number);
- let deposit_address = get_address(deposit_private_key);
+ let deposit_address = get_address_from_private_key(deposit_private_key);
Self {
deposit_private_key,
deposit_address,
diff --git a/src/state/mod.rs b/src/state/mod.rs
index 9177ac0..d1c2bb8 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -1,4 +1,5 @@
pub mod key;
pub mod mode;
pub mod prover;
+#[allow(clippy::module_inception)]
pub mod state;
diff --git a/src/state/prover.rs b/src/state/prover.rs
index 454da8f..8eae8fd 100644
--- a/src/state/prover.rs
+++ b/src/state/prover.rs
@@ -18,6 +18,12 @@ pub struct Prover {
claim_wrapper_processor: OnceLock,
}
+impl Default for Prover {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl Prover {
pub fn new() -> Self {
Self {
diff --git a/src/state/state.rs b/src/state/state.rs
index 93f47ef..8af1afa 100644
--- a/src/state/state.rs
+++ b/src/state/state.rs
@@ -2,38 +2,84 @@ use chrono::NaiveDateTime;
use super::{key::Key, prover::Prover};
use crate::{
+ external_api::{
+ contracts::{
+ int1::Int1Contract,
+ minter::MinterContract,
+ token::TokenContract,
+ utils::{get_provider, NormalProvider},
+ },
+ graph::client::GraphClient,
+ },
services::{
assets_status::{fetch_assets_status, AssetsStatus},
sync::sync_trees,
},
- utils::{deposit_hash_tree::DepositHashTree, eligible_tree_with_map::EligibleTreeWithMap},
+ utils::{
+ config::Settings, deposit_hash_tree::DepositHashTree,
+ eligible_tree_with_map::EligibleTreeWithMap,
+ },
};
pub struct State {
pub deposit_hash_tree: DepositHashTree,
pub short_term_eligible_tree: EligibleTreeWithMap,
pub long_term_eligible_tree: EligibleTreeWithMap,
- pub last_tree_feched_at: NaiveDateTime,
- pub last_deposit_synced_block: u64,
+ pub last_tree_fetched_at: NaiveDateTime,
pub prover: Prover,
+
+ // block chain state
+ pub int1: Int1Contract,
+ pub minter: MinterContract,
+ pub token: TokenContract,
+ pub provider: NormalProvider,
+
+ pub graph_client: GraphClient,
}
impl State {
- pub fn new() -> Self {
+ pub fn new(rpc_url: &str) -> Self {
+ let settings = Settings::load().unwrap();
+ let provider = get_provider(rpc_url).unwrap();
+ let int1 = Int1Contract::new(
+ provider.clone(),
+ settings.blockchain.int1_address.parse().unwrap(),
+ );
+ let minter = MinterContract::new(
+ provider.clone(),
+ settings.blockchain.minter_address.parse().unwrap(),
+ );
+ let token = TokenContract::new(
+ provider.clone(),
+ settings.blockchain.token_address.parse().unwrap(),
+ );
+ let graph_client = GraphClient::new(
+ provider.clone(),
+ &settings.blockchain.graph_url,
+ None,
+ settings.blockchain.graph_health_check_timeout_in_sec,
+ );
+
Self {
deposit_hash_tree: DepositHashTree::new(),
short_term_eligible_tree: EligibleTreeWithMap::new(),
long_term_eligible_tree: EligibleTreeWithMap::new(),
- last_tree_feched_at: NaiveDateTime::default(),
- last_deposit_synced_block: 0,
+ last_tree_fetched_at: NaiveDateTime::default(),
prover: Prover::new(),
+ int1,
+ minter,
+ token,
+ provider,
+ graph_client,
}
}
pub async fn sync_trees(&mut self) -> anyhow::Result<()> {
sync_trees(
- &mut self.last_deposit_synced_block,
- &mut self.last_tree_feched_at,
+ &self.graph_client,
+ &self.int1,
+ &self.minter,
+ &mut self.last_tree_fetched_at,
&mut self.deposit_hash_tree,
&mut self.short_term_eligible_tree,
&mut self.long_term_eligible_tree,
@@ -44,6 +90,6 @@ impl State {
pub async fn sync_and_fetch_assets(&mut self, key: &Key) -> anyhow::Result {
self.sync_trees().await?;
- fetch_assets_status(&self, key.deposit_address, key.deposit_private_key).await
+ fetch_assets_status(self, key.deposit_address, key.deposit_private_key).await
}
}
diff --git a/src/test/mod.rs b/src/test/mod.rs
index 2d1c922..82114f2 100644
--- a/src/test/mod.rs
+++ b/src/test/mod.rs
@@ -1,22 +1,29 @@
+use alloy::primitives::B256;
use chrono::NaiveDateTime;
-use ethers::types::H256;
use intmax2_zkp::ethereum_types::u256::U256;
use mining_circuit_v1::eligible_tree::EligibleLeaf;
use num_bigint::BigUint;
use crate::{
- external_api::contracts::utils::get_address,
+ external_api::{
+ contracts::{
+ int1::Int1Contract,
+ minter::MinterContract,
+ token::TokenContract,
+ utils::{get_address_from_private_key, get_provider},
+ },
+ graph::client::GraphClient,
+ },
state::{key::Key, prover::Prover, state::State},
utils::{deposit_hash_tree::DepositHashTree, eligible_tree_with_map::EligibleTreeWithMap},
};
pub fn get_dummy_keys() -> Key {
- let deposit_private_key: H256 =
+ let deposit_private_key: B256 =
"0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e"
.parse()
.unwrap();
- let deposit_address = get_address(deposit_private_key);
-
+ let deposit_address = get_address_from_private_key(deposit_private_key);
Key {
deposit_private_key,
deposit_address,
@@ -25,7 +32,7 @@ pub fn get_dummy_keys() -> Key {
}
}
-pub async fn get_dummy_state() -> State {
+pub async fn get_dummy_state(rpc_url: &str) -> State {
let mut eligible_tree = EligibleTreeWithMap::new();
for i in 0..100 {
eligible_tree.push(EligibleLeaf {
@@ -33,14 +40,37 @@ pub async fn get_dummy_state() -> State {
amount: U256::try_from(BigUint::from(10u32).pow(18)).unwrap(),
});
}
+ let settings = crate::utils::config::Settings::load().unwrap();
+ let provider = get_provider(rpc_url).unwrap();
+ let int1 = Int1Contract::new(
+ provider.clone(),
+ settings.blockchain.int1_address.parse().unwrap(),
+ );
+ let minter = MinterContract::new(
+ provider.clone(),
+ settings.blockchain.minter_address.parse().unwrap(),
+ );
+ let token = TokenContract::new(
+ provider.clone(),
+ settings.blockchain.token_address.parse().unwrap(),
+ );
+ let graph_client = GraphClient::new(
+ provider.clone(),
+ &settings.blockchain.graph_url,
+ None,
+ settings.blockchain.graph_health_check_timeout_in_sec,
+ );
- let state = State {
+ State {
deposit_hash_tree: DepositHashTree::new(),
short_term_eligible_tree: eligible_tree.clone(),
long_term_eligible_tree: eligible_tree.clone(),
- last_tree_feched_at: NaiveDateTime::default(),
- last_deposit_synced_block: 0,
+ last_tree_fetched_at: NaiveDateTime::default(),
prover: Prover::new(),
- };
- state
+ int1,
+ minter,
+ token,
+ provider,
+ graph_client,
+ }
}
diff --git a/src/utils/bin_parser.rs b/src/utils/bin_parser.rs
index 0603f0b..12cc7ad 100644
--- a/src/utils/bin_parser.rs
+++ b/src/utils/bin_parser.rs
@@ -1,3 +1,5 @@
+use std::time::Instant;
+
use anyhow::ensure;
use intmax2_zkp::{
constants::DEPOSIT_TREE_HEIGHT,
@@ -36,16 +38,31 @@ impl TryFrom for EligibleTreeInfo {
type Error = anyhow::Error;
fn try_from(bin_tree: BinEligibleTree) -> anyhow::Result {
+ let instant = Instant::now();
let mut tree = EligibleTreeWithMap::new();
- for leaf in bin_tree.leaves {
+ for leaf in &bin_tree.leaves {
let amount: U256 = BigUint::from_bytes_le(&leaf.amount).try_into()?;
tree.push(EligibleLeaf {
deposit_index: leaf.deposit_index,
amount,
});
}
+ log::info!(
+ "Inserting {} eligible leaves took {:?}",
+ bin_tree.leaves.len(),
+ instant.elapsed()
+ );
+ ensure!(tree.tree.height() == ELIGIBLE_TREE_HEIGHT);
+
+ ensure!(
+ bin_tree.tree_height == ELIGIBLE_TREE_HEIGHT as u32,
+ "Tree height mismatch: expected {}, got {}",
+ ELIGIBLE_TREE_HEIGHT,
+ bin_tree.tree_height
+ );
+
let expected_root = Bytes32::from_bytes_be(&bin_tree.root_hash);
- let actual_root: Bytes32 = tree.get_root().try_into()?;
+ let actual_root = tree.get_root();
ensure!(
actual_root == expected_root,
"Root hash mismatch: expected {}, got {}",
@@ -107,13 +124,21 @@ impl TryFrom for DepositTreeInfo {
type Error = anyhow::Error;
fn try_from(bin_tree: BinDepositTree) -> anyhow::Result {
+ let instant = Instant::now();
let mut tree = DepositHashTree::new();
- for leaf_hash in bin_tree.leaf_hashes {
- let leaf_hash: Bytes32 = Bytes32::from_bytes_be(&leaf_hash);
+ for leaf_hash in &bin_tree.leaf_hashes {
+ let leaf_hash: Bytes32 = Bytes32::from_bytes_be(leaf_hash);
tree.push(leaf_hash);
}
+ log::info!(
+ "Inserting {} deposit leaves took {:?}",
+ bin_tree.leaf_hashes.len(),
+ instant.elapsed()
+ );
+ ensure!(tree.tree.height() == DEPOSIT_TREE_HEIGHT);
+
let expected_root = Bytes32::from_bytes_be(&bin_tree.root_hash);
- let actual_root: Bytes32 = tree.get_root().try_into()?;
+ let actual_root = tree.get_root();
ensure!(
actual_root == expected_root,
"Root hash mismatch: expected {}, got {}",
diff --git a/src/utils/config.rs b/src/utils/config.rs
index 9c353c3..55efd1f 100644
--- a/src/utils/config.rs
+++ b/src/utils/config.rs
@@ -31,7 +31,6 @@ pub struct Api {
pub withdrawal_gnark_prover_url: String,
pub claim_gnark_prover_url: String,
pub circulation_server_url: String,
- pub gas_server_url: String,
pub tree_data_repository: String,
pub tree_data_directory: String,
pub tree_data_branch: String,
@@ -43,6 +42,8 @@ pub struct Api {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Blockchain {
pub chain_id: u64,
+ pub graph_url: String,
+ pub graph_health_check_timeout_in_sec: u64,
pub int1_address: String,
pub minter_address: String,
pub token_address: String,
@@ -64,7 +65,7 @@ pub struct Service {
pub mining_min_cooldown_in_sec: u64,
pub mining_max_cooldown_in_sec: u64,
pub loop_cooldown_in_sec: u64,
- pub high_gas_retry_inverval_in_sec: u64,
+ pub high_gas_retry_interval_in_sec: u64,
}
impl Settings {
@@ -79,9 +80,9 @@ impl Settings {
}
}
-const BASE_SEPOLIA_CONFIG: &'static [u8] = include_bytes!("../../config/config.base-sepolia.toml");
-const BASE_CONFIG: &'static [u8] = include_bytes!("../../config/config.base.toml");
-const MAINNET_CONFIG: &'static [u8] = include_bytes!("../../config/config.mainnet.toml");
+const BASE_SEPOLIA_CONFIG: &[u8] = include_bytes!("../../config/config.base-sepolia.toml");
+const BASE_CONFIG: &[u8] = include_bytes!("../../config/config.base.toml");
+const MAINNET_CONFIG: &[u8] = include_bytes!("../../config/config.mainnet.toml");
pub fn create_config_files() -> anyhow::Result<()> {
create_file_with_content(&config_path(Network::BaseSepolia), BASE_SEPOLIA_CONFIG)?;
diff --git a/src/utils/deposit_hash_tree.rs b/src/utils/deposit_hash_tree.rs
index 9962aac..2a6d72d 100644
--- a/src/utils/deposit_hash_tree.rs
+++ b/src/utils/deposit_hash_tree.rs
@@ -35,6 +35,12 @@ pub struct DepositHashTree {
pub hashes: HashMap,
}
+impl Default for DepositHashTree {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl DepositHashTree {
pub fn new() -> Self {
Self {
@@ -50,11 +56,10 @@ impl DepositHashTree {
pub fn push(&mut self, hash: Bytes32) {
let index = self.tree.len();
self.tree.push(DepositHash(hash));
- if self.hashes.contains_key(&hash) {
- // don't overwrite the index if the hash already exists
- return;
+ if let std::collections::hash_map::Entry::Vacant(e) = self.hashes.entry(hash) {
+ e.insert(index as u32);
} else {
- self.hashes.insert(hash, index as u32);
+ // don't overwrite the index if the hash already exists
}
}
diff --git a/src/utils/derive_key.rs b/src/utils/derive_key.rs
index 71d82cc..700aa01 100644
--- a/src/utils/derive_key.rs
+++ b/src/utils/derive_key.rs
@@ -1,52 +1,92 @@
-use ethers::{types::H256, utils::keccak256};
+use alloy::primitives::{keccak256, B256};
use intmax2_zkp::{
common::salt::Salt,
ethereum_types::{bytes32::Bytes32, u256::U256, u32limb_trait::U32LimbTrait},
};
use std::str::FromStr;
-pub fn derive_salt_from_private_key_nonce(private_key: H256, nonce: u64) -> Salt {
+pub fn derive_salt_from_private_key_nonce(private_key: B256, nonce: u64) -> Salt {
let deposit_salt_prefix =
- H256::from_str("0xbf21c6520d666a4167f35c091393809e314f62a8e5cb1c166dd4dcac3abe53ad")
+ B256::from_str("0xbf21c6520d666a4167f35c091393809e314f62a8e5cb1c166dd4dcac3abe53ad")
.unwrap();
- let prefixed_private_key = vec![deposit_salt_prefix.as_bytes(), private_key.as_bytes()]
+ let prefixed_private_key = [deposit_salt_prefix.to_vec(), private_key.to_vec()]
.concat()
.to_vec();
let hashed_private_key = keccak256(keccak256(&prefixed_private_key));
- let hashed_private_key_with_nonce =
- vec![hashed_private_key.to_vec(), nonce.to_be_bytes().to_vec()]
- .concat()
- .to_vec();
- let salt_bytes = Bytes32::from_bytes_be(&keccak256(&hashed_private_key_with_nonce));
+ let hashed_private_key_with_nonce = [hashed_private_key.to_vec(), nonce.to_be_bytes().to_vec()]
+ .concat()
+ .to_vec();
+ let salt_bytes = Bytes32::from_bytes_be(keccak256(&hashed_private_key_with_nonce).as_ref());
Salt(salt_bytes.reduce_to_hash_out())
}
/// Get the public key from a private key
-pub fn derive_pubkey_from_private_key(private_key: H256) -> U256 {
+pub fn derive_pubkey_from_private_key(private_key: B256) -> U256 {
let deposit_salt_prefix =
- H256::from_str("0xbf21c6520d666a4167f35c091393809e314f62a8e5cb1c166dd4dcac3abe53ad")
+ B256::from_str("0xbf21c6520d666a4167f35c091393809e314f62a8e5cb1c166dd4dcac3abe53ad")
.unwrap();
- let prefixed_private_key = vec![deposit_salt_prefix.as_bytes(), private_key.as_bytes()]
+ let prefixed_private_key = [deposit_salt_prefix.to_vec(), private_key.to_vec()]
.concat()
.to_vec();
let hashed_private_key = keccak256(keccak256(&prefixed_private_key));
- let pubkey = U256::from_bytes_be(&hashed_private_key);
+ let pubkey = U256::from_bytes_be(hashed_private_key.as_ref());
pubkey
}
-pub fn derive_deposit_private_key(withdrawal_private_key: H256, number: u64) -> H256 {
+pub fn derive_deposit_private_key(withdrawal_private_key: B256, number: u64) -> B256 {
// random prefix
let prefix =
- H256::from_str("0x80059c155bb5d835019afc9e979c30cabd98c9d2141e67562b7bd636d7005cbc")
+ B256::from_str("0x80059c155bb5d835019afc9e979c30cabd98c9d2141e67562b7bd636d7005cbc")
.unwrap();
- let prefixed_private_key = vec![prefix.as_bytes(), withdrawal_private_key.as_bytes()]
+ let prefixed_private_key = [prefix.to_vec(), withdrawal_private_key.to_vec()]
.concat()
.to_vec();
let hashed_private_key = keccak256(keccak256(&prefixed_private_key));
let hashed_private_key_with_number =
- vec![hashed_private_key.to_vec(), number.to_be_bytes().to_vec()]
+ [hashed_private_key.to_vec(), number.to_be_bytes().to_vec()]
.concat()
.to_vec();
- let deposit_private_key = H256::from_slice(&keccak256(&hashed_private_key_with_number));
- deposit_private_key
+
+ keccak256(&hashed_private_key_with_number)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use alloy::primitives::B256;
+
+ fn private_key() -> B256 {
+ "0x8d7a905dad7deda35996c7127b0d6dd9921f7d45e3f8dce86e09370265bb7571"
+ .parse()
+ .unwrap()
+ }
+
+ #[test]
+ fn test_derive_salt_from_private_key_nonce() {
+ let nonce = 1;
+ let salt = derive_salt_from_private_key_nonce(private_key(), nonce);
+ assert_eq!(
+ salt.to_string(),
+ "0xf55e011dcea2bda3f2221d4ac872f681ce6b97dc9490c8d89afafb4e211d4ecc"
+ );
+ }
+
+ #[test]
+ fn test_derive_pubkey_from_private_key() {
+ let pubkey = derive_pubkey_from_private_key(private_key());
+ assert_eq!(
+ pubkey.to_string(),
+ "102824996597214675512080228570082669559954049667357114099795180313928773990100"
+ );
+ }
+
+ #[test]
+ fn test_derive_deposit_private_key() {
+ let number = 1;
+ let deposit_private_key = derive_deposit_private_key(private_key(), number);
+ assert_eq!(
+ deposit_private_key.to_string(),
+ "0x724bfaba8fdaa147295f428cc52c64d012c93056795d4c78ccdcb0d074e636c3"
+ );
+ }
}
diff --git a/src/utils/eligible_tree_with_map.rs b/src/utils/eligible_tree_with_map.rs
index 91e3a6b..98dcc2a 100644
--- a/src/utils/eligible_tree_with_map.rs
+++ b/src/utils/eligible_tree_with_map.rs
@@ -9,6 +9,12 @@ pub struct EligibleTreeWithMap {
pub map: HashMap, // key: deposit_index, value: eligible index
}
+impl Default for EligibleTreeWithMap {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl EligibleTreeWithMap {
pub fn new() -> Self {
let tree = EligibleTree::new(ELIGIBLE_TREE_HEIGHT);
diff --git a/src/utils/encryption.rs b/src/utils/encryption.rs
index 4e1abce..6fd8296 100644
--- a/src/utils/encryption.rs
+++ b/src/utils/encryption.rs
@@ -2,7 +2,7 @@ use aes_gcm::{aead::Aead, NewAead as _};
use serde::Serialize;
use sha3::{Digest, Keccak256};
-const NONCE: &'static str = "intmaxmining";
+const NONCE: &str = "intmaxmining";
pub fn encrypt(password: &str, value: &T) -> anyhow::Result> {
let password_hash = keccak256_hash(password);
diff --git a/src/utils/env_config.rs b/src/utils/env_config.rs
index 985bcac..6d2c705 100644
--- a/src/utils/env_config.rs
+++ b/src/utils/env_config.rs
@@ -1,7 +1,9 @@
-use std::{env, io::BufReader, path::PathBuf, str::FromStr as _};
-
-use ethers::types::{Address, H256, U256};
+use alloy::primitives::{
+ utils::{format_units, parse_units},
+ Address, B256, U256,
+};
use serde::{Deserialize, Serialize};
+use std::{env, io::BufReader, path::PathBuf, str::FromStr as _};
use super::{
config::Settings,
@@ -28,7 +30,7 @@ pub struct EnvConfig {
pub max_gas_price: U256,
pub encrypt: bool,
pub withdrawal_address: Address,
- pub withdrawal_private_key: Option,
+ pub withdrawal_private_key: Option,
pub encrypted_withdrawal_private_key: Option>,
pub mining_unit: U256,
pub mining_times: u64,
@@ -50,9 +52,9 @@ impl EnvConfig {
}
pub fn load_from_file(network: Network, i: usize) -> anyhow::Result {
- let file = std::fs::File::open(&env_config_path(network, i)).map_err(|_| {
+ let file = std::fs::File::open(env_config_path(network, i)).map_err(|_| {
anyhow::anyhow!(
- "Faield to open the config file at {:?}",
+ "Failed to open the config file at {:?}",
env_config_path(network, i)
)
})?;
@@ -125,7 +127,7 @@ impl EnvConfig {
fn to_string(&self) -> anyhow::Result {
let network = format!("{}", self.network);
- let max_gas_price = ethers::utils::format_units(self.max_gas_price, "gwei").unwrap();
+ let max_gas_price = format_units(self.max_gas_price, "gwei").unwrap();
let encrypt = if self.withdrawal_private_key.is_some() {
"false".to_string()
} else if self.encrypted_withdrawal_private_key.is_some() {
@@ -138,8 +140,8 @@ impl EnvConfig {
let encrypted_withdrawal_private_key = self
.encrypted_withdrawal_private_key
.clone()
- .map(|key| hex::encode(key));
- let mining_unit = ethers::utils::format_units(self.mining_unit, "ether").unwrap();
+ .map(hex::encode);
+ let mining_unit = format_units(self.mining_unit, "ether").unwrap();
let mining_times = self.mining_times.to_string();
Ok(EnvConfigString {
network,
@@ -157,7 +159,7 @@ impl EnvConfig {
fn from_string(value: &EnvConfigString) -> anyhow::Result {
let network =
Network::from_str(&value.network).map_err(|_| anyhow::anyhow!("Invalid network"))?;
- let max_gas_price: U256 = ethers::utils::parse_units(value.max_gas_price.clone(), "gwei")
+ let max_gas_price: U256 = parse_units(&value.max_gas_price, "gwei")
.map_err(|_| anyhow::anyhow!("failed to parse MAX_GAS_PRICE"))?
.into();
let encrypt = if value.encrypt == "true" {
@@ -179,7 +181,7 @@ impl EnvConfig {
.map_err(|_| anyhow::anyhow!("failed to parse WITHDRAWAL_ADDRESS"))?;
let withdrawal_private_key = if !encrypt {
- let withdrawal_private_key: H256 = value
+ let withdrawal_private_key: B256 = value
.withdrawal_private_key
.as_ref()
.unwrap()
@@ -199,7 +201,7 @@ impl EnvConfig {
None
};
- let mining_unit: U256 = ethers::utils::parse_units(value.mining_unit.clone(), "ether")
+ let mining_unit: U256 = parse_units(&value.mining_unit, "ether")
.map_err(|_| anyhow::anyhow!("failed to parse MINING_UNIT"))?
.into();
let mining_times: u64 = value
@@ -237,9 +239,14 @@ struct EnvConfigString {
#[cfg(test)]
mod tests {
- use ethers::{types::U256, utils::format_units};
+ use alloy::primitives::{
+ utils::{format_units, parse_units},
+ B256, U256,
+ };
- use crate::{external_api::contracts::utils::get_address, utils::network::Network};
+ use crate::{
+ external_api::contracts::utils::get_address_from_private_key, utils::network::Network,
+ };
#[test]
fn load_env_test() {
@@ -250,17 +257,17 @@ mod tests {
#[test]
fn test_env_config_string_conversion() {
- let key = ethers::types::H256::random();
- let address = get_address(key);
+ let key = B256::random();
+ let address = get_address_from_private_key(key);
let env_config = super::EnvConfig {
- network: Network::Holesky,
+ network: Network::BaseSepolia,
rpc_url: "http://localhost:8545".to_string(),
- max_gas_price: 30_000_000_000u64.into(),
+ max_gas_price: U256::from(30_000_000_000u64),
encrypt: false,
withdrawal_address: address,
withdrawal_private_key: Some(key),
encrypted_withdrawal_private_key: None,
- mining_unit: 100_000_000_000_000_000u128.into(),
+ mining_unit: U256::from(100_000_000_000_000_000u128),
mining_times: 10,
};
let env_config_string = env_config.to_string().unwrap();
@@ -270,17 +277,17 @@ mod tests {
#[test]
fn test_export_and_import_config() {
- let key = ethers::types::H256::random();
- let address = get_address(key);
+ let key = B256::random();
+ let address = get_address_from_private_key(key);
let env_config = super::EnvConfig {
- network: Network::Holesky,
+ network: Network::BaseSepolia,
rpc_url: "http://localhost:8545".to_string(),
- max_gas_price: 30_000_000_000u64.into(),
+ max_gas_price: U256::from(30_000_000_000u64),
withdrawal_address: address,
encrypt: false,
withdrawal_private_key: Some(key),
encrypted_withdrawal_private_key: None,
- mining_unit: 100_000_000_000_000_000u128.into(),
+ mining_unit: U256::from(100_000_000_000_000_000u128),
mining_times: 10,
};
env_config.export_to_env().unwrap();
@@ -293,9 +300,7 @@ mod tests {
fn mini_test() {
let amount = U256::from(100000000000000000u128);
let amount_str: String = format_units(amount, "gwei").unwrap();
- let recover: U256 = ethers::utils::parse_units(amount_str, "gwei")
- .unwrap()
- .into();
+ let recover: U256 = parse_units(&amount_str, "gwei").unwrap().into();
assert_eq!(amount, recover);
}
}
diff --git a/src/utils/env_validation.rs b/src/utils/env_validation.rs
index 431330c..e8cd193 100644
--- a/src/utils/env_validation.rs
+++ b/src/utils/env_validation.rs
@@ -1,9 +1,14 @@
+use alloy::{
+ primitives::{utils::parse_ether, U256},
+ providers::{Provider, ProviderBuilder},
+};
+use reqwest::Url;
+
use super::{
config::Settings,
env_config::EnvConfig,
network::{get_network, Network},
};
-use ethers::{providers::Middleware as _, types::U256};
pub fn get_allowed_mining_times() -> Vec {
let network = get_network();
@@ -11,8 +16,6 @@ pub fn get_allowed_mining_times() -> Vec {
vec![1, 5, 10]
} else if network == Network::Base {
vec![1, 10]
- } else if network == Network::Holesky {
- vec![1, 5, 10]
} else {
vec![10]
}
@@ -26,8 +29,8 @@ pub async fn validate_env_config(env: &EnvConfig) -> anyhow::Result<()> {
}
fn validate_mining_unit(mining_unit: U256) -> anyhow::Result<()> {
- let one_tenth: U256 = ethers::utils::parse_ether("0.1").unwrap().into();
- let one: U256 = ethers::utils::parse_ether("1").unwrap().into();
+ let one_tenth: U256 = parse_ether("0.1").unwrap();
+ let one: U256 = parse_ether("1").unwrap();
if mining_unit != one_tenth && mining_unit != one {
anyhow::bail!("MINING_UNIT environment variable must be either '1' or '0.1'");
}
@@ -46,10 +49,14 @@ fn validate_mining_times(mining_times: u64) -> anyhow::Result<()> {
}
pub async fn validate_rpc_url(rpc_url: &str) -> anyhow::Result<()> {
- let client = ethers::providers::Provider::::try_from(rpc_url)?;
- let chain_id = client.get_chainid().await?;
+ let rpc_url: Url = rpc_url
+ .parse()
+ .map_err(|e| anyhow::anyhow!("Failed to parse RPC URL {}: {}", rpc_url, e))?;
+
+ let client = ProviderBuilder::new().connect_http(rpc_url);
+ let chain_id = client.get_chain_id().await?;
let setting = Settings::load()?;
- if chain_id != setting.blockchain.chain_id.into() {
+ if chain_id != setting.blockchain.chain_id {
return Err(anyhow::anyhow!(
"RPC URL chain id {} does not match the expected chain id {}",
chain_id,
diff --git a/src/utils/errors.rs b/src/utils/errors.rs
index e5238a6..7cf182c 100644
--- a/src/utils/errors.rs
+++ b/src/utils/errors.rs
@@ -1,28 +1,17 @@
-use std::fmt;
-
-#[derive(Debug)]
+#[derive(Debug, thiserror::Error)]
pub enum CLIError {
+ #[error("Version error: {0}")]
VersionError(String),
+ #[error("IO error: {0}")]
IoError(std::io::Error),
+ #[error("Environment variable error: {0}")]
EnvError(String),
+ #[error("Internal error: {0}")]
InternalError(String),
+ #[error("Balance error: {0}")]
BalanceError(String),
+ #[error("Parse error: {0}")]
ParseError(String),
+ #[error("Network error: {0}")]
NetworkError(String),
}
-
-impl fmt::Display for CLIError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self {
- CLIError::VersionError(msg) => write!(f, "Version error: {}", msg),
- CLIError::IoError(err) => write!(f, "IO error: {}", err),
- CLIError::EnvError(msg) => write!(f, "Environment variable error: {}", msg),
- CLIError::InternalError(msg) => write!(f, "Internal error: {}", msg),
- CLIError::BalanceError(msg) => write!(f, "Balance error: {}", msg),
- CLIError::ParseError(msg) => write!(f, "Parse error: {}", msg),
- CLIError::NetworkError(msg) => write!(f, "Network error: {}", msg),
- }
- }
-}
-
-impl std::error::Error for CLIError {}
diff --git a/src/utils/network.rs b/src/utils/network.rs
index fc5c1a7..f19cf4e 100644
--- a/src/utils/network.rs
+++ b/src/utils/network.rs
@@ -1,30 +1,20 @@
-use std::{env, fmt::Display, str::FromStr};
-
use serde::{Deserialize, Serialize};
-use strum::EnumIter;
+use std::{env, fmt::Display, str::FromStr};
+use strum_macros::EnumIter;
-#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, EnumIter)]
+#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, EnumIter, Default)]
pub enum Network {
Localnet,
- Sepolia,
- Holesky,
+ #[default]
BaseSepolia,
Base,
Mainnet,
}
-impl Default for Network {
- fn default() -> Self {
- Network::BaseSepolia
- }
-}
-
impl Display for Network {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Network::Localnet => write!(f, "localnet"),
- Network::Sepolia => write!(f, "sepolia"),
- Network::Holesky => write!(f, "holesky"),
Network::BaseSepolia => write!(f, "base-sepolia"),
Network::Base => write!(f, "base"),
Network::Mainnet => write!(f, "mainnet"),
@@ -38,8 +28,6 @@ impl FromStr for Network {
fn from_str(s: &str) -> Result {
match s {
"localnet" => Ok(Network::Localnet),
- "sepolia" => Ok(Network::Sepolia),
- "holesky" => Ok(Network::Holesky),
"mainnet" => Ok(Network::Mainnet),
"base" => Ok(Network::Base),
"base-sepolia" => Ok(Network::BaseSepolia),
@@ -54,8 +42,5 @@ pub fn get_network() -> Network {
}
pub fn is_legacy() -> bool {
- get_network() == Network::Mainnet || get_network() == Network::Holesky
+ get_network() == Network::Mainnet
}
-
-#[cfg(test)]
-mod tests {}