diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9791be0..93197af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.80.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: components: clippy, rustfmt - uses: Swatinem/rust-cache@v2 @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.80.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: components: rustfmt - run: cargo fmt --all -- --check @@ -52,7 +52,7 @@ jobs: id: fc with: issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' + comment-author: "github-actions[bot]" body-includes: thiscommentistofindthisformatcomment - name: Create or update comment continue-on-error: true @@ -86,10 +86,10 @@ jobs: MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ - RUSTUP_TOOLCHAIN: nightly # udeps needs nightly + RUSTUP_TOOLCHAIN: nightly # udeps needs nightly steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.80.0 + - uses: dtolnay/rust-toolchain@1.81.0 with: toolchain: nightly components: rustfmt @@ -139,7 +139,7 @@ jobs: sudo rm -rf /usr/local/lib/android df -h - name: Setup rust env - uses: dtolnay/rust-toolchain@1.80.0 + uses: dtolnay/rust-toolchain@1.81.0 - name: Retreive cached dependecies uses: Swatinem/rust-cache@v2 - name: Add LLVM Debian repository @@ -155,7 +155,7 @@ jobs: uses: actions/checkout@v4 with: repository: lambdaclass/cairo_native - ref: 4355357697e9ab57ab88ae3a4282aac61455619e + ref: 4ba9e1609163c0d760f2a716244729d3116cc5ee path: cairo_native - name: Build Cairo Native Runtime Library shell: bash @@ -164,7 +164,7 @@ jobs: make runtime echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV - name: Test - run: cargo test --all-features + run: cargo test test_macos: name: Test (macOS, Apple silicon) @@ -180,7 +180,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup rust env - uses: dtolnay/rust-toolchain@1.80.0 + uses: dtolnay/rust-toolchain@1.81.0 - name: Rust `$PATH` workaround. run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - uses: Homebrew/actions/setup-homebrew@master @@ -192,7 +192,7 @@ jobs: uses: actions/checkout@v4 with: repository: lambdaclass/cairo_native - ref: 44d420814553c37cec7d2177892b36fc199f6cda + ref: 4ba9e1609163c0d760f2a716244729d3116cc5ee path: cairo_native - name: Build Cairo Native Runtime Library run: | @@ -200,4 +200,4 @@ jobs: make runtime echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV - name: Test - run: cargo test --all-features + run: cargo test diff --git a/Cargo.lock b/Cargo.lock index 5cb3033..4f03608 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" [[package]] name = "aquamarine" @@ -476,7 +476,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" +source = "git+https://github.com/lambdaclass/sequencer?rev=5ce75fc617bbc709a5997228930030dce358ee79#5ce75fc617bbc709a5997228930030dce358ee79" dependencies = [ "anyhow", "ark-ec", @@ -1129,8 +1129,8 @@ dependencies = [ [[package]] name = "cairo-native" -version = "0.2.0-alpha.3" -source = "git+https://github.com/lambdaclass//cairo_native.git?rev=82c25b377f50904e1253b614c8719388277530e6#82c25b377f50904e1253b614c8719388277530e6" +version = "0.2.0-alpha.4" +source = "git+https://github.com/lambdaclass//cairo_native.git?rev=4ba9e1609163c0d760f2a716244729d3116cc5ee#4ba9e1609163c0d760f2a716244729d3116cc5ee" dependencies = [ "anyhow", "aquamarine", @@ -1141,7 +1141,6 @@ dependencies = [ "bumpalo", "cairo-lang-compiler", "cairo-lang-defs", - "cairo-lang-diagnostics", "cairo-lang-filesystem", "cairo-lang-runner", "cairo-lang-semantic", @@ -1183,13 +1182,12 @@ dependencies = [ [[package]] name = "cairo-native-runtime" -version = "0.2.0-alpha.3" -source = "git+https://github.com/lambdaclass//cairo_native.git?rev=82c25b377f50904e1253b614c8719388277530e6#82c25b377f50904e1253b614c8719388277530e6" +version = "0.2.0-alpha.4" +source = "git+https://github.com/lambdaclass//cairo_native.git?rev=4ba9e1609163c0d760f2a716244729d3116cc5ee#4ba9e1609163c0d760f2a716244729d3116cc5ee" dependencies = [ "cairo-lang-sierra-gas", "itertools 0.13.0", "lazy_static", - "libc", "num-traits 0.2.19", "rand", "starknet-curve 0.5.1", @@ -1239,9 +1237,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.28" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -2285,9 +2283,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -2573,9 +2571,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -2673,9 +2671,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libloading" @@ -3037,7 +3035,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" +source = "git+https://github.com/lambdaclass/sequencer?rev=5ce75fc617bbc709a5997228930030dce358ee79#5ce75fc617bbc709a5997228930030dce358ee79" dependencies = [ "clap", "itertools 0.10.5", @@ -3350,9 +3348,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] @@ -3714,9 +3712,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "log", "once_cell", @@ -3738,9 +3736,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -3765,9 +3763,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -3902,9 +3900,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "610f75ff4a8e3cb29b85da56eabdd1bff5b06739059a4b8e2967fef32e5d9944" dependencies = [ "itoa", "memchr", @@ -4052,7 +4050,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "sierra-emu" version = "0.1.0" -source = "git+https://github.com/lambdaclass/sierra-emu.git#40ee99489effa22fd806d0ccabe4ed8c3bb87629" +source = "git+https://github.com/lambdaclass/sierra-emu.git#071caea75a403fb940a96b574f2a70dc431e0662" dependencies = [ "cairo-lang-compiler", "cairo-lang-filesystem", @@ -4431,7 +4429,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" +source = "git+https://github.com/lambdaclass/sequencer?rev=5ce75fc617bbc709a5997228930030dce358ee79#5ce75fc617bbc709a5997228930030dce358ee79" dependencies = [ "bitvec", "cairo-lang-starknet-classes", @@ -5035,7 +5033,7 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls 0.23.14", + "rustls 0.23.15", "rustls-pki-types", "serde", "serde_json", @@ -5160,9 +5158,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -5171,9 +5169,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -5186,9 +5184,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -5198,9 +5196,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5208,9 +5206,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -5221,15 +5219,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 2e19221..d98108d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,13 +9,14 @@ resolver = "2" [workspace.dependencies] thiserror = "1.0.32" starknet-types-core = "0.1.6" -starknet_api = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.8.x"} -blockifier = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.8.x"} -cairo-native = { git = "https://github.com/lambdaclass/cairo_native" } +# branch = native2.8.x +starknet_api = { git = "https://github.com/lambdaclass/sequencer", rev = "5ce75fc617bbc709a5997228930030dce358ee79" } +blockifier = { git = "https://github.com/lambdaclass/sequencer", rev = "5ce75fc617bbc709a5997228930030dce358ee79" } +cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "4ba9e1609163c0d760f2a716244729d3116cc5ee" } tracing = "0.1" serde_json = "1.0.116" serde_with = "3.9.0" serde = "1.0.197" [patch.'https://github.com/lambdaclass/cairo_native'] -cairo-native = { git = 'https://github.com/lambdaclass//cairo_native.git', rev = "82c25b377f50904e1253b614c8719388277530e6" } +cairo-native = { git = 'https://github.com/lambdaclass//cairo_native.git', rev = "4ba9e1609163c0d760f2a716244729d3116cc5ee" } diff --git a/rpc-state-reader/src/blockifier_state_reader.rs b/rpc-state-reader/src/blockifier_state_reader.rs index 99245fb..2a12be7 100644 --- a/rpc-state-reader/src/blockifier_state_reader.rs +++ b/rpc-state-reader/src/blockifier_state_reader.rs @@ -243,7 +243,7 @@ pub fn execute_tx( }; return ( blockifier_tx - .execute(&mut state, &block_context, true, true) + .execute(&mut state, &block_context, false, true) .unwrap(), trace, receipt, @@ -254,7 +254,7 @@ pub fn execute_tx( ( blockifier_tx - .execute(&mut state, &block_context, true, true) + .execute(&mut state, &block_context, false, true) .unwrap(), trace, receipt, diff --git a/rpc-state-reader/src/utils.rs b/rpc-state-reader/src/utils.rs index d78dca0..9c8b121 100644 --- a/rpc-state-reader/src/utils.rs +++ b/rpc-state-reader/src/utils.rs @@ -2,7 +2,7 @@ use std::{ collections::HashMap, io::{self, Read}, path::PathBuf, - sync::{Arc, OnceLock, RwLock}, + sync::{Arc, Mutex, OnceLock}, }; use cairo_lang_sierra::program::Program; @@ -25,7 +25,7 @@ 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( @@ -128,14 +128,14 @@ pub fn deserialize_transaction_json( } pub fn get_native_executor(program: Program, class_hash: ClassHash) -> Arc { - let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| RwLock::new(HashMap::new())); + let cache_lock = AOT_PROGRAM_CACHE.get_or_init(|| Mutex::new(HashMap::new())); + let mut cache = cache_lock.lock().unwrap(); - let executor = cache_lock.read().unwrap().get(&class_hash).map(Arc::clone); + let executor = cache.get(&class_hash).map(Arc::clone); match executor { Some(executor) => executor, None => { - let mut cache = cache_lock.write().unwrap(); let path = PathBuf::from(format!( "compiled_programs/{}.{}", class_hash.to_hex_string(),