|
1 | | -use alloy_consensus::{Transaction, TxEip1559}; |
| 1 | +use alloy_consensus::TxEip1559; |
2 | 2 | use alloy_eips::{Encodable2718, eip7623::TOTAL_COST_FLOOR_PER_TOKEN}; |
3 | 3 | use alloy_evm::Database; |
4 | 4 | use alloy_op_evm::OpEvm; |
@@ -387,84 +387,6 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def |
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | | - |
391 | | - fn sign_tx( |
392 | | - &self, |
393 | | - to: Address, |
394 | | - from: Signer, |
395 | | - gas_used: Option<u64>, |
396 | | - calldata: Bytes, |
397 | | - ctx: &OpPayloadBuilderCtx<ExtraCtx>, |
398 | | - db: &mut State<impl Database>, |
399 | | - ) -> Result<Recovered<OpTransactionSigned>, BuilderTransactionError> { |
400 | | - let nonce = get_nonce(db, from.address)?; |
401 | | - // Create the EIP-1559 transaction |
402 | | - let tx = OpTypedTransaction::Eip1559(TxEip1559 { |
403 | | - chain_id: ctx.chain_id(), |
404 | | - nonce, |
405 | | - // Due to EIP-150, 63/64 of available gas is forwarded to external calls so need to add a buffer |
406 | | - gas_limit: gas_used |
407 | | - .map(|gas| gas * 64 / 63) |
408 | | - .unwrap_or(ctx.block_gas_limit()), |
409 | | - max_fee_per_gas: ctx.base_fee().into(), |
410 | | - to: TxKind::Call(to), |
411 | | - input: calldata, |
412 | | - ..Default::default() |
413 | | - }); |
414 | | - Ok(from.sign_tx(tx)?) |
415 | | - } |
416 | | - |
417 | | - fn simulate_call( |
418 | | - &self, |
419 | | - signed_tx: Recovered<OpTransactionSigned>, |
420 | | - expected_topic: Option<B256>, |
421 | | - revert_handler: impl FnOnce(Bytes) -> BuilderTransactionError, |
422 | | - evm: &mut OpEvm< |
423 | | - &mut State<StateProviderDatabase<impl StateProvider>>, |
424 | | - NoOpInspector, |
425 | | - PrecompilesMap, |
426 | | - >, |
427 | | - ) -> Result<SimulationSuccessResult, BuilderTransactionError> { |
428 | | - let ResultAndState { result, state } = match evm.transact(&signed_tx) { |
429 | | - Ok(res) => res, |
430 | | - Err(err) => { |
431 | | - if err.is_invalid_tx_err() { |
432 | | - return Err(BuilderTransactionError::InvalidTransactionError(Box::new( |
433 | | - err, |
434 | | - ))); |
435 | | - } else { |
436 | | - return Err(BuilderTransactionError::EvmExecutionError(Box::new(err))); |
437 | | - } |
438 | | - } |
439 | | - }; |
440 | | - |
441 | | - match result { |
442 | | - ExecutionResult::Success { |
443 | | - logs, |
444 | | - gas_used, |
445 | | - output, |
446 | | - .. |
447 | | - } => { |
448 | | - if let Some(topic) = expected_topic |
449 | | - && !logs.iter().any(|log| log.topics().first() == Some(&topic)) |
450 | | - { |
451 | | - return Err(BuilderTransactionError::InvalidContract( |
452 | | - signed_tx.to().unwrap_or_default(), |
453 | | - InvalidContractDataError::InvalidLogs(topic), |
454 | | - )); |
455 | | - } |
456 | | - Ok(SimulationSuccessResult { |
457 | | - gas_used, |
458 | | - output: output.into_data(), |
459 | | - state_changes: state, |
460 | | - }) |
461 | | - } |
462 | | - ExecutionResult::Revert { output, .. } => Err(revert_handler(output)), |
463 | | - ExecutionResult::Halt { reason, .. } => Err(BuilderTransactionError::other( |
464 | | - BuilderTransactionError::TransactionHalted(reason), |
465 | | - )), |
466 | | - } |
467 | | - } |
468 | 390 | } |
469 | 391 |
|
470 | 392 | #[derive(Debug, Clone)] |
|
0 commit comments