From 50e695793a3f81d8c411452fbf132b122b9defd7 Mon Sep 17 00:00:00 2001 From: FrancoGiachetta Date: Mon, 2 Dec 2024 15:11:10 -0300 Subject: [PATCH] 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 d7e7dc5..eadafdd 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 4e24c43..0283b00 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 eff062b..5fcc07f 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);