Skip to content

Commit

Permalink
Reuse execute_tx_configurable_with_state
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Jul 11, 2024
1 parent 719b717 commit fe179cd
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions rpc-state-reader/src/blockifier_state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ pub fn execute_tx_configurable(
state: &mut CachedState<RpcStateReader>,
tx_hash: &str,
block_number: BlockNumber,
_skip_validate: bool,
_skip_nonce_check: bool,
skip_validate: bool,
skip_nonce_check: bool,
) -> TransactionExecutionResult<(
TransactionExecutionInfo,
TransactionTrace,
Expand All @@ -376,9 +376,29 @@ pub fn execute_tx_configurable(
let tx_hash =
TransactionHash(StarkFelt::try_from(tx_hash.strip_prefix("0x").unwrap()).unwrap());
let tx = state.state.0.get_transaction(&tx_hash).unwrap();
let block_context = fetch_block_context(&state.state.0, block_number);
let blockifier_exec_info = execute_tx_with_blockifier(state, block_context, tx, tx_hash)?;
let gas_price = state.state.0.get_gas_price(block_number.0).unwrap();
let RpcBlockInfo {
block_timestamp,
sequencer_address,
..
} = state.state.0.get_block_info().unwrap();

let block_info = BlockInfo {
block_number,
block_timestamp,
sequencer_address,
// TODO: Check gas_prices and use_kzg_da
gas_prices: gas_price,
use_kzg_da: false,
};
let blockifier_exec_info = execute_tx_configurable_with_state(
&tx_hash,
tx,
block_info,
skip_validate,
skip_nonce_check,
state,
)?;
let trace = state.state.0.get_transaction_trace(&tx_hash).unwrap();
let receipt = state.state.0.get_transaction_receipt(&tx_hash).unwrap();
Ok((blockifier_exec_info, trace, receipt))
Expand Down

0 comments on commit fe179cd

Please sign in to comment.