Executes the transaction through the EVM and builds the result from scratch.
(
&mut self,
transaction: Recovered<BaseTxEnvelope>,
idx: usize,
effective_gas_price: u128,
)
| 287 | |
| 288 | /// Executes the transaction through the EVM and builds the result from scratch. |
| 289 | fn execute_with_evm( |
| 290 | &mut self, |
| 291 | transaction: Recovered<BaseTxEnvelope>, |
| 292 | idx: usize, |
| 293 | effective_gas_price: u128, |
| 294 | ) -> Result<ExecutedPendingTransaction, StateProcessorError> { |
| 295 | let tx_hash = transaction.tx_hash(); |
| 296 | |
| 297 | let is_deposit = transaction.is_deposit(); |
| 298 | |
| 299 | let da_footprint_used = if self |
| 300 | .chain_spec |
| 301 | .is_jovian_active_at_timestamp(self.evm.block().timestamp().saturating_to()) |
| 302 | && !is_deposit |
| 303 | { |
| 304 | self.jovian_da_footprint_estimation(&transaction)? |
| 305 | } else { |
| 306 | 0 |
| 307 | }; |
| 308 | |
| 309 | let start = Instant::now(); |
| 310 | let transact_result = self.evm.transact(&transaction); |
| 311 | let elapsed_us = start.elapsed().as_micros(); |
| 312 | |
| 313 | match transact_result { |
| 314 | Ok(ResultAndState { state, result }) => { |
| 315 | let gas_used = result.tx_gas_used(); |
| 316 | for (addr, acc) in &state { |
| 317 | let existing_override = self.state_overrides.entry(*addr).or_default(); |
| 318 | existing_override.balance = Some(acc.info.balance); |
| 319 | existing_override.nonce = Some(acc.info.nonce); |
| 320 | existing_override.code = acc.info.code.clone().map(|code| code.bytes()); |
| 321 | |
| 322 | let existing = |
| 323 | existing_override.state_diff.get_or_insert_with(Default::default); |
| 324 | let changed_slots = acc |
| 325 | .storage |
| 326 | .iter() |
| 327 | .map(|(&key, slot)| (B256::from(key), B256::from(slot.present_value))); |
| 328 | |
| 329 | existing.extend(changed_slots); |
| 330 | } |
| 331 | |
| 332 | self.cumulative_gas_used = self |
| 333 | .cumulative_gas_used |
| 334 | .checked_add(gas_used) |
| 335 | .ok_or(ExecutionError::GasOverflow)?; |
| 336 | |
| 337 | // Build receipt using the unified receipt builder - handles both |
| 338 | // deposit and non-deposit transactions seamlessly |
| 339 | let receipt = self.receipt_builder.build( |
| 340 | &mut self.evm, |
| 341 | &transaction, |
| 342 | &result, |
| 343 | self.cumulative_gas_used, |
| 344 | self.pending_block.timestamp, |
| 345 | )?; |
| 346 |
no test coverage detected