From 0807ed00fd404ff9584c201cf5f0611372b26cb0 Mon Sep 17 00:00:00 2001 From: greged93 <82421016+greged93@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:16:16 +0100 Subject: [PATCH] dev: bump deps (#747) * bump jsonrpsee * bump reth * bump rust in CI --------- Co-authored-by: Elias Tazartes <66871571+Eikix@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- Cargo.lock | 644 ++++++++++-------- Cargo.toml | 8 +- rust-toolchain | 2 +- src/config.rs | 2 +- src/eth_provider/contracts/erc20.rs | 4 +- src/eth_provider/database/types/serde/mod.rs | 2 +- .../database/types/transaction.rs | 6 +- src/eth_provider/error.rs | 6 - src/eth_provider/provider.rs | 58 +- src/eth_rpc/api/eth_api.rs | 30 +- src/eth_rpc/api/web3_api.rs | 4 +- src/eth_rpc/mod.rs | 9 +- src/eth_rpc/rpc.rs | 4 +- src/eth_rpc/servers/eth_rpc.rs | 30 +- src/eth_rpc/servers/web3_rpc.rs | 4 +- src/models/felt.rs | 20 +- src/test_utils/eoa.rs | 26 +- src/test_utils/evm_contract.rs | 6 +- src/test_utils/mongo/mod.rs | 4 +- src/test_utils/sequencer/mod.rs | 6 +- tests/alchemy.rs | 15 +- tests/eth_provider.rs | 2 +- 23 files changed, 482 insertions(+), 412 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1d0ec7e4..4d5e0566f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: profile: minimal components: llvm-tools-preview, rustfmt, clippy override: true - toolchain: 1.74.0 + toolchain: 1.75.0 - name: Retrieve cached dependencies uses: Swatinem/rust-cache@v2 - name: Setup coverage env diff --git a/Cargo.lock b/Cargo.lock index 2c81d8941..dbc2e5230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -98,11 +98,22 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4df496257fe2fae392687ef30207325c50c68520108a94798b0c6cc1a6102f70" dependencies = [ + "alloy-rlp", "num_enum", "serde", "strum 0.25.0", ] +[[package]] +name = "alloy-genesis" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fcbf995278007c19b75e40d4fda7fd477e2d1598" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rpc-types", + "serde", +] + [[package]] name = "alloy-json-abi" version = "0.5.2" @@ -153,6 +164,29 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "alloy-primitives" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "getrandom", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + [[package]] name = "alloy-rlp" version = "0.3.3" @@ -176,6 +210,44 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "alloy-rpc-engine-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fcbf995278007c19b75e40d4fda7fd477e2d1598" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rlp", + "alloy-rpc-types", + "jsonrpsee-types 0.20.3", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-rpc-trace-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fcbf995278007c19b75e40d4fda7fd477e2d1598" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rpc-types", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-rpc-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#fcbf995278007c19b75e40d4fda7fd477e2d1598" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rlp", + "itertools 0.12.1", + "jsonrpsee-types 0.20.3", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "alloy-sol-type-parser" version = "0.5.2" @@ -185,6 +257,22 @@ dependencies = [ "winnow", ] +[[package]] +name = "alloy-trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59974c3c7778ebbcd73356a430fd4608aaf0630b1fdb4f5337bfd70f40b66618" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rlp", + "derive_more", + "hashbrown 0.14.2", + "nybbles", + "serde", + "smallvec", + "tracing", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -254,6 +342,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arc-swap" version = "1.6.0" @@ -500,15 +594,6 @@ dependencies = [ "zstd-safe 7.0.0", ] -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener", -] - [[package]] name = "async-trait" version = "0.1.74" @@ -540,6 +625,16 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "aurora-engine-modexp" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfacad86e9e138fca0670949eb8ed4ffdf73a55bded8887efe0863cd1a3a6f70" +dependencies = [ + "hex", + "num", +] + [[package]] name = "auto_impl" version = "1.1.0" @@ -916,8 +1011,9 @@ dependencies = [ [[package]] name = "c-kzg" -version = "0.1.0" -source = "git+https://github.com/ethereum/c-kzg-4844?rev=f5f6f863d475847876a2bd5ee252058d37c3a15d#f5f6f863d475847876a2bd5ee252058d37c3a15d" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32700dc7904064bb64e857d38a1766607372928e2466ee5f02a869829b3297d7" dependencies = [ "bindgen", "blst", @@ -928,19 +1024,6 @@ dependencies = [ "serde", ] -[[package]] -name = "c-kzg" -version = "0.1.0" -source = "git+https://github.com/ethereum/c-kzg-4844#e266280d88f006b23925c5062476b316d5407cb1" -dependencies = [ - "bindgen", - "blst", - "cc", - "glob", - "hex", - "libc", -] - [[package]] name = "cairo-felt" version = "0.8.2" @@ -1619,8 +1702,8 @@ checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" [[package]] name = "codecs-derive" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +version = "0.1.0-alpha.16" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.16#d8a9b581da3bf82d03a9b7cb36f0d81765e08523" dependencies = [ "convert_case 0.6.0", "parity-scale-codec", @@ -2826,12 +2909,6 @@ dependencies = [ "yansi 0.5.1", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "eyre" version = "0.6.9" @@ -3026,7 +3103,7 @@ dependencies = [ "path-slash", "regex", "reqwest", - "revm-primitives 1.3.0", + "revm-primitives 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 1.0.20", "serde", "serde_json", @@ -4025,26 +4102,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "gloo-net" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9902a044653b26b99f7e3693a42f171312d9be8b26b5697bd1e43ad1f8a35e10" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "gloo-utils", - "js-sys", - "pin-project", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "gloo-timers" version = "0.2.6" @@ -4057,19 +4114,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gloo-utils" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "good_lp" version = "1.7.0" @@ -4308,9 +4352,7 @@ dependencies = [ "futures-util", "http", "hyper", - "log", "rustls", - "rustls-native-certs", "tokio", "tokio-rustls", ] @@ -4605,6 +4647,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -4644,41 +4695,16 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1822d18e4384a5e79d94dc9e4d1239cfa9fad24e55b44d2efeff5b394c9fece4" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core 0.18.2", - "jsonrpsee-http-client", - "jsonrpsee-proc-macros 0.18.2", - "jsonrpsee-server 0.18.2", - "jsonrpsee-types 0.18.2", - "jsonrpsee-wasm-client", - "jsonrpsee-ws-client", - "tracing", -] - -[[package]] -name = "jsonrpsee-client-transport" -version = "0.18.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11aa5766d5c430b89cb26a99b88f3245eb91534be8126102cea9e45ee3891b22" +checksum = "9579d0ca9fb30da026bac2f0f7d9576ec93489aeb7cd4971dd5b4617d82c79b2" dependencies = [ - "futures-channel", - "futures-util", - "gloo-net", - "http", - "jsonrpsee-core 0.18.2", - "pin-project", - "rustls-native-certs", - "soketto", - "thiserror", + "jsonrpsee-core 0.21.0", + "jsonrpsee-proc-macros 0.21.0", + "jsonrpsee-server 0.21.0", + "jsonrpsee-types 0.21.0", "tokio", - "tokio-rustls", - "tokio-util", "tracing", - "webpki-roots 0.23.1", ] [[package]] @@ -4709,48 +4735,23 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.18.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c6832a55f662b5a6ecc844db24b8b9c387453f923de863062c60ce33d62b81" +checksum = "776d009e2f591b78c038e0d053a796f94575d66ca4e77dd84bfc5e81419e436c" dependencies = [ "anyhow", - "async-lock", "async-trait", "beef", - "futures-timer", "futures-util", - "globset", "hyper", - "jsonrpsee-types 0.18.2", + "jsonrpsee-types 0.21.0", "parking_lot 0.12.1", "rand", "rustc-hash", "serde", "serde_json", - "soketto", - "thiserror", - "tokio", - "tokio-stream", - "tracing", - "wasm-bindgen-futures", -] - -[[package]] -name = "jsonrpsee-http-client" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1705c65069729e3dccff6fd91ee431d5d31cabcf00ce68a62a2c6435ac713af9" -dependencies = [ - "async-trait", - "hyper", - "hyper-rustls", - "jsonrpsee-core 0.18.2", - "jsonrpsee-types 0.18.2", - "serde", - "serde_json", "thiserror", "tokio", - "tower", "tracing", ] @@ -4769,12 +4770,12 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.18.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6027ac0b197ce9543097d02a290f550ce1d9432bf301524b013053c0b75cc94" +checksum = "d94b7505034e2737e688e1153bf81e6f93ad296695c43958d6da2e4321f0a990" dependencies = [ "heck 0.4.1", - "proc-macro-crate 1.3.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -4804,17 +4805,21 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.18.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f06661d1a6b6e5b85469dc9c29acfbb9b3bb613797a6fd10a3ebb8a70754057" +checksum = "5cc7c6d1a2c58f6135810284a390d9f823d0f508db74cd914d8237802de80f98" dependencies = [ "futures-util", + "http", "hyper", - "jsonrpsee-core 0.18.2", - "jsonrpsee-types 0.18.2", + "jsonrpsee-core 0.21.0", + "jsonrpsee-types 0.21.0", + "pin-project", + "route-recognizer", "serde", "serde_json", "soketto", + "thiserror", "tokio", "tokio-stream", "tokio-util", @@ -4838,9 +4843,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.18.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5bf6c75ce2a4217421154adfc65a24d2b46e77286e59bba5d9fa6544ccc8f4" +checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" dependencies = [ "anyhow", "beef", @@ -4851,26 +4856,16 @@ dependencies = [ ] [[package]] -name = "jsonrpsee-wasm-client" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34e6ea7c6d862e60f8baebd946c037b70c6808a4e4e31e792a4029184e3ce13a" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core 0.18.2", - "jsonrpsee-types 0.18.2", -] - -[[package]] -name = "jsonrpsee-ws-client" -version = "0.18.2" +name = "jsonrpsee-types" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64b2589680ba1ad7863f279cd2d5083c1dc0a7c0ea959d22924553050f8ab9f" +checksum = "3266dfb045c9174b24c77c2dfe0084914bb23a6b2597d70c9dc6018392e1cd1b" dependencies = [ - "http", - "jsonrpsee-client-transport", - "jsonrpsee-core 0.18.2", - "jsonrpsee-types 0.18.2", + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", ] [[package]] @@ -4915,6 +4910,7 @@ dependencies = [ name = "kakarot-rpc" version = "0.1.0" dependencies = [ + "alloy-rlp", "anyhow", "async-trait", "auto_impl", @@ -4928,14 +4924,13 @@ dependencies = [ "foundry-config", "futures", "hex", - "jsonrpsee 0.18.2", + "jsonrpsee 0.21.0", "katana-core", "lazy_static", "log", "mongodb", "reqwest", "reth-primitives", - "reth-rlp", "reth-rpc-types", "rstest", "ruint", @@ -5023,6 +5018,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "lalrpop" version = "0.20.0" @@ -5364,7 +5369,7 @@ dependencies = [ "trust-dns-resolver", "typed-builder 0.10.0", "uuid 1.6.1", - "webpki-roots 0.25.2", + "webpki-roots", ] [[package]] @@ -5374,7 +5379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac06db03ec2f46ee0ecdca1a1c34a99c0d188a0d83439b84bf0cb4b386e4ab09" dependencies = [ "matrixmultiply", - "num-complex", + "num-complex 0.2.4", "num-integer", "num-traits 0.2.17", "rawpointer", @@ -5406,6 +5411,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint", + "num-complex 0.4.4", + "num-integer", + "num-iter", + "num-rational", + "num-traits 0.2.17", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -5429,6 +5448,15 @@ dependencies = [ "num-traits 0.2.17", ] +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits 0.2.17", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -5439,6 +5467,17 @@ dependencies = [ "num-traits 0.2.17", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits 0.2.17", +] + [[package]] name = "num-modular" version = "0.5.1" @@ -5466,6 +5505,18 @@ dependencies = [ "rand", ] +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits 0.2.17", +] + [[package]] name = "num-traits" version = "0.1.43" @@ -5531,6 +5582,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +[[package]] +name = "nybbles" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836816c354fb2c09622b54545a6f98416147346b13cc7eba5f92fab6b3042c93" +dependencies = [ + "alloy-rlp", + "const-hex", + "proptest", + "serde", + "smallvec", +] + [[package]] name = "object" version = "0.32.1" @@ -5583,12 +5647,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - [[package]] name = "option-ext" version = "0.2.0" @@ -6341,7 +6399,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.25.2", + "webpki-roots", "winreg", ] @@ -6357,131 +6415,151 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +version = "0.1.0-alpha.16" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.16#d8a9b581da3bf82d03a9b7cb36f0d81765e08523" dependencies = [ + "alloy-primitives 0.6.2", "bytes", "codecs-derive", - "revm-primitives 1.1.2", +] + +[[package]] +name = "reth-ethereum-forks" +version = "0.1.0-alpha.16" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.16#d8a9b581da3bf82d03a9b7cb36f0d81765e08523" +dependencies = [ + "alloy-chains", + "alloy-primitives 0.6.2", + "alloy-rlp", + "crc", + "serde", + "thiserror", ] [[package]] name = "reth-primitives" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +version = "0.1.0-alpha.16" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.16#d8a9b581da3bf82d03a9b7cb36f0d81765e08523" dependencies = [ + "ahash 0.8.6", + "alloy-chains", + "alloy-genesis", + "alloy-primitives 0.6.2", + "alloy-rlp", + "alloy-trie", + "byteorder", "bytes", - "c-kzg 0.1.0 (git+https://github.com/ethereum/c-kzg-4844?rev=f5f6f863d475847876a2bd5ee252058d37c3a15d)", - "crc", - "crunchy", "derive_more", - "ethers-core", - "fixed-hash", - "hex", - "hex-literal", - "impl-serde", "itertools 0.11.0", "modular-bitfield", + "num_enum", + "nybbles", "once_cell", - "paste", "rayon", "reth-codecs", - "reth-rlp", - "reth-rlp-derive", - "revm-primitives 1.1.2", - "ruint", - "secp256k1", + "reth-ethereum-forks", + "reth-rpc-types", + "revm", + "revm-primitives 1.3.0 (git+https://github.com/bluealloy/revm?branch=reth_freeze)", + "secp256k1 0.27.0", "serde", "serde_json", - "serde_with 3.4.0", "sha2", + "smallvec", "strum 0.25.0", "sucds", "tempfile", "thiserror", - "tiny-keccak", - "tokio", - "tokio-stream", "tracing", - "url", "zstd 0.12.4", ] [[package]] -name = "reth-rlp" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +name = "reth-rpc-types" +version = "0.1.0-alpha.16" +source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.16#d8a9b581da3bf82d03a9b7cb36f0d81765e08523" dependencies = [ - "arrayvec", - "auto_impl", + "alloy-primitives 0.6.2", + "alloy-rlp", + "alloy-rpc-engine-types", + "alloy-rpc-trace-types", + "alloy-rpc-types", "bytes", - "c-kzg 0.1.0 (git+https://github.com/ethereum/c-kzg-4844?rev=f5f6f863d475847876a2bd5ee252058d37c3a15d)", - "ethereum-types", - "reth-rlp-derive", - "revm-primitives 1.1.2", + "itertools 0.12.1", + "jsonrpsee-types 0.20.3", + "secp256k1 0.27.0", + "serde", + "serde_json", + "serde_with 3.4.0", + "thiserror", + "url", ] [[package]] -name = "reth-rlp-derive" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +name = "revm" +version = "3.5.0" +source = "git+https://github.com/bluealloy/revm?branch=reth_freeze#2caa13db91db770e7e015a6e52b5feedbb38ee8a" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", + "auto_impl", + "revm-interpreter", + "revm-precompile", ] [[package]] -name = "reth-rpc-types" -version = "0.1.0-alpha.10" -source = "git+https://github.com/paradigmxyz/reth.git?tag=v0.1.0-alpha.10#1b16d804ef01f4ec3c25e7986381c22739c105b9" +name = "revm-interpreter" +version = "1.3.0" +source = "git+https://github.com/bluealloy/revm?branch=reth_freeze#2caa13db91db770e7e015a6e52b5feedbb38ee8a" dependencies = [ - "itertools 0.11.0", - "reth-primitives", - "reth-rlp", - "serde", - "serde_json", - "thiserror", + "revm-primitives 1.3.0 (git+https://github.com/bluealloy/revm?branch=reth_freeze)", +] + +[[package]] +name = "revm-precompile" +version = "2.2.0" +source = "git+https://github.com/bluealloy/revm?branch=reth_freeze#2caa13db91db770e7e015a6e52b5feedbb38ee8a" +dependencies = [ + "aurora-engine-modexp", + "c-kzg", + "k256", + "once_cell", + "revm-primitives 1.3.0 (git+https://github.com/bluealloy/revm?branch=reth_freeze)", + "ripemd", + "secp256k1 0.28.2", + "sha2", + "substrate-bn", ] [[package]] name = "revm-primitives" -version = "1.1.2" -source = "git+https://github.com/bluealloy/revm?rev=516f62cc#516f62ccc1c5f2a62e5fc58115213fe04c7f7a8c" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51187b852d9e458816a2e19c81f1dd6c924077e1a8fccd16e4f044f865f299d7" dependencies = [ + "alloy-primitives 0.4.2", + "alloy-rlp", "auto_impl", "bitflags 2.4.1", "bitvec", - "bytes", - "c-kzg 0.1.0 (git+https://github.com/ethereum/c-kzg-4844)", - "derive_more", "enumn", - "fixed-hash", "hashbrown 0.14.2", "hex", - "hex-literal", - "once_cell", - "primitive-types", - "rlp", - "ruint", - "serde", - "sha3", ] [[package]] name = "revm-primitives" version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51187b852d9e458816a2e19c81f1dd6c924077e1a8fccd16e4f044f865f299d7" +source = "git+https://github.com/bluealloy/revm?branch=reth_freeze#2caa13db91db770e7e015a6e52b5feedbb38ee8a" dependencies = [ - "alloy-primitives 0.4.2", + "alloy-primitives 0.6.2", "alloy-rlp", "auto_impl", "bitflags 2.4.1", "bitvec", + "c-kzg", "enumn", "hashbrown 0.14.2", "hex", + "serde", ] [[package]] @@ -6554,6 +6632,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "route-recognizer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" + [[package]] name = "rstest" version = "0.18.2" @@ -6687,22 +6771,10 @@ checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring 0.17.5", - "rustls-webpki 0.101.7", + "rustls-webpki", "sct", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile", - "schannel", - "security-framework", -] - [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -6712,16 +6784,6 @@ dependencies = [ "base64 0.21.5", ] -[[package]] -name = "rustls-webpki" -version = "0.100.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6a5fc258f1c1276dfe3016516945546e2d5383911efc0fc4f1cdc5df3a4ae3" -dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", -] - [[package]] name = "rustls-webpki" version = "0.101.7" @@ -6930,15 +6992,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "schannel" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "schemars" version = "0.8.16" @@ -7013,39 +7066,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "rand", - "secp256k1-sys", + "secp256k1-sys 0.8.1", ] [[package]] -name = "secp256k1-sys" -version = "0.8.1" +name = "secp256k1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ - "cc", + "secp256k1-sys 0.9.2", ] [[package]] -name = "security-framework" -version = "2.9.2" +name = "secp256k1-sys" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "cc", ] [[package]] -name = "security-framework-sys" -version = "2.9.1" +name = "secp256k1-sys" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" dependencies = [ - "core-foundation-sys", - "libc", + "cc", ] [[package]] @@ -7378,6 +7426,16 @@ dependencies = [ "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -7454,6 +7512,10 @@ name = "smallvec" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +dependencies = [ + "arbitrary", + "serde", +] [[package]] name = "smol_str" @@ -7543,7 +7605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec63571489873d4506683915840eeb1bb16b3198ee4894cc6f2fe3013d505e56" dependencies = [ "ndarray", - "num-complex", + "num-complex 0.2.4", "num-traits 0.1.43", ] @@ -7857,6 +7919,19 @@ dependencies = [ "syn 2.0.39", ] +[[package]] +name = "substrate-bn" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c" +dependencies = [ + "byteorder", + "crunchy", + "lazy_static", + "rand", + "rustc-hex", +] + [[package]] name = "subtle" version = "2.5.0" @@ -8791,15 +8866,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" -dependencies = [ - "rustls-webpki 0.100.3", -] - [[package]] name = "webpki-roots" version = "0.25.2" diff --git a/Cargo.toml b/Cargo.toml index c9dccd5c5..979ea2739 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,12 +27,12 @@ starknet-abigen-parser = { git = "https://github.com/glihm/starknet-abigen-rs", starknet-abigen-macros = { git = "https://github.com/glihm/starknet-abigen-rs", tag = "v0.1.4-beta3", default-features = false } # Ethereum dependencies +alloy-rlp = { version = "0.3", default-features = false } ethers = { version = "2.0.9", default-features = false } ethers-solc = { version = "2.0.9", default-features = false } -jsonrpsee = { version = "0.18.2", features = ["full"] } -reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.1.0-alpha.10", default-features = false } -reth-rlp = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.1.0-alpha.10", default-features = false } -reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.1.0-alpha.10", default-features = false } +jsonrpsee = { version = "0.21.0", features = ["macros", "server"] } +reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.1.0-alpha.16", default-features = false } +reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v0.1.0-alpha.16", default-features = false } # Serde serde = { version = "1.0.188", default-features = false, features = ["derive"] } diff --git a/rust-toolchain b/rust-toolchain index a438b1639..7897a24d1 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "1.74.0" \ No newline at end of file +channel = "1.75.0" diff --git a/src/config.rs b/src/config.rs index 268d39a19..ab06dca24 100644 --- a/src/config.rs +++ b/src/config.rs @@ -133,7 +133,7 @@ impl JsonRpcClientBuilder { /// # Example /// /// ```rust - /// use kakarot_rpc::starknet_client::config::{JsonRpcClientBuilder, KakarotRpcConfig, Network}; + /// use kakarot_rpc::config::{JsonRpcClientBuilder, KakarotRpcConfig, Network}; /// use starknet::core::types::FieldElement; /// use starknet::providers::jsonrpc::HttpTransport; /// use starknet::providers::JsonRpcClient; diff --git a/src/eth_provider/contracts/erc20.rs b/src/eth_provider/contracts/erc20.rs index 70840dac0..1a38cb206 100644 --- a/src/eth_provider/contracts/erc20.rs +++ b/src/eth_provider/contracts/erc20.rs @@ -1,4 +1,5 @@ use ethers::abi::AbiEncode; +use ethers::core::types::Address as EthersAddress; use ethers::prelude::abigen; use reth_primitives::Address; @@ -32,7 +33,8 @@ impl EthereumErc20

{ pub async fn balance_of(self, evm_address: Address, block_id: BlockId) -> EthProviderResult { // Prepare the calldata for the bytecode function call - let calldata = IERC20Calls::BalanceOf(BalanceOfCall { account: evm_address.into() }).encode(); + let address = EthersAddress::from_slice(evm_address.as_slice()); + let calldata = IERC20Calls::BalanceOf(BalanceOfCall { account: address }).encode(); let call = CallRequest { from: Some(Address::default()), diff --git a/src/eth_provider/database/types/serde/mod.rs b/src/eth_provider/database/types/serde/mod.rs index 128db4ec7..4c0959a15 100644 --- a/src/eth_provider/database/types/serde/mod.rs +++ b/src/eth_provider/database/types/serde/mod.rs @@ -11,7 +11,7 @@ use serde_json::Value; /// /// The database stores {"hash": "0x1234"}. This gets serialized to /// "{\"hash\":\"0x1234\"}". It's not possible to deserialize \"0x1234\" -/// into a U64 or H256 type from reth_primitives (since \"0x1234\" is the +/// into a U64 or B256 type from reth_primitives (since \"0x1234\" is the /// serialized representation of the string "0x1234"). This function provides /// a custom deserialization that first deserializes the data into a /// HashMap, which can them be used to deserialize into the diff --git a/src/eth_provider/database/types/transaction.rs b/src/eth_provider/database/types/transaction.rs index eb3f2e0de..ae0d432f0 100644 --- a/src/eth_provider/database/types/transaction.rs +++ b/src/eth_provider/database/types/transaction.rs @@ -1,4 +1,4 @@ -use reth_primitives::H256; +use reth_primitives::B256; use reth_rpc_types::Transaction; use serde::Deserialize; @@ -29,10 +29,10 @@ pub struct StoredTransactionHash { #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Hash { - pub hash: H256, + pub hash: B256, } -impl From for H256 { +impl From for B256 { fn from(hash: StoredTransactionHash) -> Self { hash.tx_hash.hash } diff --git a/src/eth_provider/error.rs b/src/eth_provider/error.rs index fe82a1e98..4739f4ef6 100644 --- a/src/eth_provider/error.rs +++ b/src/eth_provider/error.rs @@ -51,12 +51,6 @@ pub enum EthProviderError { MethodNotSupported(String), } -impl From for jsonrpsee::core::Error { - fn from(err: EthProviderError) -> Self { - Self::Call(err.into()) - } -} - impl From for ErrorObject<'static> { fn from(value: EthProviderError) -> Self { rpc_err(EthRpcErrorCode::InternalError, value.to_string()) diff --git a/src/eth_provider/provider.rs b/src/eth_provider/provider.rs index 9a99aca28..2d87b514a 100644 --- a/src/eth_provider/provider.rs +++ b/src/eth_provider/provider.rs @@ -1,3 +1,4 @@ +use alloy_rlp::Decodable as _; use async_trait::async_trait; use auto_impl::auto_impl; use eyre::Result; @@ -7,8 +8,8 @@ use reth_primitives::Address; use reth_primitives::BlockId; use reth_primitives::Bytes; use reth_primitives::TransactionSigned; -use reth_primitives::{BlockNumberOrTag, H256, U256, U64}; -use reth_rlp::Decodable as _; +use reth_primitives::{BlockNumberOrTag, B256, U256, U64}; +use reth_rpc_types::other::OtherFields; use reth_rpc_types::CallRequest; use reth_rpc_types::FeeHistory; use reth_rpc_types::Filter; @@ -67,7 +68,7 @@ pub trait EthereumProvider { /// Returns the chain id. async fn chain_id(&self) -> EthProviderResult>; /// Returns a block by hash. Block can be full or just the hashes of the transactions. - async fn block_by_hash(&self, hash: H256, full: bool) -> EthProviderResult>; + async fn block_by_hash(&self, hash: B256, full: bool) -> EthProviderResult>; /// Returns a block by number. Block can be full or just the hashes of the transactions. async fn block_by_number( &self, @@ -75,15 +76,15 @@ pub trait EthereumProvider { full: bool, ) -> EthProviderResult>; /// Returns the transaction count for a block by hash. - async fn block_transaction_count_by_hash(&self, hash: H256) -> EthProviderResult; + async fn block_transaction_count_by_hash(&self, hash: B256) -> EthProviderResult; /// Returns the transaction count for a block by number. async fn block_transaction_count_by_number(&self, number_or_tag: BlockNumberOrTag) -> EthProviderResult; /// Returns the transaction by hash. - async fn transaction_by_hash(&self, hash: H256) -> EthProviderResult>; + async fn transaction_by_hash(&self, hash: B256) -> EthProviderResult>; /// Returns the transaction by block hash and index. async fn transaction_by_block_hash_and_index( &self, - hash: H256, + hash: B256, index: Index, ) -> EthProviderResult>; /// Returns the transaction by block number and index. @@ -93,7 +94,7 @@ pub trait EthereumProvider { index: Index, ) -> EthProviderResult>; /// Returns the transaction receipt by hash of the transaction. - async fn transaction_receipt(&self, hash: H256) -> EthProviderResult>; + async fn transaction_receipt(&self, hash: B256) -> EthProviderResult>; /// Returns the balance of an address in native eth. async fn balance(&self, address: Address, block_id: Option) -> EthProviderResult; /// Returns the storage of an address at a certain index. @@ -116,7 +117,7 @@ pub trait EthereumProvider { reward_percentiles: Option>, ) -> EthProviderResult; /// Send a raw transaction to the network and returns the transactions hash. - async fn send_raw_transaction(&self, transaction: Bytes) -> EthProviderResult; + async fn send_raw_transaction(&self, transaction: Bytes) -> EthProviderResult; } /// Structure that implements the EthereumProvider trait. @@ -137,7 +138,7 @@ where let sort = doc! { "header.number": -1 }; let header: Option = self.database.get_one("headers", filter, sort).await?; let block_number = match header { - None => self.starknet_provider.block_number().await?.into(), // in case the database is empty, use the starknet provider + None => U64::from(self.starknet_provider.block_number().await?), // in case the database is empty, use the starknet provider Some(header) => { let number = header.header.number.ok_or(EthProviderError::ValueNotFound)?; let n = number.as_le_bytes_trimmed(); @@ -145,7 +146,7 @@ where if n.len() > 8 { return Err(ConversionError::ValueOutOfRange("Block number too large".to_string()).into()); } - U64::from_little_endian(n.as_ref()) + U64::from_le_slice(n.as_ref()) } }; Ok(block_number) @@ -179,10 +180,10 @@ where async fn chain_id(&self) -> EthProviderResult> { let chain_id = self.starknet_provider.chain_id().await?; let chain_id: Option = chain_id.try_into().ok(); - Ok(chain_id.map(Into::into)) + Ok(chain_id.map(U64::from)) } - async fn block_by_hash(&self, hash: H256, full: bool) -> EthProviderResult> { + async fn block_by_hash(&self, hash: B256, full: bool) -> EthProviderResult> { let header_filter = into_filter("header.hash", hash, 64); let tx_filter = into_filter("tx.blockHash", hash, 64); let block = self.block(header_filter, tx_filter, full).await?; @@ -204,10 +205,10 @@ where Ok(block) } - async fn block_transaction_count_by_hash(&self, hash: H256) -> EthProviderResult { + async fn block_transaction_count_by_hash(&self, hash: B256) -> EthProviderResult { let filter = into_filter("tx.blockHash", hash, 64); let count = self.database.count("transactions", filter).await?; - Ok(count.into()) + Ok(U64::from(count)) } async fn block_transaction_count_by_number(&self, number_or_tag: BlockNumberOrTag) -> EthProviderResult { @@ -215,10 +216,10 @@ where let filter = into_filter("tx.blockNumber", block_number, 64); let count = self.database.count("transactions", filter).await?; - Ok(count.into()) + Ok(U64::from(count)) } - async fn transaction_by_hash(&self, hash: H256) -> EthProviderResult> { + async fn transaction_by_hash(&self, hash: B256) -> EthProviderResult> { let filter = into_filter("tx.hash", hash, 64); let tx: Option = self.database.get_one("transactions", filter, None).await?; Ok(tx.map(Into::into)) @@ -226,7 +227,7 @@ where async fn transaction_by_block_hash_and_index( &self, - hash: H256, + hash: B256, index: Index, ) -> EthProviderResult> { let mut filter = into_filter("tx.blockHash", hash, 64); @@ -249,7 +250,7 @@ where Ok(tx.map(Into::into)) } - async fn transaction_receipt(&self, hash: H256) -> EthProviderResult> { + async fn transaction_receipt(&self, hash: B256) -> EthProviderResult> { let filter = into_filter("receipt.transactionHash", hash, 64); let tx: Option = self.database.get_one("receipts", filter, None).await?; Ok(tx.map(Into::into)) @@ -322,7 +323,7 @@ where } async fn get_logs(&self, filter: Filter) -> EthProviderResult { - let current_block = self.block_number().await?.as_u64(); + let current_block = self.block_number().await?.try_into().map_err(ConversionError::from)?; let from = filter.get_from_block().unwrap_or_default(); let to = filter.get_to_block().unwrap_or(current_block); @@ -333,7 +334,7 @@ where _ => (from, to), }; - // Convert the topics to a vector of H256 + // Convert the topics to a vector of B256 let topics = filter .topics .into_iter() @@ -395,7 +396,7 @@ where return Ok(FeeHistory::default()); } - let end_block = U256::from(self.tag_into_block_number(newest_block).await?.as_u64()); + let end_block = U256::from(self.tag_into_block_number(newest_block).await?); let end_block_plus = end_block + U256::from(1); // If the block count is larger than the end block, we need to reduce it. @@ -433,17 +434,17 @@ where Ok(FeeHistory { base_fee_per_gas, gas_used_ratio, oldest_block: start_block, reward: Some(vec![]) }) } - async fn send_raw_transaction(&self, transaction: Bytes) -> EthProviderResult { + async fn send_raw_transaction(&self, transaction: Bytes) -> EthProviderResult { let mut data = transaction.0.as_ref(); let transaction_signed = TransactionSigned::decode(&mut data) .map_err(|err| ConversionError::ToStarknetTransactionError(err.to_string()))?; - let chain_id = self.chain_id().await?.unwrap_or_default(); + let chain_id = self.chain_id().await?.unwrap_or_default().try_into().map_err(ConversionError::from)?; let signer = transaction_signed .recover_signer() .ok_or_else(|| ConversionError::ToStarknetTransactionError("Failed to recover signer".to_string()))?; - let transaction = to_starknet_transaction(&transaction_signed, chain_id.as_u64(), signer)?; + let transaction = to_starknet_transaction(&transaction_signed, chain_id, signer)?; #[cfg(not(feature = "testing"))] { @@ -456,7 +457,7 @@ where #[cfg(feature = "testing")] { let res = self.starknet_provider.add_invoke_transaction(transaction).await?; - Ok(H256::from_slice(&res.transaction_hash.to_bytes_be()[..])) + Ok(B256::from_slice(&res.transaction_hash.to_bytes_be()[..])) } } } @@ -490,7 +491,7 @@ where let from = into_via_wrapper!(call.from.unwrap_or_default()); let data = call.input.unique_input().unwrap_or_default().cloned().unwrap_or_default(); - let calldata: Vec<_> = data.to_vec().into_iter().map(FieldElement::from).collect(); + let calldata: Vec<_> = data.into_iter().map(FieldElement::from).collect(); let gas_limit = into_via_try_wrapper!(call.gas.unwrap_or_default()); let gas_price = into_via_try_wrapper!(call.gas_price.unwrap_or_default()); @@ -557,6 +558,7 @@ where uncles: Vec::new(), size: None, withdrawals: None, + other: OtherFields::default(), }; Ok(Some(block.into())) @@ -565,8 +567,8 @@ where /// Convert the given BlockNumberOrTag into a block number async fn tag_into_block_number(&self, tag: BlockNumberOrTag) -> EthProviderResult { match tag { - BlockNumberOrTag::Earliest => Ok(U64::zero()), - BlockNumberOrTag::Number(number) => Ok(number.into()), + BlockNumberOrTag::Earliest => Ok(U64::ZERO), + BlockNumberOrTag::Number(number) => Ok(U64::from(number)), BlockNumberOrTag::Latest | BlockNumberOrTag::Finalized | BlockNumberOrTag::Safe => { self.block_number().await } diff --git a/src/eth_rpc/api/eth_api.rs b/src/eth_rpc/api/eth_api.rs index 722ce0893..2a4d8ba8a 100644 --- a/src/eth_rpc/api/eth_api.rs +++ b/src/eth_rpc/api/eth_api.rs @@ -1,9 +1,9 @@ use jsonrpsee::core::RpcResult as Result; use jsonrpsee::proc_macros::rpc; -use reth_primitives::{AccessListWithGasUsed, Address, BlockId, BlockNumberOrTag, Bytes, H256, H64, U128, U256, U64}; +use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U128, U256, U64}; use reth_rpc_types::{ - CallRequest, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, RichBlock, SyncStatus, - Transaction as EthTransaction, TransactionReceipt, TransactionRequest, Work, + AccessListWithGasUsed, CallRequest, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, + RichBlock, SyncStatus, Transaction as EthTransaction, TransactionReceipt, TransactionRequest, Work, }; #[rpc(server, namespace = "eth")] @@ -30,7 +30,7 @@ pub trait EthApi { /// Returns information about a block by hash. #[method(name = "getBlockByHash")] - async fn block_by_hash(&self, hash: H256, full: bool) -> Result>; + async fn block_by_hash(&self, hash: B256, full: bool) -> Result>; /// Returns information about a block by number. #[method(name = "getBlockByNumber")] @@ -38,7 +38,7 @@ pub trait EthApi { /// Returns the number of transactions in a block from a block matching the given block hash. #[method(name = "getBlockTransactionCountByHash")] - async fn block_transaction_count_by_hash(&self, hash: H256) -> Result; + async fn block_transaction_count_by_hash(&self, hash: B256) -> Result; /// Returns the number of transactions in a block matching the given block number. #[method(name = "getBlockTransactionCountByNumber")] @@ -46,7 +46,7 @@ pub trait EthApi { /// Returns the number of uncles in a block from a block matching the given block hash. #[method(name = "getUncleCountByBlockHash")] - async fn block_uncles_count_by_block_hash(&self, hash: H256) -> Result; + async fn block_uncles_count_by_block_hash(&self, hash: B256) -> Result; /// Returns the number of uncles in a block with given block number. #[method(name = "getUncleCountByBlockNumber")] @@ -54,7 +54,7 @@ pub trait EthApi { /// Returns an uncle block of the given block and index. #[method(name = "getUncleByBlockHashAndIndex")] - async fn uncle_by_block_hash_and_index(&self, hash: H256, index: Index) -> Result>; + async fn uncle_by_block_hash_and_index(&self, hash: B256, index: Index) -> Result>; /// Returns an uncle block of the given block and index. #[method(name = "getUncleByBlockNumberAndIndex")] @@ -66,11 +66,11 @@ pub trait EthApi { /// Returns the information about a transaction requested by transaction hash. #[method(name = "getTransactionByHash")] - async fn transaction_by_hash(&self, hash: H256) -> Result>; + async fn transaction_by_hash(&self, hash: B256) -> Result>; /// Returns information about a transaction by block hash and transaction index position. #[method(name = "getTransactionByBlockHashAndIndex")] - async fn transaction_by_block_hash_and_index(&self, hash: H256, index: Index) -> Result>; + async fn transaction_by_block_hash_and_index(&self, hash: B256, index: Index) -> Result>; /// Returns information about a transaction by block number and transaction index position. #[method(name = "getTransactionByBlockNumberAndIndex")] @@ -82,7 +82,7 @@ pub trait EthApi { /// Returns the receipt of a transaction by transaction hash. #[method(name = "getTransactionReceipt")] - async fn transaction_receipt(&self, hash: H256) -> Result>; + async fn transaction_receipt(&self, hash: B256) -> Result>; /// Returns the balance of the account of given address. #[method(name = "getBalance")] @@ -172,20 +172,20 @@ pub trait EthApi { /// Used for submitting mining hashrate. #[method(name = "submitHashrate")] - async fn submit_hashrate(&self, hashrate: U256, id: H256) -> Result; + async fn submit_hashrate(&self, hashrate: U256, id: B256) -> Result; /// Used for submitting a proof-of-work solution. #[method(name = "submitWork")] - async fn submit_work(&self, nonce: H64, pow_hash: H256, mix_digest: H256) -> Result; + async fn submit_work(&self, nonce: B64, pow_hash: B256, mix_digest: B256) -> Result; /// Sends transaction; will block waiting for signer to return the /// transaction hash. #[method(name = "sendTransaction")] - async fn send_transaction(&self, request: TransactionRequest) -> Result; + async fn send_transaction(&self, request: TransactionRequest) -> Result; /// Sends signed transaction, returning its hash. #[method(name = "sendRawTransaction")] - async fn send_raw_transaction(&self, bytes: Bytes) -> Result; + async fn send_raw_transaction(&self, bytes: Bytes) -> Result; /// Returns an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" /// + len(message) + message))). @@ -207,7 +207,7 @@ pub trait EthApi { async fn get_proof( &self, address: Address, - keys: Vec, + keys: Vec, block_id: Option, ) -> Result; diff --git a/src/eth_rpc/api/web3_api.rs b/src/eth_rpc/api/web3_api.rs index c68431f7e..361d82498 100644 --- a/src/eth_rpc/api/web3_api.rs +++ b/src/eth_rpc/api/web3_api.rs @@ -1,6 +1,6 @@ use jsonrpsee::core::RpcResult as Result; use jsonrpsee::proc_macros::rpc; -use reth_primitives::{Bytes, H256}; +use reth_primitives::{Bytes, B256}; #[rpc(server, namespace = "web3")] #[async_trait] @@ -11,5 +11,5 @@ pub trait Web3Api { /// Returns Keccak256 of some input value #[method(name = "sha3")] - fn sha3(&self, input: Bytes) -> Result; + fn sha3(&self, input: Bytes) -> Result; } diff --git a/src/eth_rpc/mod.rs b/src/eth_rpc/mod.rs index 6d721cd74..591f0e7c1 100644 --- a/src/eth_rpc/mod.rs +++ b/src/eth_rpc/mod.rs @@ -12,13 +12,12 @@ use eyre::Result; use jsonrpsee::server::{ServerBuilder, ServerHandle}; use jsonrpsee::RpcModule; use thiserror::Error; -use tower::ServiceBuilder; use tower_http::cors::{Any, CorsLayer}; #[derive(Error, Debug)] pub enum RpcError { #[error(transparent)] - JsonRpcServerError(#[from] jsonrpsee::core::Error), + IoError(#[from] std::io::Error), #[error(transparent)] ParseError(#[from] AddrParseError), } @@ -34,17 +33,17 @@ pub async fn run_server( let cors = CorsLayer::new().allow_methods(Any).allow_origin(Any).allow_headers(Any); - let service = ServiceBuilder::new().layer(cors); + let http_middleware = tower::ServiceBuilder::new().layer(cors); let server = ServerBuilder::default() .max_connections(std::env::var("RPC_MAX_CONNECTIONS").unwrap_or("100".to_string()).parse().unwrap()) - .set_middleware(service) + .set_http_middleware(http_middleware) .build(socket_addr.parse::()?) .await?; let addr = server.local_addr()?; - let handle = server.start(kakarot_rpc_module)?; + let handle = server.start(kakarot_rpc_module); Ok((addr, handle)) } diff --git a/src/eth_rpc/rpc.rs b/src/eth_rpc/rpc.rs index 01dc8d0ce..95ed0ec95 100644 --- a/src/eth_rpc/rpc.rs +++ b/src/eth_rpc/rpc.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::marker::PhantomData; use std::sync::Arc; -use jsonrpsee::core::Error; +use jsonrpsee::server::RegisterMethodError; use jsonrpsee::{Methods, RpcModule}; use crate::eth_provider::provider::EthereumProvider; @@ -53,7 +53,7 @@ where Self { modules, _phantom: PhantomData } } - pub fn rpc_module(&self) -> Result, Error> { + pub fn rpc_module(&self) -> Result, RegisterMethodError> { let mut rpc_module = RpcModule::new(()); for methods in self.modules.values().cloned() { diff --git a/src/eth_rpc/servers/eth_rpc.rs b/src/eth_rpc/servers/eth_rpc.rs index 4dad121d7..d6628c26d 100644 --- a/src/eth_rpc/servers/eth_rpc.rs +++ b/src/eth_rpc/servers/eth_rpc.rs @@ -2,10 +2,10 @@ use crate::eth_provider::constant::{BASE_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS}; use crate::eth_provider::error::EthProviderError; use crate::eth_provider::provider::EthereumProvider; use jsonrpsee::core::{async_trait, RpcResult as Result}; -use reth_primitives::{AccessListWithGasUsed, Address, BlockId, BlockNumberOrTag, Bytes, H256, H64, U128, U256, U64}; +use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U128, U256, U64}; use reth_rpc_types::{ - CallRequest, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, RichBlock, SyncStatus, - Transaction as EtherTransaction, TransactionReceipt, TransactionRequest, Work, + AccessListWithGasUsed, CallRequest, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, + RichBlock, SyncStatus, Transaction as EtherTransaction, TransactionReceipt, TransactionRequest, Work, }; use serde_json::Value; @@ -58,7 +58,7 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %hash))] - async fn block_by_hash(&self, hash: H256, full: bool) -> Result> { + async fn block_by_hash(&self, hash: B256, full: bool) -> Result> { Ok(self.eth_provider.block_by_hash(hash, full).await?) } @@ -68,7 +68,7 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %hash))] - async fn block_transaction_count_by_hash(&self, hash: H256) -> Result { + async fn block_transaction_count_by_hash(&self, hash: B256) -> Result { Ok(self.eth_provider.block_transaction_count_by_hash(hash).await?) } @@ -78,7 +78,7 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %_hash))] - async fn block_uncles_count_by_block_hash(&self, _hash: H256) -> Result { + async fn block_uncles_count_by_block_hash(&self, _hash: B256) -> Result { tracing::warn!("Kakarot chain does not produce uncles"); Ok(U256::ZERO) } @@ -90,7 +90,7 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %_hash, index = ?_index))] - async fn uncle_by_block_hash_and_index(&self, _hash: H256, _index: Index) -> Result> { + async fn uncle_by_block_hash_and_index(&self, _hash: B256, _index: Index) -> Result> { tracing::warn!("Kakarot chain does not produce uncles"); Ok(None) } @@ -106,12 +106,12 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %hash))] - async fn transaction_by_hash(&self, hash: H256) -> Result> { + async fn transaction_by_hash(&self, hash: B256) -> Result> { Ok(self.eth_provider.transaction_by_hash(hash).await?) } #[tracing::instrument(skip_all, ret, err, fields(hash = %hash, index = ?index))] - async fn transaction_by_block_hash_and_index(&self, hash: H256, index: Index) -> Result> { + async fn transaction_by_block_hash_and_index(&self, hash: B256, index: Index) -> Result> { Ok(self.eth_provider.transaction_by_block_hash_and_index(hash, index).await?) } @@ -125,7 +125,7 @@ where } #[tracing::instrument(skip_all, ret, err, fields(hash = %hash))] - async fn transaction_receipt(&self, hash: H256) -> Result> { + async fn transaction_receipt(&self, hash: B256) -> Result> { Ok(self.eth_provider.transaction_receipt(hash).await?) } @@ -207,20 +207,20 @@ where Ok(Work::default()) } - async fn submit_hashrate(&self, _hashrate: U256, _id: H256) -> Result { + async fn submit_hashrate(&self, _hashrate: U256, _id: B256) -> Result { Err(EthProviderError::MethodNotSupported("eth_submitHashrate".to_string()).into()) } - async fn submit_work(&self, _nonce: H64, _pow_hash: H256, _mix_digest: H256) -> Result { + async fn submit_work(&self, _nonce: B64, _pow_hash: B256, _mix_digest: B256) -> Result { Err(EthProviderError::MethodNotSupported("eth_submitWork".to_string()).into()) } - async fn send_transaction(&self, _request: TransactionRequest) -> Result { + async fn send_transaction(&self, _request: TransactionRequest) -> Result { Err(EthProviderError::MethodNotSupported("eth_sendTransaction".to_string()).into()) } #[tracing::instrument(skip_all, ret, err, fields(bytes = %bytes))] - async fn send_raw_transaction(&self, bytes: Bytes) -> Result { + async fn send_raw_transaction(&self, bytes: Bytes) -> Result { Ok(self.eth_provider.send_raw_transaction(bytes).await?) } @@ -239,7 +239,7 @@ where async fn get_proof( &self, _address: Address, - _keys: Vec, + _keys: Vec, _block_id: Option, ) -> Result { Err(EthProviderError::MethodNotSupported("eth_getProof".to_string()).into()) diff --git a/src/eth_rpc/servers/web3_rpc.rs b/src/eth_rpc/servers/web3_rpc.rs index e6a0d608a..978373b49 100644 --- a/src/eth_rpc/servers/web3_rpc.rs +++ b/src/eth_rpc/servers/web3_rpc.rs @@ -1,5 +1,5 @@ use jsonrpsee::core::{async_trait, RpcResult as Result}; -use reth_primitives::{keccak256, Bytes, H256}; +use reth_primitives::{keccak256, Bytes, B256}; use crate::eth_rpc::api::web3_api::Web3ApiServer; @@ -19,7 +19,7 @@ impl Web3ApiServer for Web3Rpc { Ok(format!("kakarot_{}", env!("CARGO_PKG_VERSION"))) } - fn sha3(&self, input: Bytes) -> Result { + fn sha3(&self, input: Bytes) -> Result { let hash = keccak256(input); Ok(hash) } diff --git a/src/models/felt.rs b/src/models/felt.rs index a36149720..87a6c9fc6 100644 --- a/src/models/felt.rs +++ b/src/models/felt.rs @@ -1,4 +1,4 @@ -use reth_primitives::{Address, H256, U256}; +use reth_primitives::{Address, B256, U256}; use starknet::core::types::FieldElement; use crate::models::errors::ConversionError; @@ -44,7 +44,7 @@ impl TryFrom for u128 { #[allow(clippy::fallible_impl_from)] impl From

for Felt252Wrapper { fn from(address: Address) -> Self { - let felt = FieldElement::from_byte_slice_be(&address.0).unwrap(); // safe unwrap since H160 is 20 bytes + let felt = FieldElement::from_byte_slice_be(address.as_slice()).unwrap(); // safe unwrap since H160 is 20 bytes Self(felt) } } @@ -65,16 +65,16 @@ impl TryFrom for Address { } } -impl TryFrom for Felt252Wrapper { +impl TryFrom for Felt252Wrapper { type Error = ConversionError; - fn try_from(h256: H256) -> Result { - let felt = FieldElement::from_bytes_be(h256.as_fixed_bytes())?; + fn try_from(value: B256) -> Result { + let felt = FieldElement::from_bytes_be(value.as_ref())?; Ok(Self(felt)) } } -impl From for H256 { +impl From for B256 { fn from(felt: Felt252Wrapper) -> Self { let felt: FieldElement = felt.into(); Self::from_slice(&felt.to_bytes_be()) @@ -170,9 +170,9 @@ mod tests { } #[test] - fn test_felt_try_from_h256_should_pass() { + fn test_felt_try_from_b256_should_pass() { // Given - let hash = H256::from_slice(&FieldElement::MAX.to_bytes_be()); + let hash = B256::from_slice(&FieldElement::MAX.to_bytes_be()); // When let hash = Felt252Wrapper::try_from(hash).unwrap(); @@ -184,9 +184,9 @@ mod tests { #[test] #[should_panic(expected = "Felt252WrapperConversionError")] - fn test_felt_try_from_h256_should_fail() { + fn test_felt_try_from_b256_should_fail() { // Given - let hash = H256::from_str(OVERFLOW_FELT).unwrap(); + let hash = B256::from_str(OVERFLOW_FELT).unwrap(); // When Felt252Wrapper::try_from(hash).unwrap(); diff --git a/src/test_utils/eoa.rs b/src/test_utils/eoa.rs index 922dcad9a..3d1d3ed27 100644 --- a/src/test_utils/eoa.rs +++ b/src/test_utils/eoa.rs @@ -4,7 +4,7 @@ use async_trait::async_trait; use ethers::abi::Tokenize; use ethers::signers::{LocalWallet, Signer}; use reth_primitives::{ - sign_message, Address, Bytes, Transaction, TransactionKind, TransactionSigned, TxEip1559, H256, U256, + sign_message, Address, Bytes, Transaction, TransactionKind, TransactionSigned, TxEip1559, B256, U256, }; use starknet::core::types::{MaybePendingTransactionReceipt, TransactionReceipt}; use starknet::core::utils::get_selector_from_name; @@ -25,10 +25,10 @@ pub trait Eoa { Ok(starknet_address(self.evm_address()?)) } fn evm_address(&self) -> Result { - let wallet = LocalWallet::from_bytes(self.private_key().as_bytes())?; + let wallet = LocalWallet::from_bytes(self.private_key().as_slice())?; Ok(Address::from_slice(wallet.address().as_bytes())) } - fn private_key(&self) -> H256; + fn private_key(&self) -> B256; fn eth_provider(&self) -> &EthDataProvider

; async fn nonce(&self) -> Result { @@ -44,7 +44,7 @@ pub trait Eoa { Ok(TransactionSigned::from_transaction_and_signature(tx, signature)) } - async fn send_transaction(&self, tx: TransactionSigned) -> Result { + async fn send_transaction(&self, tx: TransactionSigned) -> Result { let eth_provider = self.eth_provider(); let mut v = Vec::new(); tx.encode_enveloped(&mut v); @@ -53,19 +53,19 @@ pub trait Eoa { } pub struct KakarotEOA { - pub private_key: H256, + pub private_key: B256, pub eth_provider: Arc>, } impl KakarotEOA

{ - pub const fn new(private_key: H256, eth_provider: Arc>) -> Self { + pub const fn new(private_key: B256, eth_provider: Arc>) -> Self { Self { private_key, eth_provider } } } #[async_trait] impl Eoa

for KakarotEOA

{ - fn private_key(&self) -> H256 { + fn private_key(&self) -> B256 { self.private_key } fn eth_provider(&self) -> &EthDataProvider

{ @@ -93,7 +93,7 @@ impl KakarotEOA

{ &bytecode, constructor_args, nonce, - chain_id.as_u64(), + chain_id.try_into()?, )?; let tx_signed = self.sign_transaction(tx)?; let tx_hash = self.send_transaction(tx_signed).await?; @@ -148,11 +148,11 @@ impl KakarotEOA

{ let nonce: u64 = nonce.try_into()?; let chain_id = self.eth_provider.chain_id().await?.unwrap_or_default(); - let tx = contract.prepare_call_transaction(function, args, nonce, value, chain_id.as_u64())?; + let tx = contract.prepare_call_transaction(function, args, nonce, value, chain_id.try_into()?)?; let tx_signed = self.sign_transaction(tx)?; let tx_hash = self.send_transaction(tx_signed).await?; - let bytes = tx_hash.to_fixed_bytes(); + let bytes = tx_hash.0; let starknet_tx_hash = FieldElement::from_bytes_be(&bytes).unwrap(); watch_tx(self.eth_provider.starknet_provider(), starknet_tx_hash, std::time::Duration::from_millis(100), 60) @@ -168,18 +168,18 @@ impl KakarotEOA

{ /// allow(dead_code) is used because this function is used in tests, /// and each test is compiled separately, so the compiler thinks this function is unused #[allow(dead_code)] - pub async fn transfer(&self, to: Address, value: u128) -> Result { + pub async fn transfer(&self, to: Address, value: u128) -> Result { let nonce = self.nonce().await?; let nonce: u64 = nonce.try_into()?; let tx = Transaction::Eip1559(TxEip1559 { - chain_id: self.eth_provider.chain_id().await?.unwrap_or_default().as_u64(), + chain_id: self.eth_provider.chain_id().await?.unwrap_or_default().try_into()?, nonce, max_priority_fee_per_gas: Default::default(), max_fee_per_gas: Default::default(), gas_limit: u64::MAX, to: TransactionKind::Call(to), - value, + value: value.into(), input: Bytes::default(), access_list: Default::default(), }); diff --git a/src/test_utils/evm_contract.rs b/src/test_utils/evm_contract.rs index b94df9871..86b0e982b 100644 --- a/src/test_utils/evm_contract.rs +++ b/src/test_utils/evm_contract.rs @@ -50,7 +50,7 @@ pub trait EvmContract { nonce, gas_limit: u64::MAX, to: TransactionKind::Create, - value: 0, + value: 0u64.into(), input: deploy_data.into(), ..Default::default() })) @@ -97,13 +97,13 @@ impl EvmContract for KakarotEvmContract { let data = abi.function(selector).and_then(|function| function.encode_input(¶ms))?; - let evm_address: Felt252Wrapper = self.evm_address.try_into()?; + let evm_address: Felt252Wrapper = self.evm_address.into(); Ok(Transaction::Eip1559(TxEip1559 { chain_id, nonce, gas_limit: u64::MAX, to: TransactionKind::Call(evm_address.try_into()?), - value, + value: value.into(), input: data.into(), ..Default::default() })) diff --git a/src/test_utils/mongo/mod.rs b/src/test_utils/mongo/mod.rs index 447f26c66..de97981f8 100644 --- a/src/test_utils/mongo/mod.rs +++ b/src/test_utils/mongo/mod.rs @@ -5,7 +5,7 @@ use mongodb::{ options::{DatabaseOptions, ReadConcern, UpdateModifications, UpdateOptions, WriteConcern}, Client, Collection, }; -use reth_primitives::H256; +use reth_primitives::{B256, U256}; use testcontainers::{ clients::{self, Cli}, core::WaitFor, @@ -23,7 +23,7 @@ lazy_static! { // The container is made static to avoid dropping it before the tests are finished. static ref CONTAINER: Container<'static, GenericImage> = DOCKER_CLI.run(IMAGE.clone()); - pub static ref BLOCK_HASH: H256 = H256::from_low_u64_be(0x1234); + pub static ref BLOCK_HASH: B256 = B256::from(U256::from(0x1234)); pub static ref BLOCK_NUMBER: u64 = 0x1234; } diff --git a/src/test_utils/sequencer/mod.rs b/src/test_utils/sequencer/mod.rs index 678983413..fb3ff6f47 100644 --- a/src/test_utils/sequencer/mod.rs +++ b/src/test_utils/sequencer/mod.rs @@ -1,13 +1,13 @@ use std::path::Path; -use std::str::FromStr; +use std::str::FromStr as _; use std::sync::Arc; use crate::eth_provider::provider::EthDataProvider; use crate::test_utils::eoa::KakarotEOA; use dojo_test_utils::sequencer::{Environment, SequencerConfig, StarknetConfig, TestSequencer}; -use ethers::types::H256; use foundry_config::utils::find_project_root_path; use katana_core::db::serde::state::SerializableState; +use reth_primitives::B256; use starknet::providers::jsonrpc::HttpTransport; use starknet::providers::JsonRpcClient; @@ -64,7 +64,7 @@ impl Katana { // Load PK dotenv::dotenv().expect("Failed to load .env file"); let pk = std::env::var("EVM_PRIVATE_KEY").expect("Failed to get EVM private key"); - let pk = H256::from_str(&pk).expect("Failed to parse EVM private key").into(); + let pk = B256::from_str(&pk).expect("Failed to parse EVM private key"); // Create a Kakarot client let database = mock_database().await; diff --git a/tests/alchemy.rs b/tests/alchemy.rs index 9650c7981..6df2a6271 100644 --- a/tests/alchemy.rs +++ b/tests/alchemy.rs @@ -1,5 +1,6 @@ #![cfg(feature = "testing")] use ethers::abi::Token; +use ethers::core::types::{Address as EthersAddress, U256 as EthersU256}; use kakarot_rpc::models::{balance::TokenBalances, felt::Felt252Wrapper}; use kakarot_rpc::test_utils::eoa::Eoa as _; use kakarot_rpc::test_utils::evm_contract::KakarotEvmContract; @@ -26,11 +27,17 @@ async fn test_token_balances(#[future] erc20: (Katana, KakarotEvmContract), _set start_kakarot_rpc_server(&katana).await.expect("Error setting up Kakarot RPC server"); // When - let to = eoa.evm_address().unwrap(); + let to = EthersAddress::from_slice(eoa.evm_address().unwrap().as_slice()); let amount = U256::from(10_000); - eoa.call_evm_contract(&erc20, "mint", (Token::Address(to.into()), Token::Uint(amount.into())), 0) - .await - .expect("Failed to mint ERC20 tokens"); + + eoa.call_evm_contract( + &erc20, + "mint", + (Token::Address(to), Token::Uint(EthersU256::from_big_endian(&amount.to_be_bytes::<32>()[..]))), + 0, + ) + .await + .expect("Failed to mint ERC20 tokens"); // Then let reqwest_client = reqwest::Client::new(); diff --git a/tests/eth_provider.rs b/tests/eth_provider.rs index fbce7c3a2..7b8d20e3b 100644 --- a/tests/eth_provider.rs +++ b/tests/eth_provider.rs @@ -144,7 +144,7 @@ async fn test_nonce_eoa(#[future] katana: Katana, _setup: ()) { let eth_provider = katana.eth_provider(); // When - let nonce = eth_provider.transaction_count(Address::zero(), None).await.unwrap(); + let nonce = eth_provider.transaction_count(Address::ZERO, None).await.unwrap(); // Then // Zero address shouldn't throw 'ContractNotFound', but return zero