From ab71c468e8420181c564cd0080a233307441055b Mon Sep 17 00:00:00 2001 From: Danil Date: Thu, 14 Dec 2023 15:47:19 +0100 Subject: [PATCH 01/22] first impl fork cheatcode Signed-off-by: Danil --- Cargo.lock | 1594 ++++++++--------- Cargo.toml | 14 +- crates/era-cheatcodes/Cargo.toml | 1 + crates/era-cheatcodes/src/cheatcodes.rs | 115 +- .../tests/src/cheatcodes/Deal.t.sol | 30 - .../tests/src/cheatcodes/Etch.t.sol | 28 - .../tests/src/cheatcodes/Fork.t.sol | 20 + .../tests/src/cheatcodes/GetNonce.t.sol | 34 - .../tests/src/cheatcodes/Load.t.sol | 49 - .../tests/src/cheatcodes/Roll.t.sol | 33 - .../tests/src/cheatcodes/Serialize.t.sol | 83 - .../tests/src/cheatcodes/SetNonce.t.sol | 22 - .../tests/src/cheatcodes/StartPrank.t.sol | 146 -- .../tests/src/cheatcodes/Store.t.sol | 37 - .../tests/src/cheatcodes/ToString.t.sol | 137 -- .../tests/src/cheatcodes/Warp.t.sol | 31 - crates/era-cheatcodes/tests/test.sh | 4 +- crates/evm/core/Cargo.toml | 1 - crates/evm/core/src/backend/fuzz.rs | 3 +- crates/evm/core/src/backend/mod.rs | 3 +- crates/evm/core/src/era_revm/transactions.rs | 2 +- crates/evm/evm/Cargo.toml | 1 - crates/evm/evm/src/inspectors/stack.rs | 2 +- 23 files changed, 924 insertions(+), 1466 deletions(-) delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol diff --git a/Cargo.lock b/Cargo.lock index 64ef33876..31fde4aee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,15 +25,15 @@ dependencies = [ "memchr", "pin-project-lite", "tokio", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tracing", ] [[package]] name = "actix-cors" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e" +checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" dependencies = [ "actix-utils", "actix-web", @@ -54,8 +54,8 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.3", - "base64 0.21.4", + "ahash 0.8.6", + "base64 0.21.5", "bitflags 2.4.1", "brotli", "bytes 1.5.0", @@ -78,7 +78,7 @@ dependencies = [ "sha1", "smallvec", "tokio", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tracing", "zstd 0.12.4", ] @@ -90,7 +90,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -128,7 +128,7 @@ dependencies = [ "actix-utils", "futures-core", "futures-util", - "mio 0.8.9", + "mio 0.8.10", "socket2 0.5.5", "tokio", "tracing", @@ -170,7 +170,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.3", + "ahash 0.8.6", "bytes 1.5.0", "bytestring", "cfg-if 1.0.0", @@ -202,9 +202,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" dependencies = [ "actix-router", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -313,25 +313,26 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if 1.0.0", - "getrandom 0.2.10", + "getrandom 0.2.11", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -366,11 +367,11 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-chains" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f12f8177eddf9275fa9ae5fd73b50cee062f9b1eb95ef435f28354c79ba386" +checksum = "4df496257fe2fae392687ef30207325c50c68520108a94798b0c6cc1a6102f70" dependencies = [ - "num_enum 0.7.0", + "num_enum 0.7.1", "serde", "strum 0.25.0", ] @@ -422,7 +423,7 @@ dependencies = [ "derive_arbitrary", "derive_more", "ethereum_ssz", - "getrandom 0.2.10", + "getrandom 0.2.11", "hex-literal", "itoa", "proptest", @@ -451,9 +452,9 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0391754c09fab4eae3404d19d0d297aa1c670c1775ab51d8a5312afeca23157" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -466,12 +467,12 @@ dependencies = [ "const-hex", "dunce", "heck 0.4.1", - "indexmap 2.0.2", + "indexmap 2.1.0", "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde_json", - "syn 2.0.38", + "syn 2.0.41", "syn-solidity", "tiny-keccak 2.0.2", ] @@ -543,9 +544,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -563,30 +564,30 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -602,7 +603,7 @@ dependencies = [ "axum", "bytes 1.5.0", "chrono", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "clap_complete_fig", "crc 3.0.1", @@ -616,7 +617,7 @@ dependencies = [ "foundry-common", "foundry-config", "foundry-evm", - "futures 0.3.28", + "futures 0.3.29", "hash-db", "hyper", "itertools 0.11.0", @@ -680,8 +681,8 @@ dependencies = [ "async-trait", "axum", "bytes 1.5.0", - "clap 4.4.6", - "futures 0.3.28", + "clap 4.4.11", + "futures 0.3.29", "hyper", "parity-tokio-ipc", "parking_lot 0.12.1", @@ -689,7 +690,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tower-http", "tracing", ] @@ -702,9 +703,9 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arbitrary" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e1373abdaa212b704512ec2bd8b26bd0b7d5c3f70117411a5d9a451383c859" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" [[package]] name = "ariadne" @@ -794,7 +795,7 @@ checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ "num-bigint 0.4.4", "num-traits", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -899,9 +900,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f658e2baef915ba0f26f1f7c42bfb8e12f532a01f449a090ded75ae7a07e9ba2" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" dependencies = [ "brotli", "flate2", @@ -937,9 +938,9 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -959,9 +960,9 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -970,9 +971,9 @@ version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -981,7 +982,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "pharos", "rustc_version 0.4.0", ] @@ -1038,7 +1039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -1066,7 +1067,7 @@ checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", "axum-core", - "base64 0.21.4", + "base64 0.21.5", "bitflags 1.3.2", "bytes 1.5.0", "futures-util", @@ -1157,9 +1158,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -1194,7 +1195,7 @@ dependencies = [ "byteorder", "cfg-if 1.0.0", "crossbeam 0.7.3", - "futures 0.3.28", + "futures 0.3.29", "hex", "lazy_static", "num_cpus", @@ -1217,7 +1218,7 @@ dependencies = [ "byteorder", "cfg-if 1.0.0", "crossbeam 0.7.3", - "futures 0.3.28", + "futures 0.3.29", "hex", "lazy_static", "num_cpus", @@ -1262,12 +1263,12 @@ dependencies = [ "lazycell", "peeking_take_while", "prettyplease", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -1284,12 +1285,12 @@ dependencies = [ "log", "peeking_take_while", "prettyplease", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.41", "which", ] @@ -1502,7 +1503,7 @@ dependencies = [ [[package]] name = "boojum" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#1588de7669b016df3f81f7139a1a4b131840e48b" +source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#8b17adf8eec7386bd475bfa19f350aef32f2f83f" dependencies = [ "arrayvec 0.7.4", "bincode", @@ -1510,7 +1511,7 @@ dependencies = [ "const_format", "convert_case 0.6.0", "crossbeam 0.8.2", - "crypto-bigint 0.5.3", + "crypto-bigint 0.5.5", "cs_derive 0.1.0 (git+https://github.com/matter-labs/era-boojum.git?branch=main)", "derivative", "ethereum-types 0.14.1", @@ -1543,9 +1544,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da74e2b81409b1b743f8f0c62cc6254afefb8b8e50bbfe3735550f7aeefa3448" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1563,9 +1564,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "regex-automata 0.4.3", @@ -1607,9 +1608,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytecount" -version = "0.6.4" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad152d03a2c813c80bb94fedbf3a3f02b28f793e39e7c214c8a0bcc196343de7" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "bytemuck" @@ -1644,9 +1645,9 @@ dependencies = [ [[package]] name = "bytestring" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae" +checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" dependencies = [ "bytes 1.5.0", ] @@ -1698,9 +1699,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] @@ -1748,7 +1749,7 @@ dependencies = [ "alloy-rlp", "async-trait", "chrono", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "clap_complete_fig", "comfy-table", @@ -1770,7 +1771,7 @@ dependencies = [ "foundry-config", "foundry-evm", "foundry-test-utils", - "futures 0.3.28", + "futures 0.3.29", "indicatif", "itertools 0.11.0", "rand 0.8.5", @@ -1857,7 +1858,7 @@ dependencies = [ "alloy-dyn-abi", "alloy-json-abi", "alloy-primitives", - "clap 4.4.6", + "clap 4.4.11", "criterion", "dirs 5.0.1", "ethers-core", @@ -1997,9 +1998,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -2007,9 +2008,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -2022,40 +2023,40 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.3" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ - "clap 4.4.6", + "clap 4.4.11", ] [[package]] name = "clap_complete_fig" -version = "4.4.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29bdbe21a263b628f83fcbeac86a4416a1d588c7669dd41473bc4149e4e7d2f1" +checksum = "87e571d70e22ec91d34e1c5317c8308035a2280d925167646bf094fc5de1737c" dependencies = [ - "clap 4.4.6", + "clap 4.4.11", "clap_complete", ] [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clearscreen" @@ -2153,7 +2154,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bech32", "bs58", "digest 0.10.7", @@ -2176,7 +2177,7 @@ dependencies = [ "async-trait", "byteorder", "cfg-if 1.0.0", - "getrandom 0.2.10", + "getrandom 0.2.11", "hex", "hidapi-rusb", "js-sys", @@ -2207,9 +2208,9 @@ dependencies = [ [[package]] name = "color-spantrace" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" +checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" dependencies = [ "once_cell", "owo-colors", @@ -2225,11 +2226,10 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", "windows-sys 0.48.0", ] @@ -2283,22 +2283,17 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c37be52ef5e3b394db27a2341010685ad5103c72ac15ce2e9420a7e8f93f342c" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" dependencies = [ "cfg-if 1.0.0", "cpufeatures", "hex", + "proptest", "serde", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "const-oid" version = "0.9.5" @@ -2320,7 +2315,7 @@ version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "unicode-xid 0.2.4", ] @@ -2359,9 +2354,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -2369,15 +2364,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -2406,7 +2401,7 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ - "crc-catalog 2.2.0", + "crc-catalog 2.4.0", ] [[package]] @@ -2417,9 +2412,9 @@ checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" [[package]] name = "crc-catalog" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" @@ -2439,9 +2434,9 @@ dependencies = [ "anes", "cast 0.3.0", "ciborium", - "clap 4.4.6", + "clap 4.4.11", "criterion-plot", - "futures 0.3.28", + "futures 0.3.29", "is-terminal", "itertools 0.10.5", "num-traits", @@ -2489,11 +2484,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" dependencies = [ "cfg-if 1.0.0", - "crossbeam-channel 0.5.8", - "crossbeam-deque 0.8.3", - "crossbeam-epoch 0.9.15", - "crossbeam-queue 0.3.8", - "crossbeam-utils 0.8.16", + "crossbeam-channel 0.5.9", + "crossbeam-deque 0.8.4", + "crossbeam-epoch 0.9.16", + "crossbeam-queue 0.3.9", + "crossbeam-utils 0.8.17", ] [[package]] @@ -2508,12 +2503,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", ] [[package]] @@ -2529,13 +2524,13 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch 0.9.15", - "crossbeam-utils 0.8.16", + "crossbeam-epoch 0.9.16", + "crossbeam-utils 0.8.17", ] [[package]] @@ -2555,15 +2550,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg 1.1.0", "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "memoffset 0.9.0", - "scopeguard", ] [[package]] @@ -2579,12 +2573,12 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "b9bcf5bdbfdd6030fb4a1c497b5d5fc5921aa2f60d359a17e249c0e6df3de153" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", ] [[package]] @@ -2600,9 +2594,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if 1.0.0", ] @@ -2616,7 +2610,7 @@ dependencies = [ "bitflags 2.4.1", "crossterm_winapi", "libc", - "mio 0.8.9", + "mio 0.8.10", "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", @@ -2638,16 +2632,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - [[package]] name = "crypto-bigint" version = "0.4.9" @@ -2662,9 +2646,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", @@ -2716,10 +2700,10 @@ dependencies = [ [[package]] name = "cs_derive" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#1588de7669b016df3f81f7139a1a4b131840e48b" +source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#8b17adf8eec7386bd475bfa19f350aef32f2f83f" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -2730,7 +2714,7 @@ version = "0.1.0" source = "git+https://github.com/matter-labs/era-sync_vm.git?branch=v1.3.3#ed8ab8984cae05d00d9d62196753c8d40df47c7d" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde", "syn 1.0.109", @@ -2787,9 +2771,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -2810,7 +2794,7 @@ checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "strsim 0.10.0", "syn 1.0.109", @@ -2834,7 +2818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "lock_api", "once_cell", "parking_lot_core 0.9.9", @@ -2842,9 +2826,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "debugid" @@ -2853,18 +2837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ "serde", - "uuid 1.5.0", -] - -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid 0.7.1", - "crypto-bigint 0.3.2", - "pem-rfc7468", + "uuid 1.6.1", ] [[package]] @@ -2873,7 +2846,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ - "const-oid 0.9.5", + "const-oid", "zeroize", ] @@ -2883,15 +2856,16 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ - "const-oid 0.9.5", + "const-oid", + "pem-rfc7468", "zeroize", ] [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", "serde", @@ -2903,20 +2877,20 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] [[package]] name = "derive_arbitrary" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -2926,7 +2900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case 0.4.0", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "rustc_version 0.4.0", "syn 1.0.109", @@ -2974,7 +2948,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.5", + "const-oid", "crypto-common", "subtle", ] @@ -3067,9 +3041,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "dyn-clone" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" [[package]] name = "ecdsa" @@ -3085,16 +3059,16 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der 0.7.8", "digest 0.10.7", - "elliptic-curve 0.13.6", + "elliptic-curve 0.13.8", "rfc6979 0.4.0", - "signature 2.1.0", - "spki 0.7.2", + "signature 2.2.0", + "spki 0.7.3", ] [[package]] @@ -3104,7 +3078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8 0.10.2", - "signature 2.1.0", + "signature 2.2.0", ] [[package]] @@ -3165,12 +3139,12 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.13.6" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct 0.2.0", - "crypto-bigint 0.5.3", + "crypto-bigint 0.5.5", "digest 0.10.7", "ff 0.13.0", "generic-array 0.14.7", @@ -3227,7 +3201,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes 1.5.0", "hex", "k256 0.13.1", @@ -3245,9 +3219,9 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3265,9 +3239,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "humantime", "is-terminal", @@ -3301,8 +3275,9 @@ dependencies = [ "ethers", "eyre", "foundry-cheatcodes-spec", + "foundry-common", "foundry-evm-core", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "hex", "itertools 0.12.0", "maplit", @@ -3321,18 +3296,18 @@ dependencies = [ [[package]] name = "era_test_node" version = "0.1.0-alpha.12" -source = "git+https://github.com/matter-labs/era-test-node.git?rev=21b48af90a9f9d98ec38cb93a32c119a3266f401#21b48af90a9f9d98ec38cb93a32c119a3266f401" +source = "git+https://github.com/matter-labs/era-test-node.git?rev=bc43d87f43207fbac8521d8daf145d9d9f69b85e#bc43d87f43207fbac8521d8daf145d9d9f69b85e" dependencies = [ "anyhow", "bigdecimal", "chrono", - "clap 4.4.6", + "clap 4.4.11", "colored", "ethabi 16.0.0", "eyre", - "futures 0.3.28", + "futures 0.3.29", "hex", - "indexmap 2.0.2", + "indexmap 2.1.0", "itertools 0.10.5", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "jsonrpc-core-client", @@ -3362,12 +3337,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3581,14 +3556,14 @@ dependencies = [ "ethers-etherscan", "eyre", "prettyplease", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "regex", "reqwest", "serde", "serde_json", - "syn 2.0.38", - "toml 0.8.2", + "syn 2.0.41", + "toml 0.8.8", "walkdir", ] @@ -3601,10 +3576,10 @@ dependencies = [ "const-hex", "ethers-contract-abigen", "ethers-core", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde_json", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3617,11 +3592,11 @@ dependencies = [ "cargo_metadata 0.18.1", "chrono", "const-hex", - "elliptic-curve 0.13.6", + "elliptic-curve 0.13.8", "ethabi 18.0.0", "generic-array 0.14.7", "k256 0.13.1", - "num_enum 0.7.0", + "num_enum 0.7.1", "once_cell", "open-fastrlp", "rand 0.8.5", @@ -3629,7 +3604,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.38", + "syn 2.0.41", "tempfile", "thiserror", "tiny-keccak 2.0.2", @@ -3684,7 +3659,7 @@ source = "git+https://github.com/gakonst/ethers-rs?rev=f0e5b194f09c533feb10d1a68 dependencies = [ "async-trait", "auto_impl", - "base64 0.21.4", + "base64 0.21.5", "bytes 1.5.0", "const-hex", "enr", @@ -3725,7 +3700,7 @@ dependencies = [ "coins-bip39", "coins-ledger", "const-hex", - "elliptic-curve 0.13.6", + "elliptic-curve 0.13.8", "eth-keystore", "ethers-core", "futures-executor", @@ -3737,7 +3712,7 @@ dependencies = [ "rusoto_kms", "semver 1.0.20", "sha2 0.10.8", - "spki 0.7.2", + "spki 0.7.3", "thiserror", "tracing", "trezor-client", @@ -3798,9 +3773,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" dependencies = [ "indenter", "once_cell", @@ -3846,9 +3821,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4caf31122bfc780557fdcd80897e95f12cc4d7217f8ac6b9d150df828a38ee8" dependencies = [ "bytes 1.5.0", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -3925,7 +3900,7 @@ dependencies = [ "num-bigint 0.4.4", "num-integer", "num-traits", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde", "syn 1.0.109", @@ -3939,30 +3914,30 @@ checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] name = "figment" -version = "0.10.11" +version = "0.10.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a014ac935975a70ad13a3bff2463b1c1b083b35ae4cb6309cfc59476aa7a181f" +checksum = "649f3e5d826594057e9a519626304d8da859ea8a0b18ce99500c586b8d45faee" dependencies = [ "atomic", "parking_lot 0.12.1", "pear", "serde", "tempfile", - "toml 0.8.2", + "toml 0.8.8", "uncased", "version_check", ] [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall 0.4.1", + "windows-sys 0.52.0", ] [[package]] @@ -4061,7 +4036,7 @@ dependencies = [ "anvil", "async-trait", "axum", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "clap_complete_fig", "comfy-table", @@ -4085,7 +4060,7 @@ dependencies = [ "foundry-debugger", "foundry-evm", "foundry-test-utils", - "futures 0.3.28", + "futures 0.3.29", "globset", "hyper", "indicatif", @@ -4139,7 +4114,7 @@ dependencies = [ "serde_json", "solang-parser", "thiserror", - "toml 0.8.2", + "toml 0.8.8", "tracing", ] @@ -4154,16 +4129,16 @@ dependencies = [ "pretty_assertions", "solang-parser", "thiserror", - "toml 0.8.2", + "toml 0.8.8", "tracing", "tracing-subscriber", ] [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -4231,7 +4206,7 @@ dependencies = [ "alloy-json-abi", "alloy-primitives", "async-trait", - "clap 4.4.6", + "clap 4.4.11", "color-eyre", "const-hex", "dotenvy", @@ -4275,7 +4250,7 @@ dependencies = [ "ansi_term", "anyhow", "async-trait", - "clap 4.4.6", + "clap 4.4.11", "comfy-table", "const-hex", "dirs 5.0.1", @@ -4377,7 +4352,7 @@ dependencies = [ "serde_regex", "tempfile", "thiserror", - "toml 0.8.2", + "toml 0.8.8", "toml_edit 0.21.0", "tracing", "walkdir", @@ -4421,14 +4396,13 @@ dependencies = [ "foundry-evm-coverage", "foundry-evm-fuzz", "foundry-evm-traces", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "multivm", "parking_lot 0.12.1", "proptest", "revm", "thiserror", "tracing", - "zksync_state", ] [[package]] @@ -4451,7 +4425,7 @@ dependencies = [ "foundry-compilers", "foundry-config", "foundry-macros", - "futures 0.3.28", + "futures 0.3.29", "itertools 0.11.0", "maplit", "multivm", @@ -4465,7 +4439,6 @@ dependencies = [ "tracing", "url", "zksync_basic_types", - "zksync_state", "zksync_types", "zksync_utils", "zksync_web3_decl", @@ -4501,7 +4474,7 @@ dependencies = [ "foundry-evm-core", "foundry-evm-coverage", "foundry-evm-traces", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "itertools 0.11.0", "parking_lot 0.12.1", "proptest", @@ -4528,11 +4501,11 @@ dependencies = [ "foundry-compilers", "foundry-config", "foundry-evm-core", - "futures 0.3.28", - "hashbrown 0.14.2", + "futures 0.3.29", + "hashbrown 0.14.3", "itertools 0.11.0", "once_cell", - "ordered-float 4.1.1", + "ordered-float 4.2.0", "revm", "serde", "tempfile", @@ -4546,9 +4519,9 @@ name = "foundry-macros" version = "0.2.0" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -4606,7 +4579,7 @@ dependencies = [ [[package]] name = "franklin-crypto" version = "0.0.5" -source = "git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper#a9e29acd73245bd3b670b62b4d481ece06d43803" +source = "git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper#2546c63b91b59bdb0ad342d26f03fb57477550b2" dependencies = [ "arr_macro", "bellman_ce 0.3.2 (git+https://github.com/matter-labs/bellman?branch=snark-wrapper)", @@ -4712,9 +4685,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -4727,9 +4700,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -4737,15 +4710,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -4766,9 +4739,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-locks" @@ -4782,26 +4755,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -4815,9 +4788,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures 0.1.31", "futures-channel", @@ -4874,9 +4847,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -4897,9 +4870,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" @@ -5108,15 +5081,15 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b6d623a1152c3facb79067d6e2ecdae48130030cf27d6eb21109f13bd7b836" +checksum = "b686a35799b53a9825575ca3f06481d0a053a409c4d97ffcf5ddd67a8760b497" [[package]] name = "gix-utils" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b85d89dc728613e26e0ed952a19583744e7f5240fcd4aa30d6c824ffd8b52f0f" +checksum = "9f82c41937f00e15a1f6cb0b55307f0ca1f77f4407ff2bf440be35aa688c6a3e" dependencies = [ "fastrand 2.0.1", ] @@ -5139,15 +5112,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" dependencies = [ "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -5198,12 +5171,12 @@ dependencies = [ [[package]] name = "google-cloud-auth" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f40175857d0b8d7b6cad6cd9594284da5041387fa2ddff30ab6d8faef65eb" +checksum = "af1087f1fbd2dd3f58c17c7574ddd99cd61cbbbc2c4dc81114b8687209b196cb" dependencies = [ "async-trait", - "base64 0.21.4", + "base64 0.21.5", "google-cloud-metadata", "google-cloud-token", "home", @@ -5220,9 +5193,9 @@ dependencies = [ [[package]] name = "google-cloud-metadata" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e4ad0802d3f416f62e7ce01ac1460898ee0efc98f8b45cd4aab7611607012f" +checksum = "cc279bfb50487d7bcd900e8688406475fc750fe474a835b2ab9ade9eb1fc90e2" dependencies = [ "reqwest", "thiserror", @@ -5231,12 +5204,13 @@ dependencies = [ [[package]] name = "google-cloud-storage" -version = "0.12.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "215abab97e07d144428425509c1dad07e57ea72b84b21bcdb6a8a5f12a5c4932" +checksum = "ac04b29849ebdeb9fb008988cc1c4d1f0c9d121b4c7f1ddeb8061df124580e93" dependencies = [ "async-stream", - "base64 0.21.4", + "async-trait", + "base64 0.21.5", "bytes 1.5.0", "futures-util", "google-cloud-auth", @@ -5245,10 +5219,10 @@ dependencies = [ "hex", "once_cell", "percent-encoding", + "pkcs8 0.10.2", "regex", "reqwest", - "ring 0.16.20", - "rsa", + "ring 0.17.7", "serde", "serde_json", "sha2 0.10.8", @@ -5261,9 +5235,9 @@ dependencies = [ [[package]] name = "google-cloud-token" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcd62eb34e3de2f085bcc33a09c3e17c4f65650f36d53eb328b00d63bcb536a" +checksum = "8f49c12ba8b21d128a2ce8585955246977fbce4415f680ebf9199b6f9d6d725f" dependencies = [ "async-trait", ] @@ -5275,7 +5249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19775995ee20209163239355bc3ad2f33f83da35d9ef72dea26e5af753552c87" dependencies = [ "dashmap", - "futures 0.3.28", + "futures 0.3.29", "futures-timer", "no-std-compat", "nonzero_ext", @@ -5309,9 +5283,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes 1.5.0", "fnv", @@ -5319,10 +5293,10 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tracing", ] @@ -5334,9 +5308,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "handlebars" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" dependencies = [ "log", "pest", @@ -5367,7 +5341,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -5376,7 +5350,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -5385,16 +5359,16 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", ] [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "allocator-api2", "serde", ] @@ -5419,9 +5393,9 @@ dependencies = [ [[package]] name = "hdrhistogram" -version = "7.5.2" +version = "7.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8" +checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d" dependencies = [ "byteorder", "num-traits", @@ -5433,7 +5407,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes 1.5.0", "headers-core", "http", @@ -5501,9 +5475,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hidapi-rusb" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee9fc48be9eab25c28b413742b38b57b85c10b5efd2d47ef013f82335cbecc8e" +checksum = "efdc2ec354929a6e8f3c6b6923a4d97427ec2f764cfee8cd4bfe890946cdf08b" dependencies = [ "cc", "libc", @@ -5513,9 +5487,9 @@ dependencies = [ [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac 0.12.1", ] @@ -5578,16 +5552,16 @@ dependencies = [ "log", "mac", "markup5ever", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes 1.5.0", "fnv", @@ -5596,9 +5570,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes 1.5.0", "http", @@ -5670,15 +5644,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", "hyper", "log", - "rustls 0.21.7", + "rustls 0.21.10", "rustls-native-certs", "tokio", "tokio-rustls 0.24.1", @@ -5736,19 +5710,28 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "ignore" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" dependencies = [ + "crossbeam-deque 0.8.4", "globset", - "lazy_static", "log", "memchr", - "regex", + "regex-automata 0.4.3", "same-file", - "thread_local", "walkdir", "winapi-util", ] @@ -5760,7 +5743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a4d73056a8d335492938cabeef794f38968ef43e6db9bc946638cfd6281003b" dependencies = [ "dunce", - "futures 0.3.28", + "futures 0.3.29", "gix-config", "ignore", "miette", @@ -5800,7 +5783,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ - "parity-scale-codec 3.6.5", + "parity-scale-codec 3.6.9", ] [[package]] @@ -5836,7 +5819,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -5859,12 +5842,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -6001,9 +5984,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" @@ -6040,7 +6023,7 @@ version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ "derive_more", - "futures 0.3.28", + "futures 0.3.29", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "jsonrpc-pubsub", "log", @@ -6054,7 +6037,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "futures-executor", "futures-util", "log", @@ -6068,7 +6051,7 @@ name = "jsonrpc-core" version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "futures-executor", "futures-util", "log", @@ -6082,7 +6065,7 @@ name = "jsonrpc-core-client" version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "jsonrpc-client-transports", ] @@ -6092,7 +6075,7 @@ version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ "proc-macro-crate 0.1.5", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -6102,7 +6085,7 @@ name = "jsonrpc-http-server" version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "hyper", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "jsonrpc-server-utils", @@ -6117,7 +6100,7 @@ name = "jsonrpc-pubsub" version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "lazy_static", "log", @@ -6132,7 +6115,7 @@ version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ "bytes 1.5.0", - "futures 0.3.28", + "futures 0.3.29", "globset", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "lazy_static", @@ -6148,7 +6131,7 @@ name = "jsonrpc-ws-server" version = "18.0.0" source = "git+https://github.com/matter-labs/jsonrpc.git?branch=master#12c53e3e20c09c2fb9966a4ef1b0ea63de172540" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "jsonrpc-core 18.0.0 (git+https://github.com/matter-labs/jsonrpc.git?branch=master)", "jsonrpc-server-utils", "log", @@ -6191,7 +6174,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls 0.24.1", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tracing", "webpki-roots 0.24.0", ] @@ -6232,7 +6215,7 @@ checksum = "aa7165efcbfbc951d180162ff28fe91b657ed81925e37a35e4a396ce12109f96" dependencies = [ "async-trait", "hyper", - "hyper-rustls 0.24.1", + "hyper-rustls 0.24.2", "jsonrpsee-core", "jsonrpsee-types", "serde", @@ -6251,7 +6234,7 @@ checksum = "21dc12b1d4f16a86e8c522823c4fab219c88c03eb7c924ec0501a64bf12e058b" dependencies = [ "heck 0.4.1", "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -6271,7 +6254,7 @@ dependencies = [ "soketto", "tokio", "tokio-stream", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tower", "tracing", ] @@ -6319,7 +6302,7 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "pem", "ring 0.16.20", "serde", @@ -6346,11 +6329,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if 1.0.0", - "ecdsa 0.16.8", - "elliptic-curve 0.13.6", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", "sha2 0.10.8", - "signature 2.1.0", + "signature 2.2.0", ] [[package]] @@ -6460,9 +6443,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libgit2-sys" @@ -6492,6 +6475,17 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + [[package]] name = "librocksdb-sys" version = "0.11.0+8.1.1" @@ -6532,35 +6526,35 @@ dependencies = [ [[package]] name = "linkme" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ed2ee9464ff9707af8e9ad834cffa4802f072caad90639c583dd3c62e6e608" +checksum = "b1e6b0bb9ca88d3c5ae88240beb9683821f903b824ee8381ef9ab4e8522fbfa9" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125974b109d512fccbc6c0244e7580143e460895dfd6ea7f8bbb692fd94396" +checksum = "b3b3f61e557a617ec6ba36c79431e1f3b5e100d67cfbdb61ed6ef384298af016" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "local-channel" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a493488de5f18c8ffcba89eebb8532ffc562dc400490eb65b84893fae0b178" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" dependencies = [ "futures-core", "futures-sink", @@ -6569,9 +6563,9 @@ dependencies = [ [[package]] name = "local-waker" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" @@ -6606,10 +6600,10 @@ checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" dependencies = [ "beef", "fnv", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "regex-syntax 0.6.29", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -6627,7 +6621,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" dependencies = [ - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -6724,22 +6718,23 @@ dependencies = [ [[package]] name = "mdbook" -version = "0.4.35" +version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c3f88addd34930bc5f01b9dc19f780447e51c92bf2536e3ded058018271775d" +checksum = "80992cb0e05f22cc052c99f8e883f1593b891014b96a8b4637fd274d7030c85e" dependencies = [ "ammonia", "anyhow", "chrono", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "elasticlunr-rs", - "env_logger 0.10.0", + "env_logger 0.10.1", "handlebars", "log", "memchr", "once_cell", "opener", + "pathdiff", "pulldown-cmark", "regex", "serde", @@ -6818,18 +6813,18 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "metrics-macros", "portable-atomic", ] [[package]] name = "metrics-exporter-prometheus" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a4964177ddfdab1e3a2b37aec7cf320e14169abb0ed73999f558136409178d5" +checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "hyper", "indexmap 1.9.3", "ipnet", @@ -6847,9 +6842,9 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -6858,8 +6853,8 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" dependencies = [ - "crossbeam-epoch 0.9.15", - "crossbeam-utils 0.8.16", + "crossbeam-epoch 0.9.16", + "crossbeam-utils 0.8.17", "hashbrown 0.13.1", "metrics", "num_cpus", @@ -6885,9 +6880,9 @@ version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -6912,8 +6907,8 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" dependencies = [ - "crossbeam-channel 0.5.8", - "crossbeam-utils 0.8.16", + "crossbeam-channel 0.5.9", + "crossbeam-utils 0.8.17", "dashmap", "skeptic", "smallvec", @@ -6957,9 +6952,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", @@ -7000,7 +6995,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multivm" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "hex", @@ -7137,13 +7132,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486" dependencies = [ "bitflags 1.3.2", - "crossbeam-channel 0.5.8", + "crossbeam-channel 0.5.9", "filetime", "fsevent-sys", "inotify", "kqueue", "libc", - "mio 0.8.9", + "mio 0.8.10", "walkdir", "windows-sys 0.45.0", ] @@ -7210,23 +7205,6 @@ dependencies = [ "serde", ] -[[package]] -name = "num-bigint-dig" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" -dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.8.5", - "smallvec", - "zeroize", -] - [[package]] name = "num-complex" version = "0.3.1" @@ -7263,7 +7241,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -7355,11 +7333,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" dependencies = [ - "num_enum_derive 0.7.0", + "num_enum_derive 0.7.1", ] [[package]] @@ -7369,21 +7347,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro-crate 2.0.0", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -7412,9 +7390,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -7454,7 +7432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" dependencies = [ "bytes 1.5.0", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -7472,9 +7450,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -7491,9 +7469,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -7504,18 +7482,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.5+3.1.3" +version = "300.2.1+3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" +checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" dependencies = [ "cc", "libc", @@ -7541,9 +7519,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "4.1.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" dependencies = [ "num-traits", ] @@ -7658,15 +7636,15 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ "arrayvec 0.7.4", "bitvec 1.0.1", "byte-slice-cast", "impl-trait-for-tuples", - "parity-scale-codec-derive 3.6.5", + "parity-scale-codec-derive 3.6.9", "serde", ] @@ -7677,19 +7655,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] [[package]] name = "parity-scale-codec-derive" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro-crate 2.0.0", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -7700,7 +7678,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "libc", "log", "rand 0.7.3", @@ -7728,7 +7706,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "syn 1.0.109", "synstructure", ] @@ -7832,6 +7810,12 @@ 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.6.0" @@ -7878,9 +7862,9 @@ dependencies = [ [[package]] name = "pear" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a386cd715229d399604b50d1361683fe687066f42d56f54be995bc6868f71c" +checksum = "4ccca0f6c17acc81df8e242ed473ec144cbf5c98037e69aa6d144780aad103c8" dependencies = [ "inlinable_string", "pear_codegen", @@ -7889,14 +7873,14 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f0f13dac8069c139e8300a6510e3f4143ecf5259c60b116a9b271b4ca0d54" +checksum = "2e22670e8eb757cff11d6c199ca7b987f352f0346e0be4dd23869ec72cb53c77" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "proc-macro2-diagnostics", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -7916,24 +7900,24 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.3.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ "base64ct", ] [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ "memchr", "thiserror", @@ -7942,9 +7926,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" dependencies = [ "pest", "pest_generator", @@ -7952,22 +7936,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "pest_meta" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" dependencies = [ "once_cell", "pest", @@ -7981,7 +7965,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap 2.1.0", ] [[package]] @@ -7990,7 +7974,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "rustc_version 0.4.0", ] @@ -8061,9 +8045,9 @@ checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ "phf_generator 0.11.2", "phf_shared 0.11.2", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -8099,9 +8083,9 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -8116,28 +8100,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" -dependencies = [ - "der 0.5.1", - "pkcs8 0.8.0", - "zeroize", -] - -[[package]] -name = "pkcs8" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" -dependencies = [ - "der 0.5.1", - "spki 0.5.4", - "zeroize", -] - [[package]] name = "pkcs8" version = "0.9.0" @@ -8155,7 +8117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der 0.7.8", - "spki 0.7.2", + "spki 0.7.3", ] [[package]] @@ -8223,9 +8185,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.4.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "powerfmt" @@ -8261,8 +8223,8 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ - "proc-macro2 1.0.69", - "syn 2.0.38", + "proc-macro2 1.0.70", + "syn 2.0.41", ] [[package]] @@ -8311,6 +8273,15 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -8318,7 +8289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", "version_check", @@ -8330,7 +8301,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "version_check", ] @@ -8352,9 +8323,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -8365,9 +8336,9 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", "version_check", "yansi 1.0.0-rc.1", ] @@ -8378,7 +8349,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "629e0d57f265ca8238345cb616eea8847b8ecb86b5d97d155be2c8963a314379" dependencies = [ - "futures 0.3.28", + "futures 0.3.29", "tokio", "tokio-stream", ] @@ -8401,15 +8372,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "prometheus_exporter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "metrics", @@ -8421,9 +8392,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", @@ -8433,7 +8404,7 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift 0.3.0", - "regex-syntax 0.7.5", + "regex-syntax 0.8.2", "rusty-fork", "tempfile", "unarray", @@ -8445,7 +8416,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf16337405ca084e9c78985114633b6827711d22b9e6ef6c6c0d665eb3f0b6e" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -8477,7 +8448,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.38", + "syn 2.0.41", "tempfile", "which", ] @@ -8490,9 +8461,9 @@ checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", "itertools 0.11.0", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -8501,7 +8472,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "057237efdb71cf4b3f9396302a3d6599a92fa94063ba537b66130980ea9909f3" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "logos", "miette", "once_cell", @@ -8584,7 +8555,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" dependencies = [ - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "libc", "mach", "once_cell", @@ -8600,7 +8571,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "libc", "mach2", "once_cell", @@ -8640,7 +8611,7 @@ version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", ] [[package]] @@ -8781,7 +8752,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", ] [[package]] @@ -8916,8 +8887,8 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-deque 0.8.3", - "crossbeam-utils 0.8.16", + "crossbeam-deque 0.8.4", + "crossbeam-utils 0.8.17", ] [[package]] @@ -8938,15 +8909,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -8958,12 +8920,12 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", + "getrandom 0.2.11", + "libredox", "thiserror", ] @@ -8976,7 +8938,7 @@ dependencies = [ "hash-db", "hash256-std-hasher", "keccak-hasher", - "parity-scale-codec 3.6.5", + "parity-scale-codec 3.6.9", "trie-db", "trie-root", ] @@ -9037,7 +8999,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes 1.5.0", "encoding_rs", "futures-core", @@ -9046,7 +9008,7 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls 0.24.1", + "hyper-rustls 0.24.2", "hyper-tls", "ipnet", "js-sys", @@ -9057,7 +9019,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.7", + "rustls 0.21.10", "rustls-native-certs", "rustls-pemfile", "serde", @@ -9067,14 +9029,14 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-rustls 0.24.1", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.25.2", + "webpki-roots 0.25.3", "winreg", ] @@ -9169,7 +9131,7 @@ dependencies = [ "bitvec 1.0.1", "c-kzg", "enumn", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "hex", "serde", ] @@ -9212,12 +9174,12 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", - "getrandom 0.2.10", + "getrandom 0.2.11", "libc", "spin 0.9.8", "untrusted 0.9.0", @@ -9261,7 +9223,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -9278,43 +9240,23 @@ dependencies = [ [[package]] name = "rpassword" -version = "7.2.0" +version = "7.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" +checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" dependencies = [ "libc", "rtoolbox", - "winapi 0.3.9", -] - -[[package]] -name = "rsa" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" -dependencies = [ - "byteorder", - "digest 0.10.7", - "num-bigint-dig", - "num-integer", - "num-iter", - "num-traits", - "pkcs1", - "pkcs8 0.8.0", - "rand_core 0.6.4", - "smallvec", - "subtle", - "zeroize", + "windows-sys 0.48.0", ] [[package]] name = "rtoolbox" -version = "0.0.1" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" dependencies = [ "libc", - "winapi 0.3.9", + "windows-sys 0.48.0", ] [[package]] @@ -9331,7 +9273,7 @@ dependencies = [ "fastrlp", "num-bigint 0.4.4", "num-traits", - "parity-scale-codec 3.6.5", + "parity-scale-codec 3.6.9", "primitive-types 0.12.2", "proptest", "rand 0.8.5", @@ -9368,7 +9310,7 @@ dependencies = [ "base64 0.13.1", "bytes 1.5.0", "crc32fast", - "futures 0.3.28", + "futures 0.3.29", "http", "hyper", "hyper-rustls 0.23.2", @@ -9392,7 +9334,7 @@ dependencies = [ "async-trait", "chrono", "dirs-next", - "futures 0.3.28", + "futures 0.3.29", "hyper", "serde", "serde_json", @@ -9409,7 +9351,7 @@ checksum = "3e1fc19cfcfd9f6b2f96e36d5b0dddda9004d2cbfc2d17543e3b9f10cc38fce8" dependencies = [ "async-trait", "bytes 1.5.0", - "futures 0.3.28", + "futures 0.3.29", "rusoto_core", "serde", "serde_json", @@ -9425,7 +9367,7 @@ dependencies = [ "bytes 1.5.0", "chrono", "digest 0.9.0", - "futures 0.3.28", + "futures 0.3.29", "hex", "hmac 0.11.0", "http", @@ -9479,15 +9421,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -9504,12 +9446,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.16.20", + "ring 0.17.7", "rustls-webpki", "sct", ] @@ -9528,21 +9470,21 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", ] [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -9588,9 +9530,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "salsa20" @@ -9627,7 +9569,7 @@ checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "cfg-if 1.0.0", "derive_more", - "parity-scale-codec 3.6.5", + "parity-scale-codec 3.6.9", "scale-info-derive", ] @@ -9638,7 +9580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ "proc-macro-crate 1.3.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -9654,9 +9596,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7b0ce13155372a76ee2e1c5ffba1fe61ede73fbea5630d61eee6fac4929c0c" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" dependencies = [ "dyn-clone", "schemars_derive", @@ -9666,11 +9608,11 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85e2a16b12bdb763244c69ab79363d71db2b4b918a2def53f80b02e0574b13c" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde_derive_internals", "syn 1.0.109", @@ -9712,12 +9654,12 @@ dependencies = [ [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -9867,9 +9809,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "sentry" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0097a48cd1999d983909f07cb03b15241c5af29e5e679379efac1c06296abecc" +checksum = "6ce4b57f1b521f674df7a1d200be8ff5d74e3712020ee25b553146657b5377d5" dependencies = [ "httpdate", "native-tls", @@ -9886,9 +9828,9 @@ dependencies = [ [[package]] name = "sentry-backtrace" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a7b80fa1dd6830a348d38a8d3a9761179047757b7dca29aef82db0118b9670" +checksum = "58cc8d4e04a73de8f718dc703943666d03f25d3e9e4d0fb271ca0b8c76dfa00e" dependencies = [ "backtrace", "once_cell", @@ -9898,9 +9840,9 @@ dependencies = [ [[package]] name = "sentry-contexts" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7615dc588930f1fd2e721774f25844ae93add2dbe2d3c2f995ce5049af898147" +checksum = "6436c1bad22cdeb02179ea8ef116ffc217797c028927def303bc593d9320c0d1" dependencies = [ "hostname", "libc", @@ -9912,9 +9854,9 @@ dependencies = [ [[package]] name = "sentry-core" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f51264e4013ed9b16558cce43917b983fa38170de2ca480349ceb57d71d6053" +checksum = "901f761681f97db3db836ef9e094acdd8756c40215326c194201941947164ef1" dependencies = [ "once_cell", "rand 0.8.5", @@ -9925,9 +9867,9 @@ dependencies = [ [[package]] name = "sentry-debug-images" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fe6180fa564d40bb942c9f0084ffb5de691c7357ead6a2b7a3154fae9e401dd" +checksum = "afdb263e73d22f39946f6022ed455b7561b22ff5553aca9be3c6a047fa39c328" dependencies = [ "findshlibs", "once_cell", @@ -9936,9 +9878,9 @@ dependencies = [ [[package]] name = "sentry-panic" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323160213bba549f9737317b152af116af35c0410f4468772ee9b606d3d6e0fa" +checksum = "74fbf1c163f8b6a9d05912e1b272afa27c652e8b47ea60cb9a57ad5e481eea99" dependencies = [ "sentry-backtrace", "sentry-core", @@ -9946,9 +9888,9 @@ dependencies = [ [[package]] name = "sentry-tracing" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38033822128e73f7b6ca74c1631cef8868890c6cb4008a291cf73530f87b4eac" +checksum = "82eabcab0a047040befd44599a1da73d3adb228ff53b5ed9795ae04535577704" dependencies = [ "sentry-backtrace", "sentry-core", @@ -9958,9 +9900,9 @@ dependencies = [ [[package]] name = "sentry-types" -version = "0.31.7" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e663b3eb62ddfc023c9cf5432daf5f1a4f6acb1df4d78dd80b740b32dd1a740" +checksum = "da956cca56e0101998c8688bc65ce1a96f00673a0e58e663664023d4c7911e82" dependencies = [ "debugid", "hex", @@ -9970,7 +9912,7 @@ dependencies = [ "thiserror", "time", "url", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -9981,9 +9923,9 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -10000,13 +9942,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -10015,18 +9957,18 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "itoa", "ryu", "serde", @@ -10058,16 +10000,16 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -10102,7 +10044,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ "darling", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -10114,7 +10056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" dependencies = [ "dashmap", - "futures 0.3.28", + "futures 0.3.29", "lazy_static", "log", "parking_lot 0.12.1", @@ -10127,9 +10069,9 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -10288,7 +10230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio 0.8.9", + "mio 0.8.10", "signal-hook", ] @@ -10313,9 +10255,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -10387,9 +10329,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" dependencies = [ "serde", ] @@ -10457,7 +10399,7 @@ checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.1", "bytes 1.5.0", - "futures 0.3.28", + "futures 0.3.29", "http", "httparse", "log", @@ -10491,16 +10433,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "spki" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" -dependencies = [ - "base64ct", - "der 0.5.1", -] - [[package]] name = "spki" version = "0.6.0" @@ -10513,9 +10445,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der 0.7.8", @@ -10554,7 +10486,7 @@ version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", "atoi", "base64 0.13.1", "bigdecimal", @@ -10563,7 +10495,7 @@ dependencies = [ "bytes 1.5.0", "chrono", "crc 2.1.0", - "crossbeam-queue 0.3.8", + "crossbeam-queue 0.3.9", "dirs 4.0.0", "either", "event-listener", @@ -10612,7 +10544,7 @@ dependencies = [ "heck 0.4.1", "hex", "once_cell", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "serde", "serde_json", @@ -10675,7 +10607,7 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator 0.10.0", "phf_shared 0.10.0", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", ] @@ -10721,7 +10653,7 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", ] @@ -10751,7 +10683,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "rustversion", "syn 1.0.109", @@ -10764,10 +10696,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "rustversion", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -10791,9 +10723,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "svm-rs" -version = "0.3.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597e3a746727984cb7ea2487b6a40726cad0dbe86628e7d429aa6b8c4c153db4" +checksum = "20689c7d03b6461b502d0b95d6c24874c7d24dea2688af80486a130a06af3b07" dependencies = [ "dirs 5.0.1", "fs2", @@ -10811,9 +10743,9 @@ dependencies = [ [[package]] name = "svm-rs-builds" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2271abd7d01895a3e5bfa4b578e32f09155002ce1ec239532e297f82aafad06b" +checksum = "aa64b5e8eecd3a8af7cfc311e29db31a268a62d5953233d3e8243ec77a71c4e3" dependencies = [ "build_const", "hex", @@ -10839,18 +10771,18 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.38" +version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "unicode-ident", ] @@ -10862,9 +10794,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2c7ad08db24862d5b787a94714ff6b047935c3e3f60af944ac969404debd7ff" dependencies = [ "paste", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -10902,7 +10834,7 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", "syn 1.0.109", "unicode-xid 0.2.4", @@ -10943,13 +10875,13 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if 1.0.0", "fastrand 2.0.1", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.48.0", ] @@ -10978,9 +10910,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -11010,13 +10942,23 @@ dependencies = [ [[package]] name = "test-log" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f66edd6b6cd810743c0c71e1d085e92b01ce6a72782032e3f794c8284fe4bcdd" +checksum = "6159ab4116165c99fc88cce31f99fa2c9dbe08d3691cb38da02fc3b45f357d2b" dependencies = [ - "proc-macro2 1.0.69", + "env_logger 0.10.1", + "test-log-macros", +] + +[[package]] +name = "test-log-macros" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d" +dependencies = [ + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -11043,9 +10985,9 @@ version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -11143,14 +11085,14 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ "backtrace", "bytes 1.5.0", "libc", - "mio 0.8.9", + "mio 0.8.10", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", @@ -11166,9 +11108,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -11198,7 +11140,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.7", + "rustls 0.21.10", "tokio", ] @@ -11222,12 +11164,12 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.21.7", + "rustls 0.21.10", "tokio", "tokio-native-tls", "tokio-rustls 0.24.1", "tungstenite", - "webpki-roots 0.25.2", + "webpki-roots 0.25.3", ] [[package]] @@ -11246,9 +11188,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes 1.5.0", "futures-core", @@ -11270,15 +11212,15 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.21.0", ] [[package]] @@ -11307,20 +11249,18 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "toml_datetime", "winnow", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.2", - "serde", - "serde_spanned", + "indexmap 2.1.0", "toml_datetime", "winnow", ] @@ -11331,7 +11271,9 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -11357,7 +11299,7 @@ dependencies = [ "rand 0.8.5", "slab", "tokio", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tower-layer", "tower-service", "tracing", @@ -11370,7 +11312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ "async-compression", - "base64 0.21.4", + "base64 0.21.5", "bitflags 2.4.1", "bytes 1.5.0", "futures-core", @@ -11385,12 +11327,12 @@ dependencies = [ "percent-encoding", "pin-project-lite", "tokio", - "tokio-util 0.7.9", + "tokio-util 0.7.10", "tower", "tower-layer", "tower-service", "tracing", - "uuid 1.5.0", + "uuid 1.6.1", ] [[package]] @@ -11423,9 +11365,9 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -11460,12 +11402,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -11481,9 +11423,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -11550,15 +11492,15 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" @@ -11574,7 +11516,7 @@ dependencies = [ "log", "native-tls", "rand 0.8.5", - "rustls 0.21.7", + "rustls 0.21.10", "sha1", "thiserror", "url", @@ -11641,15 +11583,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-bom" -version = "2.0.2" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98e90c70c9f0d4d1ee6d0a7d04aa06cb9bbd53d8cfbdd62a0269a7c2eb640552" +checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" [[package]] name = "unicode-ident" @@ -11730,11 +11672,11 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "log", "native-tls", "once_cell", @@ -11743,12 +11685,12 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -11777,17 +11719,17 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", "serde", ] [[package]] name = "uuid" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", "serde", ] @@ -11811,9 +11753,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "8.2.5" +version = "8.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e7dc29b3c54a2ea67ef4f953d5ec0c4085035c0ae2d325be1c0d2144bd9f16" +checksum = "1290fd64cc4e7d3c9b07d7f333ce0ce0007253e32870e632624835cc80b83939" dependencies = [ "anyhow", "git2", @@ -11857,15 +11799,15 @@ name = "vise-macros" version = "0.1.0" source = "git+https://github.com/matter-labs/vise.git?rev=dd05139b76ab0843443ab3ff730174942c825dae#dd05139b76ab0843443ab3ff730174942c825dae" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "vlog" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "chrono", "sentry", @@ -11939,9 +11881,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", "wasm-bindgen-shared", ] @@ -11973,9 +11915,9 @@ version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -12010,7 +11952,7 @@ dependencies = [ "atomic-take", "clearscreen", "command-group", - "futures 0.3.28", + "futures 0.3.29", "ignore-files", "miette", "nix 0.26.4", @@ -12049,9 +11991,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -12064,16 +12006,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5388522c899d1e1c96a4c307e3797e0f697ba7c77dd8e0e625ecba9dd0342937" dependencies = [ "arrayvec 0.7.4", - "base64 0.21.4", + "base64 0.21.5", "bytes 1.5.0", "derive_more", "ethabi 18.0.0", "ethereum-types 0.14.1", - "futures 0.3.28", + "futures 0.3.29", "futures-timer", "headers", "hex", - "idna", + "idna 0.4.0", "jsonrpc-core 18.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log", "once_cell", @@ -12094,7 +12036,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.5", + "ring 0.17.7", "untrusted 0.9.0", ] @@ -12109,9 +12051,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "which" @@ -12396,9 +12338,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.26" +version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" +checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" dependencies = [ "memchr", ] @@ -12430,7 +12372,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" dependencies = [ "async_io_stream", - "futures 0.3.28", + "futures 0.3.29", "js-sys", "log", "pharos", @@ -12481,11 +12423,31 @@ version = "1.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" +[[package]] +name = "zerocopy" +version = "0.7.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +dependencies = [ + "proc-macro2 1.0.70", + "quote 1.0.33", + "syn 2.0.41", +] + [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] @@ -12496,9 +12458,9 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] @@ -12512,7 +12474,7 @@ dependencies = [ "bzip2", "constant_time_eq", "crc32fast", - "crossbeam-utils 0.8.16", + "crossbeam-utils 0.8.17", "flate2", "hmac 0.12.1", "pbkdf2 0.11.0", @@ -12605,7 +12567,7 @@ dependencies = [ "async-trait", "cast 0.2.0", "chrono", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "clap_complete_fig", "comfy-table", @@ -12627,7 +12589,7 @@ dependencies = [ "foundry-config", "foundry-evm", "foundry-test-utils", - "futures 0.3.28", + "futures 0.3.29", "indicatif", "itertools 0.11.0", "rand 0.8.5", @@ -12723,7 +12685,7 @@ dependencies = [ "codegen 0.2.0", "crossbeam 0.8.2", "derivative", - "env_logger 0.10.0", + "env_logger 0.10.1", "hex", "num-bigint 0.4.4", "num-integer", @@ -12750,7 +12712,7 @@ dependencies = [ "codegen 0.2.0", "crossbeam 0.8.2", "derivative", - "env_logger 0.10.0", + "env_logger 0.10.1", "hex", "rand 0.4.6", "rayon", @@ -12773,7 +12735,7 @@ dependencies = [ "anvil", "async-trait", "axum", - "clap 4.4.6", + "clap 4.4.11", "clap_complete", "clap_complete_fig", "comfy-table", @@ -12798,7 +12760,7 @@ dependencies = [ "foundry-debugger", "foundry-evm", "foundry-test-utils", - "futures 0.3.28", + "futures 0.3.29", "globset", "hyper", "indicatif", @@ -12840,8 +12802,8 @@ version = "0.1.0" source = "git+https://github.com/lambdaclass/zksync-web3-rs.git?rev=70327ae5413c517bd4d27502507cdd96ee40cd22#70327ae5413c517bd4d27502507cdd96ee40cd22" dependencies = [ "async-trait", - "clap 4.4.6", - "env_logger 0.10.0", + "clap 4.4.11", + "env_logger 0.10.1", "ethers", "ethers-contract", "hex", @@ -12856,7 +12818,7 @@ dependencies = [ [[package]] name = "zksync_basic_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "serde", "serde_json", @@ -12866,13 +12828,13 @@ dependencies = [ [[package]] name = "zksync_circuit_breaker" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "async-trait", "backon", "convert_case 0.6.0", - "futures 0.3.28", + "futures 0.3.29", "hex", "metrics", "serde_json", @@ -12889,7 +12851,7 @@ dependencies = [ [[package]] name = "zksync_commitment_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "zkevm_test_harness 1.4.0", "zksync_types", @@ -12899,7 +12861,7 @@ dependencies = [ [[package]] name = "zksync_concurrency" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "once_cell", @@ -12917,7 +12879,7 @@ dependencies = [ [[package]] name = "zksync_config" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "serde", @@ -12927,7 +12889,7 @@ dependencies = [ [[package]] name = "zksync_consensus_bft" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "once_cell", @@ -12947,7 +12909,7 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "blst", @@ -12965,7 +12927,7 @@ dependencies = [ [[package]] name = "zksync_consensus_executor" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "prost", @@ -12987,7 +12949,7 @@ dependencies = [ [[package]] name = "zksync_consensus_network" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "async-trait", @@ -13011,7 +12973,7 @@ dependencies = [ [[package]] name = "zksync_consensus_roles" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "bit-vec", @@ -13019,6 +12981,7 @@ dependencies = [ "prost", "rand 0.8.5", "serde", + "thiserror", "tracing", "zksync_concurrency", "zksync_consensus_crypto", @@ -13030,7 +12993,7 @@ dependencies = [ [[package]] name = "zksync_consensus_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "async-trait", @@ -13047,7 +13010,7 @@ dependencies = [ [[package]] name = "zksync_consensus_sync_blocks" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "thiserror", @@ -13062,7 +13025,7 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "thiserror", "zksync_concurrency", @@ -13071,7 +13034,7 @@ dependencies = [ [[package]] name = "zksync_contracts" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "envy", "ethabi 18.0.0", @@ -13085,7 +13048,7 @@ dependencies = [ [[package]] name = "zksync_core" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "actix-cors", "actix-rt", @@ -13097,7 +13060,7 @@ dependencies = [ "bitflags 1.3.2", "chrono", "ctrlc", - "futures 0.3.28", + "futures 0.3.29", "governor", "hex", "itertools 0.10.5", @@ -13156,7 +13119,7 @@ dependencies = [ [[package]] name = "zksync_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "base64 0.13.1", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13171,7 +13134,7 @@ dependencies = [ [[package]] name = "zksync_dal" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "bigdecimal", @@ -13180,6 +13143,7 @@ dependencies = [ "itertools 0.10.5", "num 0.3.1", "once_cell", + "prost", "rand 0.8.5", "serde", "serde_json", @@ -13190,8 +13154,11 @@ dependencies = [ "tracing", "url", "vise", + "zksync_consensus_roles", "zksync_contracts", "zksync_health_check", + "zksync_protobuf", + "zksync_protobuf_build", "zksync_system_constants", "zksync_types", "zksync_utils", @@ -13200,7 +13167,7 @@ dependencies = [ [[package]] name = "zksync_eth_client" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "async-trait", @@ -13220,7 +13187,7 @@ dependencies = [ [[package]] name = "zksync_eth_signer" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "async-trait", "hex", @@ -13239,10 +13206,10 @@ dependencies = [ [[package]] name = "zksync_health_check" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "async-trait", - "futures 0.3.28", + "futures 0.3.29", "serde", "serde_json", "tokio", @@ -13252,7 +13219,7 @@ dependencies = [ [[package]] name = "zksync_mempool" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "tracing", "zksync_types", @@ -13261,7 +13228,7 @@ dependencies = [ [[package]] name = "zksync_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "leb128", "once_cell", @@ -13278,7 +13245,7 @@ dependencies = [ [[package]] name = "zksync_mini_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "once_cell", "zksync_basic_types", @@ -13288,7 +13255,7 @@ dependencies = [ [[package]] name = "zksync_object_store" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "async-trait", @@ -13306,7 +13273,7 @@ dependencies = [ [[package]] name = "zksync_protobuf" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "bit-vec", @@ -13324,28 +13291,28 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=ed71b2e817c980a2daffef6a01885219e1dc6fa0#ed71b2e817c980a2daffef6a01885219e1dc6fa0" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" dependencies = [ "anyhow", "heck 0.4.1", "prettyplease", - "proc-macro2 1.0.69", + "proc-macro2 1.0.70", "prost-build", "prost-reflect", "protox", "quote 1.0.33", - "syn 2.0.38", + "syn 2.0.41", ] [[package]] name = "zksync_prover_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "async-trait", "ctrlc", - "futures 0.3.28", + "futures 0.3.29", "regex", "reqwest", "tokio", @@ -13360,7 +13327,7 @@ dependencies = [ [[package]] name = "zksync_queued_job_processor" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "async-trait", @@ -13373,7 +13340,7 @@ dependencies = [ [[package]] name = "zksync_state" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "itertools 0.10.5", @@ -13390,7 +13357,7 @@ dependencies = [ [[package]] name = "zksync_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "num_cpus", "once_cell", @@ -13402,7 +13369,7 @@ dependencies = [ [[package]] name = "zksync_system_constants" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "bigdecimal", @@ -13420,7 +13387,7 @@ dependencies = [ [[package]] name = "zksync_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13432,7 +13399,6 @@ dependencies = [ "num_enum 0.6.1", "once_cell", "parity-crypto", - "prost", "rlp", "serde", "serde_json", @@ -13455,11 +13421,11 @@ dependencies = [ [[package]] name = "zksync_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "bigdecimal", - "futures 0.3.28", + "futures 0.3.29", "hex", "itertools 0.10.5", "metrics", @@ -13477,7 +13443,7 @@ dependencies = [ [[package]] name = "zksync_verification_key_generator_and_server" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "anyhow", "bincode", @@ -13497,7 +13463,7 @@ dependencies = [ [[package]] name = "zksync_web3_decl" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=bd268ac02bc3530c1d3247cb9496c3e13c2e52d9#bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" dependencies = [ "bigdecimal", "chrono", diff --git a/Cargo.toml b/Cargo.toml index cbbcc771d..9edf60fe4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,13 +159,13 @@ alloy-rlp = "0.3.3" solang-parser = "=0.3.3" ## zksync -era_test_node = { git = "https://github.com/matter-labs/era-test-node.git", rev = "21b48af90a9f9d98ec38cb93a32c119a3266f401" } -zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } -zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } -zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } -multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } -zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } -zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "bd268ac02bc3530c1d3247cb9496c3e13c2e52d9" } +era_test_node = { git = "https://github.com/matter-labs/era-test-node.git", rev = "bc43d87f43207fbac8521d8daf145d9d9f69b85e" } +zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } ## misc chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } diff --git a/crates/era-cheatcodes/Cargo.toml b/crates/era-cheatcodes/Cargo.toml index 71cdb9f5c..49b537fdc 100644 --- a/crates/era-cheatcodes/Cargo.toml +++ b/crates/era-cheatcodes/Cargo.toml @@ -20,6 +20,7 @@ multivm.workspace = true zksync_web3_decl.workspace = true zksync_utils.workspace = true foundry-evm-core.workspace = true +foundry-common.workspace = true foundry-cheatcodes-spec.workspace = true alloy-sol-types = { workspace = true, features = ["json"] } diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 02b0934b5..c75635b8d 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -1,12 +1,17 @@ -use crate::utils::{ToH160, ToH256}; +use crate::utils::{ToH160, ToH256, ToU256}; use alloy_sol_types::SolInterface; -use era_test_node::{fork::ForkStorage, utils::bytecode_to_factory_dep}; +use era_test_node::{ + deps::storage_view::StorageView, fork::ForkStorage, utils::bytecode_to_factory_dep, +}; use ethers::utils::to_checksum; use foundry_cheatcodes_spec::Vm; -use foundry_evm_core::{backend::DatabaseExt, era_revm::db::RevmDatabaseForEra}; +use foundry_evm_core::{ + backend::DatabaseExt, era_revm::db::RevmDatabaseForEra, fork::CreateFork, opts::EvmOpts, +}; use itertools::Itertools; use multivm::{ interface::{dyn_tracers::vm_1_3_3::DynTracer, tracer::TracerExecutionStatus}, + vm_latest::{L1BatchEnv, SystemEnv}, vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, zk_evm_1_3_3::{ tracing::{AfterExecutionData, VmLocalStateData}, @@ -17,9 +22,17 @@ use multivm::{ }, }, }; -use std::{cell::RefMut, collections::HashMap, fmt::Debug}; +use revm::{ + primitives::{BlockEnv, CfgEnv, Env, SpecId}, + JournaledState, +}; +use std::{ + cell::{OnceCell, RefMut}, + collections::HashMap, + fmt::Debug, +}; use zksync_basic_types::{AccountTreeId, H160, H256, U256}; -use zksync_state::{ReadStorage, StoragePtr, StorageView, WriteStorage}; +use zksync_state::{ReadStorage, StoragePtr, WriteStorage}; use zksync_types::{ block::{pack_block_info, unpack_block_info}, get_code_key, get_nonce_key, @@ -58,6 +71,12 @@ const INTERNAL_CONTRACT_ADDRESSES: [H160; 20] = [ H160::zero(), ]; +#[derive(Debug, Clone)] +struct EraEnv { + l1_batch_env: L1BatchEnv, + system_env: SystemEnv, +} + #[derive(Debug, Default, Clone)] pub struct CheatcodeTracer { one_time_actions: Vec, @@ -66,6 +85,7 @@ pub struct CheatcodeTracer { return_ptr: Option, near_calls: usize, serialized_objects: HashMap, + env: OnceCell, } #[derive(Debug, Clone)] @@ -150,10 +170,22 @@ impl DynTracer, SimpleMemory> } impl VmTracer, H> for CheatcodeTracer { + fn initialize_tracer( + &mut self, + _state: &mut ZkSyncVmState, H>, + l1_batch_env: &L1BatchEnv, + system_env: &SystemEnv, + ) { + self.env + .set(EraEnv { l1_batch_env: l1_batch_env.clone(), system_env: system_env.clone() }) + .unwrap(); + } + fn finish_cycle( &mut self, state: &mut ZkSyncVmState, H>, _bootloader_state: &mut BootloaderState, + _storage: StoragePtr>, ) -> TracerExecutionStatus { while let Some(action) = self.one_time_actions.pop() { match action { @@ -214,6 +246,7 @@ impl CheatcodeTracer { return_data: None, return_ptr: None, serialized_objects: HashMap::new(), + env: OnceCell::default(), } } @@ -474,6 +507,32 @@ impl CheatcodeTracer { &mut storage, ); } + createSelectFork_1(createSelectFork_1Call { urlOrAlias, blockNumber }) => { + tracing::info!("👷 Creating and selecting fork {}", urlOrAlias,); + let handle = &storage.borrow_mut().storage_handle; + let s = handle.inner.write().unwrap(); + let mut f = s.fork.as_ref().unwrap().fork_source.db.lock().unwrap(); + let era_env = self.env.get().unwrap(); + let mut era_rpc = HashMap::new(); + era_rpc + .insert("mainnet".to_string(), "https://mainnet.era.zksync.io:443".to_string()); + era_rpc.insert( + "testnet".to_string(), + "https://testnet.era.zksync.dev:443".to_string(), + ); + let block_number = blockNumber.to_u256().as_u64(); + let mut env = into_revm_env(&era_env); + let mut state = JournaledState::new(SpecId::LATEST, vec![]); + let q = f.create_select_fork( + create_fork_request(era_env, &era_rpc, Some(block_number), urlOrAlias), + &mut env, + &mut state, + ); + dbg!(&q); + dbg!(&state); + dbg!(&env); + self.return_data = Some(vec![q.unwrap().to_u256()]); + } _ => { tracing::error!("👷 Unrecognized cheatcode"); } @@ -516,3 +575,49 @@ impl CheatcodeTracer { self.return_data = Some(data); } } + +fn into_revm_env(env: &EraEnv) -> Env { + use foundry_common::zk_utils::conversion_utils::h160_to_address; + use revm::primitives::U256; + let block = BlockEnv { + number: U256::from(env.l1_batch_env.number.0), + coinbase: h160_to_address(env.l1_batch_env.fee_account), + timestamp: U256::from(env.l1_batch_env.timestamp), + gas_limit: U256::from(env.system_env.gas_limit), + basefee: U256::from(env.l1_batch_env.base_fee()), + ..Default::default() + }; + + let mut cfg = CfgEnv::default(); + cfg.chain_id = env.system_env.chain_id.as_u64(); + + Env { block, cfg, ..Default::default() } +} + +fn create_fork_request( + env: &EraEnv, + era_rpc: &HashMap, + block_number: Option, + url_or_alias: String, +) -> CreateFork { + use foundry_evm_core::opts::Env; + use revm::primitives::Address as revmAddress; + let url = &era_rpc[&url_or_alias]; + let env = into_revm_env(&env); + let opts_env = Env { + gas_limit: u64::MAX, + chain_id: None, + tx_origin: revmAddress::ZERO, + block_number: 0, + block_timestamp: 0, + ..Default::default() + }; + let evm_opts = EvmOpts { + env: opts_env, + fork_url: Some(url.clone()), + fork_block_number: block_number, + ..Default::default() + }; + + CreateFork { enable_caching: true, url: url.clone(), env, evm_opts } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol deleted file mode 100644 index 0b83e3218..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeDealTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - uint256 constant NEW_BALANCE = 10; - - function testDeal() public { - uint256 balanceBefore = address(TEST_ADDRESS).balance; - console.log("balance before:", balanceBefore); - - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "deal(address,uint256)", - TEST_ADDRESS, - NEW_BALANCE - ) - ); - uint256 balanceAfter = address(TEST_ADDRESS).balance; - console.log("balance after :", balanceAfter); - - require(balanceAfter == NEW_BALANCE, "balance mismatch"); - require(balanceAfter != balanceBefore, "balance unchanged"); - require(success, "deal failed"); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol deleted file mode 100644 index 199e2118a..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeEtchTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - bytes constant GREETER_CODE = - hex"00050000000000020000000003010019000000600330027000000060033001970000000102200190000000950000c13d000000040230008c000000e00000413d000000000201043b0000006702200197000000680220009c000000e00000c13d0000000002000416000000000202004b000000e00000c13d000000040230008a000000200220008c000000e00000413d0000000402100370000000000502043b000000640250009c000000e00000213d00000023025000390000006904000041000000000632004b000000000600001900000000060480190000006902200197000000000702004b0000000004008019000000690220009c00000000020600190000000002046019000000000202004b000000e00000c13d0000000406500039000000000261034f000000000402043b000000640240009c0000009d0000213d0000001f07400039000000200200008a000000000727016f000000bf07700039000000000727016f0000006a087000410000006b0880009c0000009d0000413d000000400070043f000000800040043f00000000054500190000002405500039000000000335004b000000e00000213d0000002003600039000000000131034f0000001f0340018f0000000505400272000000440000613d00000000060000190000000507600210000000000871034f000000000808043b000000a00770003900000000008704350000000106600039000000000756004b0000003c0000413d000000000603004b000000530000613d0000000505500210000000000151034f0000000303300210000000a005500039000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f0000000000150435000000a0014000390000000000010435000000800100043d000000640310009c0000009d0000213d000000000400041a000000010340019000000001034002700000007f0330618f0000001f0530008c00000000050000190000000105002039000000000454013f0000000104400190000000fc0000c13d000000200430008c000000740000413d0000001f0410003900000005044002700000006c044000410000006c05000041000000200610008c000000000405401900000000000004350000001f0330003900000005033002700000006c03300041000000000534004b000000740000813d000000000004041b0000000104400039000000000534004b000000700000413d0000001f0310008c000001000000a13d0000000003210170000000a0040000390000006c020000410000000000000435000000880000613d0000006c0200004100000020060000390000000004000019000000000506001900000080065000390000000006060433000000000062041b000000200650003900000001022000390000002004400039000000000734004b0000007e0000413d000000a004500039000000000313004b000000920000813d0000000303100210000000f80330018f000000010500008a000000000335022f000000000353013f0000000004040433000000000334016f000000000032041b000000010200003900000001031002100000010a0000013d0000008002000039000000400020043f0000000002000416000000000202004b000000e00000c13d0000006102300041000000620220009c000000a30000213d0000006d0100004100000000001004350000004101000039000000040010043f0000006e010000410000017b000104300000009f023000390000006302200197000000400020043f0000001f0230018f0000000504300272000000b20000613d00000000050000190000000506500210000000000761034f000000000707043b000000800660003900000000007604350000000105500039000000000645004b000000aa0000413d000000000502004b000000c10000613d0000000504400210000000000141034f00000003022002100000008004400039000000000504043300000000052501cf000000000525022f000000000101043b0000010002200089000000000121022f00000000012101cf000000000151019f0000000000140435000000200130008c000000e00000413d000000800400043d000000640140009c000000e00000213d00000080033000390000009f01400039000000000131004b000000e00000813d00000080024000390000000001020433000000640510009c0000009d0000213d0000003f05100039000000200900008a000000000595016f000000400800043d0000000005580019000000000685004b00000000060000190000000106004039000000640750009c0000009d0000213d00000001066001900000009d0000c13d000000400050043f00000000061804360000000004140019000000a004400039000000000334004b000000e20000a13d00000000010000190000017b00010430000000000301004b000000ec0000613d000000000300001900000000046300190000002003300039000000000523001900000000050504330000000000540435000000000413004b000000e50000413d000000000116001900000000000104350000000004080433000000640140009c0000009d0000213d000000000100041a000000010210019000000001011002700000007f0310018f000000000301c0190000001f0130008c00000000010000190000000101002039000000010110018f000000000112004b0000010e0000613d0000006d0100004100000000001004350000002201000039000000a00000013d000000000201004b0000000002000019000001040000613d000000a00200043d0000000303100210000000010400008a000000000334022f000000000343013f000000000332016f0000000102100210000000000123019f000000000010041b00000000010000190000017a0001042e000000200130008c000001340000413d000100000003001d000300000004001d000000000000043500000060010000410000000002000414000000600320009c0000000001024019000000c00110021000000065011001c70000801002000039000500000008001d000400000009001d000200000006001d017901740000040f0000000206000029000000040900002900000005080000290000000102200190000000e00000613d00000003040000290000001f024000390000000502200270000000200340008c0000000002004019000000000301043b00000001010000290000001f01100039000000050110027000000000011300190000000002230019000000000312004b000001340000813d000000000002041b0000000102200039000000000312004b000001300000413d0000001f0140008c000001630000a13d000300000004001d000000000000043500000060010000410000000002000414000000600320009c0000000001024019000000c00110021000000065011001c70000801002000039000500000008001d000400000009001d017901740000040f000000040300002900000005060000290000000102200190000000e00000613d000000030700002900000000033701700000002002000039000000000101043b000001550000613d0000002002000039000000000400001900000000056200190000000005050433000000000051041b000000200220003900000001011000390000002004400039000000000534004b0000014d0000413d000000000373004b000001600000813d0000000303700210000000f80330018f000000010400008a000000000334022f000000000343013f00000000026200190000000002020433000000000232016f000000000021041b000000010100003900000001027002100000016d0000013d000000000104004b0000000001000019000001670000613d00000000010604330000000302400210000000010300008a000000000223022f000000000232013f000000000221016f0000000101400210000000000112019f000000000010041b00000020010000390000010000100443000001200000044300000066010000410000017a0001042e00000177002104230000000102000039000000000001042d0000000002000019000000000001042d00000179000004320000017a0001042e0000017b00010430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009fffffffffffffffffffffffffffffffffffffffffffffffff000000000000007f00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff02000000000000000000000000000000000000200000000000000000000000000000000200000000000000000000000000000040000001000000000000000000ffffffff00000000000000000000000000000000000000000000000000000000a4136862000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000080290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5634e487b71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051358bfd296e885430dddecb908ce82d20e6832374027da7514aebac3689d51f"; - - function testEtch() public { - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "etch(address,bytes)", - TEST_ADDRESS, - GREETER_CODE - ) - ); - require(success, "etch failed"); - - (success, ) = TEST_ADDRESS.call( - abi.encodeWithSignature("setGreeting(string)", "hello world") - ); - require(success, "setGreeting failed"); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol new file mode 100644 index 000000000..234272b17 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -0,0 +1,20 @@ + +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract ForkTest is Test { + address constant TEST_ADDRESS = 0x10b252872733BFdC7fB22dB0BE5D1E55C0141848; + function testFork() public { + uint256 balanceBefore = address(TEST_ADDRESS).balance; + console.log("balance before:", balanceBefore); + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) + ); + require(success, "fork failed"); + uint256 balanceAfter = address(TEST_ADDRESS).balance; + console.log("balance after :", balanceAfter); + } +} \ No newline at end of file diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol deleted file mode 100644 index 12c0f9f10..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeSetNonceTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - uint256 constant NEW_NONCE = uint256(123456); - - function testSetNonce() public { - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "setNonce(address,uint64)", - TEST_ADDRESS, - NEW_NONCE - ) - ); - require(success, "setNonce failed"); - console.log("failed?", failed()); - - //test getNonce - (bool success2, bytes memory data2) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("getNonce(address)", TEST_ADDRESS) - ); - require(success2, "getNonce failed"); - uint256 nonce = abi.decode(data2, (uint256)); - console.log("nonce: 0x", nonce); - require(nonce == NEW_NONCE, "nonce was not changed"); - console.log("failed?", failed()); - } -} - - diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol deleted file mode 100644 index a99a123d9..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract Storage { - uint256 slot0 = 10; -} - -contract LoadTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - uint256 slot0 = 20; - Storage store; - - function setUp() public { - store = new Storage(); - } - - function testLoadOwnStorage() public { - uint256 slot; - assembly { - slot := slot0.slot - } - (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "load(address,bytes32)", - address(this), - bytes32(slot) - ) - ); - require(success, "load failed"); - uint256 val = abi.decode(data, (uint256)); - assertEq(val, 20, "load failed"); - } - - function testLoadOtherStorage() public { - (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "load(address,bytes32)", - address(store), - bytes32(0) - ) - ); - require(success, "load failed"); - uint256 val = abi.decode(data, (uint256)); - assertEq(val, 10, "load failed"); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol deleted file mode 100644 index 9a706cc93..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeRollTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - uint256 constant NEW_BLOCK_NUMBER = 10; - - function testRoll() public { - uint256 initialBlockNumber = block.number; - console.log("blockNumber before:", initialBlockNumber); - - require( - NEW_BLOCK_NUMBER != initialBlockNumber, - "block number must be different than current block number" - ); - - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("roll(uint256)", NEW_BLOCK_NUMBER) - ); - require(success, "roll failed"); - uint256 finalBlockNumber = block.number; - console.log("blockNumber after :", finalBlockNumber); - - require( - finalBlockNumber == NEW_BLOCK_NUMBER, - "block number was not changed" - ); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol deleted file mode 100644 index c2c95b1c8..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeSerializeTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - - function testSerializeAddress() external { - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "serializeAddress(string,string,address)", - "obj1", - "address", - TEST_ADDRESS - ) - ); - require(success, "serializeAddress failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == - keccak256(bytes("0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a")), - "serializeAddress mismatch" - ); - console.log("failed?", failed()); - } - - function testSerializeBool() external { - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "serializeBool(string,string,bool)", - "obj1", - "boolean", - true - ) - ); - require(success, "serializeBool failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes("true")), - "serializeBool mismatch" - ); - console.log("failed?", failed()); - } - - function testSerializeUint() external { - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "serializeUint(string,string,uint256)", - "obj1", - "uint", - 99 - ) - ); - require(success, "serializeUint failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes("99")), - "serializeUint mismatch" - ); - console.log("failed?", failed()); - } - - function trimReturnBytes( - bytes memory rawData - ) internal pure returns (bytes memory) { - uint256 lengthStartingPos = rawData.length - 32; - bytes memory lengthSlice = new bytes(32); - for (uint256 i = 0; i < 32; i++) { - lengthSlice[i] = rawData[lengthStartingPos + i]; - } - uint256 length = abi.decode(lengthSlice, (uint256)); - bytes memory data = new bytes(length); - for (uint256 i = 0; i < length; i++) { - data[i] = rawData[i]; - } - return data; - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol deleted file mode 100644 index 29a99ee0e..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeSetNonceTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - uint256 constant NEW_NONCE = uint256(123456); - - function testSetNonce() public { - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "setNonce(address,uint64)", - TEST_ADDRESS, - NEW_NONCE - ) - ); - require(success, "setNonce failed"); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol deleted file mode 100644 index 3b5a73b82..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol +++ /dev/null @@ -1,146 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeStartPrankTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - address constant TEST_ORIGIN = 0xdEBe90b7BFD87Af696B1966082F6515a6E72F3d8; - - function testStartPrank() public { - address original_msg_sender = msg.sender; - address original_tx_origin = tx.origin; - - PrankVictim victim = new PrankVictim(); - - // Verify that the victim is set up correctly - victim.assertCallerAndOrigin( - address(this), - "startPrank failed: victim.assertCallerAndOrigin failed", - original_tx_origin, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - // Start prank without tx.origin - (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("startPrank(address)", TEST_ADDRESS) - ); - require(success1, "startPrank failed"); - - require( - msg.sender == TEST_ADDRESS, - "startPrank failed: msg.sender unchanged" - ); - require( - tx.origin == original_tx_origin, - "startPrank failed tx.origin changed" - ); - victim.assertCallerAndOrigin( - TEST_ADDRESS, - "startPrank failed: victim.assertCallerAndOrigin failed", - original_tx_origin, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - // Stop prank - (bool success2, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("stopPrank()") - ); - require(success2, "stopPrank failed"); - - require( - msg.sender == original_msg_sender, - "stopPrank failed: msg.sender didn't return to original" - ); - require( - tx.origin == original_tx_origin, - "stopPrank failed tx.origin changed" - ); - victim.assertCallerAndOrigin( - address(this), - "startPrank failed: victim.assertCallerAndOrigin failed", - original_tx_origin, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - console.log("failed?", failed()); - } - - function testStartPrankWithOrigin() external { - address original_msg_sender = msg.sender; - address original_tx_origin = tx.origin; - - PrankVictim victim = new PrankVictim(); - - // Verify that the victim is set up correctly - victim.assertCallerAndOrigin( - address(this), - "startPrank failed: victim.assertCallerAndOrigin failed", - original_tx_origin, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - // Start prank with tx.origin - (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "startPrank(address,address)", - TEST_ADDRESS, - TEST_ORIGIN - ) - ); - require(success1, "startPrank failed"); - - require( - msg.sender == TEST_ADDRESS, - "startPrank failed: msg.sender unchanged" - ); - require( - tx.origin == TEST_ORIGIN, - "startPrank failed: tx.origin unchanged" - ); - victim.assertCallerAndOrigin( - TEST_ADDRESS, - "startPrank failed: victim.assertCallerAndOrigin failed", - TEST_ORIGIN, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - // Stop prank - (bool success2, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("stopPrank()") - ); - require(success2, "stopPrank failed"); - - require( - msg.sender == original_msg_sender, - "stopPrank failed: msg.sender didn't return to original" - ); - require( - tx.origin == original_tx_origin, - "stopPrank failed: tx.origin didn't return to original" - ); - victim.assertCallerAndOrigin( - address(this), - "startPrank failed: victim.assertCallerAndOrigin failed", - original_tx_origin, - "startPrank failed: victim.assertCallerAndOrigin failed" - ); - - console.log("failed?", failed()); - } -} - -contract PrankVictim { - function assertCallerAndOrigin( - address expectedSender, - string memory senderMessage, - address expectedOrigin, - string memory originMessage - ) public view { - console.log("msg.sender", msg.sender); - console.log("tx.origin", tx.origin); - require(msg.sender == expectedSender, senderMessage); - require(tx.origin == expectedOrigin, originMessage); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol deleted file mode 100644 index 7e22a7e41..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: MIT OR Apache-2.0 -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract Storage { - uint256 public slot0 = 10; - uint256 public slot1 = 20; -} - -contract StoreTest is Test { - address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; - Storage store; - - function setUp() public { - store = new Storage(); - } - - function testStore() public { - assertEq(store.slot0(), 10, "initial value for slot 0 is incorrect"); - assertEq(store.slot1(), 20, "initial value for slot 1 is incorrect"); - - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature( - "store(address,bytes32,bytes32)", - address(store), - bytes32(0), - bytes32(uint256(1)) - ) - ); - require(success, "store failed"); - assertEq(store.slot0(), 1, "store failed"); - assertEq(store.slot1(), 20, "store failed"); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol deleted file mode 100644 index ff9305123..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol +++ /dev/null @@ -1,137 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeToStringTest is Test { - function testToStringFromAddress() external { - address testAddress = 0x413D15117be7a498e68A64FcfdB22C6e2AaE1808; - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(address)", testAddress) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == - keccak256(bytes("0x413D15117be7a498e68A64FcfdB22C6e2AaE1808")), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function testToStringFromBool() external { - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(bool)", false) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes("false")), - "toString mismatch" - ); - - (success, rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(bool)", true) - ); - require(success, "toString failed"); - data = trimReturnBytes(rawData); - testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes("true")), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function testToStringFromUint256() external { - uint256 value = 99; - string memory stringValue = "99"; - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(uint256)", value) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes(stringValue)), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function testToStringFromInt256() external { - int256 value = -99; - string memory stringValue = "-99"; - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(int256)", value) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == keccak256(bytes(stringValue)), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function testToStringFromBytes32() external { - bytes32 testBytes = hex"4ec893b0a778b562e893cee722869c3e924e9ee46ec897cabda6b765a6624324"; - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(bytes32)", testBytes) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == - keccak256( - bytes( - "0x4ec893b0a778b562e893cee722869c3e924e9ee46ec897cabda6b765a6624324" - ) - ), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function testToStringFromBytes() external { - bytes - memory testBytes = hex"89987299ea14decf0e11d068474a6e459439802edca8aacf9644222e490d8ef6db"; - (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("toString(bytes)", testBytes) - ); - require(success, "toString failed"); - bytes memory data = trimReturnBytes(rawData); - string memory testString = string(abi.encodePacked(data)); - require( - keccak256(bytes(testString)) == - keccak256( - bytes( - "0x89987299ea14decf0e11d068474a6e459439802edca8aacf9644222e490d8ef6db" - ) - ), - "toString mismatch" - ); - console.log("failed?", failed()); - } - - function trimReturnBytes( - bytes memory rawData - ) internal pure returns (bytes memory) { - uint256 lengthStartingPos = rawData.length - 32; - bytes memory lengthSlice = new bytes(32); - for (uint256 i = 0; i < 32; i++) { - lengthSlice[i] = rawData[lengthStartingPos + i]; - } - uint256 length = abi.decode(lengthSlice, (uint256)); - bytes memory data = new bytes(length); - for (uint256 i = 0; i < length; i++) { - data[i] = rawData[i]; - } - return data; - } -} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol deleted file mode 100644 index 336dec06c..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract CheatcodeWarpTest is Test { - uint256 constant NEW_BLOCK_TIMESTAMP = uint256(10000); - - function testWarp() public { - uint256 initialTimestamp = block.timestamp; - console.log("timestamp before:", initialTimestamp); - require( - NEW_BLOCK_TIMESTAMP != initialTimestamp, - "timestamp must be different than current block timestamp" - ); - - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("warp(uint256)", NEW_BLOCK_TIMESTAMP) - ); - require(success, "warp failed"); - - uint256 finalTimestamp = block.timestamp; - console.log("timestamp after:", finalTimestamp); - require( - finalTimestamp == NEW_BLOCK_TIMESTAMP, - "timestamp was not changed" - ); - console.log("failed?", failed()); - } -} diff --git a/crates/era-cheatcodes/tests/test.sh b/crates/era-cheatcodes/tests/test.sh index 86e6e76ca..8eac7c7c7 100755 --- a/crates/era-cheatcodes/tests/test.sh +++ b/crates/era-cheatcodes/tests/test.sh @@ -6,7 +6,7 @@ set -o pipefail -e REPO_ROOT="../../.." SOLC_VERSION=${SOLC_VERSION:-"v0.8.20"} SOLC="solc-${SOLC_VERSION}" -BINARY_PATH="${REPO_ROOT}/target/release/zkforge" +BINARY_PATH="${REPO_ROOT}/target/debug/zkforge" function download_solc() { case "$(uname -s)" in @@ -35,7 +35,7 @@ function wait_for_build() { # See https://unix.stackexchange.com/questions/312631/bash-script-with-set-e-doesnt-stop-on-command function build_zkforge() { echo "Building ${1}..." - cargo build --release --manifest-path="${1}/Cargo.toml" + cargo build --manifest-path="${1}/Cargo.toml" wait_for_build 30 } diff --git a/crates/evm/core/Cargo.toml b/crates/evm/core/Cargo.toml index 82e6ee021..f6eb3f31c 100644 --- a/crates/evm/core/Cargo.toml +++ b/crates/evm/core/Cargo.toml @@ -40,7 +40,6 @@ zksync_types.workspace = true era_test_node.workspace = true zksync_utils.workspace = true zksync_web3_decl.workspace = true -zksync_state.workspace = true derive_more.workspace = true eyre = "0.6" diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index c31205784..d50e67d93 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -16,9 +16,8 @@ use revm::{ use std::{borrow::Cow, collections::HashMap}; use crate::era_revm::db::RevmDatabaseForEra; -use era_test_node::fork::ForkStorage; +use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; -use zksync_state::StorageView; /// A wrapper around `Backend` that ensures only `revm::DatabaseRef` functions are called. /// diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index 394910a34..fb82c2141 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -29,9 +29,8 @@ use revm::{ use std::collections::{HashMap, HashSet}; use crate::era_revm::db::RevmDatabaseForEra; -use era_test_node::fork::ForkStorage; +use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; -use zksync_state::StorageView; mod diagnostic; pub use diagnostic::RevertDiagnostic; diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index 7563cb373..c4fb61cfb 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -1,4 +1,5 @@ use era_test_node::{ + deps::storage_view::StorageView, fork::{ForkDetails, ForkStorage}, node::{ InMemoryNode, InMemoryNodeConfig, ShowCalls, ShowGasDetails, ShowStorageLogs, ShowVMDetails, @@ -21,7 +22,6 @@ use std::{ sync::{Arc, Mutex}, }; use zksync_basic_types::{web3::signing::keccak256, L1BatchNumber, L2ChainId, H160, H256, U256}; -use zksync_state::StorageView; use zksync_types::{ api::Block, fee::Fee, l2::L2Tx, transaction_request::PaymasterParams, PackedEthSignature, StorageKey, StorageLogQueryType, ACCOUNT_CODE_STORAGE_ADDRESS, diff --git a/crates/evm/evm/Cargo.toml b/crates/evm/evm/Cargo.toml index ac1a99108..ac8efbdb2 100644 --- a/crates/evm/evm/Cargo.toml +++ b/crates/evm/evm/Cargo.toml @@ -48,5 +48,4 @@ tracing = "0.1" # zksync multivm.workspace = true era_cheatcodes.workspace = true -zksync_state.workspace = true era_test_node.workspace = true diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index be1d3a885..837a24a94 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -574,8 +574,8 @@ use era_test_node::fork::ForkStorage; use foundry_evm_core::era_revm::db::RevmDatabaseForEra; use era_cheatcodes::cheatcodes::CheatcodeTracer; +use era_test_node::deps::storage_view::StorageView; use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; -use zksync_state::StorageView; impl ToTracerPointer>>, HistoryDisabled> From 5c7f0dadc647a04f01e7b8a9e1d65fd5c3476807 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 15 Dec 2023 11:05:48 +0100 Subject: [PATCH 02/22] Implement some forking Signed-off-by: Danil --- Cargo.lock | 55 ++++++------ Cargo.toml | 14 +-- crates/era-cheatcodes/src/cheatcodes.rs | 87 +++++++++++++------ .../tests/src/cheatcodes/Addr.t.sol | 20 ----- .../tests/src/cheatcodes/Fork.t.sol | 28 ++++-- crates/era-cheatcodes/tests/test.sh | 4 +- crates/evm/core/src/backend/fuzz.rs | 12 ++- crates/evm/core/src/backend/mod.rs | 19 +++- crates/evm/core/src/era_revm/transactions.rs | 58 +++++++++---- crates/evm/core/src/fork/backend.rs | 9 +- crates/evm/core/src/fork/database.rs | 2 + crates/zkforge/src/runner.rs | 1 + 12 files changed, 196 insertions(+), 113 deletions(-) delete mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol diff --git a/Cargo.lock b/Cargo.lock index 31fde4aee..6d8016125 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3296,7 +3296,6 @@ dependencies = [ [[package]] name = "era_test_node" version = "0.1.0-alpha.12" -source = "git+https://github.com/matter-labs/era-test-node.git?rev=bc43d87f43207fbac8521d8daf145d9d9f69b85e#bc43d87f43207fbac8521d8daf145d9d9f69b85e" dependencies = [ "anyhow", "bigdecimal", @@ -6995,7 +6994,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multivm" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "hex", @@ -8380,7 +8379,7 @@ dependencies = [ [[package]] name = "prometheus_exporter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "metrics", @@ -11807,7 +11806,7 @@ dependencies = [ [[package]] name = "vlog" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "chrono", "sentry", @@ -12818,7 +12817,7 @@ dependencies = [ [[package]] name = "zksync_basic_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "serde", "serde_json", @@ -12828,7 +12827,7 @@ dependencies = [ [[package]] name = "zksync_circuit_breaker" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "async-trait", @@ -12851,7 +12850,7 @@ dependencies = [ [[package]] name = "zksync_commitment_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "zkevm_test_harness 1.4.0", "zksync_types", @@ -12879,7 +12878,7 @@ dependencies = [ [[package]] name = "zksync_config" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "serde", @@ -13034,7 +13033,7 @@ dependencies = [ [[package]] name = "zksync_contracts" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "envy", "ethabi 18.0.0", @@ -13048,7 +13047,7 @@ dependencies = [ [[package]] name = "zksync_core" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "actix-cors", "actix-rt", @@ -13119,7 +13118,7 @@ dependencies = [ [[package]] name = "zksync_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "base64 0.13.1", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13134,7 +13133,7 @@ dependencies = [ [[package]] name = "zksync_dal" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "bigdecimal", @@ -13167,7 +13166,7 @@ dependencies = [ [[package]] name = "zksync_eth_client" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "async-trait", @@ -13187,7 +13186,7 @@ dependencies = [ [[package]] name = "zksync_eth_signer" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "async-trait", "hex", @@ -13206,7 +13205,7 @@ dependencies = [ [[package]] name = "zksync_health_check" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "async-trait", "futures 0.3.29", @@ -13219,7 +13218,7 @@ dependencies = [ [[package]] name = "zksync_mempool" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "tracing", "zksync_types", @@ -13228,7 +13227,7 @@ dependencies = [ [[package]] name = "zksync_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "leb128", "once_cell", @@ -13245,7 +13244,7 @@ dependencies = [ [[package]] name = "zksync_mini_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "once_cell", "zksync_basic_types", @@ -13255,7 +13254,7 @@ dependencies = [ [[package]] name = "zksync_object_store" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "async-trait", @@ -13307,7 +13306,7 @@ dependencies = [ [[package]] name = "zksync_prover_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "async-trait", @@ -13327,7 +13326,7 @@ dependencies = [ [[package]] name = "zksync_queued_job_processor" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "async-trait", @@ -13340,7 +13339,7 @@ dependencies = [ [[package]] name = "zksync_state" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "itertools 0.10.5", @@ -13357,7 +13356,7 @@ dependencies = [ [[package]] name = "zksync_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "num_cpus", "once_cell", @@ -13369,7 +13368,7 @@ dependencies = [ [[package]] name = "zksync_system_constants" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "bigdecimal", @@ -13387,7 +13386,7 @@ dependencies = [ [[package]] name = "zksync_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13421,7 +13420,7 @@ dependencies = [ [[package]] name = "zksync_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "bigdecimal", @@ -13443,7 +13442,7 @@ dependencies = [ [[package]] name = "zksync_verification_key_generator_and_server" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "anyhow", "bincode", @@ -13463,7 +13462,7 @@ dependencies = [ [[package]] name = "zksync_web3_decl" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=a954b3ad6bd3b8c44e41217c6a50a2044b48dc06#a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" dependencies = [ "bigdecimal", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 9edf60fe4..c6edc34b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,13 +159,13 @@ alloy-rlp = "0.3.3" solang-parser = "=0.3.3" ## zksync -era_test_node = { git = "https://github.com/matter-labs/era-test-node.git", rev = "bc43d87f43207fbac8521d8daf145d9d9f69b85e" } -zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } -zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } -zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } -multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } -zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } -zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a954b3ad6bd3b8c44e41217c6a50a2044b48dc06" } +era_test_node = { path = "../era-test-node" } +zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } ## misc chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index c75635b8d..62176e3a9 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -6,7 +6,10 @@ use era_test_node::{ use ethers::utils::to_checksum; use foundry_cheatcodes_spec::Vm; use foundry_evm_core::{ - backend::DatabaseExt, era_revm::db::RevmDatabaseForEra, fork::CreateFork, opts::EvmOpts, + backend::DatabaseExt, + era_revm::{db::RevmDatabaseForEra, transactions::storage_to_state}, + fork::CreateFork, + opts::EvmOpts, }; use itertools::Itertools; use multivm::{ @@ -92,6 +95,7 @@ pub struct CheatcodeTracer { enum FinishCycleOneTimeActions { StorageWrite { key: StorageKey, read_value: H256, write_value: H256 }, StoreFactoryDep { hash: U256, bytecode: Vec }, + CreateFork { url_or_alias: String, block_number: u64 }, } #[derive(Debug, Default, Clone)] @@ -184,8 +188,8 @@ impl VmTracer, H> for CheatcodeT fn finish_cycle( &mut self, state: &mut ZkSyncVmState, H>, - _bootloader_state: &mut BootloaderState, - _storage: StoragePtr>, + bootloader_state: &mut BootloaderState, + storage: StoragePtr>, ) -> TracerExecutionStatus { while let Some(action) = self.one_time_actions.pop() { match action { @@ -207,6 +211,56 @@ impl VmTracer, H> for CheatcodeT FinishCycleOneTimeActions::StoreFactoryDep { hash, bytecode } => state .decommittment_processor .populate(vec![(hash, bytecode)], Timestamp(state.local_state.timestamp)), + FinishCycleOneTimeActions::CreateFork { url_or_alias, block_number } => { + let modified_storage: HashMap = + storage.borrow_mut().modified_storage_keys().clone(); + storage.borrow_mut().clean_cache(); + let fork_id = { + let handle = &storage.borrow_mut().storage_handle; + let mut fork_storage = handle.inner.write().unwrap(); + fork_storage.value_read_cache.clear(); + let era_db = fork_storage.fork.as_ref().unwrap().fork_source.clone(); + let bytecodes = bootloader_state + .get_last_tx_compressed_bytecodes() + .iter() + .map(|b| bytecode_to_factory_dep(b.original.clone())) + .collect(); + + let mut journaled_state = JournaledState::new(SpecId::LATEST, vec![]); + + let state = + storage_to_state(modified_storage.clone(), bytecodes, era_db.clone()); + *journaled_state.state() = state; + + let mut db = era_db.db.lock().unwrap(); + let era_env = self.env.get().unwrap(); + let mut era_rpc = HashMap::new(); + era_rpc.insert( + "mainnet".to_string(), + "https://mainnet.era.zksync.io:443".to_string(), + ); + era_rpc.insert( + "testnet".to_string(), + "https://testnet.era.zksync.dev:443".to_string(), + ); + let mut env = into_revm_env(&era_env); + db.create_select_fork( + create_fork_request( + era_env, + &era_rpc, + Some(block_number), + url_or_alias, + ), + &mut env, + &mut journaled_state, + ) + }; + dbg!(&fork_id); + storage.borrow_mut().modified_storage_keys = modified_storage; + // dbg!(&state); + // dbg!(&env); + self.return_data = Some(vec![fork_id.unwrap().to_u256()]); + } } } @@ -509,29 +563,12 @@ impl CheatcodeTracer { } createSelectFork_1(createSelectFork_1Call { urlOrAlias, blockNumber }) => { tracing::info!("👷 Creating and selecting fork {}", urlOrAlias,); - let handle = &storage.borrow_mut().storage_handle; - let s = handle.inner.write().unwrap(); - let mut f = s.fork.as_ref().unwrap().fork_source.db.lock().unwrap(); - let era_env = self.env.get().unwrap(); - let mut era_rpc = HashMap::new(); - era_rpc - .insert("mainnet".to_string(), "https://mainnet.era.zksync.io:443".to_string()); - era_rpc.insert( - "testnet".to_string(), - "https://testnet.era.zksync.dev:443".to_string(), - ); + let block_number = blockNumber.to_u256().as_u64(); - let mut env = into_revm_env(&era_env); - let mut state = JournaledState::new(SpecId::LATEST, vec![]); - let q = f.create_select_fork( - create_fork_request(era_env, &era_rpc, Some(block_number), urlOrAlias), - &mut env, - &mut state, - ); - dbg!(&q); - dbg!(&state); - dbg!(&env); - self.return_data = Some(vec![q.unwrap().to_u256()]); + self.one_time_actions.push(FinishCycleOneTimeActions::CreateFork { + url_or_alias: urlOrAlias, + block_number, + }); } _ => { tracing::error!("👷 Unrecognized cheatcode"); diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol deleted file mode 100644 index e6c0418d7..000000000 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; -import {Constants} from "./Constants.sol"; - -contract AddrTest is Test { - function testAddr() public { - uint256 pk = 77814517325470205911140941194401928579557062014761831930645393041380819009408; - address expected = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266; - - (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("addr(uint256)", pk) - ); - require(success, "addr failed"); - address addr = abi.decode(data, (address)); - assertEq(addr, expected, "expected address did not match"); - console.log("failed?", failed()); - } -} \ No newline at end of file diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 234272b17..8542acaf3 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -7,14 +7,26 @@ import {Constants} from "./Constants.sol"; contract ForkTest is Test { address constant TEST_ADDRESS = 0x10b252872733BFdC7fB22dB0BE5D1E55C0141848; - function testFork() public { - uint256 balanceBefore = address(TEST_ADDRESS).balance; - console.log("balance before:", balanceBefore); - (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + address constant TOKEN_ADDRESS = 0x493257fD37EDB34451f62EDf8D2a0C418852bA4C; + function setUp() public { + (bool success, bytes memory data) = TOKEN_ADDRESS.call( + abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) + ); + console.log("balance before:", uint256(bytes32(data))); + (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) ); - require(success, "fork failed"); - uint256 balanceAfter = address(TEST_ADDRESS).balance; - console.log("balance after :", balanceAfter); + require(success1, "fork failed"); + } + function testFork() public { + + // (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + // abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) + // ); + // let balance_after = uint256(bytes32(data2)); + // require(success2, "balance failed"); + uint256 balance_after = 1; + console.log("balance after:", balance_after); + } -} \ No newline at end of file +} diff --git a/crates/era-cheatcodes/tests/test.sh b/crates/era-cheatcodes/tests/test.sh index 8eac7c7c7..67e07a2a8 100755 --- a/crates/era-cheatcodes/tests/test.sh +++ b/crates/era-cheatcodes/tests/test.sh @@ -58,4 +58,6 @@ command -v git &>/dev/null || { build_zkforge "${REPO_ROOT}" echo "Running tests..." -RUST_LOG=debug "${BINARY_PATH}" test --use "./${SOLC}" +RUST_LOG=sharedbackend=trace,era_test_node=debug,multivm=debug,foundry_evm=trace,evm=trace,foundry_common=trace,foundry_evm_core=trace,zkforge=trace "${BINARY_PATH}" test --use "./${SOLC}" +# RUST_LOG=era_test_node=debug,zkforge=trace "${BINARY_PATH}" test --use "./${SOLC}" +# RUST_LOG=debug "${BINARY_PATH}" test --use "./${SOLC}" diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index d50e67d93..75302cd4b 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -10,10 +10,11 @@ use alloy_primitives::{Address, B256, U256}; use ethers_core::utils::GenesisAccount; use revm::{ db::DatabaseRef, - primitives::{AccountInfo, Bytecode, EVMResult, Env, ResultAndState}, + primitives::{AccountInfo, Bytecode, EVMError, EVMResult, Env, ResultAndState}, Database, Inspector, JournaledState, }; use std::{borrow::Cow, collections::HashMap}; +use zksync_types::{StorageKey, StorageValue}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; @@ -65,8 +66,9 @@ impl<'a> FuzzBackendWrapper<'a> { { self.is_initialized = false; - let result: EVMResult = - crate::era_revm::transactions::run_era_transaction(env, self, inspector); + let keys = self.backend.modified_storage_keys.clone(); + let result: Result> = + crate::era_revm::transactions::run_era_transaction(env, self, inspector, keys); Ok(result.unwrap()) } @@ -221,6 +223,10 @@ impl<'a> DatabaseExt for FuzzBackendWrapper<'a> { fn has_cheatcode_access(&self, account: Address) -> bool { self.backend.has_cheatcode_access(account) } + + fn set_modified_keys(&mut self, keys: HashMap) { + self.backend.to_mut().set_modified_keys(keys) + } } impl<'a> DatabaseRef for FuzzBackendWrapper<'a> { diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index fb82c2141..e167482ea 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -21,8 +21,8 @@ use revm::{ inspectors::NoOpInspector, precompile::{Precompiles, SpecId}, primitives::{ - Account, AccountInfo, Bytecode, CreateScheme, EVMResult, Env, HashMap as Map, Log, - ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, + Account, AccountInfo, Bytecode, CreateScheme, EVMError, EVMResult, Env, HashMap as Map, + Log, ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, }, Database, DatabaseCommit, Inspector, JournaledState, EVM, }; @@ -31,6 +31,7 @@ use std::collections::{HashMap, HashSet}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; +use zksync_types::{StorageKey, StorageValue}; mod diagnostic; pub use diagnostic::RevertDiagnostic; @@ -312,6 +313,8 @@ pub trait DatabaseExt: Database { } Ok(()) } + + fn set_modified_keys(&mut self, keys: HashMap) {} } /// Provides the underlying `revm::Database` implementation. @@ -395,6 +398,8 @@ pub struct Backend { active_fork_ids: Option<(LocalForkId, ForkLookupIndex)>, /// holds additional Backend data inner: BackendInner, + /// Storage for zksync + modified_storage_keys: HashMap, } // === impl Backend === @@ -423,6 +428,7 @@ impl Backend { fork_init_journaled_state: inner.new_journaled_state(), active_fork_ids: None, inner, + modified_storage_keys: Default::default(), }; if let Some(fork) = fork { @@ -466,6 +472,7 @@ impl Backend { fork_init_journaled_state: self.inner.new_journaled_state(), active_fork_ids: None, inner: Default::default(), + modified_storage_keys: Default::default(), } } @@ -775,8 +782,9 @@ impl Backend { { self.initialize(env); - let result: EVMResult = - crate::era_revm::transactions::run_era_transaction(env, self, inspector); + let keys = self.modified_storage_keys.clone(); + let result: Result> = + crate::era_revm::transactions::run_era_transaction(env, self, inspector, keys); Ok(result.unwrap()) } @@ -1386,6 +1394,9 @@ impl DatabaseExt for Backend { fn has_cheatcode_access(&self, account: Address) -> bool { self.inner.cheatcode_access_accounts.contains(&account) } + fn set_modified_keys(&mut self, keys: HashMap) { + self.modified_storage_keys = keys; + } } impl DatabaseRef for Backend { diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index c4fb61cfb..c887dd6e3 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -24,7 +24,7 @@ use std::{ use zksync_basic_types::{web3::signing::keccak256, L1BatchNumber, L2ChainId, H160, H256, U256}; use zksync_types::{ api::Block, fee::Fee, l2::L2Tx, transaction_request::PaymasterParams, PackedEthSignature, - StorageKey, StorageLogQueryType, ACCOUNT_CODE_STORAGE_ADDRESS, + StorageKey, StorageLogQueryType, StorageValue, ACCOUNT_CODE_STORAGE_ADDRESS, }; use zksync_utils::{h256_to_account_address, u256_to_h256}; @@ -129,7 +129,12 @@ pub enum DatabaseError { MissingCode(bool), } -pub fn run_era_transaction(env: &mut Env, db: DB, inspector: INSP) -> EVMResult +pub fn run_era_transaction( + env: &mut Env, + db: DB, + inspector: INSP, + modified_storage: HashMap, +) -> EVMResult where DB: DatabaseExt + Send, ::Error: Debug, @@ -193,7 +198,12 @@ where } let tracer = inspector.into_tracer_pointer(); let era_execution_result = node - .run_l2_tx_raw(l2_tx, multivm::interface::TxExecutionMode::VerifyExecute, vec![tracer]) + .run_l2_tx_raw( + l2_tx, + multivm::interface::TxExecutionMode::VerifyExecute, + vec![tracer], + modified_storage, + ) .unwrap(); let (modified_keys, tx_result, _call_traces, _block, bytecodes, _block_ctx) = @@ -241,6 +251,28 @@ where } }; + let state = storage_to_state(modified_keys.clone(), bytecodes, era_db.clone()); + era_db.db.lock().unwrap().set_modified_keys(modified_keys); + Ok(ResultAndState { result: execution_result, state }) +} + +fn decode_l2_tx_result(output: Vec) -> Vec { + ethabi::decode(&[ParamType::Bytes], &output) + .ok() + .and_then(|result| result.first().cloned()) + .and_then(|result| result.into_bytes()) + .unwrap_or_default() +} + +pub fn storage_to_state( + modified_keys: HashMap, + bytecodes: HashMap>, + era_db: RevmDatabaseForEra, +) -> rHashMap +where + DB: DatabaseExt + Send, + ::Error: Debug, +{ let account_to_keys: HashMap> = modified_keys.iter().fold(HashMap::new(), |mut acc, (storage_key, value)| { acc.entry(*storage_key.address()).or_default().insert(*storage_key, *value); @@ -313,16 +345,7 @@ where ) }) .collect(); - - Ok(ResultAndState { result: execution_result, state }) -} - -fn decode_l2_tx_result(output: Vec) -> Vec { - ethabi::decode(&[ParamType::Bytes], &output) - .ok() - .and_then(|result| result.first().cloned()) - .and_then(|result| result.into_bytes()) - .unwrap_or_default() + state } #[cfg(test)] @@ -364,8 +387,13 @@ mod tests { }; let mock_db = MockDatabase::default(); - let res = run_era_transaction::<_, ResultAndState, _>(&mut env, mock_db, Noop::default()) - .expect("failed executing"); + let res = run_era_transaction::<_, ResultAndState, _>( + &mut env, + mock_db, + Noop::default(), + Default::default(), + ) + .expect("failed executing"); assert!(!res.state.is_empty(), "unexpected failure: no states were touched"); for (address, account) in res.state { diff --git a/crates/evm/core/src/fork/backend.rs b/crates/evm/core/src/fork/backend.rs index ed708bc01..e3872a009 100644 --- a/crates/evm/core/src/fork/backend.rs +++ b/crates/evm/core/src/fork/backend.rs @@ -191,6 +191,7 @@ where let fut = Box::pin(async move { // serialize & deserialize back to U256 let idx_req = B256::from(idx); + dbg!(address, idx, block_id); let storage = provider .get_storage_at( NameOrAddress::Address(address.to_ethers()), @@ -220,6 +221,8 @@ where let resp = tokio::try_join!(balance, nonce, code).map(|(balance, nonce, code)| { (balance.to_alloy(), nonce.to_alloy(), Bytes::from(code.0)) }); + + dbg!((&resp, &address)); (resp, address) }); ProviderRequest::Account(fut) @@ -661,7 +664,7 @@ impl DatabaseRef for SharedBackend { fn storage_ref(&self, address: Address, index: U256) -> Result { trace!(target: "sharedbackend", "request storage {:?} at {:?}", address, index); - match self.do_get_storage(address, index).map_err(|err| { + let res = match self.do_get_storage(address, index).map_err(|err| { error!(target: "sharedbackend", %err, %address, %index, "Failed to send/recv `storage`"); if err.is_possibly_non_archive_node_error() { error!(target: "sharedbackend", "{NON_ARCHIVE_NODE_WARNING}"); @@ -670,7 +673,9 @@ impl DatabaseRef for SharedBackend { }) { Ok(val) => Ok(val), Err(err) => Err(err), - } + }; + dbg!(&res); + res } fn block_hash_ref(&self, number: U256) -> Result { diff --git a/crates/evm/core/src/fork/database.rs b/crates/evm/core/src/fork/database.rs index 1c39b99e1..db855b46d 100644 --- a/crates/evm/core/src/fork/database.rs +++ b/crates/evm/core/src/fork/database.rs @@ -160,10 +160,12 @@ impl Database for ForkedDatabase { } fn code_by_hash(&mut self, code_hash: B256) -> Result { + dbg!(code_hash); Database::code_by_hash(&mut self.cache_db, code_hash) } fn storage(&mut self, address: Address, index: U256) -> Result { + dbg!(address, index); Database::storage(&mut self.cache_db, address, index) } diff --git a/crates/zkforge/src/runner.rs b/crates/zkforge/src/runner.rs index 2ce8160a8..289788998 100644 --- a/crates/zkforge/src/runner.rs +++ b/crates/zkforge/src/runner.rs @@ -309,6 +309,7 @@ impl<'a> ContractRunner<'a> { /// similar to `eth_call`. #[instrument(name = "test", skip_all, fields(name = %func.signature(), %should_fail))] pub fn run_test(&self, func: &Function, should_fail: bool, setup: TestSetup) -> TestResult { + trace!("executing test {:?}", func.name); let TestSetup { address, mut logs, mut traces, mut labeled_addresses, mut coverage, .. } = setup; From 4607a6ac3fcedff90d8b24aff8c6acaee012582b Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 15 Dec 2023 11:13:33 +0100 Subject: [PATCH 03/22] Balance Signed-off-by: Danil --- .../tests/src/cheatcodes/Fork.t.sol | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 8542acaf3..76019ff98 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -6,12 +6,13 @@ import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "./Constants.sol"; contract ForkTest is Test { - address constant TEST_ADDRESS = 0x10b252872733BFdC7fB22dB0BE5D1E55C0141848; + address constant TEST_ADDRESS = 0x695D6fB3c17159c89a9Eb8b2556cb6c04D5c42A4; address constant TOKEN_ADDRESS = 0x493257fD37EDB34451f62EDf8D2a0C418852bA4C; function setUp() public { - (bool success, bytes memory data) = TOKEN_ADDRESS.call( - abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) - ); + // (bool success, bytes memory data) = TOKEN_ADDRESS.call( + // abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) + // ); + uint256 balance_before = address(TEST_ADDRESS).balance; console.log("balance before:", uint256(bytes32(data))); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) @@ -20,12 +21,13 @@ contract ForkTest is Test { } function testFork() public { - // (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( - // abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) - // ); - // let balance_after = uint256(bytes32(data2)); - // require(success2, "balance failed"); - uint256 balance_after = 1; + (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) + ); + // uint256 balance_after = uint256(bytes32(data2)); + uint256 balance_after = address(TEST_ADDRESS).balance; + require(success2, "balance failed"); + // uint256 balance_after = 1; console.log("balance after:", balance_after); } From 337cdb438803c915532cfb010c1e3a2cad320521 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 15 Dec 2023 14:20:24 +0100 Subject: [PATCH 04/22] Add zksync provider Signed-off-by: Danil --- Cargo.lock | 1 + .../tests/src/cheatcodes/Fork.t.sol | 14 ++-- crates/evm/core/Cargo.toml | 1 + crates/evm/core/src/backend/error.rs | 3 + crates/evm/core/src/backend/mod.rs | 2 +- crates/evm/core/src/era_revm/db.rs | 1 + crates/evm/core/src/fork/backend.rs | 68 ++++++++++++++++--- crates/evm/core/src/fork/mod.rs | 1 + crates/evm/core/src/fork/multi.rs | 26 ++++++- crates/evm/core/src/fork/zksync_provider.rs | 8 +++ 10 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 crates/evm/core/src/fork/zksync_provider.rs diff --git a/Cargo.lock b/Cargo.lock index 6d8016125..59ace98fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4412,6 +4412,7 @@ dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-types", + "async-trait", "auto_impl", "const-hex", "derive_more", diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 76019ff98..2bda0fc9f 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -6,14 +6,14 @@ import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "./Constants.sol"; contract ForkTest is Test { - address constant TEST_ADDRESS = 0x695D6fB3c17159c89a9Eb8b2556cb6c04D5c42A4; - address constant TOKEN_ADDRESS = 0x493257fD37EDB34451f62EDf8D2a0C418852bA4C; + address constant TEST_ADDRESS = 0x9C5819D1F9391B9818F5BD6D701755fBF8d013AC; + address constant TOKEN_ADDRESS = 0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4; function setUp() public { // (bool success, bytes memory data) = TOKEN_ADDRESS.call( // abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) // ); - uint256 balance_before = address(TEST_ADDRESS).balance; - console.log("balance before:", uint256(bytes32(data))); + // uint256 balance_before = address(TEST_ADDRESS).balance; + // console.log("balance before:", balance_before); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) ); @@ -24,9 +24,9 @@ contract ForkTest is Test { (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) ); - // uint256 balance_after = uint256(bytes32(data2)); - uint256 balance_after = address(TEST_ADDRESS).balance; - require(success2, "balance failed"); + uint256 balance_after = uint256(bytes32(data2)); + // uint256 balance_after = address(TEST_ADDRESS).balance; + // require(success2, "balance failed"); // uint256 balance_after = 1; console.log("balance after:", balance_after); diff --git a/crates/evm/core/Cargo.toml b/crates/evm/core/Cargo.toml index f6eb3f31c..0bce7e835 100644 --- a/crates/evm/core/Cargo.toml +++ b/crates/evm/core/Cargo.toml @@ -55,6 +55,7 @@ tokio = { version = "1", features = ["time", "macros"] } tracing = "0.1" url = "2" auto_impl = "1" +async-trait = "0.1" [dev-dependencies] maplit = "1" diff --git a/crates/evm/core/src/backend/error.rs b/crates/evm/core/src/backend/error.rs index b22c768d4..8634ba4f9 100644 --- a/crates/evm/core/src/backend/error.rs +++ b/crates/evm/core/src/backend/error.rs @@ -33,6 +33,8 @@ pub enum DatabaseError { GetBlockHash(u64, Arc), #[error("failed to get full block for {0:?}: {1}")] GetFullBlock(BlockId, Arc), + #[error("failed to get bytecode for {0:?}: {1}")] + GetBytecode(B256, Arc), #[error("block {0:?} does not exist")] BlockNotFound(BlockId), #[error("failed to get transaction {0}: {1}")] @@ -66,6 +68,7 @@ impl DatabaseError { Self::GetBlockHash(_, err) => Some(err), Self::GetFullBlock(_, err) => Some(err), Self::GetTransaction(_, err) => Some(err), + Self::GetBytecode(_, err) => Some(err), // Enumerate explicitly to make sure errors are updated if a new one is added. Self::NoCheats(_) | Self::MissingAccount(_) | diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index e167482ea..a20ec17e9 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -17,7 +17,7 @@ use foundry_common::{ SYSTEM_TRANSACTION_TYPE, }; use revm::{ - db::{CacheDB, DatabaseRef}, + db::{self, CacheDB, DatabaseRef}, inspectors::NoOpInspector, precompile::{Precompiles, SpecId}, primitives::{ diff --git a/crates/evm/core/src/era_revm/db.rs b/crates/evm/core/src/era_revm/db.rs index 02a7ac6ed..7556e3924 100644 --- a/crates/evm/core/src/era_revm/db.rs +++ b/crates/evm/core/src/era_revm/db.rs @@ -5,6 +5,7 @@ /// This code doesn't do any mutatios to Database: after each transaction run, the Revm /// is usually collecing all the diffs - and applies them to database itself. use std::{ + backtrace::Backtrace, collections::HashMap, fmt::Debug, sync::{Arc, Mutex}, diff --git a/crates/evm/core/src/fork/backend.rs b/crates/evm/core/src/fork/backend.rs index e3872a009..71ffd08b2 100644 --- a/crates/evm/core/src/fork/backend.rs +++ b/crates/evm/core/src/fork/backend.rs @@ -2,6 +2,7 @@ use crate::{ backend::{DatabaseError, DatabaseResult}, fork::{cache::FlushJsonBlockCacheDB, BlockchainDb}, + utils::CallKind, }; use alloy_primitives::{keccak256, Address, Bytes, B256, U256}; use ethers_core::{ @@ -13,6 +14,7 @@ use foundry_common::{ types::{ToAlloy, ToEthers}, NON_ARCHIVE_NODE_WARNING, }; +use foundry_compilers::artifacts::bytecode; use futures::{ channel::mpsc::{channel, Receiver, Sender}, stream::Stream, @@ -32,6 +34,8 @@ use std::{ }, }; +use super::zksync_provider::ZkSyncMiddleware; + // Various future/request type aliases type AccountFuture = @@ -48,10 +52,14 @@ type TransactionFuture = Pin< Box, Err>, B256)> + Send>, >; +type BytecodeHashFuture = + Pin, Err>, B256)> + Send>>; + type AccountInfoSender = OneshotSender>; type StorageSender = OneshotSender>; type BlockHashSender = OneshotSender>; type FullBlockSender = OneshotSender>>; +type ByteCodeHashSender = OneshotSender>; type TransactionSender = OneshotSender>; /// Request variants that are executed by the provider @@ -61,6 +69,7 @@ enum ProviderRequest { BlockHash(BlockHashFuture), FullBlock(FullBlockFuture), Transaction(TransactionFuture), + ByteCodeHash(BytecodeHashFuture), } /// The Request type the Backend listens for @@ -78,6 +87,8 @@ enum BackendRequest { Transaction(B256, TransactionSender), /// Sets the pinned block to fetch data from SetPinnedBlock(BlockId), + /// Get the bytecode for the given hash + ByteCodeHash(B256, ByteCodeHashSender), } /// Handles an internal provider and listens for requests. @@ -85,7 +96,7 @@ enum BackendRequest { /// This handler will remain active as long as it is reachable (request channel still open) and /// requests are in progress. #[must_use = "futures do nothing unless polled"] -pub struct BackendHandler { +pub struct BackendHandler { provider: M, /// Stores all the data. db: BlockchainDb, @@ -108,7 +119,7 @@ pub struct BackendHandler { impl BackendHandler where - M: Middleware + Clone + 'static, + M: ZkSyncMiddleware + Clone + 'static, { fn new( provider: M, @@ -174,6 +185,9 @@ where BackendRequest::SetPinnedBlock(block_id) => { self.block_id = Some(block_id); } + BackendRequest::ByteCodeHash(code_hash, sender) => { + self.request_bytecode_by_hash(code_hash, sender); + } } } @@ -241,6 +255,15 @@ where } } + fn request_bytecode_by_hash(&mut self, code_hash: B256, sender: ByteCodeHashSender) { + let provider = self.provider.clone(); + let fut = Box::pin(async move { + let bytecode = provider.get_bytecode_by_hash(code_hash).await; + (sender, bytecode, code_hash) + }); + self.pending_requests.push(ProviderRequest::ByteCodeHash(fut)); + } + /// process a request for an entire block fn request_full_block(&mut self, number: BlockId, sender: FullBlockSender) { let provider = self.provider.clone(); @@ -301,7 +324,7 @@ where impl Future for BackendHandler where - M: Middleware + Clone + Unpin + 'static, + M: ZkSyncMiddleware + Clone + Unpin + 'static, { type Output = (); @@ -468,6 +491,20 @@ where continue } } + ProviderRequest::ByteCodeHash(fut) => { + if let Poll::Ready((sender, bytecode, code_hash)) = fut.poll_unpin(cx) { + let msg = match bytecode { + Ok(Some(bytecode)) => Ok(bytecode), + Ok(None) => Err(DatabaseError::MissingCode(code_hash)), + Err(err) => { + let err = Arc::new(eyre::Error::new(err)); + Err(DatabaseError::GetBytecode(code_hash, err)) + } + }; + let _ = sender.send(msg); + continue + } + } } // not ready, insert and poll again pin.pending_requests.push(request); @@ -531,7 +568,7 @@ impl SharedBackend { /// NOTE: this should be called with `Arc` pub async fn spawn_backend(provider: M, db: BlockchainDb, pin_block: Option) -> Self where - M: Middleware + Unpin + 'static + Clone, + M: ZkSyncMiddleware + Unpin + 'static + Clone, { let (shared, handler) = Self::new(provider, db, pin_block); // spawn the provider handler to a task @@ -548,7 +585,7 @@ impl SharedBackend { pin_block: Option, ) -> Self where - M: Middleware + Unpin + 'static + Clone, + M: ZkSyncMiddleware + Unpin + 'static + Clone, { let (shared, handler) = Self::new(provider, db, pin_block); @@ -577,7 +614,7 @@ impl SharedBackend { pin_block: Option, ) -> (Self, BackendHandler) where - M: Middleware + Unpin + 'static + Clone, + M: ZkSyncMiddleware + Unpin + 'static + Clone, { let (backend, backend_rx) = channel(1); let cache = Arc::new(FlushJsonBlockCacheDB(Arc::clone(db.cache()))); @@ -638,6 +675,15 @@ impl SharedBackend { }) } + fn do_get_bytecode(&self, hash: B256) -> DatabaseResult { + tokio::task::block_in_place(|| { + let (sender, rx) = oneshot_channel(); + let req = BackendRequest::ByteCodeHash(hash, sender); + self.backend.clone().try_send(req)?; + rx.recv()? + }) + } + /// Flushes the DB to disk if caching is enabled pub(crate) fn flush_cache(&self) { self.cache.0.flush(); @@ -659,7 +705,14 @@ impl DatabaseRef for SharedBackend { } fn code_by_hash_ref(&self, hash: B256) -> Result { - Err(DatabaseError::MissingCode(hash)) + trace!(target: "sharedbackend", %hash, "request codehash"); + self.do_get_bytecode(hash).map_err(|err| { + error!(target: "sharedbackend", %err, %hash, "Failed to send/recv `code_by_hash`"); + if err.is_possibly_non_archive_node_error() { + error!(target: "sharedbackend", "{NON_ARCHIVE_NODE_WARNING}"); + } + err + }) } fn storage_ref(&self, address: Address, index: U256) -> Result { @@ -674,7 +727,6 @@ impl DatabaseRef for SharedBackend { Ok(val) => Ok(val), Err(err) => Err(err), }; - dbg!(&res); res } diff --git a/crates/evm/core/src/fork/mod.rs b/crates/evm/core/src/fork/mod.rs index f9042ac91..250c3aac8 100644 --- a/crates/evm/core/src/fork/mod.rs +++ b/crates/evm/core/src/fork/mod.rs @@ -11,6 +11,7 @@ mod cache; pub use cache::{BlockchainDb, BlockchainDbMeta, JsonBlockCacheDB, MemDb}; pub mod database; +pub mod zksync_provider; mod multi; pub use multi::{ForkId, MultiFork, MultiForkHandler}; diff --git a/crates/evm/core/src/fork/multi.rs b/crates/evm/core/src/fork/multi.rs index f00d5ffed..b96392715 100644 --- a/crates/evm/core/src/fork/multi.rs +++ b/crates/evm/core/src/fork/multi.rs @@ -4,8 +4,9 @@ //! concurrently active pairs at once. use crate::fork::{BackendHandler, BlockchainDb, BlockchainDbMeta, CreateFork, SharedBackend}; +use alloy_primitives::Bytes; use ethers_core::types::{BlockId, BlockNumber}; -use ethers_providers::Provider; +use ethers_providers::{JsonRpcClient, Provider}; use foundry_common::{runtime_client::RuntimeClient, types::ToEthers, ProviderBuilder}; use foundry_config::Config; use futures::{ @@ -26,6 +27,8 @@ use std::{ time::Duration, }; +use super::zksync_provider::ZkSyncMiddleware; + /// The identifier for a specific fork, this could be the name of the network a custom descriptive /// name. #[derive(Debug, Clone, Eq, PartialEq, Hash)] @@ -479,3 +482,24 @@ async fn create_fork(mut fork: CreateFork) -> eyre::Result<(CreatedFork, Handler let fork = CreatedFork::new(fork, backend); Ok((fork, handler)) } + +#[async_trait::async_trait] +impl ZkSyncMiddleware for Provider

{ + async fn get_bytecode_by_hash( + &self, + hash: alloy_primitives::B256, + ) -> Result, Self::Error> { + let bytecode: Option = self.request("zks_getBytecodeByHash", vec![hash]).await?; + Ok(bytecode.map(revm::primitives::Bytecode::new_raw)) + } +} + +#[async_trait::async_trait] +impl ZkSyncMiddleware for Arc> { + async fn get_bytecode_by_hash( + &self, + hash: alloy_primitives::B256, + ) -> Result, Self::Error> { + self.as_ref().get_bytecode_by_hash(hash).await + } +} diff --git a/crates/evm/core/src/fork/zksync_provider.rs b/crates/evm/core/src/fork/zksync_provider.rs new file mode 100644 index 000000000..6d142ac2c --- /dev/null +++ b/crates/evm/core/src/fork/zksync_provider.rs @@ -0,0 +1,8 @@ +use alloy_primitives::B256; +use ethers_providers::Middleware; +use revm::primitives::Bytecode; + +#[async_trait::async_trait] +pub trait ZkSyncMiddleware: Middleware { + async fn get_bytecode_by_hash(&self, hash: B256) -> Result, Self::Error>; +} From f3599cee0b095ce64356b8718b5b652828418679 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 15 Dec 2023 14:36:32 +0100 Subject: [PATCH 05/22] It's alive Signed-off-by: Danil --- crates/era-cheatcodes/src/cheatcodes.rs | 3 --- .../tests/src/cheatcodes/Fork.t.sol | 26 +++++++++---------- crates/evm/core/src/fork/backend.rs | 2 -- crates/evm/core/src/fork/database.rs | 2 -- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 62176e3a9..8c4334dee 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -255,10 +255,7 @@ impl VmTracer, H> for CheatcodeT &mut journaled_state, ) }; - dbg!(&fork_id); storage.borrow_mut().modified_storage_keys = modified_storage; - // dbg!(&state); - // dbg!(&env); self.return_data = Some(vec![fork_id.unwrap().to_u256()]); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 2bda0fc9f..a2b361f09 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -6,29 +6,29 @@ import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "./Constants.sol"; contract ForkTest is Test { - address constant TEST_ADDRESS = 0x9C5819D1F9391B9818F5BD6D701755fBF8d013AC; + /// USDC TOKEN address constant TOKEN_ADDRESS = 0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4; function setUp() public { - // (bool success, bytes memory data) = TOKEN_ADDRESS.call( - // abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) - // ); - // uint256 balance_before = address(TEST_ADDRESS).balance; - // console.log("balance before:", balance_before); + /// USDC TOKEN doesn't exists locally + (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + abi.encodeWithSignature("decimals()") + ); + uint256 decimals_before = uint256(bytes32(data2)); + console.log("decimals_before:", decimals_before); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) ); + require(decimals_before == 0, "Contract exists locally"); require(success1, "fork failed"); } function testFork() public { - + /// After createSelect fork the decimals should exist (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( - abi.encodeWithSignature("getBalance(address)", TEST_ADDRESS) + abi.encodeWithSignature("decimals()") ); - uint256 balance_after = uint256(bytes32(data2)); - // uint256 balance_after = address(TEST_ADDRESS).balance; - // require(success2, "balance failed"); - // uint256 balance_after = 1; - console.log("balance after:", balance_after); + uint256 decimals_after = uint256(bytes32(data2)); + console.log("decimals_after:", decimals_after); + require(decimals_after == 6, "Contract dosent exists in fork"); } } diff --git a/crates/evm/core/src/fork/backend.rs b/crates/evm/core/src/fork/backend.rs index 71ffd08b2..a654d743f 100644 --- a/crates/evm/core/src/fork/backend.rs +++ b/crates/evm/core/src/fork/backend.rs @@ -205,7 +205,6 @@ where let fut = Box::pin(async move { // serialize & deserialize back to U256 let idx_req = B256::from(idx); - dbg!(address, idx, block_id); let storage = provider .get_storage_at( NameOrAddress::Address(address.to_ethers()), @@ -236,7 +235,6 @@ where (balance.to_alloy(), nonce.to_alloy(), Bytes::from(code.0)) }); - dbg!((&resp, &address)); (resp, address) }); ProviderRequest::Account(fut) diff --git a/crates/evm/core/src/fork/database.rs b/crates/evm/core/src/fork/database.rs index db855b46d..1c39b99e1 100644 --- a/crates/evm/core/src/fork/database.rs +++ b/crates/evm/core/src/fork/database.rs @@ -160,12 +160,10 @@ impl Database for ForkedDatabase { } fn code_by_hash(&mut self, code_hash: B256) -> Result { - dbg!(code_hash); Database::code_by_hash(&mut self.cache_db, code_hash) } fn storage(&mut self, address: Address, index: U256) -> Result { - dbg!(address, index); Database::storage(&mut self.cache_db, address, index) } From d633bea868e6037456339258d5eb9a7ed3fb8623 Mon Sep 17 00:00:00 2001 From: Danil Date: Fri, 15 Dec 2023 16:12:13 +0100 Subject: [PATCH 06/22] Use the correct urls Signed-off-by: Danil --- Cargo.lock | 1 + crates/era-cheatcodes/Cargo.toml | 1 + crates/era-cheatcodes/src/cheatcodes.rs | 43 ++++++++++++------- crates/era-cheatcodes/tests/foundry.toml | 3 +- .../tests/src/cheatcodes/Fork.t.sol | 9 ++-- crates/evm/evm/src/inspectors/stack.rs | 2 +- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59ace98fd..f889bbcd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3274,6 +3274,7 @@ dependencies = [ "ethabi 18.0.0", "ethers", "eyre", + "foundry-cheatcodes", "foundry-cheatcodes-spec", "foundry-common", "foundry-evm-core", diff --git a/crates/era-cheatcodes/Cargo.toml b/crates/era-cheatcodes/Cargo.toml index 49b537fdc..5676b13e4 100644 --- a/crates/era-cheatcodes/Cargo.toml +++ b/crates/era-cheatcodes/Cargo.toml @@ -22,6 +22,7 @@ zksync_utils.workspace = true foundry-evm-core.workspace = true foundry-common.workspace = true foundry-cheatcodes-spec.workspace = true +foundry-cheatcodes.workspace = true alloy-sol-types = { workspace = true, features = ["json"] } ethabi = "18.0.0" diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 8c4334dee..a5a59530e 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -4,6 +4,7 @@ use era_test_node::{ deps::storage_view::StorageView, fork::ForkStorage, utils::bytecode_to_factory_dep, }; use ethers::utils::to_checksum; +use foundry_cheatcodes::CheatsConfig; use foundry_cheatcodes_spec::Vm; use foundry_evm_core::{ backend::DatabaseExt, @@ -33,6 +34,7 @@ use std::{ cell::{OnceCell, RefMut}, collections::HashMap, fmt::Debug, + sync::Arc, }; use zksync_basic_types::{AccountTreeId, H160, H256, U256}; use zksync_state::{ReadStorage, StoragePtr, WriteStorage}; @@ -89,6 +91,8 @@ pub struct CheatcodeTracer { near_calls: usize, serialized_objects: HashMap, env: OnceCell, + /// Additional, user configurable context this Inspector has access to when inspecting a call + config: Arc, } #[derive(Debug, Clone)] @@ -234,22 +238,22 @@ impl VmTracer, H> for CheatcodeT let mut db = era_db.db.lock().unwrap(); let era_env = self.env.get().unwrap(); - let mut era_rpc = HashMap::new(); - era_rpc.insert( - "mainnet".to_string(), - "https://mainnet.era.zksync.io:443".to_string(), - ); - era_rpc.insert( - "testnet".to_string(), - "https://testnet.era.zksync.dev:443".to_string(), - ); + // let mut era_rpc = HashMap::new(); + // era_rpc.insert( + // "mainnet".to_string(), + // "https://mainnet.era.zksync.io:443".to_string(), + // ); + // era_rpc.insert( + // "testnet".to_string(), + // "https://testnet.era.zksync.dev:443".to_string(), + // ); let mut env = into_revm_env(&era_env); db.create_select_fork( create_fork_request( era_env, - &era_rpc, + self.config.clone(), Some(block_number), - url_or_alias, + &url_or_alias, ), &mut env, &mut journaled_state, @@ -289,7 +293,7 @@ impl VmTracer, H> for CheatcodeT } impl CheatcodeTracer { - pub fn new() -> Self { + pub fn new(cheatcodes_config: Arc) -> Self { CheatcodeTracer { one_time_actions: vec![], permanent_actions: FinishCyclePermanentActions { start_prank: None }, @@ -298,6 +302,7 @@ impl CheatcodeTracer { return_ptr: None, serialized_objects: HashMap::new(), env: OnceCell::default(), + config: cheatcodes_config, } } @@ -630,13 +635,14 @@ fn into_revm_env(env: &EraEnv) -> Env { fn create_fork_request( env: &EraEnv, - era_rpc: &HashMap, + config: Arc, block_number: Option, - url_or_alias: String, + url_or_alias: &str, ) -> CreateFork { use foundry_evm_core::opts::Env; use revm::primitives::Address as revmAddress; - let url = &era_rpc[&url_or_alias]; + + let url = config.rpc_url(url_or_alias).unwrap(); let env = into_revm_env(&env); let opts_env = Env { gas_limit: u64::MAX, @@ -653,5 +659,10 @@ fn create_fork_request( ..Default::default() }; - CreateFork { enable_caching: true, url: url.clone(), env, evm_opts } + CreateFork { + enable_caching: config.rpc_storage_caching.enable_for_endpoint(&url), + url, + env, + evm_opts, + } } diff --git a/crates/era-cheatcodes/tests/foundry.toml b/crates/era-cheatcodes/tests/foundry.toml index ea122abec..c8d63ecd6 100644 --- a/crates/era-cheatcodes/tests/foundry.toml +++ b/crates/era-cheatcodes/tests/foundry.toml @@ -5,5 +5,6 @@ libs = ['lib'] [rpc_endpoints] local = "${ERA_TEST_NODE_RPC_URL}" - +mainnet = "https://mainnet.era.zksync.io:443" +testnet = "https://testnet.era.zksync.dev:443" # See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index a2b361f09..a49ede2c0 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -10,18 +10,19 @@ contract ForkTest is Test { address constant TOKEN_ADDRESS = 0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4; function setUp() public { /// USDC TOKEN doesn't exists locally - (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + (bool success, bytes memory data) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") ); - uint256 decimals_before = uint256(bytes32(data2)); + uint256 decimals_before = uint256(bytes32(data)); console.log("decimals_before:", decimals_before); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) ); require(decimals_before == 0, "Contract exists locally"); require(success1, "fork failed"); - } - function testFork() public { + } + + function testFork() public{ /// After createSelect fork the decimals should exist (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index 837a24a94..aef3961f7 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -587,6 +587,6 @@ impl StorageView>>, HistoryDisabled, > { - CheatcodeTracer::new().into_tracer_pointer() + CheatcodeTracer::new(self.cheatcodes.as_ref().unwrap().config.clone()).into_tracer_pointer() } } From 5ae99e1714c96d64aa81be2e541dd84a58b0f5f9 Mon Sep 17 00:00:00 2001 From: Danil Date: Sat, 16 Dec 2023 00:14:01 +0100 Subject: [PATCH 07/22] Make it work properly with l2blocks Signed-off-by: Danil --- Cargo.lock | 57 +-- Cargo.toml | 12 +- crates/anvil/Cargo.toml | 1 + crates/anvil/src/eth/backend/db.rs | 1 + crates/anvil/src/eth/backend/mem/state.rs | 4 +- crates/era-cheatcodes/src/cheatcodes.rs | 42 +- .../tests/src/cheatcodes/Fork.t.sol | 4 +- crates/evm/core/Cargo.toml | 2 +- crates/evm/core/src/backend/fuzz.rs | 2 +- crates/evm/core/src/backend/in_memory_db.rs | 1 + crates/evm/core/src/backend/mod.rs | 16 +- crates/evm/core/src/era_revm/db.rs | 435 +++++++++--------- crates/evm/core/src/era_revm/transactions.rs | 7 +- crates/evm/core/src/fork/backend.rs | 11 +- 14 files changed, 298 insertions(+), 297 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f889bbcd9..46d731d83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -638,6 +638,7 @@ dependencies = [ "trie-db", "vergen", "yansi 0.5.1", + "zksync_types", ] [[package]] @@ -4428,7 +4429,6 @@ dependencies = [ "foundry-macros", "futures 0.3.29", "itertools 0.11.0", - "maplit", "multivm", "once_cell", "parking_lot 0.12.1", @@ -4440,6 +4440,7 @@ dependencies = [ "tracing", "url", "zksync_basic_types", + "zksync_state", "zksync_types", "zksync_utils", "zksync_web3_decl", @@ -6996,7 +6997,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multivm" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "hex", @@ -8381,7 +8382,7 @@ dependencies = [ [[package]] name = "prometheus_exporter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "metrics", @@ -11808,7 +11809,7 @@ dependencies = [ [[package]] name = "vlog" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "chrono", "sentry", @@ -12819,7 +12820,7 @@ dependencies = [ [[package]] name = "zksync_basic_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "serde", "serde_json", @@ -12829,7 +12830,7 @@ dependencies = [ [[package]] name = "zksync_circuit_breaker" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "async-trait", @@ -12852,7 +12853,7 @@ dependencies = [ [[package]] name = "zksync_commitment_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "zkevm_test_harness 1.4.0", "zksync_types", @@ -12880,7 +12881,7 @@ dependencies = [ [[package]] name = "zksync_config" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "serde", @@ -13035,7 +13036,7 @@ dependencies = [ [[package]] name = "zksync_contracts" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "envy", "ethabi 18.0.0", @@ -13049,7 +13050,7 @@ dependencies = [ [[package]] name = "zksync_core" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "actix-cors", "actix-rt", @@ -13120,7 +13121,7 @@ dependencies = [ [[package]] name = "zksync_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "base64 0.13.1", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13135,7 +13136,7 @@ dependencies = [ [[package]] name = "zksync_dal" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "bigdecimal", @@ -13168,7 +13169,7 @@ dependencies = [ [[package]] name = "zksync_eth_client" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "async-trait", @@ -13188,7 +13189,7 @@ dependencies = [ [[package]] name = "zksync_eth_signer" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "async-trait", "hex", @@ -13207,7 +13208,7 @@ dependencies = [ [[package]] name = "zksync_health_check" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "async-trait", "futures 0.3.29", @@ -13220,7 +13221,7 @@ dependencies = [ [[package]] name = "zksync_mempool" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "tracing", "zksync_types", @@ -13229,7 +13230,7 @@ dependencies = [ [[package]] name = "zksync_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "leb128", "once_cell", @@ -13246,7 +13247,7 @@ dependencies = [ [[package]] name = "zksync_mini_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "once_cell", "zksync_basic_types", @@ -13256,7 +13257,7 @@ dependencies = [ [[package]] name = "zksync_object_store" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "async-trait", @@ -13308,7 +13309,7 @@ dependencies = [ [[package]] name = "zksync_prover_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "async-trait", @@ -13328,7 +13329,7 @@ dependencies = [ [[package]] name = "zksync_queued_job_processor" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "async-trait", @@ -13341,7 +13342,7 @@ dependencies = [ [[package]] name = "zksync_state" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "itertools 0.10.5", @@ -13358,7 +13359,7 @@ dependencies = [ [[package]] name = "zksync_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "num_cpus", "once_cell", @@ -13370,7 +13371,7 @@ dependencies = [ [[package]] name = "zksync_system_constants" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "bigdecimal", @@ -13388,7 +13389,7 @@ dependencies = [ [[package]] name = "zksync_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13422,7 +13423,7 @@ dependencies = [ [[package]] name = "zksync_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "bigdecimal", @@ -13444,7 +13445,7 @@ dependencies = [ [[package]] name = "zksync_verification_key_generator_and_server" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "anyhow", "bincode", @@ -13464,7 +13465,7 @@ dependencies = [ [[package]] name = "zksync_web3_decl" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=6c26612279698a572afcdd54132e7cbf58a9c332#6c26612279698a572afcdd54132e7cbf58a9c332" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" dependencies = [ "bigdecimal", "chrono", diff --git a/Cargo.toml b/Cargo.toml index c6edc34b8..f7deaf332 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,12 +160,12 @@ solang-parser = "=0.3.3" ## zksync era_test_node = { path = "../era-test-node" } -zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } -zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } -zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } -multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } -zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } -zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "6c26612279698a572afcdd54132e7cbf58a9c332" } +zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } ## misc chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } diff --git a/crates/anvil/Cargo.toml b/crates/anvil/Cargo.toml index dbced4c69..efc9d5974 100644 --- a/crates/anvil/Cargo.toml +++ b/crates/anvil/Cargo.toml @@ -26,6 +26,7 @@ anvil-server = { path = "server" } foundry-common.workspace = true foundry-config.workspace = true foundry-evm.workspace = true +zksync_types.workspace = true # evm support bytes = "1.4.0" diff --git a/crates/anvil/src/eth/backend/db.rs b/crates/anvil/src/eth/backend/db.rs index a36d7953a..8d20e526b 100644 --- a/crates/anvil/src/eth/backend/db.rs +++ b/crates/anvil/src/eth/backend/db.rs @@ -296,6 +296,7 @@ impl DatabaseRef for StateDb { } fn storage_ref(&self, address: B160, index: rU256) -> DatabaseResult { + println!("statedb"); self.0.storage_ref(address, index) } diff --git a/crates/anvil/src/eth/backend/mem/state.rs b/crates/anvil/src/eth/backend/mem/state.rs index bda955860..bb56b71d7 100644 --- a/crates/anvil/src/eth/backend/mem/state.rs +++ b/crates/anvil/src/eth/backend/mem/state.rs @@ -7,7 +7,9 @@ use ethers::{ types::H256, utils::{rlp, rlp::RlpStream}, }; -use foundry_common::types::{ToAlloy, ToEthers}; +use foundry_common::{ + types::{ToAlloy, ToEthers}, +}; use foundry_evm::{ backend::DatabaseError, hashbrown::HashMap as Map, diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index a5a59530e..ac3b586e3 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -91,7 +91,6 @@ pub struct CheatcodeTracer { near_calls: usize, serialized_objects: HashMap, env: OnceCell, - /// Additional, user configurable context this Inspector has access to when inspecting a call config: Arc, } @@ -151,7 +150,7 @@ impl DynTracer, SimpleMemory> tracing::error!("cheatcode triggered, but no calldata or ergs available"); return } - tracing::info!("near call: cheatcode triggered"); + tracing::info!("far call: cheatcode triggered"); let calldata = { let ptr = state.vm_local_state.registers [CALL_IMPLICIT_CALLDATA_FAT_PTR_REGISTER as usize]; @@ -216,11 +215,17 @@ impl VmTracer, H> for CheatcodeT .decommittment_processor .populate(vec![(hash, bytecode)], Timestamp(state.local_state.timestamp)), FinishCycleOneTimeActions::CreateFork { url_or_alias, block_number } => { - let modified_storage: HashMap = - storage.borrow_mut().modified_storage_keys().clone(); + let modified_storage: HashMap = storage + .borrow_mut() + .modified_storage_keys() + .clone() + .into_iter() + .filter(|(key, _)| key.address() != &zksync_types::SYSTEM_CONTEXT_ADDRESS) + .collect(); storage.borrow_mut().clean_cache(); let fork_id = { - let handle = &storage.borrow_mut().storage_handle; + let handle: &ForkStorage> = + &storage.borrow_mut().storage_handle; let mut fork_storage = handle.inner.write().unwrap(); fork_storage.value_read_cache.clear(); let era_db = fork_storage.fork.as_ref().unwrap().fork_source.clone(); @@ -231,24 +236,14 @@ impl VmTracer, H> for CheatcodeT .collect(); let mut journaled_state = JournaledState::new(SpecId::LATEST, vec![]); - let state = storage_to_state(modified_storage.clone(), bytecodes, era_db.clone()); *journaled_state.state() = state; let mut db = era_db.db.lock().unwrap(); let era_env = self.env.get().unwrap(); - // let mut era_rpc = HashMap::new(); - // era_rpc.insert( - // "mainnet".to_string(), - // "https://mainnet.era.zksync.io:443".to_string(), - // ); - // era_rpc.insert( - // "testnet".to_string(), - // "https://testnet.era.zksync.dev:443".to_string(), - // ); - let mut env = into_revm_env(&era_env); - db.create_select_fork( + let mut env = into_revm_env(era_env); + let res = db.create_select_fork( create_fork_request( era_env, self.config.clone(), @@ -257,9 +252,14 @@ impl VmTracer, H> for CheatcodeT ), &mut env, &mut journaled_state, - ) + ); + drop(db); + let mut db_env = era_db.env.lock().unwrap(); + *db_env = env; + res }; storage.borrow_mut().modified_storage_keys = modified_storage; + self.return_data = Some(vec![fork_id.unwrap().to_u256()]); } } @@ -619,9 +619,9 @@ fn into_revm_env(env: &EraEnv) -> Env { use foundry_common::zk_utils::conversion_utils::h160_to_address; use revm::primitives::U256; let block = BlockEnv { - number: U256::from(env.l1_batch_env.number.0), + number: U256::from(env.l1_batch_env.first_l2_block.number), coinbase: h160_to_address(env.l1_batch_env.fee_account), - timestamp: U256::from(env.l1_batch_env.timestamp), + timestamp: U256::from(env.l1_batch_env.first_l2_block.timestamp), gas_limit: U256::from(env.system_env.gas_limit), basefee: U256::from(env.l1_batch_env.base_fee()), ..Default::default() @@ -643,7 +643,7 @@ fn create_fork_request( use revm::primitives::Address as revmAddress; let url = config.rpc_url(url_or_alias).unwrap(); - let env = into_revm_env(&env); + let env = into_revm_env(env); let opts_env = Env { gas_limit: u64::MAX, chain_id: None, diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index a49ede2c0..96b47fb2d 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -14,9 +14,10 @@ contract ForkTest is Test { abi.encodeWithSignature("decimals()") ); uint256 decimals_before = uint256(bytes32(data)); + console.log("block", block.number); console.log("decimals_before:", decimals_before); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 243698) + abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 19579636) ); require(decimals_before == 0, "Contract exists locally"); require(success1, "fork failed"); @@ -28,6 +29,7 @@ contract ForkTest is Test { abi.encodeWithSignature("decimals()") ); uint256 decimals_after = uint256(bytes32(data2)); + console.log("block", block.number); console.log("decimals_after:", decimals_after); require(decimals_after == 6, "Contract dosent exists in fork"); diff --git a/crates/evm/core/Cargo.toml b/crates/evm/core/Cargo.toml index 0bce7e835..6a0faf214 100644 --- a/crates/evm/core/Cargo.toml +++ b/crates/evm/core/Cargo.toml @@ -58,4 +58,4 @@ auto_impl = "1" async-trait = "0.1" [dev-dependencies] -maplit = "1" +zksync_state.workspace = true \ No newline at end of file diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index 75302cd4b..e424cc0ce 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -10,7 +10,7 @@ use alloy_primitives::{Address, B256, U256}; use ethers_core::utils::GenesisAccount; use revm::{ db::DatabaseRef, - primitives::{AccountInfo, Bytecode, EVMError, EVMResult, Env, ResultAndState}, + primitives::{AccountInfo, Bytecode, EVMError, Env, ResultAndState}, Database, Inspector, JournaledState, }; use std::{borrow::Cow, collections::HashMap}; diff --git a/crates/evm/core/src/backend/in_memory_db.rs b/crates/evm/core/src/backend/in_memory_db.rs index 6cb2c73ee..2f8022eb0 100644 --- a/crates/evm/core/src/backend/in_memory_db.rs +++ b/crates/evm/core/src/backend/in_memory_db.rs @@ -38,6 +38,7 @@ impl DatabaseRef for MemDb { } fn storage_ref(&self, address: Address, index: U256) -> Result { + println!("memdb"); DatabaseRef::storage_ref(&self.inner, address, index) } diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index a20ec17e9..ef536688d 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -12,16 +12,17 @@ use ethers_core::{ utils::GenesisAccount, }; use foundry_common::{ + conversion_utils::h160_to_address, is_known_system_sender, types::{ToAlloy, ToEthers}, SYSTEM_TRANSACTION_TYPE, }; use revm::{ - db::{self, CacheDB, DatabaseRef}, + db::{CacheDB, DatabaseRef}, inspectors::NoOpInspector, precompile::{Precompiles, SpecId}, primitives::{ - Account, AccountInfo, Bytecode, CreateScheme, EVMError, EVMResult, Env, HashMap as Map, + Account, AccountInfo, Bytecode, CreateScheme, EVMError, Env, HashMap as Map, Log, ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, }, Database, DatabaseCommit, Inspector, JournaledState, EVM, @@ -314,7 +315,7 @@ pub trait DatabaseExt: Database { Ok(()) } - fn set_modified_keys(&mut self, keys: HashMap) {} + fn set_modified_keys(&mut self, _keys: HashMap) {} } /// Provides the underlying `revm::Database` implementation. @@ -672,7 +673,7 @@ impl Backend { ) { if let Some((_, fork_idx)) = self.active_fork_ids.as_ref() { let active = self.inner.get_fork(*fork_idx); - merge_account_data(accounts, &active.db, active_journaled_state, target_fork) + merge_account_data(accounts, &active.db, active_journaled_state, target_fork); } else { merge_account_data(accounts, &self.mem_db, active_journaled_state, target_fork) } @@ -1115,6 +1116,11 @@ impl DatabaseExt for Backend { } self.update_fork_db(active_journaled_state, &mut fork); + // // Remove system context for enforcong it to be loaded from the fork + // let system_context = foundry_common::zk_utils::conversion_utils::h160_to_address( + // zksync_types::SYSTEM_CONTEXT_ADDRESS, + // ); + // fork.db.accounts.remove(&system_context); // insert the fork back self.inner.set_fork(idx, fork); @@ -1809,6 +1815,8 @@ pub(crate) fn merge_account_data( } *active_journaled_state = target_fork.journaled_state.clone(); + + target_fork.db.accounts.remove(&h160_to_address(zksync_types::SYSTEM_CONTEXT_ADDRESS)); } /// Clones the account data from the `active_journaled_state` into the `fork_journaled_state` diff --git a/crates/evm/core/src/era_revm/db.rs b/crates/evm/core/src/era_revm/db.rs index 7556e3924..945f1f1a9 100644 --- a/crates/evm/core/src/era_revm/db.rs +++ b/crates/evm/core/src/era_revm/db.rs @@ -5,7 +5,6 @@ /// This code doesn't do any mutatios to Database: after each transaction run, the Revm /// is usually collecing all the diffs - and applies them to database itself. use std::{ - backtrace::Backtrace, collections::HashMap, fmt::Debug, sync::{Arc, Mutex}, @@ -17,7 +16,7 @@ use foundry_common::zk_utils::conversion_utils::{ h160_to_address, h256_to_b256, h256_to_h160, revm_u256_to_h256, u256_to_revm_u256, }; use revm::{ - primitives::{Bytecode, Bytes}, + primitives::{Bytecode, Bytes, Env}, Database, }; use zksync_basic_types::{ @@ -34,12 +33,12 @@ use zksync_utils::{address_to_h256, h256_to_u256, u256_to_h256}; #[derive(Default)] pub struct RevmDatabaseForEra { pub db: Arc>>, - pub current_block: u64, + pub env: Arc>, } impl Clone for RevmDatabaseForEra { fn clone(&self) -> Self { - Self { db: self.db.clone(), current_block: self.current_block } + Self { db: self.db.clone(), env: self.env.clone() } } } @@ -47,7 +46,7 @@ impl Debug for RevmDatabaseForEra { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("RevmDatabaseForEra") .field("db", &"db") - .field("current_block", &self.current_block) + .field("env", &self.env.lock().unwrap()) .finish() } } @@ -154,21 +153,9 @@ where &self, address: H160, idx: U256, - block: Option, + _block: Option, ) -> eyre::Result { - // We cannot support historical lookups. Only the most recent block is supported. - let current_block = self.current_block; - if let Some(block) = &block { - match block { - BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number(num)) => { - let current_block_number_l2 = current_block * 2; - if num.as_u64() != current_block_number_l2 { - eyre::bail!("Only fetching of the most recent L2 block {} is supported - but queried for {}", current_block_number_l2, num) - } - } - _ => eyre::bail!("Only fetching most recent block is implemented"), - } - } + // We don't need to verify the block here, because foundry backend is taking care of it let mut result = self.read_storage_internal(address, idx); if L2_ETH_TOKEN_ADDRESS == address && result.is_zero() { @@ -269,210 +256,206 @@ where } } -#[cfg(test)] -#[allow(clippy::box_default)] -mod tests { - use maplit::hashmap; - use revm::primitives::AccountInfo; - - use super::*; - use crate::era_revm::testing::MockDatabase; - - #[test] - fn test_fetch_account_code_returns_hash_and_code_if_present_in_modified_keys_and_bytecodes() { - let bytecode_hash = H256::repeat_byte(0x3); - let bytecode = vec![U256::from(4)]; - let account = H160::repeat_byte(0xa); - let modified_keys = hashmap! { - StorageKey::new( - AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), - address_to_h256(&account), - ) => bytecode_hash, - }; - let bytecodes = hashmap! { - h256_to_u256(bytecode_hash) => bytecode.clone(), - }; - let db = RevmDatabaseForEra { - current_block: 0, - db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), - }; - - let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); - - let expected = Some(( - bytecode_hash, - Bytecode::new_raw( - bytecode - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into(), - ), - )); - assert_eq!(expected, actual) - } - - #[test] - fn test_fetch_account_code_returns_hash_and_code_if_not_in_modified_keys_but_in_bytecodes() { - let bytecode_hash = H256::repeat_byte(0x3); - let bytecode = vec![U256::from(4)]; - let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash - let modified_keys = Default::default(); - let bytecodes = hashmap! { - h256_to_u256(bytecode_hash) => bytecode.clone(), - }; - let db = RevmDatabaseForEra { - current_block: 0, - db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), - }; - - let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); - - let expected = Some(( - bytecode_hash, - Bytecode::new_raw( - bytecode - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into(), - ), - )); - assert_eq!(expected, actual) - } - - #[test] - fn test_fetch_account_code_returns_hash_and_code_from_db_if_not_in_modified_keys_or_bytecodes() - { - let bytecode_hash = H256::repeat_byte(0x3); - let bytecode = vec![U256::from(4)]; - let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash - let modified_keys = Default::default(); - let bytecodes = Default::default(); - let db = RevmDatabaseForEra { - current_block: 0, - db: Arc::new(Mutex::new(Box::new(MockDatabase { - basic: hashmap! { - h160_to_address(account) => AccountInfo { - code_hash: bytecode_hash.to_fixed_bytes().into(), - code: Some(Bytecode::new_raw( - bytecode - .clone() - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into())), - ..Default::default() - } - }, - }))), - }; - - let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); - - let expected = Some(( - bytecode_hash, - Bytecode::new_raw( - bytecode - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into(), - ), - )); - assert_eq!(expected, actual) - } - - #[test] - fn test_fetch_account_code_returns_hash_and_code_from_db_if_address_in_modified_keys_but_not_in_bytecodes( - ) { - let bytecode_hash = H256::repeat_byte(0x3); - let bytecode = vec![U256::from(4)]; - let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash - let modified_keys = hashmap! { - StorageKey::new( - AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), - address_to_h256(&account), - ) => bytecode_hash, - }; - let bytecodes = Default::default(); // nothing in bytecodes - let db = RevmDatabaseForEra { - current_block: 0, - db: Arc::new(Mutex::new(Box::new(MockDatabase { - basic: hashmap! { - h160_to_address(account) => AccountInfo { - code_hash: bytecode_hash.to_fixed_bytes().into(), - code: Some(Bytecode::new_raw( - bytecode - .clone() - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into())), - ..Default::default() - } - }, - }))), - }; - - let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); - - let expected = Some(( - bytecode_hash, - Bytecode::new_raw( - bytecode - .into_iter() - .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) - .collect::>() - .into(), - ), - )); - assert_eq!(expected, actual) - } - - #[test] - fn test_get_storage_at_does_not_panic_when_even_numbered_blocks_are_requested() { - // This test exists because era-test-node creates two L2 (virtual) blocks per transaction. - // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 - - let db = &RevmDatabaseForEra { - current_block: 1, - db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), - }; - - let actual = db - .get_storage_at( - H160::zero(), - U256::zero(), - Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( - zksync_basic_types::U64::from(2), - ))), - ) - .expect("failed getting storage"); - - assert_eq!(H256::zero(), actual) - } - - #[test] - #[should_panic( - expected = "Only fetching of the most recent L2 block 2 is supported - but queried for 1" - )] - fn test_get_storage_at_panics_when_odd_numbered_blocks_are_requested() { - // This test exists because era-test-node creates two L2 (virtual) blocks per transaction. - // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 - - let db = &RevmDatabaseForEra { - current_block: 1, - db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), - }; - - db.get_storage_at( - H160::zero(), - U256::zero(), - Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( - zksync_basic_types::U64::from(1), - ))), - ) - .unwrap(); - } -} +// #[cfg(test)] +// #[allow(clippy::box_default)] +// mod tests { +// use maplit::hashmap; +// use revm::primitives::AccountInfo; + +// use super::*; +// use crate::era_revm::testing::MockDatabase; + +// #[test] +// fn test_fetch_account_code_returns_hash_and_code_if_present_in_modified_keys_and_bytecodes() +// { let bytecode_hash = H256::repeat_byte(0x3); +// let bytecode = vec![U256::from(4)]; +// let account = H160::repeat_byte(0xa); +// let modified_keys = hashmap! { +// StorageKey::new( +// AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), +// address_to_h256(&account), +// ) => bytecode_hash, +// }; +// let bytecodes = hashmap! { +// h256_to_u256(bytecode_hash) => bytecode.clone(), +// }; +// let db = RevmDatabaseForEra { +// current_block: 0, +// db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), +// }; + +// let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + +// let expected = Some(( +// bytecode_hash, +// Bytecode::new_raw( +// bytecode +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into(), +// ), +// )); +// assert_eq!(expected, actual) +// } + +// #[test] +// fn test_fetch_account_code_returns_hash_and_code_if_not_in_modified_keys_but_in_bytecodes() { +// let bytecode_hash = H256::repeat_byte(0x3); +// let bytecode = vec![U256::from(4)]; +// let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of +// the 32-byte hash let modified_keys = Default::default(); +// let bytecodes = hashmap! { +// h256_to_u256(bytecode_hash) => bytecode.clone(), +// }; +// let db = RevmDatabaseForEra { +// current_block: 0, +// db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), +// }; + +// let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + +// let expected = Some(( +// bytecode_hash, +// Bytecode::new_raw( +// bytecode +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into(), +// ), +// )); +// assert_eq!(expected, actual) +// } + +// #[test] +// fn test_fetch_account_code_returns_hash_and_code_from_db_if_not_in_modified_keys_or_bytecodes() +// { +// let bytecode_hash = H256::repeat_byte(0x3); +// let bytecode = vec![U256::from(4)]; +// let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of +// the 32-byte hash let modified_keys = Default::default(); +// let bytecodes = Default::default(); +// let db = RevmDatabaseForEra { +// current_block: 0, +// db: Arc::new(Mutex::new(Box::new(MockDatabase { +// basic: hashmap! { +// h160_to_address(account) => AccountInfo { +// code_hash: bytecode_hash.to_fixed_bytes().into(), +// code: Some(Bytecode::new_raw( +// bytecode +// .clone() +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into())), +// ..Default::default() +// } +// }, +// }))), +// }; + +// let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + +// let expected = Some(( +// bytecode_hash, +// Bytecode::new_raw( +// bytecode +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into(), +// ), +// )); +// assert_eq!(expected, actual) +// } + +// #[test] +// fn test_fetch_account_code_returns_hash_and_code_from_db_if_address_in_modified_keys_but_not_in_bytecodes( +// ) { let bytecode_hash = H256::repeat_byte(0x3); let bytecode = vec![U256::from(4)]; let +// account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the +// 32-byte hash let modified_keys = hashmap! { StorageKey::new( +// AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), address_to_h256(&account), +// ) => bytecode_hash, +// }; +// let bytecodes = Default::default(); // nothing in bytecodes +// let db = RevmDatabaseForEra { +// current_block: 0, +// db: Arc::new(Mutex::new(Box::new(MockDatabase { +// basic: hashmap! { +// h160_to_address(account) => AccountInfo { +// code_hash: bytecode_hash.to_fixed_bytes().into(), +// code: Some(Bytecode::new_raw( +// bytecode +// .clone() +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into())), +// ..Default::default() +// } +// }, +// }))), +// }; + +// let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + +// let expected = Some(( +// bytecode_hash, +// Bytecode::new_raw( +// bytecode +// .into_iter() +// .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) +// .collect::>() +// .into(), +// ), +// )); +// assert_eq!(expected, actual) +// } + +// #[test] +// fn test_get_storage_at_does_not_panic_when_even_numbered_blocks_are_requested() { +// // This test exists because era-test-node creates two L2 (virtual) blocks per +// transaction. // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 + +// let db = &RevmDatabaseForEra { +// current_block: 1, +// db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), +// }; + +// let actual = db +// .get_storage_at( +// H160::zero(), +// U256::zero(), +// Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( +// zksync_basic_types::U64::from(2), +// ))), +// ) +// .expect("failed getting storage"); + +// assert_eq!(H256::zero(), actual) +// } + +// #[test] +// #[should_panic( +// expected = "Only fetching of the most recent L2 block 2 is supported - but queried for 1" +// )] +// fn test_get_storage_at_panics_when_odd_numbered_blocks_are_requested() { +// // This test exists because era-test-node creates two L2 (virtual) blocks per +// transaction. // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 + +// let db = &RevmDatabaseForEra { +// current_block: 1, +// db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), +// }; + +// db.get_storage_at( +// H160::zero(), +// U256::zero(), +// Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( +// zksync_basic_types::U64::from(1), +// ))), +// ) +// .unwrap(); +// } +// } diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index c887dd6e3..cf151d286 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -141,7 +141,10 @@ where INSP: ToTracerPointer>>, HistoryDisabled>, { let (num, ts) = (env.block.number.to::(), env.block.timestamp.to::()); - let era_db = RevmDatabaseForEra { db: Arc::new(Mutex::new(Box::new(db))), current_block: num }; + let era_db = RevmDatabaseForEra { + db: Arc::new(Mutex::new(Box::new(db))), + env: Arc::new(Mutex::new(env.clone())), + }; let nonces = era_db.get_nonce_for_address(address_to_h160(env.tx.caller)); @@ -166,7 +169,7 @@ where 31337 }; - let (l2_num, l2_ts) = (num * 2, ts * 2); + let (l2_num, l2_ts) = (num, ts * 2); let fork_details = ForkDetails { fork_source: era_db.clone(), l1_block: L1BatchNumber(num as u32), diff --git a/crates/evm/core/src/fork/backend.rs b/crates/evm/core/src/fork/backend.rs index a654d743f..cdf1c5aa2 100644 --- a/crates/evm/core/src/fork/backend.rs +++ b/crates/evm/core/src/fork/backend.rs @@ -2,19 +2,17 @@ use crate::{ backend::{DatabaseError, DatabaseResult}, fork::{cache::FlushJsonBlockCacheDB, BlockchainDb}, - utils::CallKind, }; use alloy_primitives::{keccak256, Address, Bytes, B256, U256}; use ethers_core::{ abi::ethereum_types::BigEndianHash, types::{Block, BlockId, NameOrAddress, Transaction}, }; -use ethers_providers::Middleware; use foundry_common::{ types::{ToAlloy, ToEthers}, NON_ARCHIVE_NODE_WARNING, }; -use foundry_compilers::artifacts::bytecode; + use futures::{ channel::mpsc::{channel, Receiver, Sender}, stream::Stream, @@ -195,6 +193,7 @@ where fn request_account_storage(&mut self, address: Address, idx: U256, listener: StorageSender) { match self.storage_requests.entry((address, idx)) { Entry::Occupied(mut entry) => { + println!("occupied {:?}, {:?}, {:?}", &address, &idx, &self.block_id); entry.get_mut().push(listener); } Entry::Vacant(entry) => { @@ -715,7 +714,7 @@ impl DatabaseRef for SharedBackend { fn storage_ref(&self, address: Address, index: U256) -> Result { trace!(target: "sharedbackend", "request storage {:?} at {:?}", address, index); - let res = match self.do_get_storage(address, index).map_err(|err| { + match self.do_get_storage(address, index).map_err(|err| { error!(target: "sharedbackend", %err, %address, %index, "Failed to send/recv `storage`"); if err.is_possibly_non_archive_node_error() { error!(target: "sharedbackend", "{NON_ARCHIVE_NODE_WARNING}"); @@ -724,8 +723,7 @@ impl DatabaseRef for SharedBackend { }) { Ok(val) => Ok(val), Err(err) => Err(err), - }; - res + } } fn block_hash_ref(&self, number: U256) -> Result { @@ -756,6 +754,7 @@ mod tests { fork::{BlockchainDbMeta, CreateFork, JsonBlockCacheDB}, opts::EvmOpts, }; + use ethers_providers::Middleware; use foundry_common::get_http_provider; use foundry_config::{Config, NamedChain}; use std::{collections::BTreeSet, path::PathBuf, sync::Arc}; From 46633446e3ea49d97c451c1a712248a6f906d3b8 Mon Sep 17 00:00:00 2001 From: Danil Date: Sat, 16 Dec 2023 13:02:16 +0100 Subject: [PATCH 08/22] Remove local era test-node Signed-off-by: Danil --- Cargo.lock | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 46d731d83..fe8cc3d94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3298,6 +3298,7 @@ dependencies = [ [[package]] name = "era_test_node" version = "0.1.0-alpha.12" +source = "git+https://github.com/matter-labs/era-test-node.git?branch=deniallugo-move-storage-view#fbe272ea3a1ae343b002a061237da631a692d8ee" dependencies = [ "anyhow", "bigdecimal", diff --git a/Cargo.toml b/Cargo.toml index f7deaf332..6df6776a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,7 +159,7 @@ alloy-rlp = "0.3.3" solang-parser = "=0.3.3" ## zksync -era_test_node = { path = "../era-test-node" } +era_test_node = { git="https://github.com/matter-labs/era-test-node.git" , branch = "deniallugo-move-storage-view"} zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } From 038b19a98a745a3fa262fd95f68b0290fd8d45b1 Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 12:41:11 +0100 Subject: [PATCH 09/22] Update to latest vm --- Cargo.lock | 88 +++++++++++--------- Cargo.toml | 12 +-- crates/era-cheatcodes/src/cheatcodes.rs | 9 +- crates/evm/core/src/backend/fuzz.rs | 2 +- crates/evm/core/src/backend/mod.rs | 6 +- crates/evm/core/src/era_revm/transactions.rs | 6 +- crates/evm/evm/src/inspectors/stack.rs | 4 +- 7 files changed, 67 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe8cc3d94..526128c0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3298,7 +3298,7 @@ dependencies = [ [[package]] name = "era_test_node" version = "0.1.0-alpha.12" -source = "git+https://github.com/matter-labs/era-test-node.git?branch=deniallugo-move-storage-view#fbe272ea3a1ae343b002a061237da631a692d8ee" +source = "git+https://github.com/matter-labs/era-test-node.git?branch=deniallugo-move-storage-view#d527b985a340ddcb80ef4008eccaf0b8e92255ae" dependencies = [ "anyhow", "bigdecimal", @@ -6998,7 +6998,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multivm" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "hex", @@ -7578,7 +7578,7 @@ dependencies = [ [[package]] name = "pairing_ce" version = "0.28.5" -source = "git+https://github.com/matter-labs/pairing.git?rev=f55393f#f55393fd366596eac792d78525d26e9c4d6ed1ca" +source = "git+https://github.com/matter-labs/pairing.git?rev=f55393fd366596eac792d78525d26e9c4d6ed1ca#f55393fd366596eac792d78525d26e9c4d6ed1ca" dependencies = [ "byteorder", "cfg-if 1.0.0", @@ -8383,7 +8383,7 @@ dependencies = [ [[package]] name = "prometheus_exporter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "metrics", @@ -11810,7 +11810,7 @@ dependencies = [ [[package]] name = "vlog" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "chrono", "sentry", @@ -12821,7 +12821,7 @@ dependencies = [ [[package]] name = "zksync_basic_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "serde", "serde_json", @@ -12831,7 +12831,7 @@ dependencies = [ [[package]] name = "zksync_circuit_breaker" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "async-trait", @@ -12854,7 +12854,7 @@ dependencies = [ [[package]] name = "zksync_commitment_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "zkevm_test_harness 1.4.0", "zksync_types", @@ -12864,7 +12864,7 @@ dependencies = [ [[package]] name = "zksync_concurrency" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "once_cell", @@ -12882,7 +12882,7 @@ dependencies = [ [[package]] name = "zksync_config" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "serde", @@ -12892,9 +12892,10 @@ dependencies = [ [[package]] name = "zksync_consensus_bft" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", + "async-trait", "once_cell", "rand 0.8.5", "thiserror", @@ -12912,14 +12913,14 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "blst", "ed25519-dalek", "ff_ce", "hex", - "pairing_ce 0.28.5 (git+https://github.com/matter-labs/pairing.git?rev=f55393f)", + "pairing_ce 0.28.5 (git+https://github.com/matter-labs/pairing.git?rev=f55393fd366596eac792d78525d26e9c4d6ed1ca)", "rand 0.4.6", "rand 0.8.5", "sha3 0.10.8", @@ -12930,7 +12931,7 @@ dependencies = [ [[package]] name = "zksync_consensus_executor" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "prost", @@ -12952,7 +12953,7 @@ dependencies = [ [[package]] name = "zksync_consensus_network" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "async-trait", @@ -12976,7 +12977,7 @@ dependencies = [ [[package]] name = "zksync_consensus_roles" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "bit-vec", @@ -12996,7 +12997,7 @@ dependencies = [ [[package]] name = "zksync_consensus_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "async-trait", @@ -13013,7 +13014,7 @@ dependencies = [ [[package]] name = "zksync_consensus_sync_blocks" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "thiserror", @@ -13028,7 +13029,7 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "thiserror", "zksync_concurrency", @@ -13037,7 +13038,7 @@ dependencies = [ [[package]] name = "zksync_contracts" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "envy", "ethabi 18.0.0", @@ -13051,7 +13052,7 @@ dependencies = [ [[package]] name = "zksync_core" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "actix-cors", "actix-rt", @@ -13073,6 +13074,7 @@ dependencies = [ "jsonrpc-http-server", "jsonrpc-pubsub", "jsonrpc-ws-server", + "lru", "metrics", "multivm", "num 0.3.1", @@ -13094,6 +13096,7 @@ dependencies = [ "zksync_commitment_utils", "zksync_concurrency", "zksync_config", + "zksync_consensus_bft", "zksync_consensus_executor", "zksync_consensus_roles", "zksync_consensus_storage", @@ -13122,7 +13125,7 @@ dependencies = [ [[package]] name = "zksync_crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "base64 0.13.1", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13137,7 +13140,7 @@ dependencies = [ [[package]] name = "zksync_dal" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "bigdecimal", @@ -13158,6 +13161,7 @@ dependencies = [ "url", "vise", "zksync_consensus_roles", + "zksync_consensus_storage", "zksync_contracts", "zksync_health_check", "zksync_protobuf", @@ -13170,7 +13174,7 @@ dependencies = [ [[package]] name = "zksync_eth_client" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "async-trait", @@ -13190,7 +13194,7 @@ dependencies = [ [[package]] name = "zksync_eth_signer" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "async-trait", "hex", @@ -13209,7 +13213,7 @@ dependencies = [ [[package]] name = "zksync_health_check" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "async-trait", "futures 0.3.29", @@ -13222,7 +13226,7 @@ dependencies = [ [[package]] name = "zksync_mempool" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "tracing", "zksync_types", @@ -13231,7 +13235,7 @@ dependencies = [ [[package]] name = "zksync_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "leb128", "once_cell", @@ -13248,7 +13252,7 @@ dependencies = [ [[package]] name = "zksync_mini_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "once_cell", "zksync_basic_types", @@ -13258,14 +13262,16 @@ dependencies = [ [[package]] name = "zksync_object_store" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "async-trait", "bincode", + "flate2", "google-cloud-auth", "google-cloud-storage", "http", + "serde_json", "tokio", "tracing", "vise", @@ -13276,7 +13282,7 @@ dependencies = [ [[package]] name = "zksync_protobuf" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "bit-vec", @@ -13294,7 +13300,7 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" version = "0.1.0" -source = "git+https://github.com/matter-labs/era-consensus.git?rev=da015d4c94b19962bc11622b6cc256e214256555#da015d4c94b19962bc11622b6cc256e214256555" +source = "git+https://github.com/matter-labs/era-consensus.git?rev=49b1a98f80d0e9f74fdceadece4283e745c71599#49b1a98f80d0e9f74fdceadece4283e745c71599" dependencies = [ "anyhow", "heck 0.4.1", @@ -13310,7 +13316,7 @@ dependencies = [ [[package]] name = "zksync_prover_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "async-trait", @@ -13330,7 +13336,7 @@ dependencies = [ [[package]] name = "zksync_queued_job_processor" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "async-trait", @@ -13343,7 +13349,7 @@ dependencies = [ [[package]] name = "zksync_state" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "itertools 0.10.5", @@ -13360,7 +13366,7 @@ dependencies = [ [[package]] name = "zksync_storage" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "num_cpus", "once_cell", @@ -13372,7 +13378,7 @@ dependencies = [ [[package]] name = "zksync_system_constants" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "bigdecimal", @@ -13390,7 +13396,7 @@ dependencies = [ [[package]] name = "zksync_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13424,7 +13430,7 @@ dependencies = [ [[package]] name = "zksync_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "bigdecimal", @@ -13446,7 +13452,7 @@ dependencies = [ [[package]] name = "zksync_verification_key_generator_and_server" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "anyhow", "bincode", @@ -13466,7 +13472,7 @@ dependencies = [ [[package]] name = "zksync_web3_decl" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=1e18d256be8eaaf4696b8432e6122aba57ae1af0#1e18d256be8eaaf4696b8432e6122aba57ae1af0" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=357957df341820a30521c9a9c8df7c805a6ba43e#357957df341820a30521c9a9c8df7c805a6ba43e" dependencies = [ "bigdecimal", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 6df6776a4..c88f70905 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,12 +160,12 @@ solang-parser = "=0.3.3" ## zksync era_test_node = { git="https://github.com/matter-labs/era-test-node.git" , branch = "deniallugo-move-storage-view"} -zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } -zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } -zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } -multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } -zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } -zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "1e18d256be8eaaf4696b8432e6122aba57ae1af0" } +zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } +zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } +multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } +zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "357957df341820a30521c9a9c8df7c805a6ba43e" } ## misc chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index ac3b586e3..f34befc55 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -14,10 +14,11 @@ use foundry_evm_core::{ }; use itertools::Itertools; use multivm::{ - interface::{dyn_tracers::vm_1_3_3::DynTracer, tracer::TracerExecutionStatus}, - vm_latest::{L1BatchEnv, SystemEnv}, - vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState}, - zk_evm_1_3_3::{ + interface::{dyn_tracers::vm_1_4_0::DynTracer, tracer::TracerExecutionStatus}, + vm_latest::{ + BootloaderState, HistoryMode, L1BatchEnv, SimpleMemory, SystemEnv, VmTracer, ZkSyncVmState, + }, + zk_evm_1_4_0::{ tracing::{AfterExecutionData, VmLocalStateData}, vm_state::PrimitiveValue, zkevm_opcode_defs::{ diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index e424cc0ce..dd91b6d2b 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -18,7 +18,7 @@ use zksync_types::{StorageKey, StorageValue}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; -use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; +use multivm::vm_latest::{HistoryDisabled, ToTracerPointer}; /// A wrapper around `Backend` that ensures only `revm::DatabaseRef` functions are called. /// diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index ef536688d..7c28c7746 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -22,8 +22,8 @@ use revm::{ inspectors::NoOpInspector, precompile::{Precompiles, SpecId}, primitives::{ - Account, AccountInfo, Bytecode, CreateScheme, EVMError, Env, HashMap as Map, - Log, ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, + Account, AccountInfo, Bytecode, CreateScheme, EVMError, Env, HashMap as Map, Log, + ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, }, Database, DatabaseCommit, Inspector, JournaledState, EVM, }; @@ -31,7 +31,7 @@ use std::collections::{HashMap, HashSet}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; -use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; +use multivm::vm_latest::{HistoryDisabled, ToTracerPointer}; use zksync_types::{StorageKey, StorageValue}; mod diagnostic; diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index cf151d286..961a621af 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -9,7 +9,7 @@ use era_test_node::{ use ethers_core::abi::ethabi::{self, ParamType}; use multivm::{ interface::VmExecutionResultAndLogs, - vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}, + vm_latest::{HistoryDisabled, ToTracerPointer}, }; use revm::primitives::{ Account, AccountInfo, Address, Bytes, EVMResult, Env, Eval, Halt, HashMap as rHashMap, @@ -355,8 +355,8 @@ where mod tests { use core::marker::PhantomData; use multivm::{ - interface::dyn_tracers::vm_1_3_3::DynTracer, - vm_refunds_enhancement::{HistoryMode, SimpleMemory, VmTracer}, + interface::dyn_tracers::vm_1_4_0::DynTracer, + vm_latest::{HistoryMode, SimpleMemory, VmTracer}, }; use zksync_state::WriteStorage; diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index aef3961f7..cee866ae6 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -575,7 +575,7 @@ use foundry_evm_core::era_revm::db::RevmDatabaseForEra; use era_cheatcodes::cheatcodes::CheatcodeTracer; use era_test_node::deps::storage_view::StorageView; -use multivm::vm_refunds_enhancement::{HistoryDisabled, ToTracerPointer}; +use multivm::vm_latest::{HistoryDisabled, ToTracerPointer}; impl ToTracerPointer>>, HistoryDisabled> @@ -583,7 +583,7 @@ impl { fn into_tracer_pointer( self, - ) -> multivm::vm_refunds_enhancement::TracerPointer< + ) -> multivm::vm_latest::TracerPointer< StorageView>>, HistoryDisabled, > { From 1845c4ea5b091e94866a7436eb78f3af0e98fc5a Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 15:09:42 +0100 Subject: [PATCH 10/22] Small follow ups Signed-off-by: Danil --- crates/anvil/src/eth/backend/db.rs | 1 - crates/anvil/src/eth/backend/mem/state.rs | 4 +--- crates/evm/core/src/backend/in_memory_db.rs | 1 - crates/evm/core/src/backend/mod.rs | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/anvil/src/eth/backend/db.rs b/crates/anvil/src/eth/backend/db.rs index 8d20e526b..a36d7953a 100644 --- a/crates/anvil/src/eth/backend/db.rs +++ b/crates/anvil/src/eth/backend/db.rs @@ -296,7 +296,6 @@ impl DatabaseRef for StateDb { } fn storage_ref(&self, address: B160, index: rU256) -> DatabaseResult { - println!("statedb"); self.0.storage_ref(address, index) } diff --git a/crates/anvil/src/eth/backend/mem/state.rs b/crates/anvil/src/eth/backend/mem/state.rs index bb56b71d7..bda955860 100644 --- a/crates/anvil/src/eth/backend/mem/state.rs +++ b/crates/anvil/src/eth/backend/mem/state.rs @@ -7,9 +7,7 @@ use ethers::{ types::H256, utils::{rlp, rlp::RlpStream}, }; -use foundry_common::{ - types::{ToAlloy, ToEthers}, -}; +use foundry_common::types::{ToAlloy, ToEthers}; use foundry_evm::{ backend::DatabaseError, hashbrown::HashMap as Map, diff --git a/crates/evm/core/src/backend/in_memory_db.rs b/crates/evm/core/src/backend/in_memory_db.rs index 2f8022eb0..6cb2c73ee 100644 --- a/crates/evm/core/src/backend/in_memory_db.rs +++ b/crates/evm/core/src/backend/in_memory_db.rs @@ -38,7 +38,6 @@ impl DatabaseRef for MemDb { } fn storage_ref(&self, address: Address, index: U256) -> Result { - println!("memdb"); DatabaseRef::storage_ref(&self.inner, address, index) } diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index 5b0a6f0eb..28d259715 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -673,7 +673,7 @@ impl Backend { ) { if let Some((_, fork_idx)) = self.active_fork_ids.as_ref() { let active = self.inner.get_fork(*fork_idx); - merge_account_data(accounts, &active.db, active_journaled_state, target_fork); + merge_account_data(accounts, &active.db, active_journaled_state, target_fork) } else { merge_account_data(accounts, &self.mem_db, active_journaled_state, target_fork) } From c0b3a726436d0c28e5f6ab2cf35b3bd90f3f5ea6 Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 15:19:51 +0100 Subject: [PATCH 11/22] Fix test Signed-off-by: Danil --- .../era-cheatcodes/tests/src/cheatcodes/Fork.t.sol | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 96b47fb2d..1c596a261 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -8,16 +8,17 @@ import {Constants} from "./Constants.sol"; contract ForkTest is Test { /// USDC TOKEN address constant TOKEN_ADDRESS = 0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4; + uint256 constant TOKEN_DECIMALS = 6; + uint256 constant FORK_BLOCK = 19579636; function setUp() public { /// USDC TOKEN doesn't exists locally (bool success, bytes memory data) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") ); uint256 decimals_before = uint256(bytes32(data)); - console.log("block", block.number); - console.log("decimals_before:", decimals_before); + require(block.number < 1000, "Local node doesn't have blocks above 1000"); (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", 19579636) + abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", FORK_BLOCK) ); require(decimals_before == 0, "Contract exists locally"); require(success1, "fork failed"); @@ -29,9 +30,9 @@ contract ForkTest is Test { abi.encodeWithSignature("decimals()") ); uint256 decimals_after = uint256(bytes32(data2)); - console.log("block", block.number); - console.log("decimals_after:", decimals_after); - require(decimals_after == 6, "Contract dosent exists in fork"); + console.log("decimals_after", decimals_after); + require(decimals_after == TOKEN_DECIMALS, "Contract dosent exists in fork"); + require(block.number == FORK_BLOCK + 1, "ENV for blocks is not set correctly"); } } From 6c87893cf9b022873a492fd9bdfd38c373a6154a Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 16:04:15 +0100 Subject: [PATCH 12/22] add create and select blocks Signed-off-by: Danil --- crates/era-cheatcodes/src/cheatcodes.rs | 106 +++++++++++++++++- .../tests/src/cheatcodes/Fork.t.sol | 24 ++++ 2 files changed, 124 insertions(+), 6 deletions(-) diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 9c4081a89..1bf18df09 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -29,7 +29,7 @@ use multivm::{ }, }; use revm::{ - primitives::{BlockEnv, CfgEnv, Env, SpecId}, + primitives::{BlockEnv, CfgEnv, Env, SpecId, U256 as rU256}, JournaledState, }; use serde::Serialize; @@ -118,7 +118,9 @@ impl LogEntry { enum FinishCycleOneTimeActions { StorageWrite { key: StorageKey, read_value: H256, write_value: H256 }, StoreFactoryDep { hash: U256, bytecode: Vec }, - CreateFork { url_or_alias: String, block_number: u64 }, + CreateSelectFork { url_or_alias: String, block_number: Option }, + CreateFork { url_or_alias: String, block_number: Option }, + SelectFork { fork_id: U256 }, } #[derive(Debug, Default, Clone)] @@ -251,7 +253,7 @@ impl VmTracer, H> for CheatcodeT FinishCycleOneTimeActions::StoreFactoryDep { hash, bytecode } => state .decommittment_processor .populate(vec![(hash, bytecode)], Timestamp(state.local_state.timestamp)), - FinishCycleOneTimeActions::CreateFork { url_or_alias, block_number } => { + FinishCycleOneTimeActions::CreateSelectFork { url_or_alias, block_number } => { let modified_storage: HashMap = storage .borrow_mut() .modified_storage_keys() @@ -284,7 +286,7 @@ impl VmTracer, H> for CheatcodeT create_fork_request( era_env, self.config.clone(), - Some(block_number), + block_number, &url_or_alias, ), &mut env, @@ -299,6 +301,65 @@ impl VmTracer, H> for CheatcodeT self.return_data = Some(vec![fork_id.unwrap().to_u256()]); } + FinishCycleOneTimeActions::CreateFork { url_or_alias, block_number } => { + let handle: &ForkStorage> = + &storage.borrow_mut().storage_handle; + let era_db = + handle.inner.write().unwrap().fork.as_ref().unwrap().fork_source.clone(); + + let mut db = era_db.db.lock().unwrap(); + let era_env = self.env.get().unwrap(); + let fork_id = db.create_fork(create_fork_request( + era_env, + self.config.clone(), + block_number, + &url_or_alias, + )); + self.return_data = Some(vec![fork_id.unwrap().to_u256()]); + } + FinishCycleOneTimeActions::SelectFork { fork_id } => { + let modified_storage: HashMap = storage + .borrow_mut() + .modified_storage_keys() + .clone() + .into_iter() + .filter(|(key, _)| key.address() != &zksync_types::SYSTEM_CONTEXT_ADDRESS) + .collect(); + { + storage.borrow_mut().clean_cache(); + let handle: &ForkStorage> = + &storage.borrow_mut().storage_handle; + let mut fork_storage = handle.inner.write().unwrap(); + fork_storage.value_read_cache.clear(); + let era_db = fork_storage.fork.as_ref().unwrap().fork_source.clone(); + let bytecodes = bootloader_state + .get_last_tx_compressed_bytecodes() + .iter() + .map(|b| bytecode_to_factory_dep(b.original.clone())) + .collect(); + + let mut journaled_state = JournaledState::new(SpecId::LATEST, vec![]); + let state = + storage_to_state(modified_storage.clone(), bytecodes, era_db.clone()); + *journaled_state.state() = state; + + let mut db = era_db.db.lock().unwrap(); + let era_env = self.env.get().unwrap(); + let mut env = into_revm_env(era_env); + db.select_fork( + rU256::from(fork_id.as_u128()), + &mut env, + &mut journaled_state, + ) + .unwrap(); + drop(db); + let mut db_env = era_db.env.lock().unwrap(); + *db_env = env; + } + storage.borrow_mut().modified_storage_keys = modified_storage; + + self.return_data = Some(vec![fork_id]); + } } } @@ -748,15 +809,48 @@ impl CheatcodeTracer { &mut storage, ); } - createSelectFork_1(createSelectFork_1Call { urlOrAlias, blockNumber }) => { + createSelectFork_0(createSelectFork_0Call { urlOrAlias }) => { tracing::info!("👷 Creating and selecting fork {}", urlOrAlias,); + self.one_time_actions.push(FinishCycleOneTimeActions::CreateSelectFork { + url_or_alias: urlOrAlias, + block_number: None, + }); + } + createSelectFork_1(createSelectFork_1Call { urlOrAlias, blockNumber }) => { + let block_number = blockNumber.to_u256().as_u64(); + tracing::info!( + "👷 Creating and selecting fork {} for block number {}", + urlOrAlias, + block_number + ); + self.one_time_actions.push(FinishCycleOneTimeActions::CreateSelectFork { + url_or_alias: urlOrAlias, + block_number: Some(block_number), + }); + } + createFork_0(createFork_0Call { urlOrAlias }) => { + tracing::info!("👷 Creating fork {}", urlOrAlias,); + + self.one_time_actions.push(FinishCycleOneTimeActions::CreateFork { + url_or_alias: urlOrAlias, + block_number: None, + }); + } + createFork_1(createFork_1Call { urlOrAlias, blockNumber }) => { let block_number = blockNumber.to_u256().as_u64(); + tracing::info!("👷 Creating fork {} for block number {}", urlOrAlias, block_number); self.one_time_actions.push(FinishCycleOneTimeActions::CreateFork { url_or_alias: urlOrAlias, - block_number, + block_number: Some(block_number), }); } + selectFork(selectForkCall { forkId }) => { + tracing::info!("👷 Selecting fork {}", forkId); + + self.one_time_actions + .push(FinishCycleOneTimeActions::SelectFork { fork_id: forkId.to_u256() }); + } writeFile(writeFileCall { path, data }) => { tracing::info!("👷 Writing data to file in path {}", path); if fs::write(path, data).is_err() { diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index 1c596a261..a05240cdf 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -35,4 +35,28 @@ contract ForkTest is Test { require(block.number == FORK_BLOCK + 1, "ENV for blocks is not set correctly"); } + + function testCreateSelectFork() public{ + (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("createFork(string,uint256)", "mainnet", FORK_BLOCK + 100) + ); + require(success, "fork failed"); + + uint256 forkId = uint256(bytes32(data)); + (bool success1, bytes memory data1) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("selectFork(uint256)", forkId) + ); + require(success1, "select fork failed"); + + + /// After createSelect fork the decimals should exist + (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + abi.encodeWithSignature("decimals()") + ); + uint256 decimals_after = uint256(bytes32(data2)); + console.log("decimals_after", decimals_after); + console.log("block ", block.number); + require(decimals_after == TOKEN_DECIMALS, "Contract dosent exists in fork"); + require(block.number == FORK_BLOCK + 100, "ENV for blocks is not set correctly"); + } } From dcc8ff96364085ff64aff3d82aab60aee058fe05 Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 16:08:46 +0100 Subject: [PATCH 13/22] Remove cheatcode tests Signed-off-by: Danil --- .../tests/src/cheatcodes/Addr.t.sol | 20 +++ .../tests/src/cheatcodes/Deal.t.sol | 30 ++++ .../tests/src/cheatcodes/Etch.t.sol | 28 ++++ .../tests/src/cheatcodes/GetNonce.t.sol | 34 ++++ .../tests/src/cheatcodes/Load.t.sol | 49 ++++++ .../tests/src/cheatcodes/Roll.t.sol | 33 ++++ .../tests/src/cheatcodes/SetNonce.t.sol | 22 +++ .../tests/src/cheatcodes/StartPrank.t.sol | 146 ++++++++++++++++++ .../tests/src/cheatcodes/Store.t.sol | 37 +++++ .../tests/src/cheatcodes/Warp.t.sol | 31 ++++ 10 files changed, 430 insertions(+) create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol new file mode 100644 index 000000000..e6c0418d7 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract AddrTest is Test { + function testAddr() public { + uint256 pk = 77814517325470205911140941194401928579557062014761831930645393041380819009408; + address expected = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266; + + (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("addr(uint256)", pk) + ); + require(success, "addr failed"); + address addr = abi.decode(data, (address)); + assertEq(addr, expected, "expected address did not match"); + console.log("failed?", failed()); + } +} \ No newline at end of file diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol new file mode 100644 index 000000000..0b83e3218 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeDealTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + uint256 constant NEW_BALANCE = 10; + + function testDeal() public { + uint256 balanceBefore = address(TEST_ADDRESS).balance; + console.log("balance before:", balanceBefore); + + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "deal(address,uint256)", + TEST_ADDRESS, + NEW_BALANCE + ) + ); + uint256 balanceAfter = address(TEST_ADDRESS).balance; + console.log("balance after :", balanceAfter); + + require(balanceAfter == NEW_BALANCE, "balance mismatch"); + require(balanceAfter != balanceBefore, "balance unchanged"); + require(success, "deal failed"); + console.log("failed?", failed()); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol new file mode 100644 index 000000000..199e2118a --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeEtchTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + bytes constant GREETER_CODE = + hex"00050000000000020000000003010019000000600330027000000060033001970000000102200190000000950000c13d000000040230008c000000e00000413d000000000201043b0000006702200197000000680220009c000000e00000c13d0000000002000416000000000202004b000000e00000c13d000000040230008a000000200220008c000000e00000413d0000000402100370000000000502043b000000640250009c000000e00000213d00000023025000390000006904000041000000000632004b000000000600001900000000060480190000006902200197000000000702004b0000000004008019000000690220009c00000000020600190000000002046019000000000202004b000000e00000c13d0000000406500039000000000261034f000000000402043b000000640240009c0000009d0000213d0000001f07400039000000200200008a000000000727016f000000bf07700039000000000727016f0000006a087000410000006b0880009c0000009d0000413d000000400070043f000000800040043f00000000054500190000002405500039000000000335004b000000e00000213d0000002003600039000000000131034f0000001f0340018f0000000505400272000000440000613d00000000060000190000000507600210000000000871034f000000000808043b000000a00770003900000000008704350000000106600039000000000756004b0000003c0000413d000000000603004b000000530000613d0000000505500210000000000151034f0000000303300210000000a005500039000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f0000000000150435000000a0014000390000000000010435000000800100043d000000640310009c0000009d0000213d000000000400041a000000010340019000000001034002700000007f0330618f0000001f0530008c00000000050000190000000105002039000000000454013f0000000104400190000000fc0000c13d000000200430008c000000740000413d0000001f0410003900000005044002700000006c044000410000006c05000041000000200610008c000000000405401900000000000004350000001f0330003900000005033002700000006c03300041000000000534004b000000740000813d000000000004041b0000000104400039000000000534004b000000700000413d0000001f0310008c000001000000a13d0000000003210170000000a0040000390000006c020000410000000000000435000000880000613d0000006c0200004100000020060000390000000004000019000000000506001900000080065000390000000006060433000000000062041b000000200650003900000001022000390000002004400039000000000734004b0000007e0000413d000000a004500039000000000313004b000000920000813d0000000303100210000000f80330018f000000010500008a000000000335022f000000000353013f0000000004040433000000000334016f000000000032041b000000010200003900000001031002100000010a0000013d0000008002000039000000400020043f0000000002000416000000000202004b000000e00000c13d0000006102300041000000620220009c000000a30000213d0000006d0100004100000000001004350000004101000039000000040010043f0000006e010000410000017b000104300000009f023000390000006302200197000000400020043f0000001f0230018f0000000504300272000000b20000613d00000000050000190000000506500210000000000761034f000000000707043b000000800660003900000000007604350000000105500039000000000645004b000000aa0000413d000000000502004b000000c10000613d0000000504400210000000000141034f00000003022002100000008004400039000000000504043300000000052501cf000000000525022f000000000101043b0000010002200089000000000121022f00000000012101cf000000000151019f0000000000140435000000200130008c000000e00000413d000000800400043d000000640140009c000000e00000213d00000080033000390000009f01400039000000000131004b000000e00000813d00000080024000390000000001020433000000640510009c0000009d0000213d0000003f05100039000000200900008a000000000595016f000000400800043d0000000005580019000000000685004b00000000060000190000000106004039000000640750009c0000009d0000213d00000001066001900000009d0000c13d000000400050043f00000000061804360000000004140019000000a004400039000000000334004b000000e20000a13d00000000010000190000017b00010430000000000301004b000000ec0000613d000000000300001900000000046300190000002003300039000000000523001900000000050504330000000000540435000000000413004b000000e50000413d000000000116001900000000000104350000000004080433000000640140009c0000009d0000213d000000000100041a000000010210019000000001011002700000007f0310018f000000000301c0190000001f0130008c00000000010000190000000101002039000000010110018f000000000112004b0000010e0000613d0000006d0100004100000000001004350000002201000039000000a00000013d000000000201004b0000000002000019000001040000613d000000a00200043d0000000303100210000000010400008a000000000334022f000000000343013f000000000332016f0000000102100210000000000123019f000000000010041b00000000010000190000017a0001042e000000200130008c000001340000413d000100000003001d000300000004001d000000000000043500000060010000410000000002000414000000600320009c0000000001024019000000c00110021000000065011001c70000801002000039000500000008001d000400000009001d000200000006001d017901740000040f0000000206000029000000040900002900000005080000290000000102200190000000e00000613d00000003040000290000001f024000390000000502200270000000200340008c0000000002004019000000000301043b00000001010000290000001f01100039000000050110027000000000011300190000000002230019000000000312004b000001340000813d000000000002041b0000000102200039000000000312004b000001300000413d0000001f0140008c000001630000a13d000300000004001d000000000000043500000060010000410000000002000414000000600320009c0000000001024019000000c00110021000000065011001c70000801002000039000500000008001d000400000009001d017901740000040f000000040300002900000005060000290000000102200190000000e00000613d000000030700002900000000033701700000002002000039000000000101043b000001550000613d0000002002000039000000000400001900000000056200190000000005050433000000000051041b000000200220003900000001011000390000002004400039000000000534004b0000014d0000413d000000000373004b000001600000813d0000000303700210000000f80330018f000000010400008a000000000334022f000000000343013f00000000026200190000000002020433000000000232016f000000000021041b000000010100003900000001027002100000016d0000013d000000000104004b0000000001000019000001670000613d00000000010604330000000302400210000000010300008a000000000223022f000000000232013f000000000221016f0000000101400210000000000112019f000000000010041b00000020010000390000010000100443000001200000044300000066010000410000017a0001042e00000177002104230000000102000039000000000001042d0000000002000019000000000001042d00000179000004320000017a0001042e0000017b00010430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009fffffffffffffffffffffffffffffffffffffffffffffffff000000000000007f00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff02000000000000000000000000000000000000200000000000000000000000000000000200000000000000000000000000000040000001000000000000000000ffffffff00000000000000000000000000000000000000000000000000000000a4136862000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000080290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5634e487b71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051358bfd296e885430dddecb908ce82d20e6832374027da7514aebac3689d51f"; + + function testEtch() public { + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "etch(address,bytes)", + TEST_ADDRESS, + GREETER_CODE + ) + ); + require(success, "etch failed"); + + (success, ) = TEST_ADDRESS.call( + abi.encodeWithSignature("setGreeting(string)", "hello world") + ); + require(success, "setGreeting failed"); + console.log("failed?", failed()); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol new file mode 100644 index 000000000..12c0f9f10 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeSetNonceTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + uint256 constant NEW_NONCE = uint256(123456); + + function testSetNonce() public { + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "setNonce(address,uint64)", + TEST_ADDRESS, + NEW_NONCE + ) + ); + require(success, "setNonce failed"); + console.log("failed?", failed()); + + //test getNonce + (bool success2, bytes memory data2) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("getNonce(address)", TEST_ADDRESS) + ); + require(success2, "getNonce failed"); + uint256 nonce = abi.decode(data2, (uint256)); + console.log("nonce: 0x", nonce); + require(nonce == NEW_NONCE, "nonce was not changed"); + console.log("failed?", failed()); + } +} + + diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol new file mode 100644 index 000000000..a99a123d9 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Load.t.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract Storage { + uint256 slot0 = 10; +} + +contract LoadTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + uint256 slot0 = 20; + Storage store; + + function setUp() public { + store = new Storage(); + } + + function testLoadOwnStorage() public { + uint256 slot; + assembly { + slot := slot0.slot + } + (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "load(address,bytes32)", + address(this), + bytes32(slot) + ) + ); + require(success, "load failed"); + uint256 val = abi.decode(data, (uint256)); + assertEq(val, 20, "load failed"); + } + + function testLoadOtherStorage() public { + (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "load(address,bytes32)", + address(store), + bytes32(0) + ) + ); + require(success, "load failed"); + uint256 val = abi.decode(data, (uint256)); + assertEq(val, 10, "load failed"); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol new file mode 100644 index 000000000..9a706cc93 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeRollTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + uint256 constant NEW_BLOCK_NUMBER = 10; + + function testRoll() public { + uint256 initialBlockNumber = block.number; + console.log("blockNumber before:", initialBlockNumber); + + require( + NEW_BLOCK_NUMBER != initialBlockNumber, + "block number must be different than current block number" + ); + + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("roll(uint256)", NEW_BLOCK_NUMBER) + ); + require(success, "roll failed"); + uint256 finalBlockNumber = block.number; + console.log("blockNumber after :", finalBlockNumber); + + require( + finalBlockNumber == NEW_BLOCK_NUMBER, + "block number was not changed" + ); + console.log("failed?", failed()); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol new file mode 100644 index 000000000..29a99ee0e --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeSetNonceTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + uint256 constant NEW_NONCE = uint256(123456); + + function testSetNonce() public { + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "setNonce(address,uint64)", + TEST_ADDRESS, + NEW_NONCE + ) + ); + require(success, "setNonce failed"); + console.log("failed?", failed()); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol new file mode 100644 index 000000000..3b5a73b82 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeStartPrankTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + address constant TEST_ORIGIN = 0xdEBe90b7BFD87Af696B1966082F6515a6E72F3d8; + + function testStartPrank() public { + address original_msg_sender = msg.sender; + address original_tx_origin = tx.origin; + + PrankVictim victim = new PrankVictim(); + + // Verify that the victim is set up correctly + victim.assertCallerAndOrigin( + address(this), + "startPrank failed: victim.assertCallerAndOrigin failed", + original_tx_origin, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + // Start prank without tx.origin + (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("startPrank(address)", TEST_ADDRESS) + ); + require(success1, "startPrank failed"); + + require( + msg.sender == TEST_ADDRESS, + "startPrank failed: msg.sender unchanged" + ); + require( + tx.origin == original_tx_origin, + "startPrank failed tx.origin changed" + ); + victim.assertCallerAndOrigin( + TEST_ADDRESS, + "startPrank failed: victim.assertCallerAndOrigin failed", + original_tx_origin, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + // Stop prank + (bool success2, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("stopPrank()") + ); + require(success2, "stopPrank failed"); + + require( + msg.sender == original_msg_sender, + "stopPrank failed: msg.sender didn't return to original" + ); + require( + tx.origin == original_tx_origin, + "stopPrank failed tx.origin changed" + ); + victim.assertCallerAndOrigin( + address(this), + "startPrank failed: victim.assertCallerAndOrigin failed", + original_tx_origin, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + console.log("failed?", failed()); + } + + function testStartPrankWithOrigin() external { + address original_msg_sender = msg.sender; + address original_tx_origin = tx.origin; + + PrankVictim victim = new PrankVictim(); + + // Verify that the victim is set up correctly + victim.assertCallerAndOrigin( + address(this), + "startPrank failed: victim.assertCallerAndOrigin failed", + original_tx_origin, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + // Start prank with tx.origin + (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "startPrank(address,address)", + TEST_ADDRESS, + TEST_ORIGIN + ) + ); + require(success1, "startPrank failed"); + + require( + msg.sender == TEST_ADDRESS, + "startPrank failed: msg.sender unchanged" + ); + require( + tx.origin == TEST_ORIGIN, + "startPrank failed: tx.origin unchanged" + ); + victim.assertCallerAndOrigin( + TEST_ADDRESS, + "startPrank failed: victim.assertCallerAndOrigin failed", + TEST_ORIGIN, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + // Stop prank + (bool success2, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("stopPrank()") + ); + require(success2, "stopPrank failed"); + + require( + msg.sender == original_msg_sender, + "stopPrank failed: msg.sender didn't return to original" + ); + require( + tx.origin == original_tx_origin, + "stopPrank failed: tx.origin didn't return to original" + ); + victim.assertCallerAndOrigin( + address(this), + "startPrank failed: victim.assertCallerAndOrigin failed", + original_tx_origin, + "startPrank failed: victim.assertCallerAndOrigin failed" + ); + + console.log("failed?", failed()); + } +} + +contract PrankVictim { + function assertCallerAndOrigin( + address expectedSender, + string memory senderMessage, + address expectedOrigin, + string memory originMessage + ) public view { + console.log("msg.sender", msg.sender); + console.log("tx.origin", tx.origin); + require(msg.sender == expectedSender, senderMessage); + require(tx.origin == expectedOrigin, originMessage); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol new file mode 100644 index 000000000..7e22a7e41 --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract Storage { + uint256 public slot0 = 10; + uint256 public slot1 = 20; +} + +contract StoreTest is Test { + address constant TEST_ADDRESS = 0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a; + Storage store; + + function setUp() public { + store = new Storage(); + } + + function testStore() public { + assertEq(store.slot0(), 10, "initial value for slot 0 is incorrect"); + assertEq(store.slot1(), 20, "initial value for slot 1 is incorrect"); + + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "store(address,bytes32,bytes32)", + address(store), + bytes32(0), + bytes32(uint256(1)) + ) + ); + require(success, "store failed"); + assertEq(store.slot0(), 1, "store failed"); + assertEq(store.slot1(), 20, "store failed"); + console.log("failed?", failed()); + } +} diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol new file mode 100644 index 000000000..336dec06c --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; + +contract CheatcodeWarpTest is Test { + uint256 constant NEW_BLOCK_TIMESTAMP = uint256(10000); + + function testWarp() public { + uint256 initialTimestamp = block.timestamp; + console.log("timestamp before:", initialTimestamp); + require( + NEW_BLOCK_TIMESTAMP != initialTimestamp, + "timestamp must be different than current block timestamp" + ); + + (bool success, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("warp(uint256)", NEW_BLOCK_TIMESTAMP) + ); + require(success, "warp failed"); + + uint256 finalTimestamp = block.timestamp; + console.log("timestamp after:", finalTimestamp); + require( + finalTimestamp == NEW_BLOCK_TIMESTAMP, + "timestamp was not changed" + ); + console.log("failed?", failed()); + } +} From 3ded7e42d3b9b10b317afd96b247b23f4ee1dd21 Mon Sep 17 00:00:00 2001 From: Danil Date: Mon, 18 Dec 2023 16:09:07 +0100 Subject: [PATCH 14/22] Remove release tests Signed-off-by: Danil --- crates/era-cheatcodes/tests/test.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/era-cheatcodes/tests/test.sh b/crates/era-cheatcodes/tests/test.sh index 67e07a2a8..86e6e76ca 100755 --- a/crates/era-cheatcodes/tests/test.sh +++ b/crates/era-cheatcodes/tests/test.sh @@ -6,7 +6,7 @@ set -o pipefail -e REPO_ROOT="../../.." SOLC_VERSION=${SOLC_VERSION:-"v0.8.20"} SOLC="solc-${SOLC_VERSION}" -BINARY_PATH="${REPO_ROOT}/target/debug/zkforge" +BINARY_PATH="${REPO_ROOT}/target/release/zkforge" function download_solc() { case "$(uname -s)" in @@ -35,7 +35,7 @@ function wait_for_build() { # See https://unix.stackexchange.com/questions/312631/bash-script-with-set-e-doesnt-stop-on-command function build_zkforge() { echo "Building ${1}..." - cargo build --manifest-path="${1}/Cargo.toml" + cargo build --release --manifest-path="${1}/Cargo.toml" wait_for_build 30 } @@ -58,6 +58,4 @@ command -v git &>/dev/null || { build_zkforge "${REPO_ROOT}" echo "Running tests..." -RUST_LOG=sharedbackend=trace,era_test_node=debug,multivm=debug,foundry_evm=trace,evm=trace,foundry_common=trace,foundry_evm_core=trace,zkforge=trace "${BINARY_PATH}" test --use "./${SOLC}" -# RUST_LOG=era_test_node=debug,zkforge=trace "${BINARY_PATH}" test --use "./${SOLC}" -# RUST_LOG=debug "${BINARY_PATH}" test --use "./${SOLC}" +RUST_LOG=debug "${BINARY_PATH}" test --use "./${SOLC}" From b8a718d7afaa615f0aea5114b9ec99ee31629954 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 22 Dec 2023 15:44:37 +0100 Subject: [PATCH 15/22] decouple env, modified keys, readd tests, make fuzz work --- Cargo.lock | 3 +- Cargo.toml | 3 +- crates/era-cheatcodes/src/cheatcodes.rs | 17 +- crates/evm/core/Cargo.toml | 3 +- crates/evm/core/src/backend/fuzz.rs | 8 +- crates/evm/core/src/backend/mod.rs | 14 +- crates/evm/core/src/era_revm/db.rs | 259 ++++++++++++++++++- crates/evm/core/src/era_revm/transactions.rs | 52 ++-- crates/evm/evm/src/inspectors/stack.rs | 3 +- smoke-test/src/Counter.sol | 4 +- 10 files changed, 291 insertions(+), 75 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 860404187..574757069 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3298,7 +3298,7 @@ dependencies = [ [[package]] name = "era_test_node" version = "0.1.0-alpha.12" -source = "git+https://github.com/matter-labs/era-test-node.git?branch=deniallugo-move-storage-view#f06f6729990ba707fb95caafaed45a0a280bec53" +source = "git+https://github.com/Moonsong-Labs/era-test-node.git?branch=nish-deniallugo-move-storage-view#2934a9c0f60fac4588f235986865136ccea7431e" dependencies = [ "anyhow", "bigdecimal", @@ -4430,6 +4430,7 @@ dependencies = [ "foundry-macros", "futures 0.3.29", "itertools 0.11.0", + "maplit", "multivm", "once_cell", "parking_lot 0.12.1", diff --git a/Cargo.toml b/Cargo.toml index c283e5c4b..3c6e4931b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,7 +159,7 @@ alloy-rlp = "0.3.3" solang-parser = "=0.3.3" ## zksync -era_test_node = { git="https://github.com/matter-labs/era-test-node.git" , branch = "deniallugo-move-storage-view"} +era_test_node = { git="https://github.com/Moonsong-Labs/era-test-node.git" , branch = "nish-deniallugo-move-storage-view"} zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "3c669e7b0caf6515ad865f4cba5ea6fb36c33811" } zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "3c669e7b0caf6515ad865f4cba5ea6fb36c33811" } zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "3c669e7b0caf6515ad865f4cba5ea6fb36c33811" } @@ -175,6 +175,7 @@ eyre = "0.6" hex = { package = "const-hex", version = "1.6", features = ["hex"] } itertools = "0.11" jsonpath_lib = "0.3" +maplit = "1" pretty_assertions = "1.4" protobuf = "=3.2.0" rand = "0.8" diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 1bf18df09..d38fd815a 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -275,14 +275,13 @@ impl VmTracer, H> for CheatcodeT .collect(); let mut journaled_state = JournaledState::new(SpecId::LATEST, vec![]); - let state = - storage_to_state(modified_storage.clone(), bytecodes, era_db.clone()); + let state = storage_to_state(&era_db, &modified_storage, bytecodes); *journaled_state.state() = state; let mut db = era_db.db.lock().unwrap(); let era_env = self.env.get().unwrap(); let mut env = into_revm_env(era_env); - let res = db.create_select_fork( + db.create_select_fork( create_fork_request( era_env, self.config.clone(), @@ -291,11 +290,7 @@ impl VmTracer, H> for CheatcodeT ), &mut env, &mut journaled_state, - ); - drop(db); - let mut db_env = era_db.env.lock().unwrap(); - *db_env = env; - res + ) }; storage.borrow_mut().modified_storage_keys = modified_storage; @@ -339,8 +334,7 @@ impl VmTracer, H> for CheatcodeT .collect(); let mut journaled_state = JournaledState::new(SpecId::LATEST, vec![]); - let state = - storage_to_state(modified_storage.clone(), bytecodes, era_db.clone()); + let state = storage_to_state(&era_db, &modified_storage, bytecodes); *journaled_state.state() = state; let mut db = era_db.db.lock().unwrap(); @@ -352,9 +346,6 @@ impl VmTracer, H> for CheatcodeT &mut journaled_state, ) .unwrap(); - drop(db); - let mut db_env = era_db.env.lock().unwrap(); - *db_env = env; } storage.borrow_mut().modified_storage_keys = modified_storage; diff --git a/crates/evm/core/Cargo.toml b/crates/evm/core/Cargo.toml index 6a0faf214..fb8f93e14 100644 --- a/crates/evm/core/Cargo.toml +++ b/crates/evm/core/Cargo.toml @@ -58,4 +58,5 @@ auto_impl = "1" async-trait = "0.1" [dev-dependencies] -zksync_state.workspace = true \ No newline at end of file +zksync_state.workspace = true +maplit.workspace = true \ No newline at end of file diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index dd91b6d2b..c7db98b42 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -14,7 +14,6 @@ use revm::{ Database, Inspector, JournaledState, }; use std::{borrow::Cow, collections::HashMap}; -use zksync_types::{StorageKey, StorageValue}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; @@ -66,9 +65,8 @@ impl<'a> FuzzBackendWrapper<'a> { { self.is_initialized = false; - let keys = self.backend.modified_storage_keys.clone(); let result: Result> = - crate::era_revm::transactions::run_era_transaction(env, self, inspector, keys); + crate::era_revm::transactions::run_era_transaction(env, self, inspector); Ok(result.unwrap()) } @@ -223,10 +221,6 @@ impl<'a> DatabaseExt for FuzzBackendWrapper<'a> { fn has_cheatcode_access(&self, account: Address) -> bool { self.backend.has_cheatcode_access(account) } - - fn set_modified_keys(&mut self, keys: HashMap) { - self.backend.to_mut().set_modified_keys(keys) - } } impl<'a> DatabaseRef for FuzzBackendWrapper<'a> { diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index 28d259715..52bbe77ae 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -32,7 +32,6 @@ use std::collections::{HashMap, HashSet}; use crate::era_revm::db::RevmDatabaseForEra; use era_test_node::{deps::storage_view::StorageView, fork::ForkStorage}; use multivm::vm_latest::{HistoryDisabled, ToTracerPointer}; -use zksync_types::{StorageKey, StorageValue}; mod diagnostic; pub use diagnostic::RevertDiagnostic; @@ -314,8 +313,6 @@ pub trait DatabaseExt: Database { } Ok(()) } - - fn set_modified_keys(&mut self, _keys: HashMap) {} } /// Provides the underlying `revm::Database` implementation. @@ -399,8 +396,6 @@ pub struct Backend { active_fork_ids: Option<(LocalForkId, ForkLookupIndex)>, /// holds additional Backend data inner: BackendInner, - /// Storage for zksync - modified_storage_keys: HashMap, } // === impl Backend === @@ -429,7 +424,6 @@ impl Backend { fork_init_journaled_state: inner.new_journaled_state(), active_fork_ids: None, inner, - modified_storage_keys: Default::default(), }; if let Some(fork) = fork { @@ -473,7 +467,6 @@ impl Backend { fork_init_journaled_state: self.inner.new_journaled_state(), active_fork_ids: None, inner: Default::default(), - modified_storage_keys: Default::default(), } } @@ -783,9 +776,8 @@ impl Backend { { self.initialize(env); - let keys = self.modified_storage_keys.clone(); let result: Result> = - crate::era_revm::transactions::run_era_transaction(env, self, inspector, keys); + crate::era_revm::transactions::run_era_transaction(env, self, inspector); Ok(result.unwrap()) } @@ -1395,10 +1387,6 @@ impl DatabaseExt for Backend { fn has_cheatcode_access(&self, account: Address) -> bool { self.inner.cheatcode_access_accounts.contains(&account) } - - fn set_modified_keys(&mut self, keys: HashMap) { - self.modified_storage_keys = keys; - } } impl DatabaseRef for Backend { diff --git a/crates/evm/core/src/era_revm/db.rs b/crates/evm/core/src/era_revm/db.rs index 9fdb54de9..68a456bc7 100644 --- a/crates/evm/core/src/era_revm/db.rs +++ b/crates/evm/core/src/era_revm/db.rs @@ -16,7 +16,7 @@ use foundry_common::zk_utils::conversion_utils::{ h160_to_address, h256_to_b256, h256_to_h160, revm_u256_to_h256, u256_to_revm_u256, }; use revm::{ - primitives::{Bytecode, Bytes, Env}, + primitives::{Bytecode, Bytes}, Database, }; use zksync_basic_types::{ @@ -25,7 +25,7 @@ use zksync_basic_types::{ use zksync_types::{ api::{BlockIdVariant, Transaction, TransactionDetails}, StorageKey, ACCOUNT_CODE_STORAGE_ADDRESS, L2_ETH_TOKEN_ADDRESS, NONCE_HOLDER_ADDRESS, - SYSTEM_CONTEXT_ADDRESS, + SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, }; use zksync_utils::{address_to_h256, h256_to_u256, u256_to_h256}; @@ -33,12 +33,14 @@ use zksync_utils::{address_to_h256, h256_to_u256, u256_to_h256}; #[derive(Default)] pub struct RevmDatabaseForEra { pub db: Arc>>, - pub env: Arc>, + // pub env: Arc>, + current_block: u64, } impl Clone for RevmDatabaseForEra { fn clone(&self) -> Self { - Self { db: self.db.clone(), env: self.env.clone() } + Self { db: self.db.clone(), current_block: self.current_block } + // Self { db: self.db.clone(), env: self.env.clone(), current_block: self.current_block } } } @@ -46,7 +48,8 @@ impl Debug for RevmDatabaseForEra { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("RevmDatabaseForEra") .field("db", &"db") - .field("env", &self.env.lock().unwrap()) + // .field("env", &self.env.lock().unwrap()) + .field("current_block", &self.current_block) .finish() } } @@ -55,6 +58,24 @@ impl RevmDatabaseForEra where ::Error: Debug, { + /// Create a new instance of [RevmDatabaseForEra]. + pub fn new(db: Arc>>) -> Self { + let db_inner = db.clone(); + let current_block = { + let mut db = db_inner.lock().expect("failed aquiring lock on the database"); + let result = db + .storage(h160_to_address(SYSTEM_CONTEXT_ADDRESS), u256_to_revm_u256(U256::from(9))) + .unwrap(); + let num_and_ts = revm_u256_to_h256(result); + let num_and_ts_bytes = num_and_ts.as_fixed_bytes(); + let num: [u8; 8] = num_and_ts_bytes[24..32].try_into().unwrap(); + u64::from_be_bytes(num) + }; + + // Self { db, env, current_block } + Self { db, current_block } + } + /// Returns the current L1 block number and timestamp from the database. /// Reads it directly from the SYSTEM_CONTEXT storage. pub fn get_l1_block_number_and_timestamp(&self) -> (u64, u64) { @@ -69,7 +90,10 @@ where /// Returns the current L2 block number and timestamp from the database. /// Reads it directly from the SYSTEM_CONTEXT storage. pub fn get_l2_block_number_and_timestamp(&self) -> (u64, u64) { - let num_and_ts = self.read_storage_internal(SYSTEM_CONTEXT_ADDRESS, U256::from(9)); + let num_and_ts = self.read_storage_internal( + SYSTEM_CONTEXT_ADDRESS, + h256_to_u256(SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION), + ); let num_and_ts_bytes = num_and_ts.as_fixed_bytes(); let num: [u8; 8] = num_and_ts_bytes[24..32].try_into().unwrap(); let ts: [u8; 8] = num_and_ts_bytes[8..16].try_into().unwrap(); @@ -164,10 +188,19 @@ where &self, address: H160, idx: U256, - _block: Option, + block: Option, ) -> eyre::Result { - // We don't need to verify the block here, because foundry backend - // is taking care of it + // We cannot support historical lookups. Only the most recent L2 block is supported. + if let Some(block) = &block { + match block { + BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number(num)) => { + if num.as_u64() != self.current_block { + eyre::bail!("Only fetching of the most recent L2 block {} is supported - but queried for {}", self.current_block, num) + } + } + _ => eyre::bail!("Only fetching most recent block is implemented"), + } + } let mut result = self.read_storage_internal(address, idx); @@ -268,3 +301,211 @@ where todo!() } } + +#[cfg(test)] +#[allow(clippy::box_default)] +mod tests { + use maplit::hashmap; + use revm::primitives::AccountInfo; + + use super::*; + use crate::era_revm::testing::MockDatabase; + + #[test] + fn test_fetch_account_code_returns_hash_and_code_if_present_in_modified_keys_and_bytecodes() { + let bytecode_hash = H256::repeat_byte(0x3); + let bytecode = vec![U256::from(4)]; + let account = H160::repeat_byte(0xa); + let modified_keys = hashmap! { + StorageKey::new( + AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), + address_to_h256(&account), + ) => bytecode_hash, + }; + let bytecodes = hashmap! { + h256_to_u256(bytecode_hash) => bytecode.clone(), + }; + let db = RevmDatabaseForEra { + current_block: 0, + db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), + }; + + let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + + let expected = Some(( + bytecode_hash, + Bytecode::new_raw( + bytecode + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into(), + ), + )); + assert_eq!(expected, actual) + } + + #[test] + fn test_fetch_account_code_returns_hash_and_code_if_not_in_modified_keys_but_in_bytecodes() { + let bytecode_hash = H256::repeat_byte(0x3); + let bytecode = vec![U256::from(4)]; + let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash + let modified_keys = Default::default(); + let bytecodes = hashmap! { + h256_to_u256(bytecode_hash) => bytecode.clone(), + }; + let db = RevmDatabaseForEra { + current_block: 0, + db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), + }; + + let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + + let expected = Some(( + bytecode_hash, + Bytecode::new_raw( + bytecode + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into(), + ), + )); + assert_eq!(expected, actual) + } + + #[test] + fn test_fetch_account_code_returns_hash_and_code_from_db_if_not_in_modified_keys_or_bytecodes() + { + let bytecode_hash = H256::repeat_byte(0x3); + let bytecode = vec![U256::from(4)]; + let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash + let modified_keys = Default::default(); + let bytecodes = Default::default(); + let db = RevmDatabaseForEra { + current_block: 0, + db: Arc::new(Mutex::new(Box::new(MockDatabase { + basic: hashmap! { + h160_to_address(account) => AccountInfo { + code_hash: bytecode_hash.to_fixed_bytes().into(), + code: Some(Bytecode::new_raw( + bytecode + .clone() + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into())), + ..Default::default() + } + }, + }))), + }; + + let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + + let expected = Some(( + bytecode_hash, + Bytecode::new_raw( + bytecode + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into(), + ), + )); + assert_eq!(expected, actual) + } + + #[test] + fn test_fetch_account_code_returns_hash_and_code_from_db_if_address_in_modified_keys_but_not_in_bytecodes( + ) { + let bytecode_hash = H256::repeat_byte(0x3); + let bytecode = vec![U256::from(4)]; + let account = h256_to_h160(&bytecode_hash); // accounts are mapped as last 20 bytes of the 32-byte hash + let modified_keys = hashmap! { + StorageKey::new( + AccountTreeId::new(ACCOUNT_CODE_STORAGE_ADDRESS), + address_to_h256(&account), + ) => bytecode_hash, + }; + let bytecodes = Default::default(); // nothing in bytecodes + let db = RevmDatabaseForEra { + current_block: 0, + db: Arc::new(Mutex::new(Box::new(MockDatabase { + basic: hashmap! { + h160_to_address(account) => AccountInfo { + code_hash: bytecode_hash.to_fixed_bytes().into(), + code: Some(Bytecode::new_raw( + bytecode + .clone() + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into())), + ..Default::default() + } + }, + }))), + }; + + let actual = db.fetch_account_code(account, &modified_keys, &bytecodes); + + let expected = Some(( + bytecode_hash, + Bytecode::new_raw( + bytecode + .into_iter() + .flat_map(|v| u256_to_h256(v).to_fixed_bytes()) + .collect::>() + .into(), + ), + )); + assert_eq!(expected, actual) + } + + #[test] + fn test_get_storage_at_does_not_panic_when_even_numbered_blocks_are_requested() { + // This test exists because era-test-node creates two L2 (virtual) blocks per transaction. + // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 + + let db = &RevmDatabaseForEra { + current_block: 1, + db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), + }; + + let actual = db + .get_storage_at( + H160::zero(), + U256::zero(), + Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( + zksync_basic_types::U64::from(2), + ))), + ) + .expect("failed getting storage"); + + assert_eq!(H256::zero(), actual) + } + + #[test] + #[should_panic( + expected = "Only fetching of the most recent L2 block 2 is supported - but queried for 1" + )] + fn test_get_storage_at_panics_when_odd_numbered_blocks_are_requested() { + // This test exists because era-test-node creates two L2 (virtual) blocks per transaction. + // See https://github.com/matter-labs/era-test-node/pull/111/files#diff-af08c3181737aa5783b96dfd920cd5ef70829f46cd1b697bdb42414c97310e13R1333 + + let db = &RevmDatabaseForEra { + current_block: 1, + db: Arc::new(Mutex::new(Box::new(MockDatabase::default()))), + }; + + db.get_storage_at( + H160::zero(), + U256::zero(), + Some(BlockIdVariant::BlockNumber(zksync_types::api::BlockNumber::Number( + zksync_basic_types::U64::from(1), + ))), + ) + .unwrap(); + } +} diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index 69d0164b0..a2089bde5 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -128,28 +128,30 @@ pub enum DatabaseError { MissingCode(bool), } -pub fn run_era_transaction( - env: &mut Env, - db: DB, - inspector: INSP, - modified_storage: HashMap, -) -> EVMResult +pub struct EraTransactionResult { + pub evm_result: ResultAndState, + pub modified_storage_keys: HashMap, +} + +pub fn run_era_transaction(env: &mut Env, db: DB, inspector: INSP) -> EVMResult where DB: DatabaseExt + Send, ::Error: Debug, INSP: ToTracerPointer>>, HistoryDisabled>, { - let (num, ts) = (env.block.number.to::(), env.block.timestamp.to::()); - let era_db = RevmDatabaseForEra { - db: Arc::new(Mutex::new(Box::new(db))), - env: Arc::new(Mutex::new(env.clone())), - }; - + let era_db = RevmDatabaseForEra::new(Arc::new(Mutex::new(Box::new(db)))); + let (num, ts) = era_db.get_l2_block_number_and_timestamp(); + let l1_num = num; let nonce = era_db.get_nonce_for_address(H160::from_slice(env.tx.caller.as_slice())); - debug!("Starting ERA transaction: block={:?} timestamp={:?} nonce={:?}", num, ts, nonce); + + info!( + "Starting ERA transaction: block={:?} timestamp={:?} nonce={:?} | l1_block={}", + num, ts, nonce, l1_num + ); // Update the environment timestamp and block number. // Check if this should be done at the end? + // In general, we do not rely on env as it's consistently maintained in foundry env.block.number = env.block.number.saturating_add(rU256::from(1)); env.block.timestamp = env.block.timestamp.saturating_add(rU256::from(1)); @@ -163,7 +165,7 @@ where let fork_details = ForkDetails { fork_source: era_db.clone(), // It will be set properly later - l1_block: L1BatchNumber(num as u32), + l1_block: L1BatchNumber(l1_num as u32), l2_block: Block::default(), l2_miniblock: num, l2_miniblock_hash: Default::default(), @@ -196,7 +198,6 @@ where l2_tx, multivm::interface::TxExecutionMode::VerifyExecute, vec![tracer], - modified_storage, false, ) .unwrap(); @@ -257,9 +258,10 @@ where } }; - let state = storage_to_state(modified_keys.clone(), bytecodes, era_db.clone()); - era_db.db.lock().unwrap().set_modified_keys(modified_keys); - Ok(ResultAndState { result: execution_result, state }) + Ok(ResultAndState { + result: execution_result, + state: storage_to_state(&era_db, &modified_keys, bytecodes), + }) } fn decode_l2_tx_result(output: Vec) -> Vec { @@ -270,10 +272,11 @@ fn decode_l2_tx_result(output: Vec) -> Vec { .unwrap_or_default() } +/// Converts the zksync era's modified keys to the revm state. pub fn storage_to_state( - modified_keys: HashMap, + era_db: &RevmDatabaseForEra, + modified_keys: &HashMap, bytecodes: HashMap>, - era_db: RevmDatabaseForEra, ) -> rHashMap where DB: DatabaseExt + Send, @@ -393,13 +396,8 @@ mod tests { }; let mock_db = MockDatabase::default(); - let res = run_era_transaction::<_, ResultAndState, _>( - &mut env, - mock_db, - Noop::default(), - Default::default(), - ) - .expect("failed executing"); + let res = run_era_transaction::<_, ResultAndState, _>(&mut env, mock_db, Noop::default()) + .expect("failed executing"); assert!(!res.state.is_empty(), "unexpected failure: no states were touched"); for (address, account) in res.state { diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index cee866ae6..8f4c2b987 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -587,6 +587,7 @@ impl StorageView>>, HistoryDisabled, > { - CheatcodeTracer::new(self.cheatcodes.as_ref().unwrap().config.clone()).into_tracer_pointer() + CheatcodeTracer::new(self.cheatcodes.as_ref().map(|c| c.config.clone()).unwrap_or_default()) + .into_tracer_pointer() } } diff --git a/smoke-test/src/Counter.sol b/smoke-test/src/Counter.sol index d29bbe2ed..a36fe0794 100644 --- a/smoke-test/src/Counter.sol +++ b/smoke-test/src/Counter.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; -import {Test, console} from "forge-std/Test.sol"; +import {Test, console2 as console} from "forge-std/Test.sol"; contract Counter { uint256 public number = 0; @@ -12,7 +12,7 @@ contract Counter { } function incrementBy(uint8 amount) public { - console.log("incrementBy"); + console.log("incrementBy", amount); number += uint256(amount); } } From 9ce601ece1ef0307acf71e85ab54fc307ac1727c Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 22 Dec 2023 15:57:42 +0100 Subject: [PATCH 16/22] fix tests --- .../tests/src/cheatcodes/ExpectCall.t.sol | 2 +- .../tests/src/cheatcodes/Fork.t.sol | 68 +++++++++++++------ 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/ExpectCall.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/ExpectCall.t.sol index defc0c56d..64cac8608 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/ExpectCall.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/ExpectCall.t.sol @@ -732,7 +732,7 @@ contract ExpectCallMixedTest is Test { uint256 times ) public pure { for (uint256 i = 0; i < times; i++) { - target.add(1, 2); + target.add(a, b); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol index a05240cdf..35a632be6 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fork.t.sol @@ -1,4 +1,3 @@ - // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; @@ -6,57 +5,82 @@ import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "./Constants.sol"; contract ForkTest is Test { - /// USDC TOKEN + /// USDC TOKEN address constant TOKEN_ADDRESS = 0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4; uint256 constant TOKEN_DECIMALS = 6; uint256 constant FORK_BLOCK = 19579636; + function setUp() public { /// USDC TOKEN doesn't exists locally (bool success, bytes memory data) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") ); + require(success, "decimals() failed"); uint256 decimals_before = uint256(bytes32(data)); - require(block.number < 1000, "Local node doesn't have blocks above 1000"); - (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("createSelectFork(string,uint256)", "mainnet", FORK_BLOCK) + require( + block.number < 1000, + "Local node doesn't have blocks above 1000" + ); + (bool success2, ) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature( + "createSelectFork(string,uint256)", + "mainnet", + FORK_BLOCK + ) ); require(decimals_before == 0, "Contract exists locally"); - require(success1, "fork failed"); - } + require(success2, "fork failed"); + } - function testFork() public{ - /// After createSelect fork the decimals should exist - (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( + function testFork() public { + /// After createSelect fork the decimals should exist + (bool success, bytes memory data2) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") ); + require(success, "decimals() failed"); uint256 decimals_after = uint256(bytes32(data2)); - console.log("decimals_after", decimals_after); - require(decimals_after == TOKEN_DECIMALS, "Contract dosent exists in fork"); - require(block.number == FORK_BLOCK + 1, "ENV for blocks is not set correctly"); - + console.log("decimals_after", decimals_after); + require( + decimals_after == TOKEN_DECIMALS, + "Contract dosent exists in fork" + ); + require( + block.number == FORK_BLOCK + 1, + "ENV for blocks is not set correctly" + ); } - function testCreateSelectFork() public{ + function testCreateSelectFork() public { (bool success, bytes memory data) = Constants.CHEATCODE_ADDRESS.call( - abi.encodeWithSignature("createFork(string,uint256)", "mainnet", FORK_BLOCK + 100) + abi.encodeWithSignature( + "createFork(string,uint256)", + "mainnet", + FORK_BLOCK + 100 + ) ); require(success, "fork failed"); uint256 forkId = uint256(bytes32(data)); - (bool success1, bytes memory data1) = Constants.CHEATCODE_ADDRESS.call( + (bool success1, ) = Constants.CHEATCODE_ADDRESS.call( abi.encodeWithSignature("selectFork(uint256)", forkId) ); require(success1, "select fork failed"); - /// After createSelect fork the decimals should exist (bool success2, bytes memory data2) = TOKEN_ADDRESS.call( abi.encodeWithSignature("decimals()") ); + require(success2, "decimals() failed"); uint256 decimals_after = uint256(bytes32(data2)); - console.log("decimals_after", decimals_after); - console.log("block ", block.number); - require(decimals_after == TOKEN_DECIMALS, "Contract dosent exists in fork"); - require(block.number == FORK_BLOCK + 100, "ENV for blocks is not set correctly"); + console.log("decimals_after", decimals_after); + console.log("block ", block.number); + require( + decimals_after == TOKEN_DECIMALS, + "Contract dosent exists in fork" + ); + require( + block.number == FORK_BLOCK + 100, + "ENV for blocks is not set correctly" + ); } } From 984b322ac5ae9ef6fddb6296c20ccc4d7fe55439 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 22 Dec 2023 15:59:27 +0100 Subject: [PATCH 17/22] remove console.log for failed() --- crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/Ffi.t.sol | 2 -- crates/era-cheatcodes/tests/src/cheatcodes/Fs.t.sol | 2 -- crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol | 2 -- .../era-cheatcodes/tests/src/cheatcodes/ReadCallers.t.sol | 4 ---- crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol | 3 --- crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol | 3 --- crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol | 1 - crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol | 6 ------ crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol | 1 - 14 files changed, 29 deletions(-) diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol index e6c0418d7..74b2f6397 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Addr.t.sol @@ -15,6 +15,5 @@ contract AddrTest is Test { require(success, "addr failed"); address addr = abi.decode(data, (address)); assertEq(addr, expected, "expected address did not match"); - console.log("failed?", failed()); } } \ No newline at end of file diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol index 0b83e3218..4d8064bfc 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Deal.t.sol @@ -25,6 +25,5 @@ contract CheatcodeDealTest is Test { require(balanceAfter == NEW_BALANCE, "balance mismatch"); require(balanceAfter != balanceBefore, "balance unchanged"); require(success, "deal failed"); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol index 199e2118a..4dccad7c1 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Etch.t.sol @@ -23,6 +23,5 @@ contract CheatcodeEtchTest is Test { abi.encodeWithSignature("setGreeting(string)", "hello world") ); require(success, "setGreeting failed"); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Ffi.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Ffi.t.sol index a70ba44e8..1323df547 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Ffi.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Ffi.t.sol @@ -25,8 +25,6 @@ contract FfiTest is Test { keccak256(bytes(output)) == keccak256(bytes("ffi works")), "ffi failed" ); - - console.log("failed?", failed()); } function testFfiString() public { diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Fs.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Fs.t.sol index 5f6cb6b79..5f32c3836 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Fs.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Fs.t.sol @@ -21,7 +21,6 @@ contract FsTest is Test { keccak256("hello readable world\nthis is the second line!\n"), "read data did not match expected data" ); - console.log("failed?", failed()); } function testWriteFile() public { @@ -45,6 +44,5 @@ contract FsTest is Test { keccak256(readData) == keccak256(bytes(writeData)), "read data did not match write data" ); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol index 12c0f9f10..b7618aa3c 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/GetNonce.t.sol @@ -17,7 +17,6 @@ contract CheatcodeSetNonceTest is Test { ) ); require(success, "setNonce failed"); - console.log("failed?", failed()); //test getNonce (bool success2, bytes memory data2) = Constants.CHEATCODE_ADDRESS.call( @@ -27,7 +26,6 @@ contract CheatcodeSetNonceTest is Test { uint256 nonce = abi.decode(data2, (uint256)); console.log("nonce: 0x", nonce); require(nonce == NEW_NONCE, "nonce was not changed"); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/ReadCallers.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/ReadCallers.t.sol index e63c72d9f..8d73d33ef 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/ReadCallers.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/ReadCallers.t.sol @@ -41,8 +41,6 @@ contract CheatcodeReadCallers is Test { require(mode == 4, "recurrent prank call mode"); require(sender == TEST_ADDRESS, "sender overridden"); require(origin == tx.origin, "origin not overridden"); - - console.log("failed?", failed()); } function testFullyPrankedReadCallers() public { @@ -60,7 +58,5 @@ contract CheatcodeReadCallers is Test { require(mode == 4, "recurrent prank call mode"); require(sender == TEST_ADDRESS, "sender overridden"); require(origin == TEST_ORIGIN, "origin overridden"); - - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol index 9a706cc93..c26381931 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Roll.t.sol @@ -28,6 +28,5 @@ contract CheatcodeRollTest is Test { finalBlockNumber == NEW_BLOCK_NUMBER, "block number was not changed" ); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol index e2109f41f..6ee5069f7 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Serialize.t.sol @@ -25,7 +25,6 @@ contract CheatcodeSerializeTest is Test { keccak256(bytes("0x6Eb28604685b1F182dAB800A1Bfa4BaFdBA8a79a")), "serializeAddress mismatch" ); - console.log("failed?", failed()); } function testSerializeBool() external { @@ -44,7 +43,6 @@ contract CheatcodeSerializeTest is Test { keccak256(bytes(testString)) == keccak256(bytes("true")), "serializeBool mismatch" ); - console.log("failed?", failed()); } function testSerializeUint() external { @@ -63,6 +61,5 @@ contract CheatcodeSerializeTest is Test { keccak256(bytes(testString)) == keccak256(bytes("99")), "serializeUint mismatch" ); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol index 29a99ee0e..c6bb4ff63 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/SetNonce.t.sol @@ -17,6 +17,5 @@ contract CheatcodeSetNonceTest is Test { ) ); require(success, "setNonce failed"); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol index 3b5a73b82..b527b7f58 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/StartPrank.t.sol @@ -64,7 +64,6 @@ contract CheatcodeStartPrankTest is Test { "startPrank failed: victim.assertCallerAndOrigin failed" ); - console.log("failed?", failed()); } function testStartPrankWithOrigin() external { @@ -126,8 +125,6 @@ contract CheatcodeStartPrankTest is Test { original_tx_origin, "startPrank failed: victim.assertCallerAndOrigin failed" ); - - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol index 7e22a7e41..e620d0f5d 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Store.t.sol @@ -32,6 +32,5 @@ contract StoreTest is Test { require(success, "store failed"); assertEq(store.slot0(), 1, "store failed"); assertEq(store.slot1(), 20, "store failed"); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol index e5f78f2fc..01cc8f0ca 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/ToString.t.sol @@ -19,7 +19,6 @@ contract CheatcodeToStringTest is Test { keccak256(bytes("0x413D15117be7a498e68A64FcfdB22C6e2AaE1808")), "toString mismatch" ); - console.log("failed?", failed()); } function testToStringFromBool() external { @@ -44,7 +43,6 @@ contract CheatcodeToStringTest is Test { keccak256(bytes(testString)) == keccak256(bytes("true")), "toString mismatch" ); - console.log("failed?", failed()); } function testToStringFromUint256() external { @@ -60,7 +58,6 @@ contract CheatcodeToStringTest is Test { keccak256(bytes(testString)) == keccak256(bytes(stringValue)), "toString mismatch" ); - console.log("failed?", failed()); } function testToStringFromInt256() external { @@ -76,7 +73,6 @@ contract CheatcodeToStringTest is Test { keccak256(bytes(testString)) == keccak256(bytes(stringValue)), "toString mismatch" ); - console.log("failed?", failed()); } function testToStringFromBytes32() external { @@ -96,7 +92,6 @@ contract CheatcodeToStringTest is Test { ), "toString mismatch" ); - console.log("failed?", failed()); } function testToStringFromBytes() external { @@ -117,6 +112,5 @@ contract CheatcodeToStringTest is Test { ), "toString mismatch" ); - console.log("failed?", failed()); } } diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol index 336dec06c..1d66940e7 100644 --- a/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol +++ b/crates/era-cheatcodes/tests/src/cheatcodes/Warp.t.sol @@ -26,6 +26,5 @@ contract CheatcodeWarpTest is Test { finalTimestamp == NEW_BLOCK_TIMESTAMP, "timestamp was not changed" ); - console.log("failed?", failed()); } } From 0adab36eab52b6231cfbf6c49beb65e72fa537d3 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 22 Dec 2023 16:02:57 +0100 Subject: [PATCH 18/22] clippy --- crates/evm/core/src/era_revm/transactions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index a2089bde5..876a0ef8d 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -330,7 +330,7 @@ where .collect() }); - let account_code = era_db.fetch_account_code(*account, &modified_keys, &bytecodes); + let account_code = era_db.fetch_account_code(*account, modified_keys, &bytecodes); let (code_hash, code) = account_code .map(|(hash, bytecode)| (B256::from(&hash.0), Some(bytecode))) From b79285bf77a6f3063898b60d21525edab50815b8 Mon Sep 17 00:00:00 2001 From: jrigada Date: Fri, 22 Dec 2023 19:28:18 +0000 Subject: [PATCH 19/22] first iteration of rpcUrls cheatcodes --- crates/era-cheatcodes/src/cheatcodes.rs | 27 +++++++++++ .../tests/src/cheatcodes/RpcUrls.t.sol | 48 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 crates/era-cheatcodes/tests/src/cheatcodes/RpcUrls.t.sol diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 68bca7e01..9fb8ee776 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -737,6 +737,33 @@ impl CheatcodeTracer { &mut storage, ); } + rpcUrl(rpcUrlCall { rpcAlias }) => { + tracing::info!("👷 Getting rpc url of {}", rpcAlias); + let rpc_endpoints = self.config.rpc_endpoints.clone(); + let rpc_url = match rpc_endpoints.get(&rpcAlias) { + Some(Ok(url)) => Some(url.clone()), + _ => None, + }; + //this should revert but we don't have reverts yet + assert!( + rpc_url.is_some(), + "Failed to resolve env var `${rpcAlias}`: environment variable not found" + ); + self.add_trimmed_return_data(rpc_url.unwrap().as_bytes()); + } + rpcUrls(rpcUrlsCall {}) => { + tracing::info!("👷 Getting rpc urls"); + let rpc_endpoints = self.config.rpc_endpoints.clone(); + let rpc_urls: Vec = rpc_endpoints + .iter() + .map(|(alias, url)| match url { + Ok(url) => format!("{}:{}", alias, url), + Err(_) => alias.clone(), + }) + .collect(); + let rpc_urls = rpc_urls.join(","); + self.add_trimmed_return_data(rpc_urls.as_bytes()); + } serializeAddress_0(serializeAddress_0Call { objectKey: object_key, valueKey: value_key, diff --git a/crates/era-cheatcodes/tests/src/cheatcodes/RpcUrls.t.sol b/crates/era-cheatcodes/tests/src/cheatcodes/RpcUrls.t.sol new file mode 100644 index 000000000..c2d528dbd --- /dev/null +++ b/crates/era-cheatcodes/tests/src/cheatcodes/RpcUrls.t.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2 as console} from "../../lib/forge-std/src/Test.sol"; +import {Constants} from "./Constants.sol"; +import {Utils} from "./Utils.sol"; + +contract RpcUrlsTest is Test { + function testRpcUrl() public { + (bool success, bytes memory rawData) = Constants.CHEATCODE_ADDRESS.call( + abi.encodeWithSignature("rpcUrl(string)", "mainnet") + ); + + bytes memory return_data = Utils.trimReturnBytes(rawData); + string memory rpc_url = string(return_data); + console.log("rpc_url", rpc_url); + require(success, "rpcUrl() failed"); + require( + keccak256(abi.encodePacked(rpc_url)) == + keccak256( + abi.encodePacked("https://mainnet.era.zksync.io:443") + ), + "rpc url retrieved does not match expected value" + ); + } + + function testRpcUrls() public { + (bool success, bytes memory rawData2) = Constants + .CHEATCODE_ADDRESS + .call(abi.encodeWithSignature("rpcUrls()")); + + bytes memory return_data2 = Utils.trimReturnBytes(rawData2); + string memory rpc_urls = string(return_data2); + + console.log("rpc_urls", rpc_urls); + + require(success, "rpcUrls() failed"); + require( + keccak256(abi.encodePacked(rpc_urls)) == + keccak256( + abi.encodePacked( + "local,mainnet:https://mainnet.era.zksync.io:443,testnet:https://testnet.era.zksync.dev:443" + ) + ), + "rpc urls retrieved does not match expected value" + ); + } +} From 43a169934b40c9f21d3001fa32f3dd16ccff976d Mon Sep 17 00:00:00 2001 From: jrigada Date: Tue, 2 Jan 2024 18:44:03 +0000 Subject: [PATCH 20/22] remove clone --- crates/era-cheatcodes/src/cheatcodes.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 972eca071..56f11a2ff 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -834,7 +834,7 @@ impl CheatcodeTracer { } rpcUrl(rpcUrlCall { rpcAlias }) => { tracing::info!("👷 Getting rpc url of {}", rpcAlias); - let rpc_endpoints = self.config.rpc_endpoints.clone(); + let rpc_endpoints = &self.config.rpc_endpoints; let rpc_url = match rpc_endpoints.get(&rpcAlias) { Some(Ok(url)) => Some(url.clone()), _ => None, @@ -848,7 +848,7 @@ impl CheatcodeTracer { } rpcUrls(rpcUrlsCall {}) => { tracing::info!("👷 Getting rpc urls"); - let rpc_endpoints = self.config.rpc_endpoints.clone(); + let rpc_endpoints = &self.config.rpc_endpoints; let rpc_urls: Vec = rpc_endpoints .iter() .map(|(alias, url)| match url { From ea2a15a0aabfdbb9c4d6b52878834b9f80ba4607 Mon Sep 17 00:00:00 2001 From: jrigada Date: Wed, 3 Jan 2024 13:11:31 +0000 Subject: [PATCH 21/22] remove wrong merged code --- crates/evm/core/src/backend/fuzz.rs | 4 ++-- crates/evm/core/src/backend/mod.rs | 4 ++-- crates/evm/core/src/era_revm/db.rs | 4 ---- crates/evm/core/src/era_revm/transactions.rs | 6 ------ 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/crates/evm/core/src/backend/fuzz.rs b/crates/evm/core/src/backend/fuzz.rs index c7db98b42..613d7fad0 100644 --- a/crates/evm/core/src/backend/fuzz.rs +++ b/crates/evm/core/src/backend/fuzz.rs @@ -10,7 +10,7 @@ use alloy_primitives::{Address, B256, U256}; use ethers_core::utils::GenesisAccount; use revm::{ db::DatabaseRef, - primitives::{AccountInfo, Bytecode, EVMError, Env, ResultAndState}, + primitives::{AccountInfo, Bytecode, EVMResult, Env, ResultAndState}, Database, Inspector, JournaledState, }; use std::{borrow::Cow, collections::HashMap}; @@ -65,7 +65,7 @@ impl<'a> FuzzBackendWrapper<'a> { { self.is_initialized = false; - let result: Result> = + let result: EVMResult = crate::era_revm::transactions::run_era_transaction(env, self, inspector); Ok(result.unwrap()) diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index 52bbe77ae..a0169ba80 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -22,7 +22,7 @@ use revm::{ inspectors::NoOpInspector, precompile::{Precompiles, SpecId}, primitives::{ - Account, AccountInfo, Bytecode, CreateScheme, EVMError, Env, HashMap as Map, Log, + Account, AccountInfo, Bytecode, CreateScheme, EVMResult, Env, HashMap as Map, Log, ResultAndState, StorageSlot, TransactTo, KECCAK_EMPTY, }, Database, DatabaseCommit, Inspector, JournaledState, EVM, @@ -776,7 +776,7 @@ impl Backend { { self.initialize(env); - let result: Result> = + let result: EVMResult = crate::era_revm::transactions::run_era_transaction(env, self, inspector); Ok(result.unwrap()) diff --git a/crates/evm/core/src/era_revm/db.rs b/crates/evm/core/src/era_revm/db.rs index 68a456bc7..94ea5adb2 100644 --- a/crates/evm/core/src/era_revm/db.rs +++ b/crates/evm/core/src/era_revm/db.rs @@ -33,14 +33,12 @@ use zksync_utils::{address_to_h256, h256_to_u256, u256_to_h256}; #[derive(Default)] pub struct RevmDatabaseForEra { pub db: Arc>>, - // pub env: Arc>, current_block: u64, } impl Clone for RevmDatabaseForEra { fn clone(&self) -> Self { Self { db: self.db.clone(), current_block: self.current_block } - // Self { db: self.db.clone(), env: self.env.clone(), current_block: self.current_block } } } @@ -48,7 +46,6 @@ impl Debug for RevmDatabaseForEra { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("RevmDatabaseForEra") .field("db", &"db") - // .field("env", &self.env.lock().unwrap()) .field("current_block", &self.current_block) .finish() } @@ -72,7 +69,6 @@ where u64::from_be_bytes(num) }; - // Self { db, env, current_block } Self { db, current_block } } diff --git a/crates/evm/core/src/era_revm/transactions.rs b/crates/evm/core/src/era_revm/transactions.rs index 876a0ef8d..af34adc31 100644 --- a/crates/evm/core/src/era_revm/transactions.rs +++ b/crates/evm/core/src/era_revm/transactions.rs @@ -128,11 +128,6 @@ pub enum DatabaseError { MissingCode(bool), } -pub struct EraTransactionResult { - pub evm_result: ResultAndState, - pub modified_storage_keys: HashMap, -} - pub fn run_era_transaction(env: &mut Env, db: DB, inspector: INSP) -> EVMResult where DB: DatabaseExt + Send, @@ -164,7 +159,6 @@ where let fork_details = ForkDetails { fork_source: era_db.clone(), - // It will be set properly later l1_block: L1BatchNumber(l1_num as u32), l2_block: Block::default(), l2_miniblock: num, From e8aaddba9905e2d369caee536a52ead20ee5ed59 Mon Sep 17 00:00:00 2001 From: jrigada Date: Wed, 3 Jan 2024 14:15:27 +0000 Subject: [PATCH 22/22] joined together --- crates/era-cheatcodes/src/cheatcodes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/era-cheatcodes/src/cheatcodes.rs b/crates/era-cheatcodes/src/cheatcodes.rs index 56f11a2ff..77a5beeef 100644 --- a/crates/era-cheatcodes/src/cheatcodes.rs +++ b/crates/era-cheatcodes/src/cheatcodes.rs @@ -849,14 +849,14 @@ impl CheatcodeTracer { rpcUrls(rpcUrlsCall {}) => { tracing::info!("👷 Getting rpc urls"); let rpc_endpoints = &self.config.rpc_endpoints; - let rpc_urls: Vec = rpc_endpoints + let rpc_urls = rpc_endpoints .iter() .map(|(alias, url)| match url { Ok(url) => format!("{}:{}", alias, url), Err(_) => alias.clone(), }) - .collect(); - let rpc_urls = rpc_urls.join(","); + .collect::>() + .join(","); self.add_trimmed_return_data(rpc_urls.as_bytes()); } serializeAddress_0(serializeAddress_0Call {