Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Jul 11, 2024
1 parent 495f92f commit 03ea721
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions rpc-state-reader/src/blockifier_state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,89 +279,6 @@ fn calculate_class_info_for_testing(contract_class: ContractClass) -> ClassInfo
ClassInfo::new(&contract_class, sierra_program_length, 100).unwrap()
}

pub fn execute_tx_configurable_with_state(
tx_hash: &TransactionHash,
tx: SNTransaction,
block_info: BlockInfo,
_skip_validate: bool,
_skip_nonce_check: bool,
state: &mut CachedState<RpcStateReader>,
) -> TransactionExecutionResult<TransactionExecutionInfo> {
// let _fee_token_address = FeeTokenAddresses {
// strk_fee_token_address: ContractAddress::default(),
// eth_fee_token_address: ContractAddress(starknet_api::patricia_key!(
// "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
// )),
// };

// Get values for block context before giving ownership of the reader
let chain_id = state.state.0.get_chain_name();

let chain_info = ChainInfo {
chain_id,
fee_token_addresses: FeeTokenAddresses::default(),
};

let block_context = BlockContext::new_unchecked(
&block_info,
&chain_info,
&VersionedConstants::latest_constants_with_overrides(u32::MAX, usize::MAX),
);

// Get transaction before giving ownership of the reader
let blockifier_tx: AccountTransaction = match tx {
SNTransaction::Invoke(tx) => {
let invoke = InvokeTransaction {
tx,
tx_hash: *tx_hash,
only_query: false,
};
AccountTransaction::Invoke(invoke)
}
SNTransaction::DeployAccount(tx) => {
let contract_address = calculate_contract_address(
tx.contract_address_salt(),
tx.class_hash(),
&tx.constructor_calldata(),
ContractAddress::default(),
)
.unwrap();
AccountTransaction::DeployAccount(DeployAccountTransaction {
only_query: false,
tx,
tx_hash: *tx_hash,
contract_address,
})
}
SNTransaction::Declare(tx) => {
let contract_class = state
.state
.get_compiled_contract_class(tx.class_hash())
.unwrap();

let class_info = calculate_class_info_for_testing(contract_class);

let declare = DeclareTransaction::new(tx, *tx_hash, class_info).unwrap();
AccountTransaction::Declare(declare)
}
SNTransaction::L1Handler(tx) => {
// As L1Hanlder is not an account transaction we execute it here and return the result
let blockifier_tx = L1HandlerTransaction {
tx,
tx_hash: *tx_hash,
paid_fee_on_l1: starknet_api::transaction::Fee(u128::MAX),
};
return blockifier_tx.execute(state, &block_context, true, true);
}
_ => unimplemented!(),
};

#[cfg(not(feature = "cairo-native"))]
let blockifier_execution = blockifier_tx.execute(state, &block_context, false, true);

blockifier_execution
}

pub fn execute_tx_configurable(
state: &mut CachedState<RpcStateReader>,
tx_hash: &str,
Expand Down

0 comments on commit 03ea721

Please sign in to comment.