Skip to content

Commit

Permalink
build: blockifier regression test add block info
Browse files Browse the repository at this point in the history
  • Loading branch information
AvivYossef-starkware committed Sep 23, 2024
1 parent 5779232 commit 6ca2811
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions crates/blockifier_regression_test/src/test_state_reader.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
use blockifier::blockifier::block::BlockInfo;
use blockifier::execution::contract_class::ContractClass;
use blockifier::state::state_api::{StateReader, StateResult};
use starknet_api::block::BlockNumber;
use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
use starknet_api::state::StorageKey;
use starknet_gateway::config::RpcStateReaderConfig;
use starknet_gateway::rpc_state_reader::RpcStateReader;
use starknet_types_core::felt::Felt;
use starknet_gateway::state_reader::MempoolStateReader;

pub struct TestStateReader(RpcStateReader);

Expand Down Expand Up @@ -32,3 +36,14 @@ impl StateReader for TestStateReader {
self.0.get_compiled_class_hash(class_hash)
}
}

impl TestStateReader {
pub fn new(config: &RpcStateReaderConfig, block_number: BlockNumber) -> Self {
Self(RpcStateReader::from_number(config, block_number))
}

pub fn get_block_info(&self) -> StateResult<BlockInfo> {
self.0.get_block_info()
}

}
2 changes: 1 addition & 1 deletion crates/gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod rpc_objects;
pub mod rpc_state_reader;
#[cfg(test)]
mod rpc_state_reader_test;
mod state_reader;
pub mod state_reader;
#[cfg(test)]
mod state_reader_test_utils;
mod stateful_transaction_validator;
Expand Down

0 comments on commit 6ca2811

Please sign in to comment.