From 758f13e8ec35464b1fb82213db297b684f86190f Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Wed, 27 Nov 2024 18:18:19 -0300 Subject: [PATCH 01/32] update seq --- Cargo.lock | 1438 +++++++++++++++++++++-------- Cargo.toml | 13 +- rpc-state-reader/Cargo.toml | 3 +- rpc-state-reader/src/execution.rs | 183 ++-- rpc-state-reader/src/objects.rs | 2 +- rpc-state-reader/src/reader.rs | 41 +- rpc-state-reader/src/utils.rs | 28 +- 7 files changed, 1224 insertions(+), 484 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b35e0b46..0daba0ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,6 +277,12 @@ dependencies = [ "rand", ] +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.6" @@ -307,6 +313,28 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "async-trait" version = "0.1.83" @@ -329,6 +357,19 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + [[package]] name = "auto_impl" version = "1.2.0" @@ -357,9 +398,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", "itoa", "matchit", "memchr", @@ -371,7 +412,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "tokio", "tower", "tower-layer", @@ -387,8 +428,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -410,6 +451,12 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + [[package]] name = "base16ct" version = "0.2.0" @@ -608,7 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "ark-ec", @@ -618,14 +665,12 @@ dependencies = [ "cached", "cairo-lang-casm", "cairo-lang-runner", - "cairo-lang-sierra", "cairo-lang-starknet-classes", - "cairo-lang-utils", "cairo-native", "cairo-vm", "derive_more 0.99.18", "indexmap 2.6.0", - "itertools 0.10.5", + "itertools 0.12.1", "keccak", "log", "num-bigint", @@ -637,26 +682,50 @@ dependencies = [ "phf", "rand", "rstest", + "semver", "serde", "serde_json", "sha2", - "sha3", - "sierra-emu", "starknet-types-core", "starknet_api", "strum 0.25.0", "strum_macros 0.25.3", "tempfile", - "thiserror 1.0.69", + "thiserror", "toml", - "tracing", +] + +[[package]] +name = "blockifier_reexecution" +version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" +dependencies = [ + "assert_matches", + "blockifier", + "cairo-lang-starknet-classes", + "cairo-lang-utils", + "clap", + "flate2", + "google-cloud-storage", + "indexmap 2.6.0", + "papyrus_execution", + "pretty_assertions", + "retry", + "serde", + "serde_json", + "starknet-core 0.6.1", + "starknet-types-core", + "starknet_api", + "starknet_gateway", + "thiserror", + "tokio", ] [[package]] name = "bon" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790d33b1027fac712b9cd2079bfb7978fe90a6aac7c7b97abe32377e699fe08f" +checksum = "1e47d5c63335658326076cf7c81795af665c534ea552da69526d6cef51b12ed9" dependencies = [ "bon-macros", "rustversion", @@ -664,9 +733,9 @@ dependencies = [ [[package]] name = "bon-macros" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447acd38643a31ee16063f92ee56c56b2694a4ecae79eba7b67a356f37b19575" +checksum = "b162272b6d55562ea30cc937d74ef4d07399e507bfd6eb3860f6a845c7264eef" dependencies = [ "darling 0.20.10", "ident_case", @@ -758,7 +827,7 @@ dependencies = [ "hashbrown 0.13.2", "instant", "once_cell", - "thiserror 1.0.69", + "thiserror", "tokio", ] @@ -818,7 +887,7 @@ dependencies = [ "rust-analyzer-salsa", "semver", "smol_str", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -902,7 +971,7 @@ dependencies = [ "itertools 0.12.1", "rust-analyzer-salsa", "serde", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -990,7 +1059,7 @@ dependencies = [ "cairo-lang-utils", "serde", "smol_str", - "thiserror 1.0.69", + "thiserror", "toml", ] @@ -1022,7 +1091,7 @@ dependencies = [ "sha2", "smol_str", "starknet-types-core", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1075,7 +1144,7 @@ dependencies = [ "sha3", "smol_str", "starknet-types-core", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1091,7 +1160,7 @@ dependencies = [ "itertools 0.12.1", "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1107,7 +1176,7 @@ dependencies = [ "itertools 0.12.1", "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1152,7 +1221,7 @@ dependencies = [ "num-bigint", "num-traits", "starknet-types-core", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1192,7 +1261,7 @@ dependencies = [ "serde_json", "smol_str", "starknet-types-core", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1215,7 +1284,7 @@ dependencies = [ "sha3", "smol_str", "starknet-types-core", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1303,7 +1372,8 @@ dependencies = [ [[package]] name = "cairo-native" version = "0.2.4" -source = "git+https://github.com/lambdaclass//cairo_native.git?rev=76e83965d3bf1252eb6c68200a3accd5fd1ec004#76e83965d3bf1252eb6c68200a3accd5fd1ec004" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bdebc70c3d563bc30078985ae3e975aa7dc4fa233631b5e0462a924c26c0dd9" dependencies = [ "anyhow", "aquamarine", @@ -1347,7 +1417,7 @@ dependencies = [ "starknet-types-core", "stats_alloc", "tempfile", - "thiserror 1.0.69", + "thiserror", "tracing", "tracing-subscriber", "utf8_iter", @@ -1356,7 +1426,8 @@ dependencies = [ [[package]] name = "cairo-native-runtime" version = "0.2.4" -source = "git+https://github.com/lambdaclass//cairo_native.git?rev=76e83965d3bf1252eb6c68200a3accd5fd1ec004#76e83965d3bf1252eb6c68200a3accd5fd1ec004" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf997252c402d6844f41357660cde3c11825ac5b3feafd0fb99b9dcdfb58aa3" dependencies = [ "cairo-lang-sierra-gas", "itertools 0.13.0", @@ -1427,7 +1498,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1553,7 +1624,7 @@ dependencies = [ "k256", "serde", "sha2", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1569,7 +1640,7 @@ dependencies = [ "pbkdf2 0.12.2", "rand", "sha2", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1589,7 +1660,7 @@ dependencies = [ "serde_derive", "sha2", "sha3", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -1707,6 +1778,15 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.16" @@ -1787,6 +1867,33 @@ 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", + "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.89", +] + [[package]] name = "darling" version = "0.14.4" @@ -1875,6 +1982,26 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +[[package]] +name = "data-encoding-macro" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" +dependencies = [ + "data-encoding", + "syn 1.0.109", +] + [[package]] name = "der" version = "0.7.9" @@ -2042,10 +2169,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] -name = "downcast" -version = "0.11.0" +name = "dtoa" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dunce" @@ -2073,6 +2200,31 @@ dependencies = [ "spki", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "educe" version = "0.5.11" @@ -2103,7 +2255,6 @@ dependencies = [ "ff", "generic-array", "group", - "pem-rfc7468", "pkcs8", "rand_core", "sec1", @@ -2218,7 +2369,7 @@ dependencies = [ "serde_json", "sha2", "sha3", - "thiserror 1.0.69", + "thiserror", "uuid", ] @@ -2235,7 +2386,7 @@ dependencies = [ "serde", "serde_json", "sha3", - "thiserror 1.0.69", + "thiserror", "uint", ] @@ -2314,7 +2465,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -2333,7 +2484,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "syn 2.0.89", @@ -2382,7 +2533,7 @@ dependencies = [ "strum 0.26.3", "syn 2.0.89", "tempfile", - "thiserror 1.0.69", + "thiserror", "tiny-keccak", "unicode-xid", ] @@ -2395,11 +2546,11 @@ checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" dependencies = [ "chrono", "ethers-core", - "reqwest", + "reqwest 0.11.27", "semver", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tracing", ] @@ -2420,10 +2571,10 @@ dependencies = [ "futures-locks", "futures-util", "instant", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tokio", "tracing", "tracing-futures", @@ -2447,15 +2598,15 @@ dependencies = [ "futures-timer", "futures-util", "hashers", - "http", + "http 0.2.12", "instant", - "jsonwebtoken", + "jsonwebtoken 8.3.0", "once_cell", "pin-project", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-tungstenite", "tracing", @@ -2482,7 +2633,7 @@ dependencies = [ "ethers-core", "rand", "sha2", - "thiserror 1.0.69", + "thiserror", "tracing", ] @@ -2510,7 +2661,7 @@ dependencies = [ "serde_json", "solang-parser", "svm-rs", - "thiserror 1.0.69", + "thiserror", "tiny-keccak", "tokio", "tracing", @@ -2550,6 +2701,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -2614,12 +2771,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "fs2" version = "0.4.3" @@ -2651,6 +2802,16 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91f328e7fb845fc832912fb6a34f40cf6d1888c92f974d1893a54e97b5ff542e" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -2676,6 +2837,7 @@ dependencies = [ "futures-core", "futures-task", "futures-util", + "num_cpus", ] [[package]] @@ -2717,6 +2879,17 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +[[package]] +name = "futures-ticker" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9763058047f713632a52e916cc7f6a4b3fc6e9fc1ff8c5b1dc49e5a89041682e" +dependencies = [ + "futures", + "futures-timer", + "instant", +] + [[package]] name = "futures-timer" version = "3.0.3" @@ -2835,12 +3008,12 @@ dependencies = [ "futures-core", "futures-sink", "gloo-utils", - "http", + "http 0.2.12", "js-sys", "pin-project", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2881,6 +3054,81 @@ dependencies = [ "microlp", ] +[[package]] +name = "google-cloud-auth" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57a13fbacc5e9c41ded3ad8d0373175a6b7a6ad430d99e89d314ac121b7ab06" +dependencies = [ + "async-trait", + "base64 0.21.7", + "google-cloud-metadata", + "google-cloud-token", + "home", + "jsonwebtoken 9.3.0", + "reqwest 0.12.9", + "serde", + "serde_json", + "thiserror", + "time", + "tokio", + "tracing", + "urlencoding", +] + +[[package]] +name = "google-cloud-metadata" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f945a208886a13d07636f38fb978da371d0abc3e34bad338124b9f8c135a8f" +dependencies = [ + "reqwest 0.12.9", + "thiserror", + "tokio", +] + +[[package]] +name = "google-cloud-storage" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7347a3d65cd64db51e5b4aebf0c68c484042948c6d53f856f58269bc9816360" +dependencies = [ + "anyhow", + "async-stream", + "async-trait", + "base64 0.21.7", + "bytes", + "futures-util", + "google-cloud-auth", + "google-cloud-metadata", + "google-cloud-token", + "hex", + "once_cell", + "percent-encoding", + "pkcs8", + "regex", + "reqwest 0.12.9", + "reqwest-middleware", + "ring 0.17.8", + "serde", + "serde_json", + "sha2", + "thiserror", + "time", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "google-cloud-token" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c12ba8b21d128a2ce8585955246977fbce4415f680ebf9199b6f9d6d725f" +dependencies = [ + "async-trait", +] + [[package]] name = "group" version = "0.13.0" @@ -2903,7 +3151,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap 2.6.0", "slab", "tokio", @@ -2991,6 +3239,21 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex_fmt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" + +[[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" @@ -3029,6 +3292,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -3036,7 +3310,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -3069,8 +3366,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -3082,6 +3379,25 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -3089,8 +3405,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.31", "log", "rustls 0.21.12", "rustls-native-certs", @@ -3105,17 +3421,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.31", "native-tls", "tokio", "tokio-native-tls", ] [[package]] -name = "iana-time-zone" -version = "0.1.61" +name = "hyper-tls" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.5.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.5.1", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3415,6 +3766,14 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "infra_utils" +version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" +dependencies = [ + "tokio", +] + [[package]] name = "inout" version = "0.1.3" @@ -3538,12 +3897,12 @@ dependencies = [ "futures-channel", "futures-util", "gloo-net", - "http", + "http 0.2.12", "jsonrpsee-core", "pin-project", "rustls-native-certs", "soketto", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-rustls", "tokio-util", @@ -3564,7 +3923,7 @@ dependencies = [ "beef", "futures-timer", "futures-util", - "hyper", + "hyper 0.14.31", "jsonrpsee-types", "parking_lot", "rand", @@ -3572,7 +3931,7 @@ dependencies = [ "serde", "serde_json", "soketto", - "thiserror 1.0.69", + "thiserror", "tokio", "tracing", "wasm-bindgen-futures", @@ -3585,13 +3944,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c7b9f95208927653e7965a98525e7fc641781cab89f0e27c43fa2974405683" dependencies = [ "async-trait", - "hyper", + "hyper 0.14.31", "hyper-rustls", "jsonrpsee-core", "jsonrpsee-types", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tokio", "tower", "tracing", @@ -3618,15 +3977,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a482bc4e25eebd0adb61a3468c722763c381225bd3ec46e926f709df8a8eb548" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.31", "jsonrpsee-core", "jsonrpsee-types", "route-recognizer", "serde", "serde_json", "soketto", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-stream", "tokio-util", @@ -3644,7 +4003,7 @@ dependencies = [ "beef", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror", "tracing", ] @@ -3665,7 +4024,7 @@ version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d06eeabbb55f0af8405288390a358ebcceb6e79e1390741e6f152309c4d6076" dependencies = [ - "http", + "http 0.2.12", "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", @@ -3679,13 +4038,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ "base64 0.21.7", - "pem", + "pem 1.1.1", "ring 0.16.20", "serde", "serde_json", "simple_asn1", ] +[[package]] +name = "jsonwebtoken" +version = "9.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +dependencies = [ + "base64 0.21.7", + "js-sys", + "pem 3.0.4", + "ring 0.17.8", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "k256" version = "0.13.4" @@ -3779,9 +4153,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.165" +version = "0.2.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" +checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" [[package]] name = "libloading" @@ -3813,7 +4187,188 @@ dependencies = [ "lifetimed-bytes", "mdbx-sys", "parking_lot", - "thiserror 1.0.69", + "thiserror", +] + +[[package]] +name = "libp2p" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681fb3f183edfbedd7a57d32ebe5dcdc0b9f94061185acf3c30249349cc6fc99" +dependencies = [ + "bytes", + "either", + "futures", + "futures-timer", + "getrandom", + "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", + "libp2p-core", + "libp2p-gossipsub", + "libp2p-identity", + "libp2p-kad", + "libp2p-swarm", + "multiaddr", + "pin-project", + "rw-stream-sink", + "thiserror", +] + +[[package]] +name = "libp2p-allow-block-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "107b238b794cb83ab53b74ad5dcf7cca3200899b72fe662840cfb52f5b0a32e6" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7cd50a78ccfada14de94cbacd3ce4b0138157f376870f13d3a8422cd075b4fd" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-core" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a8920cbd8540059a01950c1e5c96ea8d89eb50c51cd366fc18bdf540a6e48f" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "libp2p-identity", + "multiaddr", + "multihash", + "multistream-select", + "once_cell", + "parking_lot", + "pin-project", + "quick-protobuf", + "rand", + "rw-stream-sink", + "serde", + "smallvec", + "thiserror", + "tracing", + "unsigned-varint 0.8.0", + "void", + "web-time", +] + +[[package]] +name = "libp2p-gossipsub" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d665144a616dadebdc5fff186b1233488cdcd8bfb1223218ff084b6d052c94f7" +dependencies = [ + "asynchronous-codec", + "base64 0.21.7", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-ticker", + "getrandom", + "hex_fmt", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec", + "rand", + "regex", + "serde", + "sha2", + "smallvec", + "tracing", + "void", +] + +[[package]] +name = "libp2p-identity" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b5621d159b32282eac446bed6670c39c7dc68a200a992d8f056afa0066f6d" +dependencies = [ + "bs58", + "ed25519-dalek", + "hkdf", + "multihash", + "quick-protobuf", + "rand", + "serde", + "sha2", + "thiserror", + "tracing", + "zeroize", +] + +[[package]] +name = "libp2p-kad" +version = "0.45.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc5767727d062c4eac74dd812c998f0e488008e82cce9c33b463d38423f9ad2" +dependencies = [ + "arrayvec", + "asynchronous-codec", + "bytes", + "either", + "fnv", + "futures", + "futures-bounded", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "quick-protobuf", + "quick-protobuf-codec", + "rand", + "serde", + "sha2", + "smallvec", + "thiserror", + "tracing", + "uint", + "void", +] + +[[package]] +name = "libp2p-swarm" +version = "0.44.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80cae6cb75f89dbca53862f9ebe0b9f463aa7b302762fcfaafb9e51dcc9b0f7e" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "lru", + "multistream-select", + "once_cell", + "rand", + "smallvec", + "tracing", + "void", ] [[package]] @@ -3982,9 +4537,12 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ + "assert_matches", "blockifier", + "infra_utils", + "pretty_assertions", "serde_json", "starknet-types-core", "starknet_api", @@ -4028,6 +4586,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -4065,30 +4633,58 @@ dependencies = [ ] [[package]] -name = "mockall" -version = "0.12.1" +name = "multiaddr" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" +checksum = "fe6351f60b488e04c1d21bc69e56b89cb3f5e8f5d22557d6e8031bdfd79b6961" dependencies = [ - "cfg-if", - "downcast", - "fragile", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", + "arrayref", + "byteorder", + "data-encoding", + "libp2p-identity", + "multibase", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint 0.8.0", + "url", ] [[package]] -name = "mockall_derive" -version = "0.12.1" +name = "multibase" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 2.0.89", + "base-x", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc41f430805af9d1cf4adae4ed2149c759b877b01d909a1f40256188d09345d2" +dependencies = [ + "core2", + "serde", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "multistream-select" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint 0.7.2", ] [[package]] @@ -4393,18 +4989,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - [[package]] name = "page_size" version = "0.6.0" @@ -4418,12 +5002,12 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ + "base64 0.13.1", "cairo-lang-starknet-classes", - "hex", + "flate2", "indexmap 2.6.0", - "itertools 0.10.5", "lazy_static", "rand", "serde", @@ -4431,34 +5015,35 @@ dependencies = [ "sha3", "starknet-types-core", "starknet_api", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "clap", - "itertools 0.10.5", + "infra_utils", + "itertools 0.12.1", "serde", "serde_json", "strum_macros 0.25.3", - "thiserror 1.0.69", + "thiserror", "validator", ] [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "blockifier", "cairo-lang-starknet-classes", "cairo-vm", "indexmap 2.6.0", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "papyrus_common", "papyrus_config", @@ -4467,14 +5052,23 @@ dependencies = [ "serde_json", "starknet-types-core", "starknet_api", - "thiserror 1.0.69", + "thiserror", "tracing", ] +[[package]] +name = "papyrus_network_types" +version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" +dependencies = [ + "libp2p", + "serde", +] + [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "quote", "syn 2.0.89", @@ -4484,7 +5078,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "async-trait", @@ -4494,7 +5088,7 @@ dependencies = [ "flate2", "futures-util", "hex", - "hyper", + "hyper 0.14.31", "jsonrpsee", "lazy_static", "metrics", @@ -4518,7 +5112,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "byteorder", "cairo-lang-casm", @@ -4541,7 +5135,7 @@ dependencies = [ "serde_json", "starknet-types-core", "starknet_api", - "thiserror 1.0.69", + "thiserror", "tracing", "validator", "zstd 0.13.2", @@ -4662,6 +5256,16 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.1", + "serde", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -4838,32 +5442,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "predicates" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" -dependencies = [ - "anstyle", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" - -[[package]] -name = "predicates-tree" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" -dependencies = [ - "predicates-core", - "termtree", -] - [[package]] name = "pretty_assertions" version = "1.4.1" @@ -4894,15 +5472,6 @@ dependencies = [ "syn 2.0.89", ] -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "primitive-types" version = "0.12.2" @@ -4969,6 +5538,29 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prometheus-client" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504ee9ff529add891127c4827eb481bd69dc0ebc72e9a682e187db4caa60c3ca" +dependencies = [ + "dtoa", + "itoa", + "parking_lot", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "proptest" version = "1.5.0" @@ -4985,6 +5577,28 @@ dependencies = [ "unarray", ] +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint 0.8.0", +] + [[package]] name = "quote" version = "1.0.37" @@ -5082,7 +5696,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -5160,46 +5774,113 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.27" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.31", + "hyper-rustls", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.4", + "winreg", +] + +[[package]] +name = "reqwest" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-tls", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.1", + "hyper-tls 0.6.0", + "hyper-util", "ipnet", "js-sys", "log", "mime", + "mime_guess", "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.12", - "rustls-pemfile", + "rustls-pemfile 2.2.0", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", - "system-configuration", + "sync_wrapper 1.0.2", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-util", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", - "webpki-roots 0.25.4", - "winreg", + "windows-registry", +] + +[[package]] +name = "reqwest-middleware" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" +dependencies = [ + "anyhow", + "async-trait", + "http 1.1.0", + "reqwest 0.12.9", + "serde", + "thiserror", + "tower-service", +] + +[[package]] +name = "retry" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9166d72162de3575f950507683fac47e30f6f2c3836b71b7fbc61aa517c9c5f4" +dependencies = [ + "rand", ] [[package]] @@ -5284,6 +5965,7 @@ name = "rpc-state-reader" version = "0.1.0" dependencies = [ "blockifier", + "blockifier_reexecution", "cairo-lang-starknet-classes", "cairo-lang-utils", "cairo-native", @@ -5419,9 +6101,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.18" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "log", "once_cell", @@ -5439,7 +6121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 1.0.4", "schannel", "security-framework", ] @@ -5453,6 +6135,15 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.10.0" @@ -5486,6 +6177,17 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.18" @@ -5868,38 +6570,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "sierra-emu" -version = "0.1.0" -source = "git+https://github.com/lambdaclass/sierra-emu.git?rev=369a3eaebc0ab189f06dfc3662e270479a8ad17a#369a3eaebc0ab189f06dfc3662e270479a8ad17a" -dependencies = [ - "cairo-lang-compiler", - "cairo-lang-filesystem", - "cairo-lang-sierra", - "cairo-lang-sierra-ap-change", - "cairo-lang-sierra-gas", - "cairo-lang-utils", - "clap", - "k256", - "keccak", - "num-bigint", - "num-traits", - "p256", - "rand", - "sec1", - "serde", - "serde_json", - "sha2", - "smallvec", - "starknet-crypto 0.7.3", - "starknet-curve 0.5.1", - "starknet-types-core", - "tempfile", - "thiserror 2.0.3", - "tracing", - "tracing-subscriber", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -5927,7 +6597,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.69", + "thiserror", "time", ] @@ -5990,7 +6660,7 @@ dependencies = [ "base64 0.13.1", "bytes", "futures", - "http", + "http 0.2.12", "httparse", "log", "rand", @@ -6007,7 +6677,7 @@ dependencies = [ "lalrpop", "lalrpop-util", "phf", - "thiserror 1.0.69", + "thiserror", "unicode-xid", ] @@ -6053,13 +6723,13 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starknet" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351ffff1bcf6a1dc569a1b330dfd85779e16506e7d4a87baa8be3744cb5415a6" +checksum = "6f0623b045f3dc10aef030c9ddd4781cff9cbe1188b71063cc510b75d1f96be6" dependencies = [ "starknet-accounts", "starknet-contract", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-crypto 0.6.2", "starknet-ff", "starknet-macros", @@ -6069,38 +6739,38 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.6.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7062b020f65d9da7f9dd9f1d97bfb644e881cda8ddb999799a799e6f2e408dd" +checksum = "68e97edc480348dca300e5a8234e6c4e6f2f1ac028f2b16fcce294ebe93d07f4" dependencies = [ "async-trait", "auto_impl", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-providers", "starknet-signers", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "starknet-contract" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d858efc93d85de95065a5732cb3e94d0c746674964c0859aab442ffbb9de76b4" +checksum = "69b86e3f6b3ca9a5c45271ab10871c99f7dc82fee3199d9f8c7baa2a1829947d" dependencies = [ "serde", "serde_json", "serde_with 2.3.3", "starknet-accounts", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-providers", - "thiserror 1.0.69", + "thiserror", ] [[package]] name = "starknet-core" -version = "0.7.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1683ca7c63f0642310eddedb7d35056d8306084dff323d440711065c63ed87" +checksum = "14139b1c39bdc2f1e663c12090ff5108fe50ebe62c09e15e32988dfaf445a7e4" dependencies = [ "base64 0.21.7", "flate2", @@ -6132,26 +6802,6 @@ dependencies = [ "starknet-ff", ] -[[package]] -name = "starknet-crypto" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f2175b0b3fc24ff2ec6dc07f5a720498994effca7e78b11a6e1c1bd02cad52" -dependencies = [ - "crypto-bigint", - "hex", - "hmac", - "num-bigint", - "num-integer", - "num-traits", - "rfc6979", - "sha2", - "starknet-crypto-codegen", - "starknet-curve 0.3.0", - "starknet-ff", - "zeroize", -] - [[package]] name = "starknet-crypto" version = "0.6.2" @@ -6202,15 +6852,6 @@ dependencies = [ "syn 2.0.89", ] -[[package]] -name = "starknet-curve" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252610baff59e4c4332ce3569f7469c5d3f9b415a2240d698fb238b2b4fc0942" -dependencies = [ - "starknet-ff", -] - [[package]] name = "starknet-curve" version = "0.4.2" @@ -6256,38 +6897,38 @@ dependencies = [ [[package]] name = "starknet-providers" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52072c2d258bf692affeccd602613d5f6c61a6ffc84da8f191ab4a1b0a5e24d1" +checksum = "c3b136c26b72ff1756f0844e0aa80bab680ceb99d63921826facbb8e7340ff82" dependencies = [ "async-trait", "auto_impl", "ethereum-types", "flate2", "log", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_with 2.3.3", - "starknet-core 0.7.2", - "thiserror 1.0.69", + "starknet-core 0.6.1", + "thiserror", "url", ] [[package]] name = "starknet-signers" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347b1bfc09846aafe16d2b3a5bc2d8a2f845e2958602442182d265fbd6011c2e" +checksum = "d9386015d2e6dc3df285bfb33a3afd8ad7596c70ed38ab57019de4d2dfc7826f" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", "rand", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-crypto 0.6.2", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -6308,38 +6949,42 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "bitvec", + "cairo-lang-runner", "cairo-lang-starknet-classes", "derive_more 0.99.18", "hex", "indexmap 2.6.0", + "infra_utils", "itertools 0.12.1", + "num-bigint", + "pretty_assertions", "primitive-types", "serde", "serde_json", "sha3", - "starknet-crypto 0.5.2", + "starknet-crypto 0.7.3", "starknet-types-core", - "strum 0.24.1", - "strum_macros 0.24.3", - "thiserror 1.0.69", + "strum 0.25.0", + "strum_macros 0.25.3", + "thiserror", ] [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "cairo-lang-starknet-classes", - "http", + "http 0.2.12", "indexmap 2.6.0", "os_info", "papyrus_common", "papyrus_config", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "serde_repr", @@ -6347,7 +6992,7 @@ dependencies = [ "starknet_api", "strum 0.25.0", "strum_macros 0.25.3", - "thiserror 1.0.69", + "thiserror", "tokio", "tokio-retry", "tracing", @@ -6357,67 +7002,86 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "axum", "blockifier", "cairo-lang-starknet-classes", - "enum-assoc", - "hyper", "mempool_test_utils", "papyrus_config", + "papyrus_network_types", "papyrus_rpc", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "starknet-types-core", "starknet_api", - "starknet_mempool_infra", + "starknet_gateway_types", "starknet_mempool_types", + "starknet_sequencer_infra", "starknet_sierra_compile", - "thiserror 1.0.69", + "thiserror", "tokio", "tracing", "validator", ] [[package]] -name = "starknet_mempool_infra" +name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", - "bincode 1.3.3", - "hyper", - "papyrus_config", - "rstest", + "axum", + "enum-assoc", + "papyrus_network_types", + "papyrus_proc_macros", + "papyrus_rpc", "serde", - "thiserror 1.0.69", - "tokio", + "serde_json", + "starknet_api", + "starknet_sequencer_infra", + "thiserror", "tracing", - "tracing-subscriber", - "validator", ] [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", - "mockall", + "papyrus_network_types", "papyrus_proc_macros", "serde", "starknet_api", - "starknet_mempool_infra", - "thiserror 1.0.69", + "starknet_sequencer_infra", + "thiserror", +] + +[[package]] +name = "starknet_sequencer_infra" +version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" +dependencies = [ + "async-trait", + "bincode 1.3.3", + "hyper 0.14.31", + "papyrus_config", + "rstest", + "serde", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", + "validator", ] [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.9.x#9d223311762880e24276bbd2af5073172b821af1" +source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", @@ -6427,7 +7091,8 @@ dependencies = [ "serde_json", "starknet-types-core", "starknet_api", - "thiserror 1.0.69", + "tempfile", + "thiserror", "validator", ] @@ -6468,12 +7133,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - [[package]] name = "strum" version = "0.25.0" @@ -6489,19 +7148,6 @@ dependencies = [ "strum_macros 0.26.4", ] -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - [[package]] name = "strum_macros" version = "0.25.3" @@ -6544,12 +7190,12 @@ dependencies = [ "fs2", "hex", "once_cell", - "reqwest", + "reqwest 0.11.27", "semver", "serde", "serde_json", "sha2", - "thiserror 1.0.69", + "thiserror", "url", "zip", ] @@ -6582,6 +7228,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -6629,7 +7284,7 @@ dependencies = [ "bindgen 0.69.5", "cc", "paste", - "thiserror 1.0.69", + "thiserror", ] [[package]] @@ -6656,12 +7311,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - [[package]] name = "test-case" version = "3.3.1" @@ -6701,16 +7350,7 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" -dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl", ] [[package]] @@ -6724,17 +7364,6 @@ dependencies = [ "syn 2.0.89", ] -[[package]] -name = "thiserror-impl" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "thiserror-impl-no-std" version = "2.0.2" @@ -7010,9 +7639,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -7022,9 +7651,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -7118,13 +7747,13 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.12", "httparse", "log", "rand", "rustls 0.21.12", "sha1", - "thiserror 1.0.69", + "thiserror", "url", "utf-8", ] @@ -7165,9 +7794,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c878a167baa8afd137494101a688ef8c67125089ff2249284bd2b5f9bfedb815" dependencies = [ - "thiserror 1.0.69", + "thiserror", ] +[[package]] +name = "unicase" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" + [[package]] name = "unicode-bidi" version = "0.3.17" @@ -7213,6 +7848,18 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" + +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + [[package]] name = "untrusted" version = "0.7.1" @@ -7235,7 +7882,7 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls 0.23.18", + "rustls 0.23.19", "rustls-pki-types", "serde", "serde_json", @@ -7254,6 +7901,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -7351,6 +8004,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "walkdir" version = "2.5.0" @@ -7443,6 +8102,19 @@ version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.72" @@ -7453,6 +8125,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.25.4" @@ -7520,6 +8202,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7721,7 +8433,7 @@ dependencies = [ "pharos", "rustc_version", "send_wrapper 0.6.0", - "thiserror 1.0.69", + "thiserror", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", diff --git a/Cargo.toml b/Cargo.toml index 39682781..896303d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,12 @@ tracing = "0.1" serde_json = "1.0.116" serde_with = "3.11.0" serde = "1.0.197" -cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } +cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.9.x" } -blockifier = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.9.x" } -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.9.x" } +starknet_api = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a", features = ["cairo_native"]} # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main -[patch.'https://github.com/lambdaclass/cairo_native'] -cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } +# [patch.'https://github.com/lambdaclass/cairo_native'] +# cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index e786239c..9dd0f435 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -19,10 +19,11 @@ starknet_api = {workspace = true} cairo-lang-starknet-classes = "2.9.0-dev.0" cairo-lang-utils = "2.9.0-dev.0" cairo-native = { workspace = true } -starknet = "0.7.0" +starknet = "0.6.0" flate2 = "1.0.25" cairo-vm = "1.0.0-rc5" blockifier = { workspace = true } +blockifier_reexecution = { workspace = true } starknet_gateway = { workspace = true } tracing = { workspace = true } diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 144829d4..26fbad07 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -1,31 +1,39 @@ +use std::{u32, usize}; + +use crate::{ + objects::{RpcTransactionReceipt, RpcTransactionTrace}, + reader::{RpcChain, RpcStateReader}, +}; use blockifier::{ blockifier::block::BlockInfo, bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, - execution::contract_class::{ClassInfo, ContractClass}, + execution::contract_class::RunnableContractClass, state::{cached_state::CachedState, state_api::StateReader}, transaction::{ - account_transaction::AccountTransaction, + account_transaction::AccountTransaction as BlockiAccountTransaction, objects::{TransactionExecutionInfo, TransactionExecutionResult}, - transactions::{ - DeclareTransaction, DeployAccountTransaction, ExecutableTransaction, InvokeTransaction, - L1HandlerTransaction, - }, + transactions::ExecutableTransaction, }, - versioned_constants::VersionedConstants, + versioned_constants::{VersionedConstants, VersionedConstantsOverrides}, +}; +use blockifier_reexecution::state_reader::compile::{ + legacy_to_contract_class_v0, sierra_to_contact_class_v1, }; +use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use starknet_api::{ block::BlockNumber, + deprecated_contract_class::ContractClass as DeprecatedContractClass, + contract_class::{ClassInfo, ContractClass, }, core::{calculate_contract_address, ContractAddress, PatriciaKey}, + executable_transaction::{ + AccountTransaction, DeclareTransaction, DeployAccountTransaction, InvokeTransaction, + L1HandlerTransaction, + }, felt, hash::StarkHash, patricia_key, - transaction::{Transaction as SNTransaction, TransactionHash}, -}; - -use crate::{ - objects::{RpcTransactionReceipt, RpcTransactionTrace}, - reader::{RpcChain, RpcStateReader}, + transaction::{fields::Fee, Transaction as SNTransaction, TransactionHash}, }; pub fn execute_tx( @@ -66,7 +74,11 @@ pub fn execute_tx( fee_token_addresses, }; let mut versioned_constants = - VersionedConstants::latest_constants_with_overrides(u32::MAX, usize::MAX); + VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { + validate_max_n_steps: u32::MAX, + invoke_tx_max_n_steps: u32::MAX, + max_recursion_depth: usize::MAX, + }); versioned_constants.disable_cairo0_redeclaration = false; let block_context = BlockContext::new( @@ -79,11 +91,8 @@ pub fn execute_tx( // Map starknet_api transaction to blockifier's let blockifier_tx = match transaction { SNTransaction::Invoke(tx) => { - let invoke = InvokeTransaction { - tx: starknet_api::executable_transaction::InvokeTransaction { tx, tx_hash }, - only_query: false, - }; - AccountTransaction::Invoke(invoke) + let invoke = AccountTransaction::Invoke(InvokeTransaction { tx, tx_hash }); + BlockiAccountTransaction::new(invoke) } SNTransaction::DeployAccount(tx) => { let contract_address = calculate_contract_address( @@ -93,34 +102,33 @@ pub fn execute_tx( ContractAddress::default(), ) .unwrap(); - AccountTransaction::DeployAccount(DeployAccountTransaction { - only_query: false, - tx: starknet_api::executable_transaction::DeployAccountTransaction { - tx, - tx_hash, - contract_address, - }, - }) + let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { + tx, + tx_hash, + contract_address, + }); + BlockiAccountTransaction::new(deploy) } SNTransaction::Declare(tx) => { // Fetch the contract_class from the next block (as we don't have it in the previous one) let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader - .get_compiled_contract_class(tx.class_hash()) - .unwrap(); - + let contract_class = next_reader.get_compiled_contract_class(&tx.class_hash()).unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - let declare = DeclareTransaction::new(tx, tx_hash, class_info).unwrap(); - AccountTransaction::Declare(declare) + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + tx_hash, + class_info, + }); + BlockiAccountTransaction::new(declare) } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { tx, tx_hash, - paid_fee_on_l1: starknet_api::transaction::Fee(u128::MAX), + paid_fee_on_l1: Fee(u128::MAX), }; return ( blockifier_tx @@ -142,13 +150,14 @@ pub fn execute_tx( ) } -fn calculate_class_info_for_testing(contract_class: ContractClass) -> ClassInfo { +fn calculate_class_info_for_testing(contract_class: RunnableContractClass) -> ClassInfo { let sierra_program_length = match contract_class { - ContractClass::V0(_) => 0, - ContractClass::V1(_) => 100, - ContractClass::V1Native(_) => 100, + RunnableContractClass::V0(contract) => (ContractClass::V0(()), 0), + RunnableContractClass::V1(contract) => (ContractClass::V1(()), 100), + RunnableContractClass::V1Native(contract) => (ContractClass::V1(()), 100), }; - ClassInfo::new(&contract_class, sierra_program_length, 100).unwrap() + + ClassInfo::new(contract_class, sierra_program_length, 100).unwrap() } pub fn execute_tx_configurable_with_state( @@ -181,7 +190,11 @@ pub fn execute_tx_configurable_with_state( fee_token_addresses: fee_token_address, }; let mut versioned_constants = - VersionedConstants::latest_constants_with_overrides(u32::MAX, usize::MAX); + VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { + validate_max_n_steps: u32::MAX, + invoke_tx_max_n_steps: u32::MAX, + max_recursion_depth: usize::MAX, + }); versioned_constants.disable_cairo0_redeclaration = false; let block_context = BlockContext::new( @@ -194,14 +207,11 @@ pub fn execute_tx_configurable_with_state( // Get transaction before giving ownership of the reader let blockifier_tx = match tx { SNTransaction::Invoke(tx) => { - let invoke = InvokeTransaction { - tx: starknet_api::executable_transaction::InvokeTransaction { - tx, - tx_hash: *tx_hash, - }, - only_query: false, - }; - AccountTransaction::Invoke(invoke) + let invoke = AccountTransaction::Invoke(InvokeTransaction { + tx, + tx_hash: *tx_hash, + }); + BlockiAccountTransaction::new(invoke) } SNTransaction::DeployAccount(tx) => { let contract_address = calculate_contract_address( @@ -211,14 +221,12 @@ pub fn execute_tx_configurable_with_state( ContractAddress::default(), ) .unwrap(); - AccountTransaction::DeployAccount(DeployAccountTransaction { - only_query: false, - tx: starknet_api::executable_transaction::DeployAccountTransaction { - tx, - tx_hash: *tx_hash, - contract_address, - }, - }) + let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { + tx, + tx_hash: *tx_hash, + contract_address, + }); + BlockiAccountTransaction::new(deploy) } SNTransaction::Declare(tx) => { let block_number = block_context.block_info().block_number; @@ -226,19 +234,23 @@ pub fn execute_tx_configurable_with_state( // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); let contract_class = next_reader - .get_compiled_contract_class(tx.class_hash()) + .get_compiled_contract_class(&tx.class_hash()) .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - let declare = DeclareTransaction::new(tx, *tx_hash, class_info).unwrap(); - AccountTransaction::Declare(declare) + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + class_info, + tx_hash: *tx_hash, + }); + BlockiAccountTransaction::new(declare) } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { tx, tx_hash: *tx_hash, - paid_fee_on_l1: starknet_api::transaction::Fee(u128::MAX), + paid_fee_on_l1: Fee(u128::MAX), }; return blockifier_tx.execute(state, &block_context, charge_fee, true); } @@ -282,16 +294,13 @@ pub fn execute_tx_with_blockifier( transaction: SNTransaction, transaction_hash: TransactionHash, ) -> TransactionExecutionResult { - let account_transaction: AccountTransaction = match transaction { + let account_transaction: BlockiAccountTransaction = match transaction { SNTransaction::Invoke(tx) => { - let invoke = InvokeTransaction { - tx: starknet_api::executable_transaction::InvokeTransaction { - tx, - tx_hash: transaction_hash, - }, - only_query: false, - }; - AccountTransaction::Invoke(invoke) + let invoke = AccountTransaction::Invoke(InvokeTransaction { + tx, + tx_hash: transaction_hash, + }); + BlockiAccountTransaction::new(invoke) } SNTransaction::DeployAccount(tx) => { let contract_address = calculate_contract_address( @@ -301,32 +310,34 @@ pub fn execute_tx_with_blockifier( ContractAddress::default(), ) .unwrap(); - AccountTransaction::DeployAccount(DeployAccountTransaction { - only_query: false, - tx: starknet_api::executable_transaction::DeployAccountTransaction { - tx, - tx_hash: transaction_hash, - contract_address, - }, - }) + let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { + tx, + tx_hash: transaction_hash, + contract_address, + }); + BlockiAccountTransaction::new(deploy) } SNTransaction::Declare(tx) => { let contract_class = state .state - .get_compiled_contract_class(tx.class_hash()) + .get_compiled_contract_class(&tx.class_hash()) .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - let declare = DeclareTransaction::new(tx, transaction_hash, class_info).unwrap(); - AccountTransaction::Declare(declare) + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + tx_hash: transaction_hash, + class_info, + }); + BlockiAccountTransaction::new(declare) } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let account_transaction = L1HandlerTransaction { tx, tx_hash: transaction_hash, - paid_fee_on_l1: starknet_api::transaction::Fee(u128::MAX), + paid_fee_on_l1: Fee(u128::MAX), }; return account_transaction.execute(state, &context, true, true); @@ -349,7 +360,11 @@ fn parse_to_rpc_chain(network: &str) -> RpcChain { pub fn fetch_block_context(reader: &RpcStateReader) -> BlockContext { let block_info = reader.get_block_info().unwrap(); let mut versioned_constants = - VersionedConstants::latest_constants_with_overrides(u32::MAX, usize::MAX); + VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { + validate_max_n_steps: u32::MAX, + invoke_tx_max_n_steps: u32::MAX, + max_recursion_depth: usize::MAX, + }); versioned_constants.disable_cairo0_redeclaration = false; let fee_token_addresses = FeeTokenAddresses { @@ -410,8 +425,8 @@ mod tests { let (tx_info, trace, _) = execute_tx(hash, chain, previous_block); assert_eq!( - tx_info.revert_error, - trace.execute_invocation.unwrap().revert_reason + tx_info.revert_error.unwrap(), + trace.execute_invocation.unwrap().. ); // We can't currently compare fee values diff --git a/rpc-state-reader/src/objects.rs b/rpc-state-reader/src/objects.rs index e9757fd9..9863fe85 100644 --- a/rpc-state-reader/src/objects.rs +++ b/rpc-state-reader/src/objects.rs @@ -7,7 +7,7 @@ use starknet_api::{ block::BlockStatus, hash::StarkHash, transaction::{ - Event, Fee, MessageToL1, Transaction, TransactionExecutionStatus, TransactionHash, + fields::Fee, Event, MessageToL1, Transaction, TransactionExecutionStatus, TransactionHash, }, }; use starknet_gateway::rpc_objects::BlockHeader; diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 5c9ffbbc..a49700c3 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -1,25 +1,34 @@ use std::{ + collections::HashMap, env, fmt, num::NonZeroU128, sync::Arc, thread, time::{Duration, Instant}, + usize, }; use blockifier::{ blockifier::block::{BlockInfo, GasPrices}, - execution::contract_class::{ - ContractClass, ContractClassV0, ContractClassV0Inner, NativeContractClassV1, + execution::{ + contract_class::{ + ContractClassV0, ContractClassV0Inner, ContractClassV1, ContractClassV1Inner, + RunnableContractClass, + }, + native::contract_class::NativeContractClassV1, }, state::state_api::{StateReader, StateResult}, + versioned_constants::CompilerVersion, }; +use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use cairo_lang_utils::bigint::BigUintAsHex; use cairo_vm::types::program::Program; use serde::Serialize; use serde_json::Value; use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ - block::{BlockNumber, GasPrice}, + block::{BlockNumber, GasPrice, NonzeroGasPrice}, + contract_class::ContractClass, core::{ChainId, ClassHash, CompiledClassHash, ContractAddress, Nonce}, state::StorageKey, transaction::{Transaction, TransactionHash}, @@ -163,12 +172,12 @@ impl RpcStateReader { sequencer_address: header.sequencer_address, block_timestamp: header.timestamp, gas_prices: GasPrices::new( - parse_gas_price(header.l1_gas_price.price_in_wei), - parse_gas_price(header.l1_gas_price.price_in_fri), - parse_gas_price(header.l1_data_gas_price.price_in_wei), - parse_gas_price(header.l1_data_gas_price.price_in_fri), - NonZeroU128::MIN, - NonZeroU128::MIN, + NonzeroGasPrice::new(header.l1_gas_price.price_in_wei)?, + NonzeroGasPrice::new(header.l1_gas_price.price_in_fri)?, + NonzeroGasPrice::new(header.l1_data_gas_price.price_in_wei)?, + NonzeroGasPrice::new(header.l1_data_gas_price.price_in_fri)?, + NonzeroGasPrice::MIN, + NonzeroGasPrice::MIN, ), use_kzg_da: true, }) @@ -288,7 +297,7 @@ impl StateReader for RpcStateReader { } } - fn get_compiled_contract_class(&self, class_hash: ClassHash) -> StateResult { + fn get_compiled_contract_class(&self, class_hash: ClassHash) -> StateResult { Ok(match self.get_contract_class(&class_hash)? { SNContractClass::Legacy(compressed_legacy_cc) => { compile_legacy_cc(compressed_legacy_cc) @@ -307,7 +316,7 @@ impl StateReader for RpcStateReader { fn compile_sierra_cc( flattened_sierra_cc: starknet::core::types::FlattenedSierraClass, class_hash: ClassHash, -) -> ContractClass { +) -> RunnableContractClass { let middle_sierra: utils::MiddleSierraContractClass = { let v = serde_json::to_value(flattened_sierra_cc).unwrap(); serde_json::from_value(v).unwrap() @@ -343,17 +352,19 @@ fn compile_sierra_cc( "vm contract compilation finished" ); - ContractClass::V1(casm_cc.try_into().unwrap()) + RunnableContractClass::V1(casm_cc.try_into().unwrap()) } else { let executor = utils::get_native_executor(&sierra_cc, class_hash); + let casm = CasmContractClass::from_contract_class(sierra_cc, false, usize::MAX).unwrap(); + let casm = ContractClassV1::try_from(casm).unwrap(); - ContractClass::V1Native(NativeContractClassV1::new(executor, sierra_cc).unwrap()) + RunnableContractClass::V1Native(NativeContractClassV1::new(executor, casm)) } } fn compile_legacy_cc( compressed_legacy_cc: starknet::core::types::CompressedLegacyContractClass, -) -> ContractClass { +) -> RunnableContractClass { let as_str = utils::decode_reader(compressed_legacy_cc.program).unwrap(); let program = Program::from_bytes(as_str.as_bytes(), None).unwrap(); let entry_points_by_type = @@ -362,7 +373,7 @@ fn compile_legacy_cc( program, entry_points_by_type, }); - ContractClass::V0(ContractClassV0(inner)) + RunnableContractClass::V0(ContractClassV0(inner)) } /// Retries the closure `MAX_RETRIES` times on RPC errors, diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index ec72b093..df87f340 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -13,9 +13,11 @@ use cairo_native::{executor::AotContractExecutor, OptLevel}; use serde::Deserialize; use starknet::core::types::{LegacyContractEntryPoint, LegacyEntryPointsByType}; use starknet_api::{ + contract_class::EntryPointType, core::{ClassHash, EntryPointSelector}, - deprecated_contract_class::{EntryPoint, EntryPointOffset, EntryPointType}, + deprecated_contract_class::{EntryPointOffset, EntryPointV0}, hash::StarkHash, + state::{EntryPoint, FunctionIndex}, }; use tracing::info; @@ -26,12 +28,12 @@ pub struct MiddleSierraContractClass { pub entry_points_by_type: ContractEntryPoints, } -static AOT_PROGRAM_CACHE: OnceLock>>> = +static AOT_PROGRAM_CACHE: OnceLock>> = OnceLock::new(); pub fn map_entry_points_by_type_legacy( entry_points_by_type: LegacyEntryPointsByType, -) -> HashMap> { +) -> HashMap> { let entry_types_to_points = HashMap::from([ ( EntryPointType::Constructor, @@ -41,9 +43,9 @@ pub fn map_entry_points_by_type_legacy( (EntryPointType::L1Handler, entry_points_by_type.l1_handler), ]); - let to_contract_entry_point = |entrypoint: &LegacyContractEntryPoint| -> EntryPoint { + let to_contract_entry_point = |entrypoint: &LegacyContractEntryPoint| -> EntryPointV0 { let felt: StarkHash = StarkHash::from_bytes_be(&entrypoint.selector.to_bytes_be()); - EntryPoint { + EntryPointV0 { offset: EntryPointOffset(entrypoint.offset as usize), selector: EntryPointSelector(felt), } @@ -71,16 +73,13 @@ pub fn decode_reader(bytes: Vec) -> io::Result { Ok(s) } -pub fn get_native_executor( - contract: &ContractClass, - class_hash: ClassHash, -) -> Arc { +pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> AotContractExecutor { let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); - let executor = cache_lock.read().unwrap().get(&class_hash).map(Arc::clone); + let executor = cache_lock.read().unwrap().get(&class_hash); match executor { - Some(executor) => executor, + Some(executor) => executor.clone(), None => { let mut cache = cache_lock.write().unwrap(); let path = PathBuf::from(format!( @@ -95,7 +94,7 @@ pub fn get_native_executor( } )); - let executor = Arc::new(if path.exists() { + let executor = if path.exists() { AotContractExecutor::load(&path).unwrap() } else { info!("starting native contract compilation"); @@ -121,9 +120,10 @@ pub fn get_native_executor( ); executor - }); + }; + + cache.insert(class_hash, executor); - cache.insert(class_hash, Arc::clone(&executor)); executor } } From b0570c567776a5da50fa710701cb6c89ae52b793 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 11:51:35 -0300 Subject: [PATCH 02/32] update --- Cargo.lock | 129 +++++++++++++++++------------- replay/src/main.rs | 31 ++++--- rpc-state-reader/Cargo.toml | 2 +- rpc-state-reader/src/execution.rs | 101 +++++++++++------------ rpc-state-reader/src/objects.rs | 1 + rpc-state-reader/src/utils.rs | 7 +- 6 files changed, 147 insertions(+), 124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0daba0ae..c30afe5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -786,9 +786,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -852,9 +852,9 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] name = "cairo-lang-casm" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e0dcdb6358bb639dd729546611bd99bada94c86e3f262c3637855abea9a972" +checksum = "7635bcfdc89a7b88ee1b906d1c5320a2da796fcfaa22a47fd8d8f778dbec8847" dependencies = [ "cairo-lang-utils", "indoc", @@ -892,18 +892,18 @@ dependencies = [ [[package]] name = "cairo-lang-debug" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0635aa554d297acefe6a35b495aba2795d0af5b7f97c4ab63829c7d62291ef41" +checksum = "2cb0b34d9179357ea50d7551fbbba723f1ee727cb84fc3d8913629225cfd89bf" dependencies = [ "cairo-lang-utils", ] [[package]] name = "cairo-lang-defs" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b356e1c09898e8b8cfdd9731579d89365a13d8b4f7e717962e0cc7d125b83c" +checksum = "c014f7eca4f119eef98767b3991e3d2d2fd1b3acb158b876f3b427c08390c0aa" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -918,9 +918,9 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfe7c6ff96182da29012b707a3554e34a50f19cc96013ee45b0eb36dd396ec8" +checksum = "6a26b27874dbb39a678443233e5259caa19793d8c4ca04470126cbbb46d21955" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -930,9 +930,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723d244465309d5409e297b5486d62cbec06f2c47b05044414bb640e3f14caab" +checksum = "072ba77267264667aa9c9569145096f8cbcac5b5d5d2ba03a9d9782052ca0363" dependencies = [ "cairo-lang-utils", "good_lp", @@ -940,9 +940,9 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237030772ae5368f19a9247e1f63f753f8ad8de963477166e402f4825c0a141d" +checksum = "de4d09f089c96ad068b0e440d2373b06c1be90a1591e231fab4ff4cf362c0117" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -956,9 +956,9 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b71f0eb3a36a6cb5f7f07843926783c4c17e44c9516b53171727a108782f3eb" +checksum = "6eaa42107bc8fed034b88373b07d7a3d5fdb22c429528f08d599e3e270193910" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -976,9 +976,9 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d095d78e2f1de499429c95655d6135a3d24c384b36d8de9f84e0aa4e07ee152" +checksum = "a8fd6e40fea873204ef91a62441ab8f90374f1d003cfd4d14f0b0183239c7739" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -1001,9 +1001,9 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb828af7f948a3ef7fa65de14e3f639daedefb046dfefcad6e3116d2cb0f89a0" +checksum = "814d67e61ee997b0ccaf944522f6d93fd6878f22cdf63fe6b5172d57116b7927" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -1021,9 +1021,9 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135a600043bf7030eacc6ebf2a609c2364d6ffeb04e1f3c809a2738f6b02c829" +checksum = "4ad812c3db5c6f55b35e733a2de52d7922455d0312005f24dacf16184b838b26" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -1040,9 +1040,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac857ec4b564712f3e16e3314e23cc0787ab1c05cdfee83f1c8f9989a6eee40f" +checksum = "5b0ca87ce30be7fc6b64b6aca3e31f452204fd4a465ba64f44fe8bfdd7336e4b" dependencies = [ "cairo-lang-debug", "quote", @@ -1051,14 +1051,13 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cc37b7f8889cdea631aeea3bcc70d5c86ac8fb1d98aabc83f16283d60f1643" +checksum = "42ac517f588f8227ed80f084c8be7f179bfb02b51ed130842e1da9b249226931" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", "serde", - "smol_str", "thiserror", "toml", ] @@ -1096,9 +1095,9 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c560cf4b4a89325d3a9594f490fffee38cf30e0990e808bb927619de9d0c973a" +checksum = "cbc96420833d29ff08cf459905a4cc6b5ea3c181171bb08767df0d95934deaa2" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -1289,9 +1288,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d77ea2e35d3610098ff13e373fc519aedc6a5096ed8547081aacfc104ef4422" +checksum = "5ddf33670e8da1fb1a797e8dfe13cb123514d60d7dee603860ae3623fa86acc1" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -1305,9 +1304,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b01d505ab26ca9ce829faf3a8dd097f5d7962d2eb8f136017a260694a6a72e8" +checksum = "8e982f95850e97005481353ab438a9696bcdd9e93b1a315354482ae8bcb2e9c0" dependencies = [ "genco", "xshell", @@ -1342,9 +1341,9 @@ dependencies = [ [[package]] name = "cairo-lang-test-utils" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb143a22f5a3510df8c4dec76e17c1e36bbcbddcd7915601f6a51a72418c454f" +checksum = "e0423b12a6c9427f57084ed4a6d4b9d07d68fbca32bdac31509052899ba37881" dependencies = [ "cairo-lang-formatter", "cairo-lang-utils", @@ -1355,9 +1354,9 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.9.0-dev.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35df943ebcf8e1db11ee9f4f46f843dde5b71639ca79ea0d8caa7973f91d8b12" +checksum = "42d50bb95a378b1ce7c4401761290744c1b46773c4bf3db2534569510c380d12" dependencies = [ "hashbrown 0.14.5", "indexmap 2.6.0", @@ -1480,9 +1479,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -6643,9 +6642,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -6723,13 +6722,13 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starknet" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0623b045f3dc10aef030c9ddd4781cff9cbe1188b71063cc510b75d1f96be6" +checksum = "351ffff1bcf6a1dc569a1b330dfd85779e16506e7d4a87baa8be3744cb5415a6" dependencies = [ "starknet-accounts", "starknet-contract", - "starknet-core 0.6.1", + "starknet-core 0.7.2", "starknet-crypto 0.6.2", "starknet-ff", "starknet-macros", @@ -6739,13 +6738,13 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e97edc480348dca300e5a8234e6c4e6f2f1ac028f2b16fcce294ebe93d07f4" +checksum = "c7062b020f65d9da7f9dd9f1d97bfb644e881cda8ddb999799a799e6f2e408dd" dependencies = [ "async-trait", "auto_impl", - "starknet-core 0.6.1", + "starknet-core 0.7.2", "starknet-providers", "starknet-signers", "thiserror", @@ -6753,15 +6752,15 @@ dependencies = [ [[package]] name = "starknet-contract" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b86e3f6b3ca9a5c45271ab10871c99f7dc82fee3199d9f8c7baa2a1829947d" +checksum = "d858efc93d85de95065a5732cb3e94d0c746674964c0859aab442ffbb9de76b4" dependencies = [ "serde", "serde_json", "serde_with 2.3.3", "starknet-accounts", - "starknet-core 0.6.1", + "starknet-core 0.7.2", "starknet-providers", "thiserror", ] @@ -6784,6 +6783,24 @@ dependencies = [ "starknet-ff", ] +[[package]] +name = "starknet-core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f1683ca7c63f0642310eddedb7d35056d8306084dff323d440711065c63ed87" +dependencies = [ + "base64 0.21.7", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto 0.6.2", + "starknet-ff", +] + [[package]] name = "starknet-core" version = "0.10.0" @@ -6897,9 +6914,9 @@ dependencies = [ [[package]] name = "starknet-providers" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b136c26b72ff1756f0844e0aa80bab680ceb99d63921826facbb8e7340ff82" +checksum = "52072c2d258bf692affeccd602613d5f6c61a6ffc84da8f191ab4a1b0a5e24d1" dependencies = [ "async-trait", "auto_impl", @@ -6910,23 +6927,23 @@ dependencies = [ "serde", "serde_json", "serde_with 2.3.3", - "starknet-core 0.6.1", + "starknet-core 0.7.2", "thiserror", "url", ] [[package]] name = "starknet-signers" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9386015d2e6dc3df285bfb33a3afd8ad7596c70ed38ab57019de4d2dfc7826f" +checksum = "347b1bfc09846aafe16d2b3a5bc2d8a2f845e2958602442182d265fbd6011c2e" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", "rand", - "starknet-core 0.6.1", + "starknet-core 0.7.2", "starknet-crypto 0.6.2", "thiserror", ] diff --git a/replay/src/main.rs b/replay/src/main.rs index ba8cc76b..7f5a9863 100644 --- a/replay/src/main.rs +++ b/replay/src/main.rs @@ -1,6 +1,6 @@ use blockifier::state::cached_state::CachedState; use blockifier::state::errors::StateError; -use blockifier::transaction::objects::TransactionExecutionInfo; +use blockifier::transaction::objects::{RevertError, TransactionExecutionInfo}; use clap::{Parser, Subcommand}; use rpc_state_reader::execution::execute_tx_configurable; @@ -359,8 +359,8 @@ fn compare_execution( let events_and_msgs = format!( "{{ events_number: {}, l2_to_l1_messages_number: {} }}", - exec_rsc.n_events + 1, - exec_rsc.message_cost_info.l2_to_l1_payload_lengths.len(), + exec_rsc.archival_data.event_summary.n_events + 1, + exec_rsc.messages.l2_to_l1_payload_lengths.len(), ); let rpc_events_and_msgs = format!( "{{ events_number: {}, l2_to_l1_messages_number: {} }}", @@ -370,25 +370,30 @@ fn compare_execution( // currently adding 1 because the sequencer is counting only the // events produced by the inner calls of a callinfo - let events_match = exec_rsc.n_events + 1 == rpc_receipt.events.len(); + let events_match = exec_rsc.archival_data.event_summary.n_events + 1 == rpc_receipt.events.len(); let msgs_match = rpc_receipt.messages_sent.len() - == exec_rsc.message_cost_info.l2_to_l1_payload_lengths.len(); + == exec_rsc.messages.l2_to_l1_payload_lengths.len(); let events_msgs_match = events_match && msgs_match; - let state_changes = exec_rsc.state_changes_for_fee; + let state_changes = exec_rsc.state.state_changes_for_fee; let state_changes_for_fee_str = format!( "{{ n_class_hash_updates: {}, n_compiled_class_hash_updates: {}, n_modified_contracts: {}, n_storage_updates: {} }}", - state_changes.n_class_hash_updates, - state_changes.n_compiled_class_hash_updates, - state_changes.n_modified_contracts, - state_changes.n_storage_updates + state_changes.state_changes_count.n_class_hash_updates, + state_changes.state_changes_count.n_compiled_class_hash_updates, + state_changes.state_changes_count.n_modified_contracts, + state_changes.state_changes_count.n_storage_updates ); let execution_gas = execution.receipt.fee; let rpc_gas = rpc_receipt.actual_fee; debug!(?execution_gas, ?rpc_gas, "execution actual fee"); + let revert_error = execution.revert_error.map(|err| match err { + RevertError::Execution(e) => e.to_string(), + RevertError::PostExecution(p) => p.to_string() + }); + if !status_matches || !events_msgs_match { let root_of_error = if !status_matches { "EXECUTION STATUS DIVERGED" @@ -399,12 +404,12 @@ fn compare_execution( } else { "MESSAGE COUNT DIVERGED" }; - + error!( reverted, rpc_reverted, root_of_error = root_of_error, - execution_error_message = execution.revert_error, + execution_error_message = revert_error, n_events_and_messages = events_and_msgs, rpc_n_events_and_msgs = rpc_events_and_msgs, da_gas = da_gas_str, @@ -417,7 +422,7 @@ fn compare_execution( info!( reverted, rpc_reverted, - execution_error_message = execution.revert_error, + execution_error_message = revert_error, n_events_and_messages = events_and_msgs, rpc_n_events_and_msgs = rpc_events_and_msgs, da_gas = da_gas_str, diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index 9dd0f435..f3fd3809 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -19,7 +19,7 @@ starknet_api = {workspace = true} cairo-lang-starknet-classes = "2.9.0-dev.0" cairo-lang-utils = "2.9.0-dev.0" cairo-native = { workspace = true } -starknet = "0.6.0" +starknet = "0.7.0" flate2 = "1.0.25" cairo-vm = "1.0.0-rc5" blockifier = { workspace = true } diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 26fbad07..3a642ef8 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -109,20 +109,20 @@ pub fn execute_tx( }); BlockiAccountTransaction::new(deploy) } - SNTransaction::Declare(tx) => { - // Fetch the contract_class from the next block (as we don't have it in the previous one) - let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); + // SNTransaction::Declare(tx) => { + // // Fetch the contract_class from the next block (as we don't have it in the previous one) + // let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader.get_compiled_contract_class(&tx.class_hash()).unwrap(); - let class_info = calculate_class_info_for_testing(contract_class); + // let contract_class = next_reader.get_compiled_contract_class(&tx.class_hash()).unwrap(); + // let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - tx_hash, - class_info, - }); - BlockiAccountTransaction::new(declare) - } + // let declare = AccountTransaction::Declare(DeclareTransaction { + // tx, + // tx_hash, + // class_info, + // }); + // BlockiAccountTransaction::new(declare) + // } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { @@ -138,7 +138,8 @@ pub fn execute_tx( receipt, ); } - SNTransaction::Deploy(_) => todo!(), + SNTransaction::Deploy(_) + | SNTransaction::Declare(_) => todo!(), }; ( @@ -150,15 +151,15 @@ pub fn execute_tx( ) } -fn calculate_class_info_for_testing(contract_class: RunnableContractClass) -> ClassInfo { - let sierra_program_length = match contract_class { - RunnableContractClass::V0(contract) => (ContractClass::V0(()), 0), - RunnableContractClass::V1(contract) => (ContractClass::V1(()), 100), - RunnableContractClass::V1Native(contract) => (ContractClass::V1(()), 100), - }; +// fn calculate_class_info_for_testing(contract_class: RunnableContractClass) -> ClassInfo { +// let (contract_class, sierra_program_length) = match contract_class { +// RunnableContractClass::V0(contract) => (ContractClass::V0(contract.into()), 0), +// RunnableContractClass::V1(contract) => (ContractClass::V1(contract.into()), 100), +// RunnableContractClass::V1Native(contract) => (ContractClass::V1(()), 100), +// }; - ClassInfo::new(contract_class, sierra_program_length, 100).unwrap() -} +// ClassInfo::new(&contract_class, sierra_program_length, 100).unwrap() +// } pub fn execute_tx_configurable_with_state( tx_hash: &TransactionHash, @@ -228,23 +229,23 @@ pub fn execute_tx_configurable_with_state( }); BlockiAccountTransaction::new(deploy) } - SNTransaction::Declare(tx) => { - let block_number = block_context.block_info().block_number; - let network = parse_to_rpc_chain(&chain_id.to_string()); - // we need to retrieve the next block in order to get the contract_class - let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader - .get_compiled_contract_class(&tx.class_hash()) - .unwrap(); - let class_info = calculate_class_info_for_testing(contract_class); + // SNTransaction::Declare(tx) => { + // let block_number = block_context.block_info().block_number; + // let network = parse_to_rpc_chain(&chain_id.to_string()); + // // we need to retrieve the next block in order to get the contract_class + // let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); + // let contract_class = next_reader + // .get_compiled_contract_class(tx.class_hash()) + // .unwrap(); + // let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - class_info, - tx_hash: *tx_hash, - }); - BlockiAccountTransaction::new(declare) - } + // let declare = AccountTransaction::Declare(DeclareTransaction { + // tx, + // class_info, + // tx_hash: *tx_hash, + // }); + // BlockiAccountTransaction::new(declare) + // } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { @@ -317,21 +318,21 @@ pub fn execute_tx_with_blockifier( }); BlockiAccountTransaction::new(deploy) } - SNTransaction::Declare(tx) => { - let contract_class = state - .state - .get_compiled_contract_class(&tx.class_hash()) - .unwrap(); + // SNTransaction::Declare(tx) => { + // let contract_class = state + // .state + // .get_compiled_contract_class(tx.class_hash()) + // .unwrap(); - let class_info = calculate_class_info_for_testing(contract_class); + // let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - tx_hash: transaction_hash, - class_info, - }); - BlockiAccountTransaction::new(declare) - } + // let declare = AccountTransaction::Declare(DeclareTransaction { + // tx, + // tx_hash: transaction_hash, + // class_info, + // }); + // BlockiAccountTransaction::new(declare) + // } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let account_transaction = L1HandlerTransaction { diff --git a/rpc-state-reader/src/objects.rs b/rpc-state-reader/src/objects.rs index 9863fe85..829cce74 100644 --- a/rpc-state-reader/src/objects.rs +++ b/rpc-state-reader/src/objects.rs @@ -1,6 +1,7 @@ //! This module contains custom objects //! and how to deserialize them from RPC calls +use blockifier::{execution::stack_trace::ErrorStackSegment, transaction::objects::RevertError}; use cairo_vm::vm::runners::cairo_runner::ExecutionResources; use serde::{Deserialize, Serialize}; use starknet_api::{ diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index df87f340..b42a07ae 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -76,7 +76,8 @@ pub fn decode_reader(bytes: Vec) -> io::Result { pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> AotContractExecutor { let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); - let executor = cache_lock.read().unwrap().get(&class_hash); + let executor = cache_lock.read().unwrap(); + let executor = executor.get(&class_hash); match executor { Some(executor) => executor.clone(), @@ -122,9 +123,7 @@ pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> A executor }; - cache.insert(class_hash, executor); - - executor + cache.insert(class_hash, executor).unwrap() } } } From cccecab898b763f4c6efabc732685bb6e0f5454f Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 13:19:20 -0300 Subject: [PATCH 03/32] update --- Cargo.lock | 91 +++++++++++++------------------ Cargo.toml | 8 +-- replay/src/main.rs | 11 ++-- rpc-state-reader/src/execution.rs | 21 ++----- rpc-state-reader/src/objects.rs | 1 - rpc-state-reader/src/reader.rs | 49 ++++++++--------- rpc-state-reader/src/utils.rs | 3 +- 7 files changed, 76 insertions(+), 108 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c30afe5d..857ba19d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,6 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "ark-ec", @@ -688,6 +687,7 @@ dependencies = [ "sha2", "starknet-types-core", "starknet_api", + "starknet_sierra_compile", "strum 0.25.0", "strum_macros 0.25.3", "tempfile", @@ -698,7 +698,6 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "assert_matches", "blockifier", @@ -852,9 +851,9 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] name = "cairo-lang-casm" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7635bcfdc89a7b88ee1b906d1c5320a2da796fcfaa22a47fd8d8f778dbec8847" +checksum = "e1e0dcdb6358bb639dd729546611bd99bada94c86e3f262c3637855abea9a972" dependencies = [ "cairo-lang-utils", "indoc", @@ -892,18 +891,18 @@ dependencies = [ [[package]] name = "cairo-lang-debug" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb0b34d9179357ea50d7551fbbba723f1ee727cb84fc3d8913629225cfd89bf" +checksum = "0635aa554d297acefe6a35b495aba2795d0af5b7f97c4ab63829c7d62291ef41" dependencies = [ "cairo-lang-utils", ] [[package]] name = "cairo-lang-defs" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c014f7eca4f119eef98767b3991e3d2d2fd1b3acb158b876f3b427c08390c0aa" +checksum = "86b356e1c09898e8b8cfdd9731579d89365a13d8b4f7e717962e0cc7d125b83c" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -918,9 +917,9 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a26b27874dbb39a678443233e5259caa19793d8c4ca04470126cbbb46d21955" +checksum = "2dfe7c6ff96182da29012b707a3554e34a50f19cc96013ee45b0eb36dd396ec8" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -930,9 +929,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072ba77267264667aa9c9569145096f8cbcac5b5d5d2ba03a9d9782052ca0363" +checksum = "723d244465309d5409e297b5486d62cbec06f2c47b05044414bb640e3f14caab" dependencies = [ "cairo-lang-utils", "good_lp", @@ -940,9 +939,9 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de4d09f089c96ad068b0e440d2373b06c1be90a1591e231fab4ff4cf362c0117" +checksum = "237030772ae5368f19a9247e1f63f753f8ad8de963477166e402f4825c0a141d" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -956,9 +955,9 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eaa42107bc8fed034b88373b07d7a3d5fdb22c429528f08d599e3e270193910" +checksum = "5b71f0eb3a36a6cb5f7f07843926783c4c17e44c9516b53171727a108782f3eb" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -976,9 +975,9 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fd6e40fea873204ef91a62441ab8f90374f1d003cfd4d14f0b0183239c7739" +checksum = "7d095d78e2f1de499429c95655d6135a3d24c384b36d8de9f84e0aa4e07ee152" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -1001,9 +1000,9 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "814d67e61ee997b0ccaf944522f6d93fd6878f22cdf63fe6b5172d57116b7927" +checksum = "bb828af7f948a3ef7fa65de14e3f639daedefb046dfefcad6e3116d2cb0f89a0" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -1021,9 +1020,9 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad812c3db5c6f55b35e733a2de52d7922455d0312005f24dacf16184b838b26" +checksum = "135a600043bf7030eacc6ebf2a609c2364d6ffeb04e1f3c809a2738f6b02c829" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -1040,9 +1039,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0ca87ce30be7fc6b64b6aca3e31f452204fd4a465ba64f44fe8bfdd7336e4b" +checksum = "ac857ec4b564712f3e16e3314e23cc0787ab1c05cdfee83f1c8f9989a6eee40f" dependencies = [ "cairo-lang-debug", "quote", @@ -1051,13 +1050,14 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ac517f588f8227ed80f084c8be7f179bfb02b51ed130842e1da9b249226931" +checksum = "23cc37b7f8889cdea631aeea3bcc70d5c86ac8fb1d98aabc83f16283d60f1643" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", "serde", + "smol_str", "thiserror", "toml", ] @@ -1095,9 +1095,9 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc96420833d29ff08cf459905a4cc6b5ea3c181171bb08767df0d95934deaa2" +checksum = "c560cf4b4a89325d3a9594f490fffee38cf30e0990e808bb927619de9d0c973a" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -1288,9 +1288,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddf33670e8da1fb1a797e8dfe13cb123514d60d7dee603860ae3623fa86acc1" +checksum = "8d77ea2e35d3610098ff13e373fc519aedc6a5096ed8547081aacfc104ef4422" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -1341,9 +1341,9 @@ dependencies = [ [[package]] name = "cairo-lang-test-utils" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0423b12a6c9427f57084ed4a6d4b9d07d68fbca32bdac31509052899ba37881" +checksum = "eb143a22f5a3510df8c4dec76e17c1e36bbcbddcd7915601f6a51a72418c454f" dependencies = [ "cairo-lang-formatter", "cairo-lang-utils", @@ -1354,9 +1354,9 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.9.0" +version = "2.9.0-dev.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d50bb95a378b1ce7c4401761290744c1b46773c4bf3db2534569510c380d12" +checksum = "35df943ebcf8e1db11ee9f4f46f843dde5b71639ca79ea0d8caa7973f91d8b12" dependencies = [ "hashbrown 0.14.5", "indexmap 2.6.0", @@ -2342,12 +2342,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3768,7 +3768,6 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "tokio", ] @@ -4536,7 +4535,6 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "assert_matches", "blockifier", @@ -5001,7 +4999,6 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5020,7 +5017,6 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "clap", "infra_utils", @@ -5035,7 +5031,6 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "blockifier", @@ -5058,7 +5053,6 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "libp2p", "serde", @@ -5067,7 +5061,6 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "quote", "syn 2.0.89", @@ -5077,7 +5070,6 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "anyhow", "async-trait", @@ -5111,7 +5103,6 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6966,7 +6957,6 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6992,7 +6982,6 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7019,7 +7008,6 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "axum", @@ -7047,7 +7035,6 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "axum", @@ -7066,7 +7053,6 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "papyrus_network_types", @@ -7080,7 +7066,6 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7098,11 +7083,11 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a#7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", "cairo-lang-utils", + "cairo-native", "papyrus_config", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 896303d2..0aab79fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main -blockifier = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a", features = ["cairo_native"]} # main -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main -blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer", rev = "7e7f34e756edcb1f3334aabcc0f8ec3dce40c85a" } # main +starknet_api = { path = "../sequencer/crates/starknet_api" } # main +blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"]} # main +starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main +blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } diff --git a/replay/src/main.rs b/replay/src/main.rs index 7f5a9863..ec78bc37 100644 --- a/replay/src/main.rs +++ b/replay/src/main.rs @@ -370,9 +370,10 @@ fn compare_execution( // currently adding 1 because the sequencer is counting only the // events produced by the inner calls of a callinfo - let events_match = exec_rsc.archival_data.event_summary.n_events + 1 == rpc_receipt.events.len(); - let msgs_match = rpc_receipt.messages_sent.len() - == exec_rsc.messages.l2_to_l1_payload_lengths.len(); + let events_match = + exec_rsc.archival_data.event_summary.n_events + 1 == rpc_receipt.events.len(); + let msgs_match = + rpc_receipt.messages_sent.len() == exec_rsc.messages.l2_to_l1_payload_lengths.len(); let events_msgs_match = events_match && msgs_match; @@ -391,7 +392,7 @@ fn compare_execution( let revert_error = execution.revert_error.map(|err| match err { RevertError::Execution(e) => e.to_string(), - RevertError::PostExecution(p) => p.to_string() + RevertError::PostExecution(p) => p.to_string(), }); if !status_matches || !events_msgs_match { @@ -404,7 +405,7 @@ fn compare_execution( } else { "MESSAGE COUNT DIVERGED" }; - + error!( reverted, rpc_reverted, diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 3a642ef8..4b06f660 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -1,14 +1,10 @@ -use std::{u32, usize}; - use crate::{ objects::{RpcTransactionReceipt, RpcTransactionTrace}, reader::{RpcChain, RpcStateReader}, }; use blockifier::{ - blockifier::block::BlockInfo, bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, - execution::contract_class::RunnableContractClass, state::{cached_state::CachedState, state_api::StateReader}, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, @@ -17,17 +13,11 @@ use blockifier::{ }, versioned_constants::{VersionedConstants, VersionedConstantsOverrides}, }; -use blockifier_reexecution::state_reader::compile::{ - legacy_to_contract_class_v0, sierra_to_contact_class_v1, -}; -use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use starknet_api::{ - block::BlockNumber, - deprecated_contract_class::ContractClass as DeprecatedContractClass, - contract_class::{ClassInfo, ContractClass, }, - core::{calculate_contract_address, ContractAddress, PatriciaKey}, + block::{BlockInfo, BlockNumber}, + core::{calculate_contract_address, ContractAddress}, executable_transaction::{ - AccountTransaction, DeclareTransaction, DeployAccountTransaction, InvokeTransaction, + AccountTransaction, DeployAccountTransaction, InvokeTransaction, L1HandlerTransaction, }, felt, @@ -138,8 +128,7 @@ pub fn execute_tx( receipt, ); } - SNTransaction::Deploy(_) - | SNTransaction::Declare(_) => todo!(), + SNTransaction::Deploy(_) | SNTransaction::Declare(_) => todo!(), }; ( @@ -157,7 +146,7 @@ pub fn execute_tx( // RunnableContractClass::V1(contract) => (ContractClass::V1(contract.into()), 100), // RunnableContractClass::V1Native(contract) => (ContractClass::V1(()), 100), // }; - + // ClassInfo::new(&contract_class, sierra_program_length, 100).unwrap() // } diff --git a/rpc-state-reader/src/objects.rs b/rpc-state-reader/src/objects.rs index 829cce74..9863fe85 100644 --- a/rpc-state-reader/src/objects.rs +++ b/rpc-state-reader/src/objects.rs @@ -1,7 +1,6 @@ //! This module contains custom objects //! and how to deserialize them from RPC calls -use blockifier::{execution::stack_trace::ErrorStackSegment, transaction::objects::RevertError}; use cairo_vm::vm::runners::cairo_runner::ExecutionResources; use serde::{Deserialize, Serialize}; use starknet_api::{ diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index a49700c3..bf494a68 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -1,24 +1,20 @@ use std::{ - collections::HashMap, env, fmt, - num::NonZeroU128, sync::Arc, thread, time::{Duration, Instant}, - usize, }; use blockifier::{ - blockifier::block::{BlockInfo, GasPrices}, + blockifier::block::validated_gas_prices, execution::{ contract_class::{ - ContractClassV0, ContractClassV0Inner, ContractClassV1, ContractClassV1Inner, - RunnableContractClass, + CompiledClassV0, CompiledClassV0Inner, CompiledClassV1, + RunnableCompiledClass, }, - native::contract_class::NativeContractClassV1, + native::contract_class::NativeCompiledClassV1, }, state::state_api::{StateReader, StateResult}, - versioned_constants::CompilerVersion, }; use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use cairo_lang_utils::bigint::BigUintAsHex; @@ -27,8 +23,7 @@ use serde::Serialize; use serde_json::Value; use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ - block::{BlockNumber, GasPrice, NonzeroGasPrice}, - contract_class::ContractClass, + block::{BlockInfo, BlockNumber, GasPrice, NonzeroGasPrice}, core::{ChainId, ClassHash, CompiledClassHash, ContractAddress, Nonce}, state::StorageKey, transaction::{Transaction, TransactionHash}, @@ -154,8 +149,8 @@ impl RpcStateReader { pub fn get_block_info(&self) -> StateResult { // This function is inspired by sequencer's RpcStateReader::get_block_info - fn parse_gas_price(price: GasPrice) -> NonZeroU128 { - NonZeroU128::new(price.0).unwrap_or(NonZeroU128::MIN) + fn parse_gas_price(price: GasPrice) -> NonzeroGasPrice { + NonzeroGasPrice::new(price).unwrap_or(NonzeroGasPrice::MIN) } let params = GetBlockWithTxHashesParams { @@ -171,13 +166,13 @@ impl RpcStateReader { block_number: header.block_number, sequencer_address: header.sequencer_address, block_timestamp: header.timestamp, - gas_prices: GasPrices::new( - NonzeroGasPrice::new(header.l1_gas_price.price_in_wei)?, - NonzeroGasPrice::new(header.l1_gas_price.price_in_fri)?, - NonzeroGasPrice::new(header.l1_data_gas_price.price_in_wei)?, - NonzeroGasPrice::new(header.l1_data_gas_price.price_in_fri)?, - NonzeroGasPrice::MIN, - NonzeroGasPrice::MIN, + gas_prices: validated_gas_prices( + parse_gas_price(header.l1_gas_price.price_in_wei), + parse_gas_price(header.l1_gas_price.price_in_fri), + parse_gas_price(header.l1_data_gas_price.price_in_wei), + parse_gas_price(header.l1_data_gas_price.price_in_fri), + parse_gas_price(header.l2_gas_price.price_in_wei), + parse_gas_price(header.l2_gas_price.price_in_fri), ), use_kzg_da: true, }) @@ -297,7 +292,7 @@ impl StateReader for RpcStateReader { } } - fn get_compiled_contract_class(&self, class_hash: ClassHash) -> StateResult { + fn get_compiled_class(&self, class_hash: ClassHash) -> StateResult { Ok(match self.get_contract_class(&class_hash)? { SNContractClass::Legacy(compressed_legacy_cc) => { compile_legacy_cc(compressed_legacy_cc) @@ -316,7 +311,7 @@ impl StateReader for RpcStateReader { fn compile_sierra_cc( flattened_sierra_cc: starknet::core::types::FlattenedSierraClass, class_hash: ClassHash, -) -> RunnableContractClass { +) -> RunnableCompiledClass { let middle_sierra: utils::MiddleSierraContractClass = { let v = serde_json::to_value(flattened_sierra_cc).unwrap(); serde_json::from_value(v).unwrap() @@ -352,28 +347,28 @@ fn compile_sierra_cc( "vm contract compilation finished" ); - RunnableContractClass::V1(casm_cc.try_into().unwrap()) + RunnableCompiledClass::V1(casm_cc.try_into().unwrap()) } else { let executor = utils::get_native_executor(&sierra_cc, class_hash); let casm = CasmContractClass::from_contract_class(sierra_cc, false, usize::MAX).unwrap(); - let casm = ContractClassV1::try_from(casm).unwrap(); + let casm = CompiledClassV1::try_from(casm).unwrap(); - RunnableContractClass::V1Native(NativeContractClassV1::new(executor, casm)) + RunnableCompiledClass::V1Native(NativeCompiledClassV1::new(executor, casm)) } } fn compile_legacy_cc( compressed_legacy_cc: starknet::core::types::CompressedLegacyContractClass, -) -> RunnableContractClass { +) -> RunnableCompiledClass { let as_str = utils::decode_reader(compressed_legacy_cc.program).unwrap(); let program = Program::from_bytes(as_str.as_bytes(), None).unwrap(); let entry_points_by_type = utils::map_entry_points_by_type_legacy(compressed_legacy_cc.entry_points_by_type); - let inner = Arc::new(ContractClassV0Inner { + let inner = Arc::new(CompiledClassV0Inner { program, entry_points_by_type, }); - RunnableContractClass::V0(ContractClassV0(inner)) + RunnableCompiledClass::V0(CompiledClassV0(inner)) } /// Retries the closure `MAX_RETRIES` times on RPC errors, diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index b42a07ae..b76905f9 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -3,7 +3,7 @@ use std::{ fs, io::{self, Read}, path::PathBuf, - sync::{Arc, OnceLock, RwLock}, + sync::{OnceLock, RwLock}, time::Instant, }; @@ -17,7 +17,6 @@ use starknet_api::{ core::{ClassHash, EntryPointSelector}, deprecated_contract_class::{EntryPointOffset, EntryPointV0}, hash::StarkHash, - state::{EntryPoint, FunctionIndex}, }; use tracing::info; From eee9886557fd4041bc20309e385521d4050fc721 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 14:07:52 -0300 Subject: [PATCH 04/32] update --- Cargo.lock | 48 ++++--------- rpc-state-reader/Cargo.toml | 2 +- rpc-state-reader/src/execution.rs | 111 ++++++++++++++++-------------- rpc-state-reader/src/reader.rs | 3 +- 4 files changed, 76 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 857ba19d..08afff57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6713,13 +6713,13 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starknet" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351ffff1bcf6a1dc569a1b330dfd85779e16506e7d4a87baa8be3744cb5415a6" +checksum = "6f0623b045f3dc10aef030c9ddd4781cff9cbe1188b71063cc510b75d1f96be6" dependencies = [ "starknet-accounts", "starknet-contract", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-crypto 0.6.2", "starknet-ff", "starknet-macros", @@ -6729,13 +6729,13 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.6.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7062b020f65d9da7f9dd9f1d97bfb644e881cda8ddb999799a799e6f2e408dd" +checksum = "68e97edc480348dca300e5a8234e6c4e6f2f1ac028f2b16fcce294ebe93d07f4" dependencies = [ "async-trait", "auto_impl", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-providers", "starknet-signers", "thiserror", @@ -6743,15 +6743,15 @@ dependencies = [ [[package]] name = "starknet-contract" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d858efc93d85de95065a5732cb3e94d0c746674964c0859aab442ffbb9de76b4" +checksum = "69b86e3f6b3ca9a5c45271ab10871c99f7dc82fee3199d9f8c7baa2a1829947d" dependencies = [ "serde", "serde_json", "serde_with 2.3.3", "starknet-accounts", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-providers", "thiserror", ] @@ -6774,24 +6774,6 @@ dependencies = [ "starknet-ff", ] -[[package]] -name = "starknet-core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1683ca7c63f0642310eddedb7d35056d8306084dff323d440711065c63ed87" -dependencies = [ - "base64 0.21.7", - "flate2", - "hex", - "serde", - "serde_json", - "serde_json_pythonic", - "serde_with 2.3.3", - "sha3", - "starknet-crypto 0.6.2", - "starknet-ff", -] - [[package]] name = "starknet-core" version = "0.10.0" @@ -6905,9 +6887,9 @@ dependencies = [ [[package]] name = "starknet-providers" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52072c2d258bf692affeccd602613d5f6c61a6ffc84da8f191ab4a1b0a5e24d1" +checksum = "c3b136c26b72ff1756f0844e0aa80bab680ceb99d63921826facbb8e7340ff82" dependencies = [ "async-trait", "auto_impl", @@ -6918,23 +6900,23 @@ dependencies = [ "serde", "serde_json", "serde_with 2.3.3", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "thiserror", "url", ] [[package]] name = "starknet-signers" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347b1bfc09846aafe16d2b3a5bc2d8a2f845e2958602442182d265fbd6011c2e" +checksum = "d9386015d2e6dc3df285bfb33a3afd8ad7596c70ed38ab57019de4d2dfc7826f" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", "rand", - "starknet-core 0.7.2", + "starknet-core 0.6.1", "starknet-crypto 0.6.2", "thiserror", ] diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index f3fd3809..9dd0f435 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -19,7 +19,7 @@ starknet_api = {workspace = true} cairo-lang-starknet-classes = "2.9.0-dev.0" cairo-lang-utils = "2.9.0-dev.0" cairo-native = { workspace = true } -starknet = "0.7.0" +starknet = "0.6.0" flate2 = "1.0.25" cairo-vm = "1.0.0-rc5" blockifier = { workspace = true } diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 4b06f660..d31190cd 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -5,6 +5,7 @@ use crate::{ use blockifier::{ bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, + execution::contract_class::RunnableCompiledClass, state::{cached_state::CachedState, state_api::StateReader}, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, @@ -13,11 +14,16 @@ use blockifier::{ }, versioned_constants::{VersionedConstants, VersionedConstantsOverrides}, }; +use blockifier_reexecution::state_reader::compile::{ + legacy_to_contract_class_v0, sierra_to_contact_class_v1, +}; +use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ block::{BlockInfo, BlockNumber}, + contract_class::ClassInfo, core::{calculate_contract_address, ContractAddress}, executable_transaction::{ - AccountTransaction, DeployAccountTransaction, InvokeTransaction, + AccountTransaction, DeclareTransaction, DeployAccountTransaction, InvokeTransaction, L1HandlerTransaction, }, felt, @@ -99,20 +105,20 @@ pub fn execute_tx( }); BlockiAccountTransaction::new(deploy) } - // SNTransaction::Declare(tx) => { - // // Fetch the contract_class from the next block (as we don't have it in the previous one) - // let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); + SNTransaction::Declare(tx) => { + // Fetch the contract_class from the next block (as we don't have it in the previous one) + let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - // let contract_class = next_reader.get_compiled_contract_class(&tx.class_hash()).unwrap(); - // let class_info = calculate_class_info_for_testing(contract_class); + let contract_class = next_reader.get_contract_class(&tx.class_hash()).unwrap(); + let class_info = calculate_class_info_for_testing(contract_class); - // let declare = AccountTransaction::Declare(DeclareTransaction { - // tx, - // tx_hash, - // class_info, - // }); - // BlockiAccountTransaction::new(declare) - // } + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + tx_hash, + class_info, + }); + BlockiAccountTransaction::new(declare) + } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { @@ -128,7 +134,7 @@ pub fn execute_tx( receipt, ); } - SNTransaction::Deploy(_) | SNTransaction::Declare(_) => todo!(), + SNTransaction::Deploy(_) => todo!(), }; ( @@ -140,15 +146,21 @@ pub fn execute_tx( ) } -// fn calculate_class_info_for_testing(contract_class: RunnableContractClass) -> ClassInfo { -// let (contract_class, sierra_program_length) = match contract_class { -// RunnableContractClass::V0(contract) => (ContractClass::V0(contract.into()), 0), -// RunnableContractClass::V1(contract) => (ContractClass::V1(contract.into()), 100), -// RunnableContractClass::V1Native(contract) => (ContractClass::V1(()), 100), -// }; +fn calculate_class_info_for_testing(contract_class: SNContractClass) -> ClassInfo { + match contract_class { + SNContractClass::Sierra(s) => { + let abi = s.abi.len(); + let program_length = s.sierra_program.len(); -// ClassInfo::new(&contract_class, sierra_program_length, 100).unwrap() -// } + ClassInfo::new(&sierra_to_contact_class_v1(s).unwrap(), program_length, abi).unwrap() + } + SNContractClass::Legacy(l) => { + let abi = l.abi.clone().unwrap().len(); + + ClassInfo::new(&legacy_to_contract_class_v0(l).unwrap(), 0, abi).unwrap() + } + } +} pub fn execute_tx_configurable_with_state( tx_hash: &TransactionHash, @@ -218,23 +230,21 @@ pub fn execute_tx_configurable_with_state( }); BlockiAccountTransaction::new(deploy) } - // SNTransaction::Declare(tx) => { - // let block_number = block_context.block_info().block_number; - // let network = parse_to_rpc_chain(&chain_id.to_string()); - // // we need to retrieve the next block in order to get the contract_class - // let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - // let contract_class = next_reader - // .get_compiled_contract_class(tx.class_hash()) - // .unwrap(); - // let class_info = calculate_class_info_for_testing(contract_class); + SNTransaction::Declare(tx) => { + let block_number = block_context.block_info().block_number; + let network = parse_to_rpc_chain(&chain_id.to_string()); + // we need to retrieve the next block in order to get the contract_class + let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); + let contract_class = next_reader.get_contract_class(&tx.class_hash()).unwrap(); + let class_info = calculate_class_info_for_testing(contract_class); - // let declare = AccountTransaction::Declare(DeclareTransaction { - // tx, - // class_info, - // tx_hash: *tx_hash, - // }); - // BlockiAccountTransaction::new(declare) - // } + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + class_info, + tx_hash: *tx_hash, + }); + BlockiAccountTransaction::new(declare) + } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let blockifier_tx = L1HandlerTransaction { @@ -279,7 +289,7 @@ pub fn execute_tx_configurable( /// and can be used with any cached state. It already receives all context information /// needed to execute the transaction. pub fn execute_tx_with_blockifier( - state: &mut CachedState, + state: &mut CachedState, context: BlockContext, transaction: SNTransaction, transaction_hash: TransactionHash, @@ -307,21 +317,18 @@ pub fn execute_tx_with_blockifier( }); BlockiAccountTransaction::new(deploy) } - // SNTransaction::Declare(tx) => { - // let contract_class = state - // .state - // .get_compiled_contract_class(tx.class_hash()) - // .unwrap(); + SNTransaction::Declare(tx) => { + let contract_class = state.state.get_contract_class(&tx.class_hash()).unwrap(); - // let class_info = calculate_class_info_for_testing(contract_class); + let class_info = calculate_class_info_for_testing(contract_class); - // let declare = AccountTransaction::Declare(DeclareTransaction { - // tx, - // tx_hash: transaction_hash, - // class_info, - // }); - // BlockiAccountTransaction::new(declare) - // } + let declare = AccountTransaction::Declare(DeclareTransaction { + tx, + tx_hash: transaction_hash, + class_info, + }); + BlockiAccountTransaction::new(declare) + } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let account_transaction = L1HandlerTransaction { diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index bf494a68..721c146f 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -9,8 +9,7 @@ use blockifier::{ blockifier::block::validated_gas_prices, execution::{ contract_class::{ - CompiledClassV0, CompiledClassV0Inner, CompiledClassV1, - RunnableCompiledClass, + CompiledClassV0, CompiledClassV0Inner, CompiledClassV1, RunnableCompiledClass, }, native::contract_class::NativeCompiledClassV1, }, From 228756db19dda600b5c1157cdb906a7c4d1e8055 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 15:04:37 -0300 Subject: [PATCH 05/32] update --- rpc-state-reader/src/execution.rs | 77 +++++++++++++++++-------------- rpc-state-reader/src/lib.rs | 2 +- rpc-state-reader/src/reader.rs | 8 ++-- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index d31190cd..44b66d54 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -393,12 +393,15 @@ mod tests { use std::thread; use blockifier::{ - execution::call_info::CallInfo, + execution::call_info::{CallInfo, EventSummary, ExecutionSummary}, + fee::resources::{StarknetResources, StateResources}, state::cached_state::StateChangesCount, - transaction::objects::{GasVector, StarknetResources}, }; use pretty_assertions_sorted::assert_eq_sorted; - use starknet_api::block::BlockNumber; + use starknet_api::{ + block::BlockNumber, + execution_resources::{GasAmount, GasVector}, + }; use test_case::test_case; use super::*; @@ -421,10 +424,10 @@ mod tests { let previous_block = BlockNumber(block_number - 1); let (tx_info, trace, _) = execute_tx(hash, chain, previous_block); - assert_eq!( - tx_info.revert_error.unwrap(), - trace.execute_invocation.unwrap().. - ); + // assert_eq!( + // tx_info.revert_error.unwrap(), + // trace.execute_invocation.unwrap() + // ); // We can't currently compare fee values } @@ -612,7 +615,7 @@ mod tests { "0x04ba569a40a866fd1cbb2f3d3ba37ef68fb91267a4931a377d6acc6e5a854f9a", 648462, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 192, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(192), l2_gas: GasAmount(0) }, 7, 3, 0, @@ -629,7 +632,7 @@ mod tests { "0x0355059efee7a38ba1fd5aef13d261914608dce7bdfacad92a71e396f0ad7a77", 661815, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 320, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(320), l2_gas: GasAmount(0) }, 9, 2, 0, @@ -646,7 +649,7 @@ mod tests { "0x05324bac55fb9fb53e738195c2dcc1e7fed1334b6db824665e3e984293bec95e", 662246, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 320, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(320), l2_gas: GasAmount(0) }, 9, 2, 0, @@ -663,7 +666,7 @@ mod tests { "0x670321c71835004fcab639e871ef402bb807351d126ccc4d93075ff2c31519d", 654001, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 320, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(320), l2_gas: GasAmount(0) }, 7, 2, 0, @@ -680,7 +683,7 @@ mod tests { "0x06962f11a96849ebf05cd222313858a93a8c5f300493ed6c5859dd44f5f2b4e3", 654770, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 320, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(320), l2_gas: GasAmount(0) }, 7, 2, 0, @@ -697,7 +700,7 @@ mod tests { "0x078b81326882ecd2dc6c5f844527c3f33e0cdb52701ded7b1aa4d220c5264f72", 653019, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 640, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(640), l2_gas: GasAmount(0) }, 28, 2, 0, @@ -714,7 +717,7 @@ mod tests { "0x0780e3a498b4fd91ab458673891d3e8ee1453f9161f4bfcb93dd1e2c91c52e10", 650558, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 448, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(448), l2_gas: GasAmount(0) }, 24, 3, 0, @@ -731,7 +734,7 @@ mod tests { "0x4f552c9430bd21ad300db56c8f4cae45d554a18fac20bf1703f180fac587d7e", 351226, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 3, 0, 0, @@ -748,7 +751,7 @@ mod tests { "0x176a92e8df0128d47f24eebc17174363457a956fa233cc6a7f8561bfbd5023a", 317093, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 6, 2, 0, @@ -765,7 +768,7 @@ mod tests { "0x026c17728b9cd08a061b1f17f08034eb70df58c1a96421e73ee6738ad258a94c", 169929, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 8, 2, 0, @@ -782,7 +785,7 @@ mod tests { "0x73ef9cde09f005ff6f411de510ecad4cdcf6c4d0dfc59137cff34a4fc74dfd", 654001, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 5, 0, 0, @@ -799,7 +802,7 @@ mod tests { "0x0743092843086fa6d7f4a296a226ee23766b8acf16728aef7195ce5414dc4d84", 186549, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 384, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(384), l2_gas: GasAmount(0) }, 7, 2, 0, @@ -816,7 +819,7 @@ mod tests { "0x066e1f01420d8e433f6ef64309adb1a830e5af0ea67e3d935de273ca57b3ae5e", 662252, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 448, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(448), l2_gas: GasAmount(0) }, 18, 2, 0, @@ -835,7 +838,7 @@ mod tests { "0x04756d898323a8f884f5a6aabd6834677f4bbaeecc2522f18b3ae45b3f99cd1e", 662250, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 10, 2, 0, @@ -852,7 +855,7 @@ mod tests { "0x00f390691fd9e865f5aef9c7cc99889fb6c2038bc9b7e270e8a4fe224ccd404d", 662251, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 256, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(256), l2_gas: GasAmount(0) }, 12, 5, 0, @@ -869,7 +872,7 @@ mod tests { "0x26be3e906db66973de1ca5eec1ddb4f30e3087dbdce9560778937071c3d3a83", 351269, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 3, 0, 0, @@ -886,7 +889,7 @@ mod tests { "0x0310c46edc795c82c71f600159fa9e6c6540cb294df9d156f685bfe62b31a5f4", 662249, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 640, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(640), l2_gas: GasAmount(0) }, 37, 2, 0, @@ -903,7 +906,7 @@ mod tests { "0x06a09ffbf996178ac6e90101047e42fe29cb7108573b2ecf4b0ebd2cba544cb4", 662248, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 384, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(384), l2_gas: GasAmount(0) }, 4, 2, 0, @@ -920,7 +923,7 @@ mod tests { "0x026e04e96ba1b75bfd066c8e138e17717ecb654909e6ac24007b644ac23e4b47", 536893, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 896, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(896), l2_gas: GasAmount(0) }, 24, 4, 0, @@ -937,7 +940,7 @@ mod tests { "0x01351387ef63fd6fe5ec10fa57df9e006b2450b8c68d7eec8cfc7d220abc7eda", 644700, RpcChain::MainNet, - GasVector { l1_gas: 0, l1_data_gas: 128, l2_gas: 0 }, + GasVector { l1_gas: GasAmount(0), l1_data_gas: GasAmount(128), l2_gas: GasAmount(0) }, 8, 2, 0, @@ -964,20 +967,24 @@ mod tests { is_reverted: bool, ) { let previous_block = BlockNumber(block_number - 1); - let (tx_info, _, _) = execute_tx(hash, chain, previous_block); + let (tx_info, _, r) = execute_tx(hash, chain, previous_block); let tx_receipt = tx_info.receipt; let starknet_resources = tx_receipt.resources.starknet_resources; - let callinfo_iter = match tx_info.execute_call_info { - Some(c) => vec![c], - None => vec![CallInfo::default()], // there's no call info, so we take the default value to have all of it's atributes set to 0 - }; + let info = tx_info.execute_call_info.unwrap(); + let versioned_constants = + VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { + validate_max_n_steps: u32::MAX, + invoke_tx_max_n_steps: u32::MAX, + max_recursion_depth: usize::MAX, + }); + let state_resources = StateResources::new_for_testing(starknet_chg, 0); let starknet_rsc = StarknetResources::new( calldata_length, signature_length, code_size, - starknet_chg, + state_resources, l1_handler_payload_size, - callinfo_iter.iter(), + info.summarize(&versioned_constants), ); assert_eq!(is_reverted, tx_info.revert_error.is_some()); @@ -1025,7 +1032,7 @@ mod tests { assert!( !execution_info.is_reverted(), "{:?}", - execution_info.revert_error.unwrap_or_default() + execution_info.revert_error.unwrap() ) })); } diff --git a/rpc-state-reader/src/lib.rs b/rpc-state-reader/src/lib.rs index bff2b19e..13ede189 100644 --- a/rpc-state-reader/src/lib.rs +++ b/rpc-state-reader/src/lib.rs @@ -9,7 +9,7 @@ mod tests { use pretty_assertions_sorted::{assert_eq, assert_eq_sorted}; use starknet_api::{ class_hash, - core::{ClassHash, ContractAddress, Nonce, PatriciaKey}, + core::{ContractAddress, Nonce}, felt, hash::StarkHash, patricia_key, diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 721c146f..ff3364b0 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -402,6 +402,8 @@ fn bytecode_size(data: &[BigUintAsHex]) -> usize { mod tests { use std::num::NonZeroU128; + use starknet_api::block::FeeType; + use super::*; #[test] @@ -411,10 +413,8 @@ mod tests { let block = reader.get_block_info().unwrap(); assert_eq!( - block - .gas_prices - .get_l1_gas_price_by_fee_type(&blockifier::transaction::objects::FeeType::Eth), - NonZeroU128::new(22804578690).unwrap() + block.gas_prices.l1_gas_price(&FeeType::Eth).get().0, + 22804578690 ); } From ebcdb2e07667210f540514da96b5f97a38f9e7b7 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 15:12:41 -0300 Subject: [PATCH 06/32] Cargo.toml --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 8 ++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08afff57..52a6396a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,6 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "anyhow", "ark-ec", @@ -698,6 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "assert_matches", "blockifier", @@ -3768,6 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "tokio", ] @@ -4535,6 +4538,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "assert_matches", "blockifier", @@ -4999,6 +5003,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5017,6 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "clap", "infra_utils", @@ -5031,6 +5037,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "anyhow", "blockifier", @@ -5053,6 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "libp2p", "serde", @@ -5061,6 +5069,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "quote", "syn 2.0.89", @@ -5070,6 +5079,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "anyhow", "async-trait", @@ -5103,6 +5113,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6939,6 +6950,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6964,6 +6976,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -6990,6 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "async-trait", "axum", @@ -7017,6 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "async-trait", "axum", @@ -7035,6 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "async-trait", "papyrus_network_types", @@ -7048,6 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7065,6 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 0aab79fd..7b1bfa37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { path = "../sequencer/crates/starknet_api" } # main -blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"]} # main -starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main -blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main +starknet_api = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2", features = ["cairo_native"] } # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } From d7f47e20788d02a358f0ac2373d336343a06e3d0 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 17:12:42 -0300 Subject: [PATCH 07/32] update --- Cargo.lock | 4 ++-- replay/src/benchmark.rs | 9 ++++----- replay/src/state_dump.rs | 30 ++++++++++++++++++++---------- rpc-state-reader/src/execution.rs | 24 ++++++++++++------------ rpc-state-reader/src/reader.rs | 8 ++++---- 5 files changed, 42 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 52a6396a..0bd0ae96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1705,9 +1705,9 @@ checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" [[package]] name = "const-hex" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487981fa1af147182687064d0a2c336586d337a606595ced9ffb0c685c250c73" +checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" dependencies = [ "cfg-if", "cpufeatures", diff --git a/replay/src/benchmark.rs b/replay/src/benchmark.rs index de2f245e..3f03a46a 100644 --- a/replay/src/benchmark.rs +++ b/replay/src/benchmark.rs @@ -1,8 +1,7 @@ use std::time::Instant; use blockifier::{ - context::BlockContext, - state::{cached_state::CachedState, state_api::StateReader}, + context::BlockContext, execution::contract_class::RunnableCompiledClass, state::{cached_state::CachedState, state_api::StateReader} }; use rpc_state_reader::{ execution::{execute_tx_with_blockifier, fetch_block_context}, @@ -176,13 +175,13 @@ impl StateReader for OptionalStateReader { self.get_inner().get_class_hash_at(contract_address) } - fn get_compiled_contract_class( + fn get_compiled_class( &self, class_hash: starknet_api::core::ClassHash, ) -> blockifier::state::state_api::StateResult< - blockifier::execution::contract_class::ContractClass, + RunnableCompiledClass, > { - self.get_inner().get_compiled_contract_class(class_hash) + self.get_inner().get_compiled_class(class_hash) } fn get_compiled_class_hash( diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 4d2b24d0..2c39c517 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -16,16 +16,13 @@ use blockifier::{ }, transaction::{ errors::TransactionExecutionError, - objects::{GasVector, TransactionExecutionInfo}, + objects::TransactionExecutionInfo, }, }; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_api::{ - core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, - deprecated_contract_class::EntryPointType, - state::StorageKey, - transaction::Calldata, + contract_class::EntryPointType, core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, execution_resources::GasVector, state::StorageKey, transaction::fields::Calldata }; use starknet_types_core::felt::Felt; @@ -38,7 +35,7 @@ pub fn dump_state_diff( let _ = fs::create_dir_all(parent); } - let state_maps = SerializableStateMaps::from(state.to_state_diff()?); + let state_maps = SerializableStateMaps::from(state.get_initial_reads()?); let execution_info = SerializableExecutionInfo::new(execution_info); let info = Info { execution_info, @@ -123,6 +120,9 @@ struct SerializableExecutionInfo { impl SerializableExecutionInfo { pub fn new(execution_info: &TransactionExecutionInfo) -> Self { + let reverted = execution_info.revert_error.clone().and_then(|f|{ + Some(f.to_string()) + }); Self { validate_call_info: execution_info .validate_call_info @@ -136,7 +136,7 @@ impl SerializableExecutionInfo { .fee_transfer_call_info .clone() .map(From::::from), - reverted: execution_info.revert_error.clone(), + reverted, receipt: SerializableTransactionReceipt { resources: SerializableTransactionResources { starknet_resources: SerializableStarknetResources { @@ -144,31 +144,40 @@ impl SerializableExecutionInfo { .receipt .resources .starknet_resources + .archival_data .calldata_length, state_changes_for_fee: SerializableStateChangesCount { n_storage_updates: execution_info .receipt .resources .starknet_resources + .state .state_changes_for_fee + .state_changes_count .n_storage_updates, n_class_hash_updates: execution_info .receipt .resources .starknet_resources + .state .state_changes_for_fee + .state_changes_count .n_class_hash_updates, n_compiled_class_hash_updates: execution_info .receipt .resources .starknet_resources + .state .state_changes_for_fee + .state_changes_count .n_compiled_class_hash_updates, n_modified_contracts: execution_info .receipt .resources .starknet_resources + .state .state_changes_for_fee + .state_changes_count .n_modified_contracts, }, message_cost_info: SerializableMessageL1CostInfo { @@ -176,22 +185,23 @@ impl SerializableExecutionInfo { .receipt .resources .starknet_resources - .message_cost_info + .messages .l2_to_l1_payload_lengths .clone(), message_segment_length: execution_info .receipt .resources .starknet_resources - .message_cost_info + .messages .message_segment_length, }, l1_handler_payload_size: execution_info .receipt .resources .starknet_resources + .messages .l1_handler_payload_size, - n_events: execution_info.receipt.resources.starknet_resources.n_events, + n_events: execution_info.receipt.resources.starknet_resources.archival_data.event_summary.n_events, }, }, da_gas: execution_info.receipt.da_gas, diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 44b66d54..14c379c5 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -6,7 +6,7 @@ use blockifier::{ bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, execution::contract_class::RunnableCompiledClass, - state::{cached_state::CachedState, state_api::StateReader}, + state::{cached_state::{CachedState, TransactionalState}, state_api::{State, StateReader}}, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, objects::{TransactionExecutionInfo, TransactionExecutionResult}, @@ -289,7 +289,7 @@ pub fn execute_tx_configurable( /// and can be used with any cached state. It already receives all context information /// needed to execute the transaction. pub fn execute_tx_with_blockifier( - state: &mut CachedState, + state: &mut CachedState, context: BlockContext, transaction: SNTransaction, transaction_hash: TransactionHash, @@ -317,18 +317,18 @@ pub fn execute_tx_with_blockifier( }); BlockiAccountTransaction::new(deploy) } - SNTransaction::Declare(tx) => { - let contract_class = state.state.get_contract_class(&tx.class_hash()).unwrap(); + // SNTransaction::Declare(tx) => { + // let contract_class = state.state.get_contract_class(&tx.class_hash()).unwrap(); - let class_info = calculate_class_info_for_testing(contract_class); + // let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - tx_hash: transaction_hash, - class_info, - }); - BlockiAccountTransaction::new(declare) - } + // let declare = AccountTransaction::Declare(DeclareTransaction { + // tx, + // tx_hash: transaction_hash, + // class_info, + // }); + // BlockiAccountTransaction::new(declare) + // } SNTransaction::L1Handler(tx) => { // As L1Hanlder is not an account transaction we execute it here and return the result let account_transaction = L1HandlerTransaction { diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index ff3364b0..658dfffd 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -139,9 +139,9 @@ impl RpcStateReader { pub fn get_transaction(&self, hash: &TransactionHash) -> StateResult { let params = json!([hash]); - + dbg!(&hash); let tx = self.send_rpc_request_with_retry("starknet_getTransactionByHash", params)?; - + objects::deser::transaction_from_json(tx).map_err(serde_err_to_state_err) } @@ -170,8 +170,8 @@ impl RpcStateReader { parse_gas_price(header.l1_gas_price.price_in_fri), parse_gas_price(header.l1_data_gas_price.price_in_wei), parse_gas_price(header.l1_data_gas_price.price_in_fri), - parse_gas_price(header.l2_gas_price.price_in_wei), - parse_gas_price(header.l2_gas_price.price_in_fri), + NonzeroGasPrice::MIN, + NonzeroGasPrice::MIN, ), use_kzg_da: true, }) From 506ca9a63a2f6836566e1150b071c1817af803da Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 17:14:45 -0300 Subject: [PATCH 08/32] format --- replay/src/benchmark.rs | 8 ++++---- replay/src/state_dump.rs | 26 +++++++++++++++++--------- rpc-state-reader/src/execution.rs | 5 ++++- rpc-state-reader/src/reader.rs | 2 +- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/replay/src/benchmark.rs b/replay/src/benchmark.rs index 3f03a46a..398c5b47 100644 --- a/replay/src/benchmark.rs +++ b/replay/src/benchmark.rs @@ -1,7 +1,9 @@ use std::time::Instant; use blockifier::{ - context::BlockContext, execution::contract_class::RunnableCompiledClass, state::{cached_state::CachedState, state_api::StateReader} + context::BlockContext, + execution::contract_class::RunnableCompiledClass, + state::{cached_state::CachedState, state_api::StateReader}, }; use rpc_state_reader::{ execution::{execute_tx_with_blockifier, fetch_block_context}, @@ -178,9 +180,7 @@ impl StateReader for OptionalStateReader { fn get_compiled_class( &self, class_hash: starknet_api::core::ClassHash, - ) -> blockifier::state::state_api::StateResult< - RunnableCompiledClass, - > { + ) -> blockifier::state::state_api::StateResult { self.get_inner().get_compiled_class(class_hash) } diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 2c39c517..363d4b24 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -14,15 +14,16 @@ use blockifier::{ cached_state::{CachedState, StateMaps, StorageEntry}, state_api::StateReader, }, - transaction::{ - errors::TransactionExecutionError, - objects::TransactionExecutionInfo, - }, + transaction::{errors::TransactionExecutionError, objects::TransactionExecutionInfo}, }; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use starknet_api::{ - contract_class::EntryPointType, core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, execution_resources::GasVector, state::StorageKey, transaction::fields::Calldata + contract_class::EntryPointType, + core::{ClassHash, CompiledClassHash, ContractAddress, EntryPointSelector, Nonce}, + execution_resources::GasVector, + state::StorageKey, + transaction::fields::Calldata, }; use starknet_types_core::felt::Felt; @@ -120,9 +121,10 @@ struct SerializableExecutionInfo { impl SerializableExecutionInfo { pub fn new(execution_info: &TransactionExecutionInfo) -> Self { - let reverted = execution_info.revert_error.clone().and_then(|f|{ - Some(f.to_string()) - }); + let reverted = execution_info + .revert_error + .clone() + .and_then(|f| Some(f.to_string())); Self { validate_call_info: execution_info .validate_call_info @@ -201,7 +203,13 @@ impl SerializableExecutionInfo { .starknet_resources .messages .l1_handler_payload_size, - n_events: execution_info.receipt.resources.starknet_resources.archival_data.event_summary.n_events, + n_events: execution_info + .receipt + .resources + .starknet_resources + .archival_data + .event_summary + .n_events, }, }, da_gas: execution_info.receipt.da_gas, diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 14c379c5..5d73eefe 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -6,7 +6,10 @@ use blockifier::{ bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, execution::contract_class::RunnableCompiledClass, - state::{cached_state::{CachedState, TransactionalState}, state_api::{State, StateReader}}, + state::{ + cached_state::{CachedState, TransactionalState}, + state_api::{State, StateReader}, + }, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, objects::{TransactionExecutionInfo, TransactionExecutionResult}, diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 658dfffd..36cfe5b2 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -141,7 +141,7 @@ impl RpcStateReader { let params = json!([hash]); dbg!(&hash); let tx = self.send_rpc_request_with_retry("starknet_getTransactionByHash", params)?; - + objects::deser::transaction_from_json(tx).map_err(serde_err_to_state_err) } From 882b5eed1ffc56db65576fdc2ad683336cc79292 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 17:30:14 -0300 Subject: [PATCH 09/32] clippy --- rpc-state-reader/Cargo.toml | 4 ++-- rpc-state-reader/src/execution.rs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/rpc-state-reader/Cargo.toml b/rpc-state-reader/Cargo.toml index 9dd0f435..5a4af9fd 100644 --- a/rpc-state-reader/Cargo.toml +++ b/rpc-state-reader/Cargo.toml @@ -16,8 +16,8 @@ serde_json = { version = "1.0", features = [ "raw_value", ] } starknet_api = {workspace = true} -cairo-lang-starknet-classes = "2.9.0-dev.0" -cairo-lang-utils = "2.9.0-dev.0" +cairo-lang-starknet-classes = "=2.9.0-dev.0" +cairo-lang-utils = "=2.9.0-dev.0" cairo-native = { workspace = true } starknet = "0.6.0" flate2 = "1.0.25" diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 5d73eefe..c0337cea 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -5,11 +5,7 @@ use crate::{ use blockifier::{ bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, - execution::contract_class::RunnableCompiledClass, - state::{ - cached_state::{CachedState, TransactionalState}, - state_api::{State, StateReader}, - }, + state::{cached_state::CachedState, state_api::StateReader}, transaction::{ account_transaction::AccountTransaction as BlockiAccountTransaction, objects::{TransactionExecutionInfo, TransactionExecutionResult}, From d9c3a20cb2283a5c98f49ab855758627f3ed8d18 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Thu, 28 Nov 2024 19:01:59 -0300 Subject: [PATCH 10/32] update main sequencer --- Cargo.lock | 36 +++++++++++++++++----------------- rpc-state-reader/src/reader.rs | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0bd0ae96..e25f155e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "ark-ec", @@ -699,7 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "assert_matches", "blockifier", @@ -3770,7 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "tokio", ] @@ -4538,7 +4538,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "assert_matches", "blockifier", @@ -5003,7 +5003,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5022,7 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "clap", "infra_utils", @@ -5037,7 +5037,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "blockifier", @@ -5060,7 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "libp2p", "serde", @@ -5069,7 +5069,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "quote", "syn 2.0.89", @@ -5079,7 +5079,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "async-trait", @@ -5113,7 +5113,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6950,7 +6950,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6976,7 +6976,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7003,7 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "axum", @@ -7031,7 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "axum", @@ -7050,7 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "papyrus_network_types", @@ -7064,7 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7082,7 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#a1ab83e8e152a0263d2f75091e75ac289439cc1e" +source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 36cfe5b2..e5decb5f 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -139,7 +139,7 @@ impl RpcStateReader { pub fn get_transaction(&self, hash: &TransactionHash) -> StateResult { let params = json!([hash]); - dbg!(&hash); + let tx = self.send_rpc_request_with_retry("starknet_getTransactionByHash", params)?; objects::deser::transaction_from_json(tx).map_err(serde_err_to_state_err) From bcb04841cb4c80c32da7880457b71ba4fff40af2 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 11:06:14 -0300 Subject: [PATCH 11/32] update main sequencer --- Cargo.lock | 30 ++++++------------------------ Cargo.toml | 8 ++++---- rpc-state-reader/src/execution.rs | 2 +- rpc-state-reader/src/objects.rs | 20 ++++++++++++++++++-- rpc-state-reader/src/reader.rs | 8 +++++--- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e25f155e..a36008ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,6 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "ark-ec", @@ -699,7 +698,6 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "assert_matches", "blockifier", @@ -1306,9 +1304,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e982f95850e97005481353ab438a9696bcdd9e93b1a315354482ae8bcb2e9c0" +checksum = "80bede54808f2e5d26a8702711009eefe4a12e5a8f3a427ba9b081073c8e9d36" dependencies = [ "genco", "xshell", @@ -1514,9 +1512,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -3770,7 +3768,6 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "tokio", ] @@ -4154,9 +4151,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.166" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libloading" @@ -4538,7 +4535,6 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "assert_matches", "blockifier", @@ -5003,7 +4999,6 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5022,7 +5017,6 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "clap", "infra_utils", @@ -5037,7 +5031,6 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "blockifier", @@ -5060,7 +5053,6 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "libp2p", "serde", @@ -5069,7 +5061,6 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "quote", "syn 2.0.89", @@ -5079,7 +5070,6 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "anyhow", "async-trait", @@ -5113,7 +5103,6 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6950,7 +6939,6 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6976,7 +6964,6 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7003,7 +6990,6 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "axum", @@ -7031,7 +7017,6 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "axum", @@ -7050,7 +7035,6 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "papyrus_network_types", @@ -7064,7 +7048,6 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7082,7 +7065,6 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=update-main-2#01b874799b52e500d485362ce9a302a017d73cac" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 7b1bfa37..8204dd10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main -blockifier = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2", features = ["cairo_native"] } # main -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main -blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer", branch = "update-main-2" } # main +starknet_api = { path = "../sequencer/crates/starknet_api" } # main +blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main +starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main +blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index c0337cea..dcc0589d 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -1046,7 +1046,7 @@ mod tests { fn from(value: &CallInfo) -> Self { Self { result: Some(value.execution.retdata.0.clone()), - calldata: Some((*value.call.calldata.0).clone()), + calldata: Some(*(value.call.calldata).0.clone()), calls: value.inner_calls.iter().map(|ci| ci.into()).collect(), // We don't have the revert reason string in the trace so we just make sure it doesn't revert revert_reason: value.execution.failed.then_some("Default String".into()), diff --git a/rpc-state-reader/src/objects.rs b/rpc-state-reader/src/objects.rs index 9863fe85..a2b471ba 100644 --- a/rpc-state-reader/src/objects.rs +++ b/rpc-state-reader/src/objects.rs @@ -4,13 +4,15 @@ use cairo_vm::vm::runners::cairo_runner::ExecutionResources; use serde::{Deserialize, Serialize}; use starknet_api::{ - block::BlockStatus, + block::{BlockHash, BlockNumber, BlockStatus, BlockTimestamp}, + core::{ContractAddress, GlobalRoot}, + data_availability::L1DataAvailabilityMode, hash::StarkHash, transaction::{ fields::Fee, Event, MessageToL1, Transaction, TransactionExecutionStatus, TransactionHash, }, }; -use starknet_gateway::rpc_objects::BlockHeader; +use starknet_gateway::rpc_objects::ResourcePrice; #[derive(Debug, Deserialize, Clone, Eq, PartialEq)] pub struct RpcTransactionTrace { @@ -58,6 +60,20 @@ pub struct FeePayment { // The following structures are taken from https://github.com/starkware-libs/sequencer, // but modified to suit our particular needs. +#[derive(Debug, Deserialize, Serialize)] +pub struct BlockHeader { + pub block_hash: BlockHash, + pub parent_hash: BlockHash, + pub block_number: BlockNumber, + pub sequencer_address: ContractAddress, + pub new_root: GlobalRoot, + pub timestamp: BlockTimestamp, + pub l1_gas_price: ResourcePrice, + pub l1_data_gas_price: ResourcePrice, + pub l1_da_mode: L1DataAvailabilityMode, + pub starknet_version: String, +} + #[derive(Debug, Deserialize, Serialize)] pub struct BlockWithTxHahes { #[serde(skip_serializing_if = "Option::is_none")] diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index e5decb5f..1e2a1563 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -31,8 +31,7 @@ use starknet_gateway::{ config::RpcStateReaderConfig, errors::{serde_err_to_state_err, RPCStateReaderError, RPCStateReaderResult}, rpc_objects::{ - BlockHeader, GetBlockWithTxHashesParams, GetClassHashAtParams, GetNonceParams, - GetStorageAtParams, + GetBlockWithTxHashesParams, GetClassHashAtParams, GetNonceParams, GetStorageAtParams, }, rpc_state_reader::RpcStateReader as GatewayRpcStateReader, }; @@ -40,7 +39,10 @@ use tracing::{info, info_span}; use ureq::json; use crate::{ - objects::{self, BlockWithTxHahes, BlockWithTxs, RpcTransactionReceipt, RpcTransactionTrace}, + objects::{ + self, BlockHeader, BlockWithTxHahes, BlockWithTxs, RpcTransactionReceipt, + RpcTransactionTrace, + }, utils, }; From 5f6542b3bbe5793b2b41668647ebd391fa08d5af Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 11:09:50 -0300 Subject: [PATCH 12/32] update Cargo.tomls --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 8 ++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a36008ab..6cf820ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,6 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "ark-ec", @@ -698,6 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -3768,6 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "tokio", ] @@ -4535,6 +4538,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -4999,6 +5003,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5017,6 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "clap", "infra_utils", @@ -5031,6 +5037,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "blockifier", @@ -5053,6 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "libp2p", "serde", @@ -5061,6 +5069,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "quote", "syn 2.0.89", @@ -5070,6 +5079,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "async-trait", @@ -5103,6 +5113,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6939,6 +6950,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6964,6 +6976,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -6990,6 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7017,6 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7035,6 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "papyrus_network_types", @@ -7048,6 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7065,6 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 8204dd10..2157fe7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { path = "../sequencer/crates/starknet_api" } # main -blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main -starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main -blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main +starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } From 15307a2498a805ebff63beccb2ff9d053fc3c1cd Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 14:04:34 -0300 Subject: [PATCH 13/32] change to trasaction creation --- rpc-state-reader/src/execution.rs | 202 +++++++++--------------------- 1 file changed, 62 insertions(+), 140 deletions(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index dcc0589d..b66a7ab8 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -3,15 +3,9 @@ use crate::{ reader::{RpcChain, RpcStateReader}, }; use blockifier::{ - bouncer::BouncerConfig, - context::{BlockContext, ChainInfo, FeeTokenAddresses}, - state::{cached_state::CachedState, state_api::StateReader}, - transaction::{ - account_transaction::AccountTransaction as BlockiAccountTransaction, - objects::{TransactionExecutionInfo, TransactionExecutionResult}, - transactions::ExecutableTransaction, - }, - versioned_constants::{VersionedConstants, VersionedConstantsOverrides}, + bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, state::{cached_state::CachedState, state_api::StateReader}, test_utils::MAX_FEE, transaction::{ + objects::{TransactionExecutionInfo, TransactionExecutionResult}, transaction_execution::Transaction as BlockiTransaction, transactions::ExecutableTransaction + }, versioned_constants::{VersionedConstants, VersionedConstantsOverrides} }; use blockifier_reexecution::state_reader::compile::{ legacy_to_contract_class_v0, sierra_to_contact_class_v1, @@ -20,15 +14,11 @@ use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ block::{BlockInfo, BlockNumber}, contract_class::ClassInfo, - core::{calculate_contract_address, ContractAddress}, - executable_transaction::{ - AccountTransaction, DeclareTransaction, DeployAccountTransaction, InvokeTransaction, - L1HandlerTransaction, - }, + core:: ContractAddress, felt, hash::StarkHash, patricia_key, - transaction::{fields::Fee, Transaction as SNTransaction, TransactionHash}, + transaction::{Transaction as SNTransaction, TransactionHash}, }; pub fn execute_tx( @@ -48,7 +38,7 @@ pub fn execute_tx( let block_info = reader.get_block_info().unwrap(); // Get transaction before giving ownership of the reader - let transaction = reader.get_transaction(&tx_hash).unwrap(); + let tx = reader.get_transaction(&tx_hash).unwrap(); let trace = reader.get_transaction_trace(&tx_hash).unwrap(); let receipt = reader.get_transaction_receipt(&tx_hash).unwrap(); @@ -84,56 +74,31 @@ pub fn execute_tx( ); // Map starknet_api transaction to blockifier's - let blockifier_tx = match transaction { - SNTransaction::Invoke(tx) => { - let invoke = AccountTransaction::Invoke(InvokeTransaction { tx, tx_hash }); - BlockiAccountTransaction::new(invoke) - } - SNTransaction::DeployAccount(tx) => { - let contract_address = calculate_contract_address( - tx.contract_address_salt(), - tx.class_hash(), - &tx.constructor_calldata(), - ContractAddress::default(), - ) - .unwrap(); - let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { - tx, - tx_hash, - contract_address, - }); - BlockiAccountTransaction::new(deploy) - } - SNTransaction::Declare(tx) => { - // Fetch the contract_class from the next block (as we don't have it in the previous one) + let blockifier_tx = match tx { + SNTransaction::Invoke(_) + | SNTransaction::DeployAccount(_) => + BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap(), + SNTransaction::Declare(ref declare_tx) => { + let block_number = block_context.block_info().block_number; + let network = parse_to_rpc_chain(&block_context.chain_info().chain_id.to_string()); + // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - - let contract_class = next_reader.get_contract_class(&tx.class_hash()).unwrap(); + let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - tx_hash, - class_info, - }); - BlockiAccountTransaction::new(declare) + BlockiTransaction::from_api(tx, tx_hash, Some(class_info), None, None, false).unwrap() } - SNTransaction::L1Handler(tx) => { - // As L1Hanlder is not an account transaction we execute it here and return the result - let blockifier_tx = L1HandlerTransaction { + SNTransaction::L1Handler(_) => { + BlockiTransaction::from_api( tx, tx_hash, - paid_fee_on_l1: Fee(u128::MAX), - }; - return ( - blockifier_tx - .execute(&mut state, &block_context, true, true) - .unwrap(), - trace, - receipt, - ); + None, + Some(MAX_FEE), + None, + false, + ).unwrap() } - SNTransaction::Deploy(_) => todo!(), + _ => todo!(), }; ( @@ -162,7 +127,7 @@ fn calculate_class_info_for_testing(contract_class: SNContractClass) -> ClassInf } pub fn execute_tx_configurable_with_state( - tx_hash: &TransactionHash, + tx_hash: TransactionHash, tx: SNTransaction, block_info: BlockInfo, _skip_validate: bool, @@ -207,51 +172,28 @@ pub fn execute_tx_configurable_with_state( // Get transaction before giving ownership of the reader let blockifier_tx = match tx { - SNTransaction::Invoke(tx) => { - let invoke = AccountTransaction::Invoke(InvokeTransaction { - tx, - tx_hash: *tx_hash, - }); - BlockiAccountTransaction::new(invoke) - } - SNTransaction::DeployAccount(tx) => { - let contract_address = calculate_contract_address( - tx.contract_address_salt(), - tx.class_hash(), - &tx.constructor_calldata(), - ContractAddress::default(), - ) - .unwrap(); - let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { - tx, - tx_hash: *tx_hash, - contract_address, - }); - BlockiAccountTransaction::new(deploy) - } - SNTransaction::Declare(tx) => { + SNTransaction::Invoke(_) + | SNTransaction::DeployAccount(_) => + BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap(), + SNTransaction::Declare(ref declare_tx) => { let block_number = block_context.block_info().block_number; let network = parse_to_rpc_chain(&chain_id.to_string()); // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader.get_contract_class(&tx.class_hash()).unwrap(); + let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - let declare = AccountTransaction::Declare(DeclareTransaction { - tx, - class_info, - tx_hash: *tx_hash, - }); - BlockiAccountTransaction::new(declare) + BlockiTransaction::from_api(tx, tx_hash, Some(class_info), None, None, false).unwrap() } - SNTransaction::L1Handler(tx) => { - // As L1Hanlder is not an account transaction we execute it here and return the result - let blockifier_tx = L1HandlerTransaction { + SNTransaction::L1Handler(_) => { + BlockiTransaction::from_api( tx, - tx_hash: *tx_hash, - paid_fee_on_l1: Fee(u128::MAX), - }; - return blockifier_tx.execute(state, &block_context, charge_fee, true); + tx_hash, + None, + Some(MAX_FEE), + None, + false, + ).unwrap() } _ => unimplemented!(), }; @@ -271,7 +213,7 @@ pub fn execute_tx_configurable( let tx = state.state.get_transaction(&tx_hash).unwrap(); let block_info = state.state.get_block_info().unwrap(); let blockifier_exec_info = execute_tx_configurable_with_state( - &tx_hash, + tx_hash, tx, block_info, skip_validate, @@ -293,50 +235,30 @@ pub fn execute_tx_with_blockifier( transaction: SNTransaction, transaction_hash: TransactionHash, ) -> TransactionExecutionResult { - let account_transaction: BlockiAccountTransaction = match transaction { - SNTransaction::Invoke(tx) => { - let invoke = AccountTransaction::Invoke(InvokeTransaction { - tx, - tx_hash: transaction_hash, - }); - BlockiAccountTransaction::new(invoke) - } - SNTransaction::DeployAccount(tx) => { - let contract_address = calculate_contract_address( - tx.contract_address_salt(), - tx.class_hash(), - &tx.constructor_calldata(), - ContractAddress::default(), - ) - .unwrap(); - let deploy = AccountTransaction::DeployAccount(DeployAccountTransaction { - tx, - tx_hash: transaction_hash, - contract_address, - }); - BlockiAccountTransaction::new(deploy) - } - // SNTransaction::Declare(tx) => { - // let contract_class = state.state.get_contract_class(&tx.class_hash()).unwrap(); - - // let class_info = calculate_class_info_for_testing(contract_class); + let account_transaction: BlockiTransaction = match transaction { + SNTransaction::Invoke(_) + | SNTransaction::DeployAccount(_) => + BlockiTransaction::from_api(transaction, transaction_hash, None, None, None, false)?, + SNTransaction::Declare(ref declare_tx) => { + let block_number = context.block_info().block_number; + let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string()); + // we need to retrieve the next block in order to get the contract_class + let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); + let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); + let class_info = calculate_class_info_for_testing(contract_class); - // let declare = AccountTransaction::Declare(DeclareTransaction { - // tx, - // tx_hash: transaction_hash, - // class_info, - // }); - // BlockiAccountTransaction::new(declare) - // } - SNTransaction::L1Handler(tx) => { + BlockiTransaction::from_api(transaction, transaction_hash, Some(class_info), None, None, false)? + } + SNTransaction::L1Handler(_) => { // As L1Hanlder is not an account transaction we execute it here and return the result - let account_transaction = L1HandlerTransaction { - tx, - tx_hash: transaction_hash, - paid_fee_on_l1: Fee(u128::MAX), - }; - - return account_transaction.execute(state, &context, true, true); + BlockiTransaction::from_api( + transaction, + transaction_hash, + None, + Some(MAX_FEE), + None, + false, + )? } _ => unimplemented!(), }; From 049873ca38c231c783551e18c350a721ae428e98 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 15:29:47 -0300 Subject: [PATCH 14/32] fix frozen --- Cargo.lock | 68 +++++++++++++--------------------- Cargo.toml | 13 +++++-- rpc-state-reader/src/reader.rs | 5 +++ rpc-state-reader/src/utils.rs | 9 +++-- 4 files changed, 44 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cf820ca..2c494be5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,6 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "ark-ec", @@ -699,7 +698,6 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -3770,7 +3768,6 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "tokio", ] @@ -3864,9 +3861,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "fb15147158e79fd8b8afd0252522769c4f48725460b37338544d8379d94fc8f9" dependencies = [ "wasm-bindgen", ] @@ -4160,9 +4157,9 @@ checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -4538,7 +4535,6 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -4614,11 +4610,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -5003,7 +4998,6 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5022,7 +5016,6 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "clap", "infra_utils", @@ -5037,7 +5030,6 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "blockifier", @@ -5060,7 +5052,6 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "libp2p", "serde", @@ -5069,7 +5060,6 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "quote", "syn 2.0.89", @@ -5079,7 +5069,6 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "async-trait", @@ -5113,7 +5102,6 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6950,7 +6938,6 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6976,7 +6963,6 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7003,7 +6989,6 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7031,7 +7016,6 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7050,7 +7034,6 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "papyrus_network_types", @@ -7064,7 +7047,6 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7082,7 +7064,6 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", @@ -7695,9 +7676,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -7705,9 +7686,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -8039,9 +8020,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "21d3b25c3ea1126a2ad5f4f9068483c2af1e64168f847abe863a526b8dbfe00b" dependencies = [ "cfg-if", "once_cell", @@ -8050,9 +8031,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "52857d4c32e496dc6537646b5b117081e71fd2ff06de792e3577a150627db283" dependencies = [ "bumpalo", "log", @@ -8065,21 +8046,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "951fe82312ed48443ac78b66fa43eded9999f738f6022e67aead7b708659e49a" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "920b0ffe069571ebbfc9ddc0b36ba305ef65577c94b06262ed793716a1afd981" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8087,9 +8069,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "bf59002391099644be3524e23b781fa43d2be0c5aa0719a18c0731b9d195cab6" dependencies = [ "proc-macro2", "quote", @@ -8100,9 +8082,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "e5047c5392700766601942795a436d7d2599af60dcc3cc1248c9120bfb0827b0" [[package]] name = "wasm-streams" @@ -8119,9 +8101,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "476364ff87d0ae6bfb661053a9104ab312542658c3d8f963b7ace80b6f9b26b9" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 2157fe7e..664ae842 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,15 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +# starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +# blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main +# starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +# blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main + +starknet_api = { path = "../sequencer/crates/starknet_api" } # main +blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main +starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main +blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 1e2a1563..88384de8 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -294,11 +294,14 @@ impl StateReader for RpcStateReader { } fn get_compiled_class(&self, class_hash: ClassHash) -> StateResult { + dbg!("ENTERED_GET_COMPILED_CLASS"); Ok(match self.get_contract_class(&class_hash)? { SNContractClass::Legacy(compressed_legacy_cc) => { + dbg!("ENTERED_LEGACY"); compile_legacy_cc(compressed_legacy_cc) } SNContractClass::Sierra(flattened_sierra_cc) => { + dbg!("ENTERED_SIERRA"); compile_sierra_cc(flattened_sierra_cc, class_hash) } }) @@ -350,7 +353,9 @@ fn compile_sierra_cc( RunnableCompiledClass::V1(casm_cc.try_into().unwrap()) } else { + dbg!("COMPILED_EXECUTOR"); let executor = utils::get_native_executor(&sierra_cc, class_hash); + dbg!("COMPILED_EXECUTOR_PASSED"); let casm = CasmContractClass::from_contract_class(sierra_cc, false, usize::MAX).unwrap(); let casm = CompiledClassV1::try_from(casm).unwrap(); diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index b76905f9..e5470171 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -75,11 +75,10 @@ pub fn decode_reader(bytes: Vec) -> io::Result { pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> AotContractExecutor { let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); - let executor = cache_lock.read().unwrap(); - let executor = executor.get(&class_hash); + let executor = cache_lock.read().unwrap().get(&class_hash).map(Clone::clone); match executor { - Some(executor) => executor.clone(), + Some(executor) => executor, None => { let mut cache = cache_lock.write().unwrap(); let path = PathBuf::from(format!( @@ -122,7 +121,9 @@ pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> A executor }; - cache.insert(class_hash, executor).unwrap() + cache.insert(class_hash, executor.clone()); + + executor } } } From 54617b6d4d439c26f2171f448c9bcb41af61e518 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 15:31:07 -0300 Subject: [PATCH 15/32] format --- rpc-state-reader/src/execution.rs | 72 +++++++++++++++++-------------- rpc-state-reader/src/reader.rs | 5 --- rpc-state-reader/src/utils.rs | 6 ++- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index b66a7ab8..53d4b636 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -3,9 +3,16 @@ use crate::{ reader::{RpcChain, RpcStateReader}, }; use blockifier::{ - bouncer::BouncerConfig, context::{BlockContext, ChainInfo, FeeTokenAddresses}, state::{cached_state::CachedState, state_api::StateReader}, test_utils::MAX_FEE, transaction::{ - objects::{TransactionExecutionInfo, TransactionExecutionResult}, transaction_execution::Transaction as BlockiTransaction, transactions::ExecutableTransaction - }, versioned_constants::{VersionedConstants, VersionedConstantsOverrides} + bouncer::BouncerConfig, + context::{BlockContext, ChainInfo, FeeTokenAddresses}, + state::{cached_state::CachedState, state_api::StateReader}, + test_utils::MAX_FEE, + transaction::{ + objects::{TransactionExecutionInfo, TransactionExecutionResult}, + transaction_execution::Transaction as BlockiTransaction, + transactions::ExecutableTransaction, + }, + versioned_constants::{VersionedConstants, VersionedConstantsOverrides}, }; use blockifier_reexecution::state_reader::compile::{ legacy_to_contract_class_v0, sierra_to_contact_class_v1, @@ -14,7 +21,7 @@ use starknet::core::types::ContractClass as SNContractClass; use starknet_api::{ block::{BlockInfo, BlockNumber}, contract_class::ClassInfo, - core:: ContractAddress, + core::ContractAddress, felt, hash::StarkHash, patricia_key, @@ -75,28 +82,23 @@ pub fn execute_tx( // Map starknet_api transaction to blockifier's let blockifier_tx = match tx { - SNTransaction::Invoke(_) - | SNTransaction::DeployAccount(_) => - BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap(), + SNTransaction::Invoke(_) | SNTransaction::DeployAccount(_) => { + BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap() + } SNTransaction::Declare(ref declare_tx) => { let block_number = block_context.block_info().block_number; let network = parse_to_rpc_chain(&block_context.chain_info().chain_id.to_string()); // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); + let contract_class = next_reader + .get_contract_class(&declare_tx.class_hash()) + .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); BlockiTransaction::from_api(tx, tx_hash, Some(class_info), None, None, false).unwrap() } SNTransaction::L1Handler(_) => { - BlockiTransaction::from_api( - tx, - tx_hash, - None, - Some(MAX_FEE), - None, - false, - ).unwrap() + BlockiTransaction::from_api(tx, tx_hash, None, Some(MAX_FEE), None, false).unwrap() } _ => todo!(), }; @@ -172,28 +174,23 @@ pub fn execute_tx_configurable_with_state( // Get transaction before giving ownership of the reader let blockifier_tx = match tx { - SNTransaction::Invoke(_) - | SNTransaction::DeployAccount(_) => - BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap(), + SNTransaction::Invoke(_) | SNTransaction::DeployAccount(_) => { + BlockiTransaction::from_api(tx, tx_hash, None, None, None, false).unwrap() + } SNTransaction::Declare(ref declare_tx) => { let block_number = block_context.block_info().block_number; let network = parse_to_rpc_chain(&chain_id.to_string()); // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); + let contract_class = next_reader + .get_contract_class(&declare_tx.class_hash()) + .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); BlockiTransaction::from_api(tx, tx_hash, Some(class_info), None, None, false).unwrap() } SNTransaction::L1Handler(_) => { - BlockiTransaction::from_api( - tx, - tx_hash, - None, - Some(MAX_FEE), - None, - false, - ).unwrap() + BlockiTransaction::from_api(tx, tx_hash, None, Some(MAX_FEE), None, false).unwrap() } _ => unimplemented!(), }; @@ -236,18 +233,27 @@ pub fn execute_tx_with_blockifier( transaction_hash: TransactionHash, ) -> TransactionExecutionResult { let account_transaction: BlockiTransaction = match transaction { - SNTransaction::Invoke(_) - | SNTransaction::DeployAccount(_) => - BlockiTransaction::from_api(transaction, transaction_hash, None, None, None, false)?, + SNTransaction::Invoke(_) | SNTransaction::DeployAccount(_) => { + BlockiTransaction::from_api(transaction, transaction_hash, None, None, None, false)? + } SNTransaction::Declare(ref declare_tx) => { let block_number = context.block_info().block_number; let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string()); // we need to retrieve the next block in order to get the contract_class let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader.get_contract_class(&declare_tx.class_hash()).unwrap(); + let contract_class = next_reader + .get_contract_class(&declare_tx.class_hash()) + .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); - BlockiTransaction::from_api(transaction, transaction_hash, Some(class_info), None, None, false)? + BlockiTransaction::from_api( + transaction, + transaction_hash, + Some(class_info), + None, + None, + false, + )? } SNTransaction::L1Handler(_) => { // As L1Hanlder is not an account transaction we execute it here and return the result diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 88384de8..1e2a1563 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -294,14 +294,11 @@ impl StateReader for RpcStateReader { } fn get_compiled_class(&self, class_hash: ClassHash) -> StateResult { - dbg!("ENTERED_GET_COMPILED_CLASS"); Ok(match self.get_contract_class(&class_hash)? { SNContractClass::Legacy(compressed_legacy_cc) => { - dbg!("ENTERED_LEGACY"); compile_legacy_cc(compressed_legacy_cc) } SNContractClass::Sierra(flattened_sierra_cc) => { - dbg!("ENTERED_SIERRA"); compile_sierra_cc(flattened_sierra_cc, class_hash) } }) @@ -353,9 +350,7 @@ fn compile_sierra_cc( RunnableCompiledClass::V1(casm_cc.try_into().unwrap()) } else { - dbg!("COMPILED_EXECUTOR"); let executor = utils::get_native_executor(&sierra_cc, class_hash); - dbg!("COMPILED_EXECUTOR_PASSED"); let casm = CasmContractClass::from_contract_class(sierra_cc, false, usize::MAX).unwrap(); let casm = CompiledClassV1::try_from(casm).unwrap(); diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index e5470171..5205e7f0 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -75,7 +75,11 @@ pub fn decode_reader(bytes: Vec) -> io::Result { pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> AotContractExecutor { let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); - let executor = cache_lock.read().unwrap().get(&class_hash).map(Clone::clone); + let executor = cache_lock + .read() + .unwrap() + .get(&class_hash) + .map(Clone::clone); match executor { Some(executor) => executor, From 5784d5655d5108feb97b38f71fb6a63085724777 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 16:21:10 -0300 Subject: [PATCH 16/32] format --- rpc-state-reader/src/execution.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 53d4b636..696103a5 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -105,7 +105,7 @@ pub fn execute_tx( ( blockifier_tx - .execute(&mut state, &block_context, true, true) + .execute(&mut state, &block_context, false, true) .unwrap(), trace, receipt, From d7e28e8ee300b620f7166c4f191a5532cc520e3e Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 17:11:37 -0300 Subject: [PATCH 17/32] format --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 13 ++++--------- rpc-state-reader/src/execution.rs | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c494be5..ec3ced62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,6 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "ark-ec", @@ -698,6 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -3768,6 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "tokio", ] @@ -4535,6 +4538,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "assert_matches", "blockifier", @@ -4998,6 +5002,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5016,6 +5021,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "clap", "infra_utils", @@ -5030,6 +5036,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "blockifier", @@ -5052,6 +5059,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "libp2p", "serde", @@ -5060,6 +5068,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "quote", "syn 2.0.89", @@ -5069,6 +5078,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "anyhow", "async-trait", @@ -5102,6 +5112,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6938,6 +6949,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6963,6 +6975,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -6989,6 +7002,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7016,6 +7030,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "axum", @@ -7034,6 +7049,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "papyrus_network_types", @@ -7047,6 +7063,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7064,6 +7081,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 664ae842..2157fe7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,15 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -# starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -# blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main -# starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -# blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main - -starknet_api = { path = "../sequencer/crates/starknet_api" } # main -blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main -starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main -blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main +starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main # [patch.'https://github.com/lambdaclass/cairo_native'] # cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 696103a5..601e7daf 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -169,7 +169,7 @@ pub fn execute_tx_configurable_with_state( block_info, chain_info, versioned_constants, - BouncerConfig::empty(), + BouncerConfig::max(), ); // Get transaction before giving ownership of the reader From 5729de7cac3ae955a3c8a978c44e3ed5485b1f18 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 17:13:47 -0300 Subject: [PATCH 18/32] change native version --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2157fe7e..4e24c43f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,12 +12,12 @@ tracing = "0.1" serde_json = "1.0.116" serde_with = "3.11.0" serde = "1.0.197" -cairo-native = "0.2.4" +cairo-native = "=0.2.4" # Sequencer Dependencies starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -# [patch.'https://github.com/lambdaclass/cairo_native'] -# cairo-native = { git = "https://github.com/lambdaclass//cairo_native.git", rev = "76e83965d3bf1252eb6c68200a3accd5fd1ec004" } +[patch.'https://github.com/lambdaclass/cairo_native'] +cairo-native = "=0.2.4" From 9869547d86abffdb4d4d67870a79811315fe0797 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 17:55:06 -0300 Subject: [PATCH 19/32] fix test --- .github/workflows/ci.yml | 1 + rpc-state-reader/src/execution.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84cbaeb5..c24cf61a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ + CAIRO_NATIVE_RUNTIME_LIBRARY: replay/ steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.82.0 diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 601e7daf..38673131 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -77,7 +77,7 @@ pub fn execute_tx( block_info, chain_info, versioned_constants, - BouncerConfig::empty(), + BouncerConfig::max(), ); // Map starknet_api transaction to blockifier's @@ -311,7 +311,7 @@ pub fn fetch_block_context(reader: &RpcStateReader) -> BlockContext { fee_token_addresses, }, versioned_constants, - BouncerConfig::empty(), + BouncerConfig::max(), ) } @@ -974,7 +974,7 @@ mod tests { fn from(value: &CallInfo) -> Self { Self { result: Some(value.execution.retdata.0.clone()), - calldata: Some(*(value.call.calldata).0.clone()), + calldata: Some((*value.call.calldata.0).clone()), calls: value.inner_calls.iter().map(|ci| ci.into()).collect(), // We don't have the revert reason string in the trace so we just make sure it doesn't revert revert_reason: value.execution.failed.then_some("Default String".into()), From 3f40de636395b3e555b92994aff33598028dd5bb Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Fri, 29 Nov 2024 18:14:03 -0300 Subject: [PATCH 20/32] fix ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c24cf61a..9a656cbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ - CAIRO_NATIVE_RUNTIME_LIBRARY: replay/ + CAIRO_NATIVE_RUNTIME_LIBRARY: replay/libcairo_native_runtime.a steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.82.0 From 61026698d52a6ad242ae08478a927a37c22eacda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Fri, 29 Nov 2024 18:43:36 -0300 Subject: [PATCH 21/32] Fix ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c24cf61a..e59505ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ - CAIRO_NATIVE_RUNTIME_LIBRARY: replay/ + CAIRO_NATIVE_RUNTIME_LIBRARY: libcairo_native_runtime.a steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.82.0 From b8cc56390b6319712c8bf1eaf2bd68efaf86ffd0 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Sun, 1 Dec 2024 16:57:55 -0300 Subject: [PATCH 22/32] fix test --- Cargo.lock | 235 +++++++++++++++--------------- rpc-state-reader/src/execution.rs | 81 ++++++---- rpc-state-reader/src/utils.rs | 2 +- 3 files changed, 168 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec3ced62..d7e7dc59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,9 +61,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -146,7 +146,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -332,7 +332,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -343,7 +343,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -378,7 +378,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -549,7 +549,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.90", "which", ] @@ -592,7 +592,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "ark-ec", @@ -669,7 +669,7 @@ dependencies = [ "cairo-native", "cairo-vm", "derive_more 0.99.18", - "indexmap 2.6.0", + "indexmap 2.7.0", "itertools 0.12.1", "keccak", "log", @@ -699,7 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -708,7 +708,7 @@ dependencies = [ "clap", "flate2", "google-cloud-storage", - "indexmap 2.6.0", + "indexmap 2.7.0", "papyrus_execution", "pretty_assertions", "retry", @@ -744,7 +744,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1047,7 +1047,7 @@ checksum = "ac857ec4b564712f3e16e3314e23cc0787ab1c05cdfee83f1c8f9989a6eee40f" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1361,7 +1361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35df943ebcf8e1db11ee9f4f46f843dde5b71639ca79ea0d8caa7973f91d8b12" dependencies = [ "hashbrown 0.14.5", - "indexmap 2.6.0", + "indexmap 2.7.0", "itertools 0.12.1", "num-bigint", "num-traits", @@ -1603,7 +1603,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1892,7 +1892,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1940,7 +1940,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1962,7 +1962,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2045,7 +2045,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2065,7 +2065,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2160,7 +2160,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2235,7 +2235,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2313,7 +2313,7 @@ checksum = "4f4b100e337b021ae69f3e7dd82e230452c54ff833958446c4a3854c66dc9326" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2333,7 +2333,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2488,7 +2488,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "syn 2.0.89", + "syn 2.0.90", "toml", "walkdir", ] @@ -2506,7 +2506,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2532,7 +2532,7 @@ dependencies = [ "serde", "serde_json", "strum 0.26.3", - "syn 2.0.89", + "syn 2.0.90", "tempfile", "thiserror", "tiny-keccak", @@ -2865,7 +2865,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2947,7 +2947,7 @@ checksum = "43eaff6bbc0b3a878361aced5ec6a2818ee7c541c5b33b5880dfa9a86c23e9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3153,7 +3153,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -3601,7 +3601,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3705,7 +3705,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3752,9 +3752,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -3770,7 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "tokio", ] @@ -3864,10 +3864,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb15147158e79fd8b8afd0252522769c4f48725460b37338544d8379d94fc8f9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -4515,7 +4516,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.89", + "syn 2.0.90", "tblgen-alt", "unindent", ] @@ -4538,7 +4539,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -4568,7 +4569,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4858,7 +4859,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4936,7 +4937,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4974,9 +4975,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.8.2" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092" +checksum = "e5ca711d8b83edbb00b44d504503cd247c9c0bd8b0fa2694f2a1a3d8165379ce" dependencies = [ "log", "serde", @@ -5002,12 +5003,12 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", "flate2", - "indexmap 2.6.0", + "indexmap 2.7.0", "lazy_static", "rand", "serde", @@ -5021,7 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "clap", "infra_utils", @@ -5036,13 +5037,13 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "blockifier", "cairo-lang-starknet-classes", "cairo-vm", - "indexmap 2.6.0", + "indexmap 2.7.0", "itertools 0.12.1", "lazy_static", "papyrus_common", @@ -5059,7 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "libp2p", "serde", @@ -5068,17 +5069,17 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "quote", - "syn 2.0.89", + "syn 2.0.90", "tracing", ] [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "async-trait", @@ -5112,14 +5113,14 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "byteorder", "cairo-lang-casm", "cairo-lang-starknet-classes", "cairo-lang-utils", "human_bytes", - "indexmap 2.6.0", + "indexmap 2.7.0", "integer-encoding", "libmdbx", "memmap2", @@ -5164,7 +5165,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5288,7 +5289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.6.0", + "indexmap 2.7.0", ] [[package]] @@ -5331,7 +5332,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5375,7 +5376,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5469,7 +5470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5558,7 +5559,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6014,7 +6015,7 @@ version = "0.17.0-pre.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719825638c59fd26a55412a24561c7c5bcf54364c88b9a7a04ba08a6eafaba8d" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "lock_api", "oorandom", "parking_lot", @@ -6034,7 +6035,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6233,7 +6234,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6267,7 +6268,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6373,7 +6374,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6384,7 +6385,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6428,7 +6429,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6478,7 +6479,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -6495,7 +6496,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6507,7 +6508,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6849,7 +6850,7 @@ checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" dependencies = [ "starknet-curve 0.4.2", "starknet-ff", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6892,7 +6893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" dependencies = [ "starknet-core 0.10.0", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6949,14 +6950,14 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "bitvec", "cairo-lang-runner", "cairo-lang-starknet-classes", "derive_more 0.99.18", "hex", - "indexmap 2.6.0", + "indexmap 2.7.0", "infra_utils", "itertools 0.12.1", "num-bigint", @@ -6975,12 +6976,12 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "cairo-lang-starknet-classes", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.7.0", "os_info", "papyrus_common", "papyrus_config", @@ -7002,7 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7030,7 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7049,7 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "papyrus_network_types", @@ -7063,7 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7081,7 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#fdf3e39dc45123d72f433a8e3b89ddbc49c0be1a" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", @@ -7159,7 +7160,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7172,7 +7173,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7214,9 +7215,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -7246,7 +7247,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7330,7 +7331,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7341,7 +7342,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "test-case-core", ] @@ -7362,7 +7363,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7486,7 +7487,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7587,7 +7588,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "toml_datetime", "winnow 0.5.40", ] @@ -7598,7 +7599,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -7658,7 +7659,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8038,9 +8039,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.96" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21d3b25c3ea1126a2ad5f4f9068483c2af1e64168f847abe863a526b8dbfe00b" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -8049,24 +8050,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.96" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52857d4c32e496dc6537646b5b117081e71fd2ff06de792e3577a150627db283" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.46" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951fe82312ed48443ac78b66fa43eded9999f738f6022e67aead7b708659e49a" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", @@ -8077,9 +8078,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.96" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920b0ffe069571ebbfc9ddc0b36ba305ef65577c94b06262ed793716a1afd981" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8087,22 +8088,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.96" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf59002391099644be3524e23b781fa43d2be0c5aa0719a18c0731b9d195cab6" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.96" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5047c5392700766601942795a436d7d2599af60dcc3cc1248c9120bfb0827b0" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-streams" @@ -8119,9 +8120,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476364ff87d0ae6bfb661053a9104ab312542658c3d8f963b7ace80b6f9b26b9" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", @@ -8497,7 +8498,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -8519,7 +8520,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8539,7 +8540,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -8560,7 +8561,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8582,7 +8583,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 38673131..0fba7454 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -350,11 +350,10 @@ mod tests { // To reexecute a transaction, we must use the state from its previous block let previous_block = BlockNumber(block_number - 1); let (tx_info, trace, _) = execute_tx(hash, chain, previous_block); - - // assert_eq!( - // tx_info.revert_error.unwrap(), - // trace.execute_invocation.unwrap() - // ); + assert_eq!( + tx_info.revert_error.and_then(|r| Some(r.to_string())), + trace.execute_invocation.unwrap().revert_reason + ); // We can't currently compare fee values } @@ -553,7 +552,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 1, }, - false + false, + 1 )] #[test_case( "0x0355059efee7a38ba1fd5aef13d261914608dce7bdfacad92a71e396f0ad7a77", @@ -570,7 +570,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 0 )] #[test_case( "0x05324bac55fb9fb53e738195c2dcc1e7fed1334b6db824665e3e984293bec95e", @@ -587,7 +588,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 1 )] #[test_case( "0x670321c71835004fcab639e871ef402bb807351d126ccc4d93075ff2c31519d", @@ -604,7 +606,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 0 )] #[test_case( "0x06962f11a96849ebf05cd222313858a93a8c5f300493ed6c5859dd44f5f2b4e3", @@ -621,7 +624,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 1 )] #[test_case( "0x078b81326882ecd2dc6c5f844527c3f33e0cdb52701ded7b1aa4d220c5264f72", @@ -638,7 +642,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 3, }, - false + false, + 0 )] #[test_case( "0x0780e3a498b4fd91ab458673891d3e8ee1453f9161f4bfcb93dd1e2c91c52e10", @@ -655,7 +660,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 3, }, - false + false, + 2 )] #[test_case( "0x4f552c9430bd21ad300db56c8f4cae45d554a18fac20bf1703f180fac587d7e", @@ -672,7 +678,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 0, }, - false + false, + 0 )] #[test_case( "0x176a92e8df0128d47f24eebc17174363457a956fa233cc6a7f8561bfbd5023a", @@ -689,7 +696,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 1, }, - false + false, + 0 )] #[test_case( "0x026c17728b9cd08a061b1f17f08034eb70df58c1a96421e73ee6738ad258a94c", @@ -706,7 +714,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 1, }, - false + false, + 0 )] #[test_case( "0x73ef9cde09f005ff6f411de510ecad4cdcf6c4d0dfc59137cff34a4fc74dfd", @@ -723,7 +732,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 0, }, - false + false, + 1 )] #[test_case( "0x0743092843086fa6d7f4a296a226ee23766b8acf16728aef7195ce5414dc4d84", @@ -740,7 +750,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 1 )] #[test_case( "0x066e1f01420d8e433f6ef64309adb1a830e5af0ea67e3d935de273ca57b3ae5e", @@ -757,7 +768,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 0 )] // Check this tx, l1_data_gas should be 384 // https://starkscan.co/tx/0x04756d898323a8f884f5a6aabd6834677f4bbaeecc2522f18b3ae45b3f99cd1e @@ -776,7 +788,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 1, }, - false + false, + 0 )] #[test_case( "0x00f390691fd9e865f5aef9c7cc99889fb6c2038bc9b7e270e8a4fe224ccd404d", @@ -793,7 +806,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 1 )] #[test_case( "0x26be3e906db66973de1ca5eec1ddb4f30e3087dbdce9560778937071c3d3a83", @@ -810,7 +824,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 0, }, - false + false, + 0 )] #[test_case( "0x0310c46edc795c82c71f600159fa9e6c6540cb294df9d156f685bfe62b31a5f4", @@ -827,7 +842,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 3, }, - false + false, + 0 )] #[test_case( "0x06a09ffbf996178ac6e90101047e42fe29cb7108573b2ecf4b0ebd2cba544cb4", @@ -844,7 +860,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 2, }, - false + false, + 0 )] #[test_case( "0x026e04e96ba1b75bfd066c8e138e17717ecb654909e6ac24007b644ac23e4b47", @@ -861,7 +878,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 4, }, - false + false, + 1 )] #[test_case( "0x01351387ef63fd6fe5ec10fa57df9e006b2450b8c68d7eec8cfc7d220abc7eda", @@ -878,7 +896,8 @@ mod tests { n_compiled_class_hash_updates: 0, n_modified_contracts: 1, }, - true + true, + 0 )] #[allow(clippy::too_many_arguments)] fn test_transaction_info( @@ -892,30 +911,28 @@ mod tests { l1_handler_payload_size: Option, starknet_chg: StateChangesCount, is_reverted: bool, + n_allocated_keys: usize ) { let previous_block = BlockNumber(block_number - 1); let (tx_info, _, r) = execute_tx(hash, chain, previous_block); - let tx_receipt = tx_info.receipt; - let starknet_resources = tx_receipt.resources.starknet_resources; - let info = tx_info.execute_call_info.unwrap(); + let starknet_resources = tx_info.clone().receipt.resources.starknet_resources; let versioned_constants = VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { validate_max_n_steps: u32::MAX, invoke_tx_max_n_steps: u32::MAX, max_recursion_depth: usize::MAX, }); - let state_resources = StateResources::new_for_testing(starknet_chg, 0); + let state_resources = StateResources::new_for_testing(starknet_chg, n_allocated_keys); let starknet_rsc = StarknetResources::new( calldata_length, signature_length, code_size, state_resources, l1_handler_payload_size, - info.summarize(&versioned_constants), + tx_info.summarize(&versioned_constants) ); - assert_eq!(is_reverted, tx_info.revert_error.is_some()); - assert_eq!(da_gas, tx_receipt.da_gas); + assert_eq!(da_gas, tx_info.receipt.da_gas); assert_eq!(starknet_rsc, starknet_resources); } diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index 5205e7f0..dabc7cee 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -79,7 +79,7 @@ pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> A .read() .unwrap() .get(&class_hash) - .map(Clone::clone); + .cloned(); match executor { Some(executor) => executor, From fab80a2b63bc0830cab1c2970aa136a3e048a0ec Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Sun, 1 Dec 2024 17:00:06 -0300 Subject: [PATCH 23/32] format --- rpc-state-reader/src/execution.rs | 6 +++--- rpc-state-reader/src/utils.rs | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 0fba7454..2e9bb2cf 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -911,11 +911,11 @@ mod tests { l1_handler_payload_size: Option, starknet_chg: StateChangesCount, is_reverted: bool, - n_allocated_keys: usize + n_allocated_keys: usize, ) { let previous_block = BlockNumber(block_number - 1); let (tx_info, _, r) = execute_tx(hash, chain, previous_block); - let starknet_resources = tx_info.clone().receipt.resources.starknet_resources; + let starknet_resources = tx_info.clone().receipt.resources.starknet_resources; let versioned_constants = VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { validate_max_n_steps: u32::MAX, @@ -929,7 +929,7 @@ mod tests { code_size, state_resources, l1_handler_payload_size, - tx_info.summarize(&versioned_constants) + tx_info.summarize(&versioned_constants), ); assert_eq!(is_reverted, tx_info.revert_error.is_some()); assert_eq!(da_gas, tx_info.receipt.da_gas); diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index dabc7cee..81c8308d 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -75,11 +75,7 @@ pub fn decode_reader(bytes: Vec) -> io::Result { pub fn get_native_executor(contract: &ContractClass, class_hash: ClassHash) -> AotContractExecutor { let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); - let executor = cache_lock - .read() - .unwrap() - .get(&class_hash) - .cloned(); + let executor = cache_lock.read().unwrap().get(&class_hash).cloned(); match executor { Some(executor) => executor, From 3b94a64c9312856d440dc9261008a0595633a5c4 Mon Sep 17 00:00:00 2001 From: Franco Giachetta Date: Mon, 2 Dec 2024 08:08:15 -0300 Subject: [PATCH 24/32] Update ci --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae55df79..e59505ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,11 +19,7 @@ jobs: MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ -<<<<<<< HEAD - CAIRO_NATIVE_RUNTIME_LIBRARY: replay/libcairo_native_runtime.a -======= CAIRO_NATIVE_RUNTIME_LIBRARY: libcairo_native_runtime.a ->>>>>>> 61026698d52a6ad242ae08478a927a37c22eacda steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.82.0 From 3bde418aef58a0170456c566fd09eebb5adcc580 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 09:09:35 -0300 Subject: [PATCH 25/32] clippy --- replay/src/state_dump.rs | 5 +---- rpc-state-reader/src/execution.rs | 4 ++-- rpc-state-reader/src/reader.rs | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 363d4b24..3b333c27 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -121,10 +121,7 @@ struct SerializableExecutionInfo { impl SerializableExecutionInfo { pub fn new(execution_info: &TransactionExecutionInfo) -> Self { - let reverted = execution_info - .revert_error - .clone() - .and_then(|f| Some(f.to_string())); + let reverted = execution_info.revert_error.clone().map(|f| f.to_string()); Self { validate_call_info: execution_info .validate_call_info diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 2e9bb2cf..02bceb04 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -320,7 +320,7 @@ mod tests { use std::thread; use blockifier::{ - execution::call_info::{CallInfo, EventSummary, ExecutionSummary}, + execution::call_info::CallInfo, fee::resources::{StarknetResources, StateResources}, state::cached_state::StateChangesCount, }; @@ -914,7 +914,7 @@ mod tests { n_allocated_keys: usize, ) { let previous_block = BlockNumber(block_number - 1); - let (tx_info, _, r) = execute_tx(hash, chain, previous_block); + let (tx_info, _, _) = execute_tx(hash, chain, previous_block); let starknet_resources = tx_info.clone().receipt.resources.starknet_resources; let versioned_constants = VersionedConstants::get_versioned_constants(VersionedConstantsOverrides { diff --git a/rpc-state-reader/src/reader.rs b/rpc-state-reader/src/reader.rs index 1e2a1563..158a7a8a 100644 --- a/rpc-state-reader/src/reader.rs +++ b/rpc-state-reader/src/reader.rs @@ -402,8 +402,6 @@ fn bytecode_size(data: &[BigUintAsHex]) -> usize { #[cfg(test)] mod tests { - use std::num::NonZeroU128; - use starknet_api::block::FeeType; use super::*; From 6153a9399a405b729482d806b5324990e2f46c34 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 09:29:38 -0300 Subject: [PATCH 26/32] clippy --- rpc-state-reader/src/execution.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 02bceb04..eff062b6 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -351,7 +351,7 @@ mod tests { let previous_block = BlockNumber(block_number - 1); let (tx_info, trace, _) = execute_tx(hash, chain, previous_block); assert_eq!( - tx_info.revert_error.and_then(|r| Some(r.to_string())), + tx_info.revert_error.map(|r| r.to_string()), trace.execute_invocation.unwrap().revert_reason ); From 6d3f22b5ed7649142c639edcf7402cb5ba48f39e Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 11:46:34 -0300 Subject: [PATCH 27/32] fix state diffs --- replay/src/state_dump.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 3b333c27..22a59ff4 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -36,7 +36,7 @@ pub fn dump_state_diff( let _ = fs::create_dir_all(parent); } - let state_maps = SerializableStateMaps::from(state.get_initial_reads()?); + let state_maps = SerializableStateMaps::from(state.to_state_diff()?); let execution_info = SerializableExecutionInfo::new(execution_info); let info = Info { execution_info, From a4486d66c0bc9c1259d2ff7c82eec845414b27ee Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 11:51:02 -0300 Subject: [PATCH 28/32] fix state diffs --- replay/src/state_dump.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replay/src/state_dump.rs b/replay/src/state_dump.rs index 22a59ff4..2b838beb 100644 --- a/replay/src/state_dump.rs +++ b/replay/src/state_dump.rs @@ -36,7 +36,7 @@ pub fn dump_state_diff( let _ = fs::create_dir_all(parent); } - let state_maps = SerializableStateMaps::from(state.to_state_diff()?); + let state_maps = SerializableStateMaps::from(state.to_state_diff()?.state_maps); let execution_info = SerializableExecutionInfo::new(execution_info); let info = Info { execution_info, From 50e695793a3f81d8c411452fbf132b122b9defd7 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 15:11:10 -0300 Subject: [PATCH 29/32] remove rpc call on declare --- Cargo.lock | 26 ++++---------------------- Cargo.toml | 14 ++++++++++---- rpc-state-reader/src/execution.rs | 3 +-- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d7e7dc59..eadafdd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,6 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "ark-ec", @@ -699,7 +698,6 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -724,9 +722,9 @@ dependencies = [ [[package]] name = "bon" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e47d5c63335658326076cf7c81795af665c534ea552da69526d6cef51b12ed9" +checksum = "9276fe602371cd8a7f70fe68c4db55b2d3e92c570627d6ed0427646edfa5cf47" dependencies = [ "bon-macros", "rustversion", @@ -734,9 +732,9 @@ dependencies = [ [[package]] name = "bon-macros" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b162272b6d55562ea30cc937d74ef4d07399e507bfd6eb3860f6a845c7264eef" +checksum = "94828b84b32b4f3ac3865f692fcdbc46c7d0dd87b29658a391d58a244e1ce45a" dependencies = [ "darling 0.20.10", "ident_case", @@ -3770,7 +3768,6 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "tokio", ] @@ -4539,7 +4536,6 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -5003,7 +4999,6 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5022,7 +5017,6 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "clap", "infra_utils", @@ -5037,7 +5031,6 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "blockifier", @@ -5060,7 +5053,6 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "libp2p", "serde", @@ -5069,7 +5061,6 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "quote", "syn 2.0.90", @@ -5079,7 +5070,6 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "async-trait", @@ -5113,7 +5103,6 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6950,7 +6939,6 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6976,7 +6964,6 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7003,7 +6990,6 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7031,7 +7017,6 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7050,7 +7035,6 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "papyrus_network_types", @@ -7064,7 +7048,6 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7082,7 +7065,6 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 4e24c43f..0283b007 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,16 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "=0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main + +starknet_api = { path = "../sequencer/crates/starknet_api" } # main +blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main +starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main +blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main + +# starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +# blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main +# starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +# blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main [patch.'https://github.com/lambdaclass/cairo_native'] cairo-native = "=0.2.4" diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index eff062b6..5fcc07f7 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -240,8 +240,7 @@ pub fn execute_tx_with_blockifier( let block_number = context.block_info().block_number; let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string()); // we need to retrieve the next block in order to get the contract_class - let next_reader = RpcStateReader::new(network, block_number.next().unwrap()); - let contract_class = next_reader + let contract_class = state .get_contract_class(&declare_tx.class_hash()) .unwrap(); let class_info = calculate_class_info_for_testing(contract_class); From a67d33fdbcf5d5e893123baceac50be1116cc051 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 15:31:34 -0300 Subject: [PATCH 30/32] remove rpc call on declare --- rpc-state-reader/src/execution.rs | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/rpc-state-reader/src/execution.rs b/rpc-state-reader/src/execution.rs index 5fcc07f7..85f504ff 100644 --- a/rpc-state-reader/src/execution.rs +++ b/rpc-state-reader/src/execution.rs @@ -236,24 +236,24 @@ pub fn execute_tx_with_blockifier( SNTransaction::Invoke(_) | SNTransaction::DeployAccount(_) => { BlockiTransaction::from_api(transaction, transaction_hash, None, None, None, false)? } - SNTransaction::Declare(ref declare_tx) => { - let block_number = context.block_info().block_number; - let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string()); - // we need to retrieve the next block in order to get the contract_class - let contract_class = state - .get_contract_class(&declare_tx.class_hash()) - .unwrap(); - let class_info = calculate_class_info_for_testing(contract_class); - - BlockiTransaction::from_api( - transaction, - transaction_hash, - Some(class_info), - None, - None, - false, - )? - } + // SNTransaction::Declare(ref declare_tx) => { + // let block_number = context.block_info().block_number; + // let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string()); + // // we need to retrieve the next block in order to get the contract_class + // let contract_class = state + // .get_compiled_class(&declare_tx.class_hash()) + // .unwrap(); + // let class_info = calculate_class_info_for_testing(contract_class); + + // BlockiTransaction::from_api( + // transaction, + // transaction_hash, + // Some(class_info), + // None, + // None, + // false, + // )? + // } SNTransaction::L1Handler(_) => { // As L1Hanlder is not an account transaction we execute it here and return the result BlockiTransaction::from_api( From 09c01c28f22cead450fd7755de7da433802e7831 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 15:53:28 -0300 Subject: [PATCH 31/32] clippy --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 16 +++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eadafdd4..95266ed5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,6 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "ark-ec", @@ -698,6 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -3768,6 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "tokio", ] @@ -4536,6 +4539,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "assert_matches", "blockifier", @@ -4999,6 +5003,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5017,6 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "clap", "infra_utils", @@ -5031,6 +5037,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "blockifier", @@ -5053,6 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "libp2p", "serde", @@ -5061,6 +5069,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "quote", "syn 2.0.90", @@ -5070,6 +5079,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "anyhow", "async-trait", @@ -5103,6 +5113,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6939,6 +6950,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6964,6 +6976,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -6990,6 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7017,6 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "axum", @@ -7035,6 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "papyrus_network_types", @@ -7048,6 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7065,6 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 0283b007..6e9fb2e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,18 +12,12 @@ tracing = "0.1" serde_json = "1.0.116" serde_with = "3.11.0" serde = "1.0.197" -cairo-native = "=0.2.4" +cairo-native = "0.2.4" # Sequencer Dependencies - -starknet_api = { path = "../sequencer/crates/starknet_api" } # main -blockifier = { path = "../sequencer/crates/blockifier", features = ["cairo_native"] } # main -starknet_gateway = { path = "../sequencer/crates/starknet_gateway" } # main -blockifier_reexecution = { path = "../sequencer/crates/blockifier_reexecution" } # main - -# starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -# blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main -# starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -# blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main [patch.'https://github.com/lambdaclass/cairo_native'] cairo-native = "=0.2.4" From ed775127635dba662179108b0331a96b689ee80b Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 17:21:58 -0300 Subject: [PATCH 32/32] change sequencer to replay branch --- Cargo.lock | 38 +++++++++++++++++++------------------- Cargo.toml | 8 ++++---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95266ed5..03e2ee99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "anyhow", "ark-ec", @@ -699,7 +699,7 @@ dependencies = [ [[package]] name = "blockifier_reexecution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "assert_matches", "blockifier", @@ -3770,7 +3770,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infra_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "tokio", ] @@ -4539,7 +4539,7 @@ dependencies = [ [[package]] name = "mempool_test_utils" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "assert_matches", "blockifier", @@ -5003,7 +5003,7 @@ dependencies = [ [[package]] name = "papyrus_common" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "base64 0.13.1", "cairo-lang-starknet-classes", @@ -5022,7 +5022,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "clap", "infra_utils", @@ -5037,7 +5037,7 @@ dependencies = [ [[package]] name = "papyrus_execution" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "anyhow", "blockifier", @@ -5060,7 +5060,7 @@ dependencies = [ [[package]] name = "papyrus_network_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "libp2p", "serde", @@ -5069,7 +5069,7 @@ dependencies = [ [[package]] name = "papyrus_proc_macros" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "quote", "syn 2.0.90", @@ -5079,7 +5079,7 @@ dependencies = [ [[package]] name = "papyrus_rpc" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "anyhow", "async-trait", @@ -5113,7 +5113,7 @@ dependencies = [ [[package]] name = "papyrus_storage" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "byteorder", "cairo-lang-casm", @@ -6950,7 +6950,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "bitvec", "cairo-lang-runner", @@ -6958,9 +6958,9 @@ dependencies = [ "derive_more 0.99.18", "hex", "indexmap 2.7.0", - "infra_utils", "itertools 0.12.1", "num-bigint", + "papyrus_proc_macros", "pretty_assertions", "primitive-types", "serde", @@ -6976,7 +6976,7 @@ dependencies = [ [[package]] name = "starknet_client" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "async-trait", "cairo-lang-starknet-classes", @@ -7003,7 +7003,7 @@ dependencies = [ [[package]] name = "starknet_gateway" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "async-trait", "axum", @@ -7031,7 +7031,7 @@ dependencies = [ [[package]] name = "starknet_gateway_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "async-trait", "axum", @@ -7050,7 +7050,7 @@ dependencies = [ [[package]] name = "starknet_mempool_types" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "async-trait", "papyrus_network_types", @@ -7064,7 +7064,7 @@ dependencies = [ [[package]] name = "starknet_sequencer_infra" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "async-trait", "bincode 1.3.3", @@ -7082,7 +7082,7 @@ dependencies = [ [[package]] name = "starknet_sierra_compile" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer.git?branch=update-main-2#5532b0b24ec7e5bad97acb9a2d9655a0c76607e0" +source = "git+https://github.com/lambdaclass/sequencer.git?branch=replay#111c6fd7ea6895f6322c15865a6f7fafaf29781e" dependencies = [ "cairo-lang-sierra", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 6e9fb2e5..5bc40adf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ serde_with = "3.11.0" serde = "1.0.197" cairo-native = "0.2.4" # Sequencer Dependencies -starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2", features = ["cairo_native"] } # main -starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main -blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "update-main-2" } # main +starknet_api = { git = "https://github.com/lambdaclass/sequencer.git", branch = "replay" } # main +blockifier = { git = "https://github.com/lambdaclass/sequencer.git", branch = "replay", features = ["cairo_native"] } # main +starknet_gateway = { git = "https://github.com/lambdaclass/sequencer.git", branch = "replay" } # main +blockifier_reexecution = { git = "https://github.com/lambdaclass/sequencer.git", branch = "replay" } # main [patch.'https://github.com/lambdaclass/cairo_native'] cairo-native = "=0.2.4"