Skip to content

Commit

Permalink
refactor(execution): put all create for testing methods under testing…
Browse files Browse the repository at this point in the history
… config
  • Loading branch information
meship-starkware committed Jul 29, 2024
1 parent a65d3f9 commit 2f47bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/blockifier/src/transaction/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
#[cfg(any(test, feature = "testing"))]
use starknet_api::calldata;
use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
use starknet_api::deprecated_contract_class::EntryPointType;
Expand All @@ -15,6 +16,7 @@ use starknet_api::transaction::{
TransactionSignature,
TransactionVersion,
};
#[cfg(any(test, feature = "testing"))]
use starknet_types_core::felt::Felt;

use crate::abi::abi_utils::selector_from_name;
Expand Down Expand Up @@ -508,6 +510,7 @@ impl L1HandlerTransaction {
self.tx.calldata.0.len() - 1
}

#[cfg(any(test, feature = "testing"))]
pub fn create_for_testing(l1_fee: Fee, contract_address: ContractAddress) -> Self {
let calldata = calldata![
Felt::from(0x123), // from_address.
Expand Down
3 changes: 2 additions & 1 deletion crates/gateway/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl Default for ChainInfoConfig {
ChainInfo::default().into()
}
}

#[cfg(any(test, feature = "testing"))]
impl ChainInfoConfig {
pub fn create_for_testing() -> Self {
BlockContext::create_for_testing().chain_info().clone().into()
Expand Down Expand Up @@ -285,6 +285,7 @@ impl SerializeConfig for StatefulTransactionValidatorConfig {
}
}

#[cfg(any(test, feature = "testing"))]
impl StatefulTransactionValidatorConfig {
pub fn create_for_testing() -> Self {
StatefulTransactionValidatorConfig {
Expand Down

0 comments on commit 2f47bed

Please sign in to comment.