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 b3194bd commit a452353
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"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
}
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 a452353

Please sign in to comment.