diff --git a/Cargo.lock b/Cargo.lock index 555f9fd4..6202d69f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,29 +38,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "ahash" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" -dependencies = [ - "getrandom 0.2.12", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -70,12 +47,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - [[package]] name = "android-tzdata" version = "0.1.1" @@ -216,15 +187,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "atoi" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" -dependencies = [ - "num-traits", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -266,7 +228,7 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" dependencies = [ - "bindgen 0.69.4", + "bindgen", "cc", "cmake", "dunce", @@ -322,18 +284,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "backon" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" -dependencies = [ - "fastrand", - "futures-core", - "pin-project", - "tokio", -] - [[package]] name = "backtrace" version = "0.3.69" @@ -434,27 +384,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.77", -] - [[package]] name = "bindgen" version = "0.69.4" @@ -507,9 +436,6 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -dependencies = [ - "serde", -] [[package]] name = "bitvec" @@ -589,18 +515,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" -[[package]] -name = "blst" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" -dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", -] - [[package]] name = "boojum" version = "0.30.1" @@ -632,30 +546,6 @@ dependencies = [ "zksync_pairing", ] -[[package]] -name = "borsh" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" -dependencies = [ - "borsh-derive", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" -dependencies = [ - "once_cell", - "proc-macro-crate 2.0.0", - "proc-macro2", - "quote", - "syn 2.0.77", - "syn_derive", -] - [[package]] name = "bs58" version = "0.5.0" @@ -699,34 +589,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "bytecount" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" - [[package]] name = "byteorder" version = "1.5.0" @@ -781,19 +643,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", -] - [[package]] name = "cargo_metadata" version = "0.18.1" @@ -846,12 +695,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "chrono" version = "0.4.38" @@ -915,14 +758,14 @@ dependencies = [ [[package]] name = "circuit_encodings" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67617688c66640c84f9b98ff26d48f7898dca4faeb45241a4f21ec333788e7b" +checksum = "f5128d4b8fbb27ac453f573a95601058e74487bdafd22a3168cded66bf340c28" dependencies = [ "derivative", "serde", - "zk_evm 0.150.5", - "zkevm_circuits 0.150.5", + "zk_evm 0.150.6", + "zkevm_circuits 0.150.6", ] [[package]] @@ -982,11 +825,11 @@ dependencies = [ [[package]] name = "circuit_sequencer_api" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21017310971d4a051e4a52ad70eed11d1ae69defeca8314f73a3a4bad16705a9" +checksum = "093d0c2c0b39144ddb4e1e88d73d95067ce34ec7750808b2eed01edbb510b88e" dependencies = [ - "circuit_encodings 0.150.5", + "circuit_encodings 0.150.6", "derivative", "rayon", "serde", @@ -1137,15 +980,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bed69047ed42e52c7e38d6421eeb8ceefb4f2a2b52eed59137f7bad7908f6800" -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "const-hex" version = "1.10.0" @@ -1231,21 +1065,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1370,33 +1189,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "curve25519-dalek-derive", - "digest 0.10.7", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "darling" version = "0.13.4" @@ -1432,19 +1224,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core 0.9.9", -] - [[package]] name = "data-encoding" version = "2.5.0" @@ -1489,6 +1268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -1605,12 +1385,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "dtoa" version = "1.0.9" @@ -1649,39 +1423,11 @@ dependencies = [ "spki 0.7.3", ] -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "pkcs8 0.10.2", - "signature 2.2.0", -] - -[[package]] -name = "ed25519-dalek" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand_core 0.6.4", - "serde", - "sha2 0.10.8", - "subtle", - "zeroize", -] - [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -dependencies = [ - "serde", -] [[package]] name = "elliptic-curve" @@ -1849,8 +1595,6 @@ dependencies = [ "zksync_basic_types", "zksync_contracts", "zksync_multivm", - "zksync_node_fee_model", - "zksync_state", "zksync_types", "zksync_utils", "zksync_web3_decl", @@ -1866,26 +1610,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "version_check", -] - -[[package]] -name = "etcetera" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" -dependencies = [ - "cfg-if 1.0.0", - "home", - "windows-sys 0.48.0", -] - [[package]] name = "eth-keystore" version = "0.5.0" @@ -2093,7 +1817,7 @@ checksum = "aab3cef6cc1c9fd7f787043c81ad3052eff2b96a3878ef1526aa446311bdbfc9" dependencies = [ "arrayvec 0.7.4", "bytes", - "cargo_metadata 0.18.1", + "cargo_metadata", "chrono", "const-hex", "elliptic-curve 0.13.8", @@ -2246,17 +1970,6 @@ dependencies = [ "yansi 0.5.1", ] -[[package]] -name = "event-listener" -version = "5.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "eyre" version = "0.6.12" @@ -2293,12 +2006,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "fiat-crypto" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" - [[package]] name = "findshlibs" version = "0.10.2" @@ -2311,12 +2018,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "finl_unicode" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" - [[package]] name = "firestorm" version = "0.5.1" @@ -2363,17 +2064,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "flume" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" -dependencies = [ - "futures-core", - "futures-sink", - "spin 0.9.8", -] - [[package]] name = "fnv" version = "1.0.7" @@ -2487,17 +2177,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "futures-intrusive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" -dependencies = [ - "futures-core", - "lock_api", - "parking_lot 0.12.1", -] - [[package]] name = "futures-io" version = "0.3.30" @@ -2744,19 +2423,12 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.7", -] [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.7", - "allocator-api2", -] [[package]] name = "hashers" @@ -2767,15 +2439,6 @@ dependencies = [ "fxhash", ] -[[package]] -name = "hashlink" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "heck" version = "0.4.1" @@ -2800,15 +2463,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - [[package]] name = "hmac" version = "0.12.1" @@ -3217,15 +2871,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "ipnetwork" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e" -dependencies = [ - "serde", -] - [[package]] name = "is-terminal" version = "0.4.10" @@ -3659,9 +3304,6 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin 0.9.8", -] [[package]] name = "lazycell" @@ -3702,44 +3344,6 @@ dependencies = [ "redox_syscall 0.4.1", ] -[[package]] -name = "librocksdb-sys" -version = "0.11.0+8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" -dependencies = [ - "bindgen 0.65.1", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "lz4-sys", - "zstd-sys", -] - -[[package]] -name = "libsqlite3-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -3794,16 +3398,6 @@ dependencies = [ "logos-codegen", ] -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "maplit" version = "1.0.2" @@ -3876,21 +3470,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mini-moka" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c325dfab65f261f386debee8b0969da215b3fa0037e74c8a1234db7ba986d803" -dependencies = [ - "crossbeam-channel", - "crossbeam-utils", - "dashmap", - "skeptic", - "smallvec", - "tagptr", - "triomphe", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4010,23 +3589,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.4.4" @@ -4143,7 +3705,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 2.0.77", @@ -4452,12 +4014,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "parking" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" - [[package]] name = "parking_lot" version = "0.11.2" @@ -4551,12 +4107,6 @@ dependencies = [ "hmac", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pem" version = "1.1.1" @@ -4684,17 +4234,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der 0.7.8", - "pkcs8 0.10.2", - "spki 0.7.3", -] - [[package]] name = "pkcs8" version = "0.9.0" @@ -5024,37 +4563,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "pulldown-cmark" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" -dependencies = [ - "bitflags 2.6.0", - "memchr", - "unicase", -] - [[package]] name = "quick-protobuf" version = "0.8.1" @@ -5310,15 +4818,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" version = "0.11.24" @@ -5466,35 +4965,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "rkyv" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" -dependencies = [ - "bitvec 1.0.1", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid 1.7.0", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rlp" version = "0.5.2" @@ -5517,58 +4987,12 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rocksdb" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" -dependencies = [ - "libc", - "librocksdb-sys", -] - [[package]] name = "route-recognizer" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" -[[package]] -name = "rsa" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" -dependencies = [ - "const-oid", - "digest 0.10.7", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8 0.10.2", - "rand_core 0.6.4", - "signature 2.2.0", - "spki 0.7.3", - "subtle", - "zeroize", -] - -[[package]] -name = "rust_decimal" -version = "1.34.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755392e1a2f77afd95580d3f0d0e94ac83eeeb7167552c9b5bca549e61a94d83" -dependencies = [ - "arrayvec 0.7.4", - "borsh", - "bytes", - "num-traits", - "rand 0.8.5", - "rkyv", - "serde", - "serde_json", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -5815,12 +5239,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "sec1" version = "0.3.0" @@ -6255,12 +5673,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - [[package]] name = "simple_asn1" version = "0.6.2" @@ -6279,21 +5691,6 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "skeptic" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" -dependencies = [ - "bytecount", - "cargo_metadata 0.14.2", - "error-chain", - "glob", - "pulldown-cmark", - "tempfile", - "walkdir", -] - [[package]] name = "slab" version = "0.4.9" @@ -6363,9 +5760,6 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] [[package]] name = "spki" @@ -6388,280 +5782,50 @@ dependencies = [ ] [[package]] -name = "sqlformat" -version = "0.2.3" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" -dependencies = [ - "itertools 0.12.1", - "nom", - "unicode_categories", -] +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "sqlx" -version = "0.8.2" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" -dependencies = [ - "sqlx-core", - "sqlx-macros", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "sqlx-core" -version = "0.8.2" +name = "string_cache" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ - "atoi", - "bigdecimal 0.4.5", - "byteorder", - "bytes", - "chrono", - "crc", - "crossbeam-queue", - "either", - "event-listener", - "futures-channel", - "futures-core", - "futures-intrusive", - "futures-io", - "futures-util", - "hashbrown 0.14.5", - "hashlink", - "hex", - "indexmap 2.5.0", - "ipnetwork", - "log", - "memchr", - "native-tls", + "new_debug_unreachable", "once_cell", - "paste", - "percent-encoding", - "rust_decimal", - "serde", - "serde_json", - "sha2 0.10.8", - "smallvec", - "sqlformat", - "thiserror", - "tokio", - "tokio-stream", - "tracing", - "url", + "parking_lot 0.12.1", + "phf_shared 0.10.0", + "precomputed-hash", ] [[package]] -name = "sqlx-macros" -version = "0.8.2" +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "proc-macro2", - "quote", - "sqlx-core", - "sqlx-macros-core", - "syn 2.0.77", + "strum_macros 0.25.3", ] [[package]] -name = "sqlx-macros-core" -version = "0.8.2" +name = "strum" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" -dependencies = [ - "dotenvy", - "either", - "heck 0.5.0", - "hex", - "once_cell", - "proc-macro2", - "quote", - "serde", - "serde_json", - "sha2 0.10.8", - "sqlx-core", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "syn 2.0.77", - "tempfile", - "tokio", - "url", -] - -[[package]] -name = "sqlx-mysql" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" -dependencies = [ - "atoi", - "base64 0.22.1", - "bigdecimal 0.4.5", - "bitflags 2.6.0", - "byteorder", - "bytes", - "chrono", - "crc", - "digest 0.10.7", - "dotenvy", - "either", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "generic-array", - "hex", - "hkdf", - "hmac", - "itoa", - "log", - "md-5", - "memchr", - "once_cell", - "percent-encoding", - "rand 0.8.5", - "rsa", - "rust_decimal", - "serde", - "sha1", - "sha2 0.10.8", - "smallvec", - "sqlx-core", - "stringprep", - "thiserror", - "tracing", - "whoami", -] - -[[package]] -name = "sqlx-postgres" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" -dependencies = [ - "atoi", - "base64 0.22.1", - "bigdecimal 0.4.5", - "bitflags 2.6.0", - "byteorder", - "chrono", - "crc", - "dotenvy", - "etcetera", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "hex", - "hkdf", - "hmac", - "home", - "ipnetwork", - "itoa", - "log", - "md-5", - "memchr", - "num-bigint", - "once_cell", - "rand 0.8.5", - "rust_decimal", - "serde", - "serde_json", - "sha2 0.10.8", - "smallvec", - "sqlx-core", - "stringprep", - "thiserror", - "tracing", - "whoami", -] - -[[package]] -name = "sqlx-sqlite" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" -dependencies = [ - "atoi", - "chrono", - "flume", - "futures-channel", - "futures-core", - "futures-executor", - "futures-intrusive", - "futures-util", - "libsqlite3-sys", - "log", - "percent-encoding", - "serde", - "serde_urlencoded", - "sqlx-core", - "tracing", - "url", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot 0.12.1", - "phf_shared 0.10.0", - "precomputed-hash", -] - -[[package]] -name = "stringprep" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" -dependencies = [ - "finl_unicode", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros 0.25.3", -] - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros 0.26.4", ] @@ -6740,18 +5904,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -6809,12 +5961,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tagptr" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" - [[package]] name = "tap" version = "1.0.1" @@ -6894,15 +6040,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.3.36" @@ -7317,12 +6454,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "triomphe" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" - [[package]] name = "try-lock" version = "0.2.5" @@ -7430,12 +6561,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - [[package]] name = "unroll" version = "0.1.5" @@ -7720,12 +6845,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "whoami" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" - [[package]] name = "winapi" version = "0.3.9" @@ -8018,45 +7137,11 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] [[package]] name = "zip" @@ -8146,9 +7231,9 @@ dependencies = [ [[package]] name = "zk_evm" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6e69931f24db5cf333b714721e8d80ff88bfdb7da8c3dc7882612ffddb8d27" +checksum = "c14bda6c101389145cd01fac900f1392876bc0284d98faf7f376237baa2cb19d" dependencies = [ "anyhow", "lazy_static", @@ -8156,7 +7241,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "zk_evm_abstractions 0.150.5", + "zk_evm_abstractions 0.150.6", ] [[package]] @@ -8187,15 +7272,15 @@ dependencies = [ [[package]] name = "zk_evm_abstractions" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6b0720261ab55490fe3a96e96de30d5d7b277940b52ea7f52dbf564eb1748" +checksum = "a008f2442fc6a508bdd1f902380242cb6ff11b8b27acdac2677c6d9f75cbb004" dependencies = [ "anyhow", "num_enum 0.6.1", "serde", "static_assertions", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", ] [[package]] @@ -8244,9 +7329,9 @@ dependencies = [ [[package]] name = "zkevm_circuits" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784fa7cfb51e17c5ced112bca43da30b3468b2347b7af0427ad9638759fb140e" +checksum = "1f68518aedd5358b17224771bb78bacd912cf66011aeda98b1f887cfb9e0972f" dependencies = [ "arrayvec 0.7.4", "boojum", @@ -8258,7 +7343,7 @@ dependencies = [ "seq-macro", "serde", "smallvec", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", "zksync_cs_derive", ] @@ -8306,9 +7391,9 @@ dependencies = [ [[package]] name = "zkevm_opcode_defs" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79055eae1b6c1ab80793ed9d77d2964c9c896afa4b5dfed278cf58cd10acfe8f" +checksum = "762b5f1c1b283c5388995a85d40a05aef1c14f50eb904998b7e9364739f5b899" dependencies = [ "bitflags 2.6.0", "blake2", @@ -8361,13 +7446,14 @@ dependencies = [ [[package]] name = "zksync_basic_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "chrono", "ethabi 18.0.0", "hex", "num_enum 0.7.2", + "secrecy", "serde", "serde_json", "serde_with", @@ -8402,9 +7488,9 @@ dependencies = [ [[package]] name = "zksync_concurrency" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4724d51934e475c846ba9e6ed169e25587385188b928a9ecfbbf616092a1c17" +checksum = "035269d811b3770debca372141ab64cad067dce8e58cb39a48cb7617d30c626b" dependencies = [ "anyhow", "once_cell", @@ -8422,87 +7508,28 @@ dependencies = [ [[package]] name = "zksync_config" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "rand 0.8.5", "secrecy", "serde", + "strum 0.26.3", + "strum_macros 0.26.4", + "time", "url", + "vise", "zksync_basic_types", "zksync_concurrency", "zksync_consensus_utils", "zksync_crypto_primitives", ] -[[package]] -name = "zksync_consensus_crypto" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7760e7a140f16f0435fbf2ad9a4b09feaad74568d05b553751d222f4803a42e" -dependencies = [ - "anyhow", - "blst", - "ed25519-dalek", - "elliptic-curve 0.13.8", - "hex", - "k256 0.13.3", - "num-bigint", - "num-traits", - "rand 0.8.5", - "sha3 0.10.8", - "thiserror", - "tracing", - "zeroize", -] - -[[package]] -name = "zksync_consensus_roles" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96f903187836210602beba27655e111e22efb229ef90bd2a95a3d6799b31685c" -dependencies = [ - "anyhow", - "bit-vec", - "hex", - "num-bigint", - "prost 0.12.3", - "rand 0.8.5", - "serde", - "thiserror", - "tracing", - "zksync_concurrency", - "zksync_consensus_crypto", - "zksync_consensus_utils", - "zksync_protobuf", - "zksync_protobuf_build", -] - -[[package]] -name = "zksync_consensus_storage" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff43cfd03ea205c763e74362dc6ec5a4d74b6b1baef0fb134dde92a8880397f7" -dependencies = [ - "anyhow", - "async-trait", - "prost 0.12.3", - "rand 0.8.5", - "thiserror", - "tracing", - "vise", - "zksync_concurrency", - "zksync_consensus_crypto", - "zksync_consensus_roles", - "zksync_protobuf", - "zksync_protobuf_build", -] - [[package]] name = "zksync_consensus_utils" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1020308512c01ab80327fb874b5b61c6fd513a6b26c8a5fce3e077600da04e4b" +checksum = "10bac8f471b182d4fa3d40cf158aac3624fe636a1ff0b4cf3fe26a0e20c68a42" dependencies = [ "anyhow", "rand 0.8.5", @@ -8513,7 +7540,7 @@ dependencies = [ [[package]] name = "zksync_contracts" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "envy", "ethabi 18.0.0", @@ -8527,7 +7554,7 @@ dependencies = [ [[package]] name = "zksync_crypto_primitives" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "blake2", @@ -8554,86 +7581,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "zksync_dal" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "anyhow", - "bigdecimal 0.4.5", - "bincode", - "chrono", - "hex", - "itertools 0.10.5", - "prost 0.12.3", - "rand 0.8.5", - "serde", - "serde_json", - "sqlx", - "strum 0.26.3", - "thiserror", - "tokio", - "tracing", - "vise", - "zksync_concurrency", - "zksync_consensus_roles", - "zksync_consensus_storage", - "zksync_contracts", - "zksync_db_connection", - "zksync_protobuf", - "zksync_protobuf_build", - "zksync_system_constants", - "zksync_types", - "zksync_utils", - "zksync_vm_interface", -] - -[[package]] -name = "zksync_db_connection" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "anyhow", - "rand 0.8.5", - "serde", - "serde_json", - "sqlx", - "thiserror", - "tokio", - "tracing", - "vise", - "zksync_basic_types", -] - -[[package]] -name = "zksync_eth_client" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "async-trait", - "jsonrpsee", - "rlp", - "thiserror", - "tracing", - "vise", - "zksync_config", - "zksync_contracts", - "zksync_eth_signer", - "zksync_types", - "zksync_web3_decl", -] - -[[package]] -name = "zksync_eth_signer" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "async-trait", - "rlp", - "thiserror", - "zksync_types", -] - [[package]] name = "zksync_ff" version = "0.30.1" @@ -8665,7 +7612,7 @@ dependencies = [ [[package]] name = "zksync_mini_merkle_tree" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "once_cell", "zksync_basic_types", @@ -8675,14 +7622,15 @@ dependencies = [ [[package]] name = "zksync_multivm" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "circuit_sequencer_api 0.133.1", "circuit_sequencer_api 0.140.3", "circuit_sequencer_api 0.141.2", "circuit_sequencer_api 0.142.2", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", + "ethabi 18.0.0", "hex", "itertools 0.10.5", "once_cell", @@ -8693,7 +7641,7 @@ dependencies = [ "zk_evm 0.133.0", "zk_evm 0.140.0", "zk_evm 0.141.0", - "zk_evm 0.150.5", + "zk_evm 0.150.6", "zksync_contracts", "zksync_system_constants", "zksync_types", @@ -8702,25 +7650,6 @@ dependencies = [ "zksync_vm_interface", ] -[[package]] -name = "zksync_node_fee_model" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "anyhow", - "async-trait", - "bigdecimal 0.4.5", - "tokio", - "tracing", - "vise", - "zksync_config", - "zksync_dal", - "zksync_eth_client", - "zksync_types", - "zksync_utils", - "zksync_web3_decl", -] - [[package]] name = "zksync_pairing" version = "0.30.1" @@ -8736,9 +7665,9 @@ dependencies = [ [[package]] name = "zksync_protobuf" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2d9ce9b9697daae6023c8da5cfe8764690a9d9c91ff32b8e1e54a7c8301fb3" +checksum = "abd55c64f54cb10967a435422f66ff5880ae14a232b245517c7ce38da32e0cab" dependencies = [ "anyhow", "bit-vec", @@ -8757,9 +7686,9 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903c23a12e160a703f9b68d0dd961daa24156af912ca1bc9efb74969f3acc645" +checksum = "4121952bcaf711005dd554612fc6e2de9b30cb58088508df87f1d38046ce8ac8" dependencies = [ "anyhow", "heck 0.5.0", @@ -8772,58 +7701,10 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "zksync_shared_metrics" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "rustc_version", - "tracing", - "vise", - "zksync_dal", - "zksync_types", -] - -[[package]] -name = "zksync_state" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "anyhow", - "async-trait", - "backon", - "chrono", - "itertools 0.10.5", - "mini-moka", - "once_cell", - "tokio", - "tracing", - "vise", - "zksync_dal", - "zksync_shared_metrics", - "zksync_storage", - "zksync_types", - "zksync_utils", - "zksync_vm_interface", -] - -[[package]] -name = "zksync_storage" -version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" -dependencies = [ - "num_cpus", - "once_cell", - "rocksdb", - "thread_local", - "tracing", - "vise", -] - [[package]] name = "zksync_system_constants" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "once_cell", "zksync_basic_types", @@ -8833,7 +7714,7 @@ dependencies = [ [[package]] name = "zksync_types" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "bigdecimal 0.4.5", @@ -8847,7 +7728,6 @@ dependencies = [ "once_cell", "prost 0.12.3", "rlp", - "secp256k1", "serde", "serde_json", "serde_with", @@ -8855,7 +7735,6 @@ dependencies = [ "thiserror", "tracing", "zksync_basic_types", - "zksync_config", "zksync_contracts", "zksync_crypto_primitives", "zksync_mini_merkle_tree", @@ -8868,7 +7747,7 @@ dependencies = [ [[package]] name = "zksync_utils" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "bigdecimal 0.4.5", @@ -8890,7 +7769,7 @@ dependencies = [ [[package]] name = "zksync_vlog" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "chrono", @@ -8915,20 +7794,20 @@ dependencies = [ [[package]] name = "zksync_vm2" -version = "0.1.0" -source = "git+https://github.com/matter-labs/vm2.git?rev=74577d9be13b1bff9d1a712389731f669b179e47#74577d9be13b1bff9d1a712389731f669b179e47" +version = "0.2.1" +source = "git+https://github.com/matter-labs/vm2.git?rev=df5bec3d04d64d434f9b0ccb285ba4681008f7b3#df5bec3d04d64d434f9b0ccb285ba4681008f7b3" dependencies = [ "enum_dispatch", "primitive-types 0.12.2", - "zk_evm_abstractions 0.150.5", - "zkevm_opcode_defs 0.150.5", + "zk_evm_abstractions 0.150.6", + "zkevm_opcode_defs 0.150.6", "zksync_vm2_interface", ] [[package]] name = "zksync_vm2_interface" -version = "0.1.0" -source = "git+https://github.com/matter-labs/vm2.git?rev=74577d9be13b1bff9d1a712389731f669b179e47#74577d9be13b1bff9d1a712389731f669b179e47" +version = "0.2.1" +source = "git+https://github.com/matter-labs/vm2.git?rev=df5bec3d04d64d434f9b0ccb285ba4681008f7b3#df5bec3d04d64d434f9b0ccb285ba4681008f7b3" dependencies = [ "primitive-types 0.12.2", ] @@ -8936,7 +7815,7 @@ dependencies = [ [[package]] name = "zksync_vm_interface" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "async-trait", @@ -8953,7 +7832,7 @@ dependencies = [ [[package]] name = "zksync_web3_decl" version = "0.1.0" -source = "git+https://github.com/matter-labs/zksync-era.git?rev=7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7#7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" +source = "git+https://github.com/matter-labs/zksync-era.git?rev=cfbcc11be0826e8c55fafa84ae01b2aead25d127#cfbcc11be0826e8c55fafa84ae01b2aead25d127" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 121cfb7f..c0784e9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,14 +12,12 @@ publish = false # We don't want to pub [dependencies] zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_defs.git", branch = "v1.5.0" } -zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_node_fee_model = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7" } -zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "7ad0425e00a44e0dd1c3abf38ab2f6335c2f86e7", features = [ +zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127" } +zksync_multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127" } +zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127" } +zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cfbcc11be0826e8c55fafa84ae01b2aead25d127", features = [ "server", ] } sha3 = "0.10.6" diff --git a/src/bootloader_debug.rs b/src/bootloader_debug.rs index 5aef27a7..816147b6 100644 --- a/src/bootloader_debug.rs +++ b/src/bootloader_debug.rs @@ -5,11 +5,11 @@ use zksync_multivm::{ use once_cell::sync::OnceCell; use zksync_basic_types::U256; +use zksync_multivm::interface::storage::WriteStorage; use zksync_multivm::vm_latest::{ constants::BOOTLOADER_HEAP_PAGE, BootloaderState, HistoryMode, SimpleMemory, VmTracer, ZkSyncVmState, }; -use zksync_state::interface::WriteStorage; /// Magic value that we put in bootloader.yul at the beginning of the debug section - to detect that /// debugger was enabled. diff --git a/src/config/cli.rs b/src/config/cli.rs index b6ddb85d..1aa08b67 100644 --- a/src/config/cli.rs +++ b/src/config/cli.rs @@ -74,6 +74,10 @@ pub struct Cli { #[arg(long)] pub dev_system_contracts: Option, + /// Enables EVM emulation. Currently, this requires local system contracts because there is no canonical EVM interpreter released yet. + #[arg(long, requires = "dev-system-contracts")] + pub emulate_evm: bool, + /// Log filter level - default: info #[arg(long)] pub log: Option, diff --git a/src/config/mod.rs b/src/config/mod.rs index df036715..b35af3b3 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -88,6 +88,14 @@ impl TestNodeConfig { DevSystemContracts::Local => system_contracts::Options::Local, }; } + if opt.emulate_evm { + assert_eq!( + self.node.system_contracts_options, + system_contracts::Options::Local, + "EVM emulation currently requires using local contracts" + ); + self.node.use_evm_emulator = true; + } // [`GasConfig`] if let Some(l1_gas_price) = &opt.l1_gas_price { @@ -140,6 +148,7 @@ pub mod node { pub show_gas_details: ShowGasDetails, pub resolve_hashes: bool, pub system_contracts_options: system_contracts::Options, + pub use_evm_emulator: bool, } impl Default for InMemoryNodeConfig { @@ -153,6 +162,7 @@ pub mod node { show_gas_details: Default::default(), resolve_hashes: Default::default(), system_contracts_options: Default::default(), + use_evm_emulator: false, } } } diff --git a/src/deps/mod.rs b/src/deps/mod.rs index 060ee37a..3e886afd 100644 --- a/src/deps/mod.rs +++ b/src/deps/mod.rs @@ -5,7 +5,7 @@ use zksync_types::{ H256, }; pub mod storage_view; -use zksync_state::interface::ReadStorage; +use zksync_multivm::interface::storage::ReadStorage; /// In-memory storage. #[derive(Debug, Default, Clone, PartialEq)] @@ -20,8 +20,12 @@ impl InMemoryStorage { chain_id: L2ChainId, bytecode_hasher: impl Fn(&[u8]) -> H256, system_contracts_options: &crate::system_contracts::Options, + use_evm_emulator: bool, ) -> Self { - let contracts = crate::system_contracts::get_deployed_contracts(system_contracts_options); + let contracts = crate::system_contracts::get_deployed_contracts( + system_contracts_options, + use_evm_emulator, + ); let system_context_init_log = get_system_context_init_logs(chain_id); diff --git a/src/deps/storage_view.rs b/src/deps/storage_view.rs index ae950652..a628ba2f 100644 --- a/src/deps/storage_view.rs +++ b/src/deps/storage_view.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, collections::HashMap, fmt, rc::Rc}; -use zksync_state::interface::{ReadStorage, WriteStorage}; +use zksync_multivm::interface::storage::{ReadStorage, WriteStorage}; use zksync_types::{StorageKey, StorageValue, H256}; /// `StorageView` is a buffer for `StorageLog`s between storage and transaction execution code. diff --git a/src/fork.rs b/src/fork.rs index 71d30c63..d85d1b37 100644 --- a/src/fork.rs +++ b/src/fork.rs @@ -28,7 +28,7 @@ use zksync_types::{ ProtocolVersionId, StorageKey, }; -use zksync_state::interface::ReadStorage; +use zksync_multivm::interface::storage::ReadStorage; use zksync_utils::{bytecode::hash_bytecode, h256_to_u256}; use zksync_web3_decl::{ @@ -124,6 +124,7 @@ impl ForkStorage { pub fn new( fork: Option, system_contracts_options: &system_contracts::Options, + use_evm_emulator: bool, ) -> Self { let chain_id = fork .as_ref() @@ -137,6 +138,7 @@ impl ForkStorage { chain_id, hash_bytecode, system_contracts_options, + use_evm_emulator, ), value_read_cache: Default::default(), fork, @@ -723,7 +725,7 @@ impl ForkDetails { #[cfg(test)] mod tests { use zksync_basic_types::{AccountTreeId, L1BatchNumber, H256}; - use zksync_state::interface::ReadStorage; + use zksync_multivm::interface::storage::ReadStorage; use zksync_types::{api::TransactionVariant, StorageKey}; use crate::config::cache::CacheConfig; @@ -769,11 +771,11 @@ mod tests { }; let mut fork_storage: ForkStorage = - ForkStorage::new(Some(fork_details), &options); + ForkStorage::new(Some(fork_details), &options, false); assert!(fork_storage.is_write_initial(&never_written_key)); assert!(!fork_storage.is_write_initial(&key_with_some_value)); - // This is the current limitation of the sytem. In theory, this should return false - as the value was written, but we don't have the API to the + // This is the current limitation of the system. In theory, this should return false - as the value was written, but we don't have the API to the // backend to get this information. assert!(fork_storage.is_write_initial(&key_with_value_0)); diff --git a/src/node/call_error_tracer.rs b/src/node/call_error_tracer.rs index 8af50257..ae10614f 100644 --- a/src/node/call_error_tracer.rs +++ b/src/node/call_error_tracer.rs @@ -1,3 +1,4 @@ +use zksync_multivm::interface::storage::WriteStorage; use zksync_multivm::{ tracers::dynamic::vm_1_5_0::DynTracer, vm_latest::{HistoryMode, SimpleMemory, VmTracer}, @@ -6,7 +7,6 @@ use zksync_multivm::{ vm_state::ErrorFlags, }, }; -use zksync_state::interface::WriteStorage; pub struct CallErrorTracer {} diff --git a/src/node/debug.rs b/src/node/debug.rs index 443443ea..441b754f 100644 --- a/src/node/debug.rs +++ b/src/node/debug.rs @@ -158,24 +158,19 @@ impl DebugNames ))) })?; - let mut l2_tx = match L2Tx::from_request(request.into(), MAX_TX_SIZE) { - Ok(tx) => tx, - Err(e) => { - let error = Web3Error::SerializationError(e); - return Err(into_jsrpc_error(error)); - } - }; + let system_contracts = inner.system_contracts.contracts_for_l2_call(); + let allow_no_target = system_contracts.evm_emulator.is_some(); + let mut l2_tx = L2Tx::from_request(request.into(), MAX_TX_SIZE, allow_no_target) + .map_err(|err| into_jsrpc_error(Web3Error::SerializationError(err)))?; let execution_mode = zksync_multivm::interface::TxExecutionMode::EthCall; let storage = StorageView::new(&inner.fork_storage).into_rc_ptr(); - let bootloader_code = inner.system_contracts.contracts_for_l2_call(); - // init vm let (mut l1_batch_env, _block_context) = inner.create_l1_batch_env(storage.clone()); // update the enforced_base_fee within l1_batch_env to match the logic in zksync_core l1_batch_env.enforced_base_fee = Some(l2_tx.common_data.fee.max_fee_per_gas.as_u64()); - let system_env = inner.create_system_env(bootloader_code.clone(), execution_mode); + let system_env = inner.create_system_env(system_contracts.clone(), execution_mode); let mut vm: Vm<_, HistoryDisabled> = Vm::new(l1_batch_env, system_env, storage); // We must inject *some* signature (otherwise bootloader code fails to generate hash). diff --git a/src/node/eth.rs b/src/node/eth.rs index 30995480..b7c87f7b 100644 --- a/src/node/eth.rs +++ b/src/node/eth.rs @@ -1,5 +1,6 @@ use std::collections::HashSet; +use anyhow::Context as _; use colored::Colorize; use futures::FutureExt; use itertools::Itertools; @@ -7,7 +8,7 @@ use zksync_basic_types::{ web3::{self, Bytes}, AccountTreeId, Address, H160, H256, U256, U64, }; -use zksync_multivm::interface::{ExecutionResult, TxExecutionMode}; +use zksync_multivm::interface::ExecutionResult; use zksync_multivm::vm_latest::constants::ETH_CALL_GAS_LIMIT; use zksync_types::{ api::{Block, BlockIdVariant, BlockNumber, TransactionVariant}, @@ -30,11 +31,173 @@ use crate::{ namespaces::{EthNamespaceT, EthTestNodeNamespaceT, RpcResult}, node::{InMemoryNode, TransactionResult, MAX_TX_SIZE, PROTOCOL_VERSION}, utils::{ - self, h256_to_u64, into_jsrpc_error, into_jsrpc_error_message, not_implemented, - report_into_jsrpc_error, IntoBoxedFuture, + self, h256_to_u64, into_jsrpc_error, not_implemented, report_into_jsrpc_error, + IntoBoxedFuture, TransparentError, }, }; +impl InMemoryNode { + fn call_impl( + &self, + req: zksync_types::transaction_request::CallRequest, + ) -> Result { + let system_contracts = self.system_contracts_for_l2_call()?; + let allow_no_target = system_contracts.evm_emulator.is_some(); + + let mut tx = L2Tx::from_request(req.into(), MAX_TX_SIZE, allow_no_target)?; + tx.common_data.fee.gas_limit = ETH_CALL_GAS_LIMIT.into(); + let call_result = self + .run_l2_call(tx, system_contracts) + .context("Invalid data due to invalid name")?; + + match call_result { + ExecutionResult::Success { output } => Ok(output.into()), + ExecutionResult::Revert { output } => { + let message = output.to_user_friendly_string(); + let pretty_message = format!( + "execution reverted{}{}", + if message.is_empty() { "" } else { ": " }, + message + ); + + tracing::info!("{}", pretty_message.on_red()); + Err(Web3Error::SubmitTransactionError( + pretty_message, + output.encoded_data(), + )) + } + ExecutionResult::Halt { reason } => { + let message = reason.to_string(); + let pretty_message = format!( + "execution halted {}{}", + if message.is_empty() { "" } else { ": " }, + message + ); + + tracing::info!("{}", pretty_message.on_red()); + Err(Web3Error::SubmitTransactionError(pretty_message, vec![])) + } + } + } + + fn send_raw_transaction_impl(&self, tx_bytes: Bytes) -> Result { + let chain_id = self + .get_inner() + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock for chain ID retrieval"))? + .fork_storage + .chain_id; + + let (tx_req, hash) = TransactionRequest::from_bytes(&tx_bytes.0, chain_id)?; + let system_contracts = self.system_contracts_for_tx(tx_req.from.unwrap_or_default())?; + let allow_no_target = system_contracts.evm_emulator.is_some(); + let mut l2_tx = L2Tx::from_request(tx_req, MAX_TX_SIZE, allow_no_target)?; + + l2_tx.set_input(tx_bytes.0, hash); + if hash != l2_tx.hash() { + let err = anyhow::anyhow!( + "Invalid transaction data: computed hash does not match the provided hash." + ); + return Err(err.into()); + }; + + self.run_l2_tx(l2_tx, system_contracts).map_err(|err| { + Web3Error::SubmitTransactionError( + format!("Execution error: {err}"), + hash.as_bytes().to_vec(), + ) + })?; + Ok(hash) + } + + fn send_transaction_impl( + &self, + tx: zksync_types::transaction_request::CallRequest, + ) -> Result { + let (chain_id, l1_gas_price) = { + let reader = self + .inner + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock"))?; + ( + reader.fork_storage.chain_id, + reader.fee_input_provider.l1_gas_price, + ) + }; + + let mut tx_req = TransactionRequest::from(tx.clone()); + // Users might expect a "sensible default" + if tx.gas.is_none() { + tx_req.gas = U256::from(MAX_L1_TRANSACTION_GAS_LIMIT); + } + + tx_req.chain_id = Some(chain_id.as_u64()); + + // EIP-1559 gas fields should be processed separately + if tx.gas_price.is_some() { + if tx.max_fee_per_gas.is_some() || tx.max_priority_fee_per_gas.is_some() { + let err = "Transaction contains unsupported fields: max_fee_per_gas or max_priority_fee_per_gas"; + tracing::error!("{err}"); + return Err(TransparentError(err.into()).into()); + } + } else { + tx_req.gas_price = tx.max_fee_per_gas.unwrap_or(U256::from(l1_gas_price)); + tx_req.max_priority_fee_per_gas = tx.max_priority_fee_per_gas; + if tx_req.transaction_type.is_none() { + tx_req.transaction_type = Some(zksync_types::EIP_1559_TX_TYPE.into()); + } + } + // Needed to calculate hash + tx_req.r = Some(U256::default()); + tx_req.s = Some(U256::default()); + tx_req.v = Some(U64::from(27)); + + let hash = tx_req.get_tx_hash()?; + let bytes = tx_req.get_signed_bytes(&PackedEthSignature::from_rsv( + &H256::default(), + &H256::default(), + 27, + ))?; + + let system_contracts = self.system_contracts_for_tx(tx_req.from.unwrap_or_default())?; + let allow_no_target = system_contracts.evm_emulator.is_some(); + let mut l2_tx: L2Tx = L2Tx::from_request(tx_req, MAX_TX_SIZE, allow_no_target)?; + + // `v` was overwritten with 0 during converting into l2 tx + let mut signature = vec![0u8; 65]; + signature[64] = 27; + l2_tx.common_data.signature = signature; + + l2_tx.set_input(bytes, hash); + + { + let reader = self + .inner + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock for accounts."))?; + if !reader + .impersonated_accounts + .contains(&l2_tx.common_data.initiator_address) + { + let err = format!( + "Initiator address {:?} is not allowed to perform transactions", + l2_tx.common_data.initiator_address + ); + tracing::error!("{err}"); + return Err(TransparentError(err).into()); + } + } + + self.run_l2_tx(l2_tx, system_contracts).map_err(|err| { + Web3Error::SubmitTransactionError( + format!("Execution error: {err}"), + hash.as_bytes().to_vec(), + ) + })?; + Ok(hash) + } +} + impl EthNamespaceT for InMemoryNode { @@ -64,59 +227,9 @@ impl EthNamespa req: zksync_types::transaction_request::CallRequest, _block: Option, ) -> RpcResult { - match L2Tx::from_request(req.into(), MAX_TX_SIZE) { - Ok(mut tx) => { - tx.common_data.fee.gas_limit = ETH_CALL_GAS_LIMIT.into(); - let result = self.run_l2_call(tx); - - match result { - Ok(execution_result) => match execution_result { - ExecutionResult::Success { output } => { - Ok(output.into()).into_boxed_future() - } - ExecutionResult::Revert { output } => { - let message = output.to_user_friendly_string(); - let pretty_message = format!( - "execution reverted{}{}", - if message.is_empty() { "" } else { ": " }, - message - ); - - tracing::info!("{}", pretty_message.on_red()); - Err(into_jsrpc_error(Web3Error::SubmitTransactionError( - pretty_message, - output.encoded_data(), - ))) - .into_boxed_future() - } - ExecutionResult::Halt { reason } => { - let message = reason.to_string(); - let pretty_message = format!( - "execution halted {}{}", - if message.is_empty() { "" } else { ": " }, - message - ); - - tracing::info!("{}", pretty_message.on_red()); - Err(into_jsrpc_error(Web3Error::SubmitTransactionError( - pretty_message, - vec![], - ))) - .into_boxed_future() - } - }, - Err(e) => { - let error_message = format!("Invalid data due to invalid name: {}", e); - let error = Web3Error::InternalError(anyhow::Error::msg(error_message)); - Err(into_jsrpc_error(error)).into_boxed_future() - } - } - } - Err(e) => { - let error = Web3Error::SerializationError(e); - Err(into_jsrpc_error(error)).into_boxed_future() - } - } + self.call_impl(req) + .map_err(into_jsrpc_error) + .into_boxed_future() } /// Returns the balance of the specified address. @@ -358,52 +471,10 @@ impl EthNamespa /// # Returns /// /// A future that resolves to the hash of the transaction if successful, or an error if the transaction is invalid or execution fails. - fn send_raw_transaction(&self, tx_bytes: Bytes) -> RpcResult { - let chain_id = match self.get_inner().read() { - Ok(reader) => reader.fork_storage.chain_id, - Err(_) => { - return futures::future::err(into_jsrpc_error(Web3Error::InternalError( - anyhow::Error::msg("Failed to acquire read lock for chain ID retrieval"), - ))) - .boxed() - } - }; - - let (tx_req, hash) = match TransactionRequest::from_bytes(&tx_bytes.0, chain_id) { - Ok(result) => result, - Err(e) => { - return futures::future::err(into_jsrpc_error(Web3Error::SerializationError(e))) - .boxed() - } - }; - - let mut l2_tx: L2Tx = match L2Tx::from_request(tx_req, MAX_TX_SIZE) { - Ok(tx) => tx, - Err(e) => { - return futures::future::err(into_jsrpc_error(Web3Error::SerializationError(e))) - .boxed() - } - }; - - l2_tx.set_input(tx_bytes.0, hash); - if hash != l2_tx.hash() { - let error_message = - "Invalid transaction data: computed hash does not match the provided hash."; - let web3_error = Web3Error::InternalError(anyhow::Error::msg(error_message)); - return futures::future::err(into_jsrpc_error(web3_error)).boxed(); - }; - - match self.run_l2_tx(l2_tx.clone(), TxExecutionMode::VerifyExecute) { - Ok(_) => Ok(hash).into_boxed_future(), - Err(e) => { - let error_message = format!("Execution error: {}", e); - futures::future::err(into_jsrpc_error(Web3Error::SubmitTransactionError( - error_message, - l2_tx.hash().as_bytes().to_vec(), - ))) - .boxed() - } - } + fn send_raw_transaction(&self, tx_bytes: Bytes) -> RpcResult { + self.send_raw_transaction_impl(tx_bytes) + .map_err(into_jsrpc_error) + .into_boxed_future() } /// Returns a block by its hash. Currently, only hashes for blocks in memory are supported. @@ -1391,113 +1462,10 @@ impl EthTestNod fn send_transaction( &self, tx: zksync_types::transaction_request::CallRequest, - ) -> jsonrpc_core::BoxFuture> { - let (chain_id, l1_gas_price) = match self.get_inner().read() { - Ok(reader) => ( - reader.fork_storage.chain_id, - reader.fee_input_provider.l1_gas_price, - ), - Err(_) => { - return futures::future::err(into_jsrpc_error_message( - "Failed to acquire read lock for chain ID retrieval.".to_string(), - )) - .boxed() - } - }; - - let mut tx_req = TransactionRequest::from(tx.clone()); - // Users might expect a "sensible default" - if tx.gas.is_none() { - tx_req.gas = U256::from(MAX_L1_TRANSACTION_GAS_LIMIT); - } - - tx_req.chain_id = Some(chain_id.as_u64()); - - // EIP-1559 gas fields should be processed separately - if tx.gas_price.is_some() { - if tx.max_fee_per_gas.is_some() || tx.max_priority_fee_per_gas.is_some() { - let error_message = "Transaction contains unsupported fields: max_fee_per_gas or max_priority_fee_per_gas"; - tracing::error!("{}", error_message); - return futures::future::err(into_jsrpc_error_message(error_message.to_string())) - .boxed(); - } - } else { - tx_req.gas_price = tx.max_fee_per_gas.unwrap_or(U256::from(l1_gas_price)); - tx_req.max_priority_fee_per_gas = tx.max_priority_fee_per_gas; - if tx_req.transaction_type.is_none() { - tx_req.transaction_type = Some(zksync_types::EIP_1559_TX_TYPE.into()); - } - } - // Needed to calculate hash - tx_req.r = Some(U256::default()); - tx_req.s = Some(U256::default()); - tx_req.v = Some(U64::from(27)); - - let hash = match tx_req.get_tx_hash() { - Ok(result) => result, - Err(e) => { - tracing::error!("Transaction request serialization error: {}", e); - return futures::future::err(into_jsrpc_error(Web3Error::SerializationError(e))) - .boxed(); - } - }; - let bytes = match tx_req.get_signed_bytes(&PackedEthSignature::from_rsv( - &H256::default(), - &H256::default(), - 27, - )) { - Ok(result) => result, - Err(e) => { - tracing::error!("Transaction request serialization error: {}", e); - return futures::future::err(into_jsrpc_error(Web3Error::SerializationError(e))) - .boxed(); - } - }; - let mut l2_tx: L2Tx = match L2Tx::from_request(tx_req, MAX_TX_SIZE) { - Ok(tx) => tx, - Err(e) => { - tracing::error!("Transaction serialization error: {}", e); - return futures::future::err(into_jsrpc_error(Web3Error::SerializationError(e))) - .boxed(); - } - }; - - // `v` was overwritten with 0 during converting into l2 tx - let mut signature = vec![0u8; 65]; - signature[64] = 27; - l2_tx.common_data.signature = signature; - - l2_tx.set_input(bytes, hash); - - match self.get_inner().read() { - Ok(reader) => { - if !reader - .impersonated_accounts - .contains(&l2_tx.common_data.initiator_address) - { - let error_message = format!( - "Initiator address {:?} is not allowed to perform transactions", - l2_tx.common_data.initiator_address - ); - tracing::error!("{}", error_message); - return futures::future::err(into_jsrpc_error_message(error_message)).boxed(); - } - } - Err(_) => { - return futures::future::err(into_jsrpc_error_message( - "Failed to acquire read lock for accounts.".to_string(), - )) - .boxed() - } - } - - match self.run_l2_tx(l2_tx.clone(), TxExecutionMode::VerifyExecute) { - Ok(_) => Ok(l2_tx.hash()).into_boxed_future(), - Err(e) => { - let error_message = format!("Execution error: {}", e); - futures::future::err(into_jsrpc_error_message(error_message)).boxed() - } - } + ) -> jsonrpc_core::BoxFuture> { + self.send_transaction_impl(tx) + .map_err(into_jsrpc_error) + .into_boxed_future() } } diff --git a/src/node/fee_model.rs b/src/node/fee_model.rs index 1f03bfcb..9984422a 100644 --- a/src/node/fee_model.rs +++ b/src/node/fee_model.rs @@ -1,6 +1,4 @@ -use std::fmt::Debug; -use zksync_node_fee_model::BatchFeeModelInputProvider; -use zksync_types::fee_model::{FeeModelConfigV2, FeeParams, FeeParamsV2}; +use zksync_types::fee_model::{BatchFeeInput, FeeModelConfigV2, FeeParams, FeeParamsV2}; use zksync_types::L1_GAS_PER_PUBDATA_BYTE; use crate::config::gas::{ @@ -103,10 +101,8 @@ impl TestNodeFeeInputProvider { max_pubdata_per_batch: self.max_pubdata_per_batch, } } -} -impl BatchFeeModelInputProvider for TestNodeFeeInputProvider { - fn get_fee_model_params(&self) -> FeeParams { + fn get_params(&self) -> FeeParams { // TODO: consider using old fee model for the olds blocks, when forking FeeParams::V2(FeeParamsV2::new( self.get_fee_model_config(), @@ -115,6 +111,15 @@ impl BatchFeeModelInputProvider for TestNodeFeeInputProvider { Default::default(), )) } + + pub(crate) fn get_batch_fee_input(&self) -> BatchFeeInput { + self.get_params().scale(1.0, 1.0) + } + + pub(crate) fn get_batch_fee_input_scaled(&self) -> BatchFeeInput { + let scale_factor = self.estimate_gas_price_scale_factor; + self.get_params().scale(scale_factor, scale_factor) + } } impl Default for TestNodeFeeInputProvider { diff --git a/src/node/in_memory.rs b/src/node/in_memory.rs index 5e6b70f4..933db585 100644 --- a/src/node/in_memory.rs +++ b/src/node/in_memory.rs @@ -10,7 +10,7 @@ use crate::{ constants::{LEGACY_RICH_WALLETS, RICH_WALLETS}, deps::{storage_view::StorageView, InMemoryStorage}, filters::EthFilters, - fork::{block_on, ForkDetails, ForkSource, ForkStorage}, + fork::{ForkDetails, ForkSource, ForkStorage}, formatter, node::{ call_error_tracer::CallErrorTracer, fee_model::TestNodeFeeInputProvider, @@ -20,6 +20,7 @@ use crate::{ system_contracts::{self, SystemContracts}, utils::{bytecode_to_factory_dep, create_debug_output, into_jsrpc_error, to_human_size}, }; +use anyhow::Context as _; use colored::Colorize; use indexmap::IndexMap; use once_cell::sync::OnceCell; @@ -35,6 +36,7 @@ use zksync_basic_types::{ U256, U64, }; use zksync_contracts::BaseSystemContracts; +use zksync_multivm::interface::storage::{ReadStorage, StoragePtr, WriteStorage}; use zksync_multivm::{ interface::{ Call, ExecutionResult, L1BatchEnv, L2Block, L2BlockEnv, SystemEnv, TxExecutionMode, @@ -53,11 +55,9 @@ use zksync_multivm::{ vm_latest::{ constants::{BATCH_GAS_LIMIT, MAX_VM_PUBDATA_PER_BATCH}, utils::l2_blocks::load_last_l2_block, - ToTracerPointer, TracerPointer, Vm, + ToTracerPointer, Vm, }, }; -use zksync_node_fee_model::BatchFeeModelInputProvider; -use zksync_state::interface::{ReadStorage, StoragePtr, WriteStorage}; use zksync_types::{ api::{Block, DebugCall, Log, TransactionReceipt, TransactionVariant}, block::{unpack_block_info, L2BlockHasher}, @@ -236,10 +236,17 @@ impl InMemoryNodeInner { blocks, block_hashes, filters: Default::default(), - fork_storage: ForkStorage::new(fork, &config.system_contracts_options), + fork_storage: ForkStorage::new( + fork, + &config.system_contracts_options, + config.use_evm_emulator, + ), config, console_log_handler: ConsoleLogHandler::default(), - system_contracts: SystemContracts::from_options(&config.system_contracts_options), + system_contracts: SystemContracts::from_options( + &config.system_contracts_options, + config.use_evm_emulator, + ), impersonated_accounts: Default::default(), rich_accounts: HashSet::new(), previous_states: Default::default(), @@ -267,10 +274,17 @@ impl InMemoryNodeInner { blocks, block_hashes, filters: Default::default(), - fork_storage: ForkStorage::new(fork, &config.system_contracts_options), + fork_storage: ForkStorage::new( + fork, + &config.system_contracts_options, + config.use_evm_emulator, + ), config, console_log_handler: ConsoleLogHandler::default(), - system_contracts: SystemContracts::from_options(&config.system_contracts_options), + system_contracts: SystemContracts::from_options( + &config.system_contracts_options, + config.use_evm_emulator, + ), impersonated_accounts: Default::default(), rich_accounts: HashSet::new(), previous_states: Default::default(), @@ -310,29 +324,21 @@ impl InMemoryNodeInner { ) .new_batch(); - let fee_input: BatchFeeInput; - - if let Some(fork) = &self + let fee_input = if let Some(fork) = &self .fork_storage .inner .read() .expect("fork_storage lock is already held by the current thread") .fork { - fee_input = BatchFeeInput::PubdataIndependent(PubdataIndependentBatchFeeModelInput { + BatchFeeInput::PubdataIndependent(PubdataIndependentBatchFeeModelInput { l1_gas_price: fork.l1_gas_price, fair_l2_gas_price: fork.l2_fair_gas_price, fair_pubdata_price: fork.fair_pubdata_price, - }); + }) } else { - let fee_input_provider = self.fee_input_provider.clone(); - fee_input = block_on(async move { - fee_input_provider - .get_batch_fee_input_scaled(1.0, 1.0) - .await - .unwrap() - }); - } + self.fee_input_provider.get_batch_fee_input() + }; let batch_env = L1BatchEnv { // TODO: set the previous batch hash properly (take from fork, when forking, and from local storage, when this is not the first block). @@ -404,30 +410,27 @@ impl InMemoryNodeInner { let is_eip712 = request_with_gas_per_pubdata_overridden .eip712_meta .is_some(); + let initiator_address = request_with_gas_per_pubdata_overridden + .from + .unwrap_or_default(); + let impersonating = self.impersonated_accounts.contains(&initiator_address); + let system_contracts = self + .system_contracts + .contracts_for_fee_estimate(impersonating) + .clone(); + let allow_no_target = system_contracts.evm_emulator.is_some(); - let mut l2_tx = - match L2Tx::from_request(request_with_gas_per_pubdata_overridden.into(), MAX_TX_SIZE) { - Ok(tx) => tx, - Err(e) => { - let error = Web3Error::SerializationError(e); - return Err(into_jsrpc_error(error)); - } - }; + let mut l2_tx = L2Tx::from_request( + request_with_gas_per_pubdata_overridden.into(), + MAX_TX_SIZE, + allow_no_target, + ) + .map_err(|err| into_jsrpc_error(Web3Error::SerializationError(err)))?; let tx: Transaction = l2_tx.clone().into(); - let fee_input_provider = self.fee_input_provider.clone(); let fee_input = { - let fee_input = block_on(async move { - fee_input_provider - .get_batch_fee_input_scaled( - fee_input_provider.estimate_gas_price_scale_factor, - fee_input_provider.estimate_gas_price_scale_factor, - ) - .await - .unwrap() - }); - + let fee_input = self.fee_input_provider.get_batch_fee_input_scaled(); // In order for execution to pass smoothly, we need to ensure that block's required gasPerPubdata will be // <= to the one in the transaction itself. adjust_pubdata_price_for_tx( @@ -465,16 +468,7 @@ impl InMemoryNodeInner { let (mut batch_env, _) = self.create_l1_batch_env(storage.clone()); batch_env.fee_input = fee_input; - let impersonating = self - .impersonated_accounts - .contains(&l2_tx.common_data.initiator_address); - - let system_env = self.create_system_env( - self.system_contracts - .contracts_for_fee_estimate(impersonating) - .clone(), - execution_mode, - ); + let system_env = self.create_system_env(system_contracts, execution_mode); // When the pubdata cost grows very high, the total gas limit required may become very high as well. If // we do binary search over any possible gas limit naively, we may end up with a very high number of iterations, @@ -975,11 +969,14 @@ impl InMemoryNode { } /// Applies multiple transactions - but still one per L1 batch. - pub fn apply_txs(&self, txs: Vec) -> Result<(), String> { + pub fn apply_txs(&self, txs: Vec) -> anyhow::Result<()> { tracing::info!("Running {:?} transactions (one per batch)", txs.len()); for tx in txs { - self.run_l2_tx(tx, TxExecutionMode::VerifyExecute)?; + // Getting contracts is reasonably cheap, so we don't cache them. We may need differing contracts + // depending on whether impersonation should be enabled for a transaction. + let system_contracts = self.system_contracts_for_tx(tx.initiator_account())?; + self.run_l2_tx(tx, system_contracts)?; } Ok(()) @@ -1009,23 +1006,55 @@ impl InMemoryNode { inner.rich_accounts.insert(address); } + pub fn system_contracts_for_l2_call(&self) -> anyhow::Result { + let inner = self + .inner + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock"))?; + Ok(inner.system_contracts.contracts_for_l2_call().clone()) + } + + pub fn system_contracts_for_tx( + &self, + tx_initiator: Address, + ) -> anyhow::Result { + let inner = self + .inner + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock"))?; + Ok(if inner.impersonated_accounts.contains(&tx_initiator) { + tracing::info!("🕵️ Executing tx from impersonated account {tx_initiator:?}"); + inner + .system_contracts + .contracts(TxExecutionMode::VerifyExecute, true) + .clone() + } else { + inner + .system_contracts + .contracts(TxExecutionMode::VerifyExecute, false) + .clone() + }) + } + /// Runs L2 'eth call' method - that doesn't commit to a block. - pub fn run_l2_call(&self, mut l2_tx: L2Tx) -> Result { + pub fn run_l2_call( + &self, + mut l2_tx: L2Tx, + base_contracts: BaseSystemContracts, + ) -> anyhow::Result { let execution_mode = TxExecutionMode::EthCall; let inner = self .inner - .write() - .map_err(|e| format!("Failed to acquire write lock: {}", e))?; + .read() + .map_err(|_| anyhow::anyhow!("Failed to acquire write lock"))?; let storage = StorageView::new(&inner.fork_storage).into_rc_ptr(); - let bootloader_code = inner.system_contracts.contracts_for_l2_call(); - // init vm let (batch_env, _) = inner.create_l1_batch_env(storage.clone()); - let system_env = inner.create_system_env(bootloader_code.clone(), execution_mode); + let system_env = inner.create_system_env(base_contracts, execution_mode); let mut vm: Vm<_, HistoryDisabled> = Vm::new(batch_env, system_env, storage.clone()); @@ -1251,13 +1280,13 @@ impl InMemoryNode { } } - // Validates L2 transaction - fn validate_tx(&self, tx: &L2Tx) -> Result<(), String> { + /// Validates L2 transaction + fn validate_tx(&self, tx: &L2Tx) -> anyhow::Result<()> { let max_gas = U256::from(u64::MAX); if tx.common_data.fee.gas_limit > max_gas || tx.common_data.fee.gas_per_pubdata_limit > max_gas { - return Err("exceeds block gas limit".into()); + anyhow::bail!("exceeds block gas limit"); } let l2_gas_price = self @@ -1272,7 +1301,7 @@ impl InMemoryNode { tx.hash(), tx.common_data.fee.max_fee_per_gas ); - return Err("block base fee higher than max fee per gas".into()); + anyhow::bail!("block base fee higher than max fee per gas"); } if tx.common_data.fee.max_fee_per_gas < tx.common_data.fee.max_priority_fee_per_gas { @@ -1281,7 +1310,7 @@ impl InMemoryNode { tx.hash(), tx.common_data.fee.max_fee_per_gas ); - return Err("max priority fee per gas higher than max fee per gas".into()); + anyhow::bail!("max priority fee per gas higher than max fee per gas"); } Ok(()) } @@ -1311,36 +1340,16 @@ impl InMemoryNode { pub fn run_l2_tx_raw( &self, l2_tx: L2Tx, - execution_mode: TxExecutionMode, - mut tracers: Vec< - TracerPointer>, zksync_multivm::vm_latest::HistoryDisabled>, - >, + system_contracts: BaseSystemContracts, execute_bootloader: bool, - ) -> Result { + ) -> anyhow::Result { let inner = self .inner .read() - .map_err(|e| format!("Failed to acquire read lock: {}", e))?; - + .map_err(|_| anyhow::anyhow!("Failed to acquire read lock"))?; let storage = StorageView::new(inner.fork_storage.clone()).into_rc_ptr(); - let (batch_env, block_ctx) = inner.create_l1_batch_env(storage.clone()); - - let bootloader_code = { - if inner - .impersonated_accounts - .contains(&l2_tx.common_data.initiator_address) - { - tracing::info!( - "🕵️ Executing tx from impersonated account {:?}", - l2_tx.common_data.initiator_address - ); - inner.system_contracts.contracts(execution_mode, true) - } else { - inner.system_contracts.contracts(execution_mode, false) - } - }; - let system_env = inner.create_system_env(bootloader_code.clone(), execution_mode); + let system_env = inner.create_system_env(system_contracts, TxExecutionMode::VerifyExecute); let mut vm: Vm<_, HistoryDisabled> = Vm::new(batch_env.clone(), system_env, storage.clone()); @@ -1350,19 +1359,17 @@ impl InMemoryNode { let call_tracer_result = Arc::new(OnceCell::default()); let bootloader_debug_result = Arc::new(OnceCell::default()); - tracers.push(CallErrorTracer::new().into_tracer_pointer()); - tracers.push(CallTracer::new(call_tracer_result.clone()).into_tracer_pointer()); - tracers.push( + let tracers = vec![ + CallErrorTracer::new().into_tracer_pointer(), + CallTracer::new(call_tracer_result.clone()).into_tracer_pointer(), BootloaderDebugTracer { result: bootloader_debug_result.clone(), } .into_tracer_pointer(), - ); - + ]; let (compressed_bytecodes, tx_result) = vm.inspect_transaction_with_bytecode_compression(&mut tracers.into(), tx.clone(), true); - let compressed_bytecodes = - compressed_bytecodes.map_err(|err| format!("failed compressing bytecodes: {err:?}"))?; + let compressed_bytecodes = compressed_bytecodes.context("failed compressing bytecodes")?; let call_traces = call_tracer_result.get().unwrap(); @@ -1476,15 +1483,12 @@ impl InMemoryNode { }; let mut bytecodes = HashMap::new(); - for b in compressed_bytecodes.iter() { - let hashcode = match bytecode_to_factory_dep(b.original.clone()) { - Ok(hc) => hc, - Err(error) => { - tracing::error!("{}", format!("cannot convert bytecode: {}", error).on_red()); - return Err(error.to_string()); - } - }; - bytecodes.insert(hashcode.0, hashcode.1); + for b in &*compressed_bytecodes { + let (hash, bytecode) = bytecode_to_factory_dep(b.original.clone()).map_err(|err| { + tracing::error!("{}", format!("cannot convert bytecode: {err}").on_red()); + err + })?; + bytecodes.insert(hash, bytecode); } if execute_bootloader { vm.execute(VmExecutionMode::Bootloader); @@ -1503,19 +1507,18 @@ impl InMemoryNode { } /// Runs L2 transaction and commits it to a new block. - pub fn run_l2_tx(&self, l2_tx: L2Tx, execution_mode: TxExecutionMode) -> Result<(), String> { + pub fn run_l2_tx( + &self, + l2_tx: L2Tx, + system_contracts: BaseSystemContracts, + ) -> anyhow::Result<()> { let tx_hash = l2_tx.hash(); let transaction_type = l2_tx.common_data.transaction_type; tracing::info!(""); tracing::info!("Validating {}", format!("{:?}", tx_hash).bold()); - match self.validate_tx(&l2_tx) { - Ok(_) => (), - Err(e) => { - return Err(e); - } - }; + self.validate_tx(&l2_tx)?; tracing::info!("Executing {}", format!("{:?}", tx_hash).bold()); @@ -1523,24 +1526,24 @@ impl InMemoryNode { let mut inner = self .inner .write() - .map_err(|e| format!("Failed to acquire write lock: {}", e))?; + .map_err(|_| anyhow::anyhow!("Failed to acquire write lock"))?; inner.filters.notify_new_pending_transaction(tx_hash); } let (keys, result, call_traces, block, bytecodes, block_ctx) = - self.run_l2_tx_raw(l2_tx.clone(), execution_mode, vec![], true)?; + self.run_l2_tx_raw(l2_tx.clone(), system_contracts, true)?; if let ExecutionResult::Halt { reason } = result.result { // Halt means that something went really bad with the transaction execution (in most cases invalid signature, // but it could also be bootloader panic etc). // In such case, we should not persist the VM data, and we should pretend that transaction never existed. - return Err(format!("Transaction HALT: {}", reason)); + anyhow::bail!("Transaction HALT: {reason}"); } // Write all the mutated keys (storage slots). let mut inner = self .inner .write() - .map_err(|e| format!("Failed to acquire write lock: {}", e))?; + .map_err(|_| anyhow::anyhow!("Failed to acquire write lock"))?; for (key, value) in keys.iter() { inner.fork_storage.set_value(*key, *value); } @@ -1811,9 +1814,11 @@ mod tests { .build(); node.set_rich_account(tx.common_data.initiator_address); - let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); - - assert_eq!(result.err(), Some("exceeds block gas limit".into())); + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); + let err = node.run_l2_tx(tx, system_contracts).unwrap_err(); + assert_eq!(err.to_string(), "exceeds block gas limit"); } #[tokio::test] @@ -1824,11 +1829,14 @@ mod tests { .build(); node.set_rich_account(tx.common_data.initiator_address); - let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); + let err = node.run_l2_tx(tx, system_contracts).unwrap_err(); assert_eq!( - result.err(), - Some("block base fee higher than max fee per gas".into()) + err.to_string(), + "block base fee higher than max fee per gas" ); } @@ -1840,11 +1848,14 @@ mod tests { .build(); node.set_rich_account(tx.common_data.initiator_address); - let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); + let err = node.run_l2_tx(tx, system_contracts).unwrap_err(); assert_eq!( - result.err(), - Some("max priority fee per gas higher than max fee per gas".into()) + err.to_string(), + "max priority fee per gas higher than max fee per gas" ); } @@ -1885,7 +1896,10 @@ mod tests { let node = InMemoryNode::::default(); let tx = testing::TransactionBuilder::new().build(); node.set_rich_account(tx.common_data.initiator_address); - node.run_l2_tx(tx, TxExecutionMode::VerifyExecute).unwrap(); + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); + node.run_l2_tx(tx, system_contracts).unwrap(); let external_storage = node.inner.read().unwrap().fork_storage.clone(); // Execute next transaction using a fresh in-memory node and the external fork storage @@ -1914,13 +1928,12 @@ mod tests { Default::default(), ); - node.run_l2_tx_raw( - testing::TransactionBuilder::new().build(), - TxExecutionMode::VerifyExecute, - vec![], - true, - ) - .expect("transaction must pass with external storage"); + let tx = testing::TransactionBuilder::new().build(); + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); + node.run_l2_tx_raw(tx, system_contracts, true) + .expect("transaction must pass with external storage"); } #[tokio::test] @@ -1968,8 +1981,12 @@ mod tests { .expect("failed signing tx"); tx.common_data.transaction_type = TransactionType::LegacyTransaction; tx.set_input(vec![], H256::repeat_byte(0x2)); + + let system_contracts = node + .system_contracts_for_tx(tx.initiator_account()) + .unwrap(); let (_, result, ..) = node - .run_l2_tx_raw(tx, TxExecutionMode::VerifyExecute, vec![], true) + .run_l2_tx_raw(tx, system_contracts, true) .expect("failed tx"); match result.result { diff --git a/src/node/in_memory_ext.rs b/src/node/in_memory_ext.rs index 0a793246..4eebb901 100644 --- a/src/node/in_memory_ext.rs +++ b/src/node/in_memory_ext.rs @@ -398,7 +398,7 @@ mod tests { use std::str::FromStr; use std::sync::{Arc, RwLock}; use zksync_basic_types::{Nonce, H256}; - use zksync_state::interface::ReadStorage; + use zksync_multivm::interface::storage::ReadStorage; use zksync_types::{api::BlockNumber, fee::Fee, l2::L2Tx, PackedEthSignature}; #[tokio::test] @@ -514,7 +514,7 @@ mod tests { blocks: Default::default(), block_hashes: Default::default(), filters: Default::default(), - fork_storage: ForkStorage::new(None, &old_system_contracts_options), + fork_storage: ForkStorage::new(None, &old_system_contracts_options, false), config: Default::default(), console_log_handler: Default::default(), system_contracts: Default::default(), diff --git a/src/system_contracts.rs b/src/system_contracts.rs index 823c4d81..6b2aa05d 100644 --- a/src/system_contracts.rs +++ b/src/system_contracts.rs @@ -1,6 +1,6 @@ use serde::Deserialize; use zksync_contracts::{ - read_sys_contract_bytecode, read_zbin_bytecode, BaseSystemContracts, ContractLanguage, + read_bootloader_code, read_sys_contract_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode, }; use zksync_multivm::interface::TxExecutionMode; @@ -30,30 +30,39 @@ pub struct SystemContracts { pub fee_estimate_impersonating_contracts: BaseSystemContracts, } -pub fn get_deployed_contracts(options: &Options) -> Vec { +pub fn get_deployed_contracts( + options: &Options, + use_evm_emulator: bool, +) -> Vec { match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => COMPILED_IN_SYSTEM_CONTRACTS.clone(), - Options::Local => get_system_smart_contracts(), + Options::Local => get_system_smart_contracts(use_evm_emulator), } } impl Default for SystemContracts { /// Creates SystemContracts that use compiled-in contracts. fn default() -> Self { - SystemContracts::from_options(&Options::BuiltIn) + SystemContracts::from_options(&Options::BuiltIn, false) } } impl SystemContracts { /// Creates the SystemContracts that use the complied contracts from ZKSYNC_HOME path. /// These are loaded at binary runtime. - pub fn from_options(options: &Options) -> Self { + pub fn from_options(options: &Options, use_evm_emulator: bool) -> Self { Self { - baseline_contracts: baseline_contracts(options), - playground_contracts: playground(options), - fee_estimate_contracts: fee_estimate_contracts(options), - baseline_impersonating_contracts: baseline_impersonating_contracts(options), - fee_estimate_impersonating_contracts: fee_estimate_impersonating_contracts(options), + baseline_contracts: baseline_contracts(options, use_evm_emulator), + playground_contracts: playground(options, use_evm_emulator), + fee_estimate_contracts: fee_estimate_contracts(options, use_evm_emulator), + baseline_impersonating_contracts: baseline_impersonating_contracts( + options, + use_evm_emulator, + ), + fee_estimate_impersonating_contracts: fee_estimate_impersonating_contracts( + options, + use_evm_emulator, + ), } } pub fn contracts_for_l2_call(&self) -> &BaseSystemContracts { @@ -91,6 +100,7 @@ impl SystemContracts { fn bsc_load_with_bootloader( bootloader_bytecode: Vec, options: &Options, + use_evm_emulator: bool, ) -> BaseSystemContracts { let hash = hash_bytecode(&bootloader_bytecode); @@ -99,7 +109,7 @@ fn bsc_load_with_bootloader( hash, }; - let bytecode = match options { + let aa_bytecode = match options { Options::BuiltIn => bytecode_from_slice( "DefaultAccount", include_bytes!("deps/contracts/DefaultAccount.json"), @@ -111,93 +121,99 @@ fn bsc_load_with_bootloader( ), }; - let hash = hash_bytecode(&bytecode); - + let aa_hash = hash_bytecode(&aa_bytecode); let default_aa = SystemContractCode { - code: bytes_to_be_words(bytecode), - hash, + code: bytes_to_be_words(aa_bytecode), + hash: aa_hash, + }; + + let evm_emulator = if use_evm_emulator { + let evm_emulator_bytecode = match options { + Options::Local => read_sys_contract_bytecode("", "EvmEmulator", ContractLanguage::Yul), + Options::BuiltIn | Options::BuiltInWithoutSecurity => { + panic!("no built-in EVM emulator yet") + } + }; + let evm_emulator_hash = hash_bytecode(&evm_emulator_bytecode); + Some(SystemContractCode { + code: bytes_to_be_words(evm_emulator_bytecode), + hash: evm_emulator_hash, + }) + } else { + None }; BaseSystemContracts { bootloader, default_aa, + evm_emulator, } } /// BaseSystemContracts with playground bootloader - used for handling 'eth_calls'. -pub fn playground(options: &Options) -> BaseSystemContracts { +pub fn playground(options: &Options, use_evm_emulator: bool) -> BaseSystemContracts { let bootloader_bytecode = match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => { include_bytes!("deps/contracts/playground_batch.yul.zbin").to_vec() } - Options::Local => read_zbin_bytecode( - "contracts/system-contracts/bootloader/build/artifacts/playground_batch.yul.zbin", - ), + Options::Local => read_bootloader_code("playground_batch"), }; - bsc_load_with_bootloader(bootloader_bytecode, options) + bsc_load_with_bootloader(bootloader_bytecode, options, use_evm_emulator) } /// Returns the system contracts for fee estimation. /// -/// # Arguments -/// -/// * `use_local_contracts` - A boolean indicating whether to use local contracts or not. -/// /// # Returns /// /// A `BaseSystemContracts` struct containing the system contracts used for handling 'eth_estimateGas'. /// It sets ENSURE_RETURNED_MAGIC to 0 and BOOTLOADER_TYPE to 'playground_block' -pub fn fee_estimate_contracts(options: &Options) -> BaseSystemContracts { +pub fn fee_estimate_contracts(options: &Options, use_evm_emulator: bool) -> BaseSystemContracts { let bootloader_bytecode = match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => { include_bytes!("deps/contracts/fee_estimate.yul.zbin").to_vec() } - Options::Local => read_zbin_bytecode( - "contracts/system-contracts/bootloader/build/artifacts/fee_estimate.yul.zbin", - ), + Options::Local => read_bootloader_code("fee_estimate"), }; - bsc_load_with_bootloader(bootloader_bytecode, options) + bsc_load_with_bootloader(bootloader_bytecode, options, use_evm_emulator) } -pub fn fee_estimate_impersonating_contracts(options: &Options) -> BaseSystemContracts { +pub fn fee_estimate_impersonating_contracts( + options: &Options, + use_evm_emulator: bool, +) -> BaseSystemContracts { let bootloader_bytecode = match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => { include_bytes!("deps/contracts/fee_estimate_impersonating.yul.zbin").to_vec() } - Options::Local => { - // Account impersonating is not supported with the local contracts - read_zbin_bytecode( - "contracts/system-contracts/bootloader/build/artifacts/fee_estimate.yul.zbin", - ) - } + // Account impersonating is not supported with the local contracts + Options::Local => read_bootloader_code("fee_estimate"), }; - bsc_load_with_bootloader(bootloader_bytecode, options) + bsc_load_with_bootloader(bootloader_bytecode, options, use_evm_emulator) } -pub fn baseline_contracts(options: &Options) -> BaseSystemContracts { +pub fn baseline_contracts(options: &Options, use_evm_emulator: bool) -> BaseSystemContracts { let bootloader_bytecode = match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => { include_bytes!("deps/contracts/proved_batch.yul.zbin").to_vec() } - Options::Local => read_zbin_bytecode( - "contracts/system-contracts/bootloader/build/artifacts/proved_batch.yul.zbin", - ), + Options::Local => read_bootloader_code("proved_batch"), }; - bsc_load_with_bootloader(bootloader_bytecode, options) + bsc_load_with_bootloader(bootloader_bytecode, options, use_evm_emulator) } -pub fn baseline_impersonating_contracts(options: &Options) -> BaseSystemContracts { +pub fn baseline_impersonating_contracts( + options: &Options, + use_evm_emulator: bool, +) -> BaseSystemContracts { let bootloader_bytecode = match options { Options::BuiltIn | Options::BuiltInWithoutSecurity => { include_bytes!("deps/contracts/proved_batch_impersonating.yul.zbin").to_vec() } // Account impersonating is not supported with the local contracts - Options::Local => read_zbin_bytecode( - "contracts/system-contracts/bootloader/build/artifacts/proved_batch.yul.zbin", - ), + Options::Local => read_bootloader_code("proved_batch"), }; - bsc_load_with_bootloader(bootloader_bytecode, options) + bsc_load_with_bootloader(bootloader_bytecode, options, use_evm_emulator) } diff --git a/src/testing.rs b/src/testing.rs index da9f9970..4ed4388f 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -653,6 +653,7 @@ pub fn default_tx_execution_info() -> TxExecutionInfo { logs: Default::default(), statistics: Default::default(), refunds: Default::default(), + new_known_factory_deps: None, }, } } diff --git a/src/utils.rs b/src/utils.rs index f9bba0da..8a328dbb 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -8,12 +8,12 @@ use futures::Future; use jsonrpc_core::{Error, ErrorCode}; use zkevm_opcode_defs::utils::bytecode_to_code_hash; use zksync_basic_types::{H256, U256, U64}; +use zksync_multivm::interface::storage::WriteStorage; use zksync_multivm::interface::{ Call, CallType, ExecutionResult, VmExecutionResultAndLogs, VmFactory, VmInterfaceExt, }; use zksync_multivm::vm_latest::HistoryDisabled; use zksync_multivm::vm_latest::Vm; -use zksync_state::interface::WriteStorage; use zksync_types::api::{BlockNumber, DebugCall, DebugCallType}; use zksync_types::l2::L2Tx; use zksync_types::web3::Bytes; @@ -207,9 +207,7 @@ pub fn create_debug_output( output: output.clone().into(), r#type: calltype, from: l2_tx.initiator_account(), - to: l2_tx - .recipient_account() - .expect("must have recipient address"), + to: l2_tx.recipient_account().unwrap_or_default(), gas: l2_tx.common_data.fee.gas_limit, value: l2_tx.execute.value, input: l2_tx.execute.calldata().into(), @@ -222,9 +220,7 @@ pub fn create_debug_output( output: Default::default(), r#type: calltype, from: l2_tx.initiator_account(), - to: l2_tx - .recipient_account() - .expect("must have recipient address"), + to: l2_tx.recipient_account().unwrap_or_default(), gas: l2_tx.common_data.fee.gas_limit, value: l2_tx.execute.value, input: l2_tx.execute.calldata().into(), @@ -294,8 +290,15 @@ pub fn into_jsrpc_error(err: Web3Error) -> Error { ErrorCode::ServerError(3) } }, - message: match err { + message: match &err { Web3Error::SubmitTransactionError(_, _) => err.to_string(), + Web3Error::InternalError(err) => { + if let Some(TransparentError(message)) = err.downcast_ref() { + message.clone() + } else { + err.to_string() + } + } _ => err.to_string(), }, data: match err { @@ -307,6 +310,24 @@ pub fn into_jsrpc_error(err: Web3Error) -> Error { } } +/// Error that can be converted to a [`Web3Error`] and has transparent JSON-RPC error message (unlike `anyhow::Error` conversions). +#[derive(Debug)] +pub(crate) struct TransparentError(pub String); + +impl fmt::Display for TransparentError { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str(&self.0) + } +} + +impl std::error::Error for TransparentError {} + +impl From for Web3Error { + fn from(err: TransparentError) -> Self { + Self::InternalError(err.into()) + } +} + pub fn into_jsrpc_error_message(msg: String) -> Error { Error { code: ErrorCode::InternalError,