From fe179cd49efe07a1c195410a892187c9570aca03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Thu, 11 Jul 2024 14:30:10 -0300 Subject: [PATCH] Reuse execute_tx_configurable_with_state --- .../src/blockifier_state_reader.rs | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/rpc-state-reader/src/blockifier_state_reader.rs b/rpc-state-reader/src/blockifier_state_reader.rs index c88b4b5..1896688 100644 --- a/rpc-state-reader/src/blockifier_state_reader.rs +++ b/rpc-state-reader/src/blockifier_state_reader.rs @@ -366,8 +366,8 @@ pub fn execute_tx_configurable( state: &mut CachedState, tx_hash: &str, block_number: BlockNumber, - _skip_validate: bool, - _skip_nonce_check: bool, + skip_validate: bool, + skip_nonce_check: bool, ) -> TransactionExecutionResult<( TransactionExecutionInfo, TransactionTrace, @@ -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))