Skip to content

Commit

Permalink
chore(blockifier_reexecution): add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AvivYossef-starkware committed Nov 6, 2024
1 parent b00e914 commit 368ebd1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"0.13.0": 600001,
"0.13.1": 620978,
"0.13.1.1": 649367,
"0.13.2": 685878,
"0.13.2.1": 700000,
"example_invoke_with_replace_class_syscall": 780008,
"example_invoke_with_deploy_syscall": 870136,
"example_deploy_account_v1": 837408,
"example_deploy_account_v3": 837792,
"example_declare_v1": 837461,
"example_declare_v2": 822636,
"example_declare_v3": 825013,
"example_l1_handler": 868429
}
13 changes: 13 additions & 0 deletions crates/blockifier_reexecution/src/state_reader/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use indexmap::IndexMap;
use papyrus_execution::{ETH_FEE_CONTRACT_ADDRESS, STRK_FEE_CONTRACT_ADDRESS};
use pretty_assertions::assert_eq;
use serde::{Deserialize, Serialize};
use starknet_api::block::BlockNumber;
use starknet_api::core::{ChainId, ClassHash, CompiledClassHash, ContractAddress, Nonce};
use starknet_api::state::StorageKey;
use starknet_api::test_utils::read_json_file;
use starknet_gateway::config::RpcStateReaderConfig;
use starknet_types_core::felt::Felt;

Expand Down Expand Up @@ -179,3 +181,14 @@ macro_rules! assert_eq_state_diff {
);
};
}

/// Returns the block numbers for re-execution.
/// There is block number for each Starknet Version (starting v0.13)
/// And some additional block with specific transactions.
#[allow(dead_code)]
pub(crate) fn get_block_numbers_for_reexecution() -> Vec<BlockNumber> {
let block_numbers_examples: HashMap<String, u64> =
serde_json::from_value(read_json_file("block_numbers_for_reexecution.json"))
.expect("Failed to deserialize block header");
block_numbers_examples.values().map(|block_number| BlockNumber(*block_number)).collect()
}

0 comments on commit 368ebd1

Please sign in to comment.