feat(op): Ecotone reject blob txs (#6480)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
This commit is contained in:
clabby
2024-02-07 21:51:07 -05:00
committed by GitHub
parent d05504f996
commit d08d72e5c3
5 changed files with 25 additions and 3 deletions

View File

@ -135,6 +135,9 @@ pub enum OptimismBlockExecutionError {
/// Thrown when force deploy of create2deployer code fails.
#[error("failed to force create2deployer account code")]
ForceCreate2DeployerFail,
/// Thrown when a blob transaction is included in a sequencer's block.
#[error("blob transaction included in sequencer block")]
BlobTransactionRejected,
}
impl BlockExecutionError {

View File

@ -17,4 +17,7 @@ pub enum OptimismPayloadBuilderError {
/// Thrown when force deploy of create2deployer code fails.
#[error("failed to force create2deployer account code")]
ForceCreate2DeployerFail,
/// Thrown when a blob transaction is included in a sequencer's block.
#[error("blob transaction included in sequencer block")]
BlobTransactionRejected,
}

View File

@ -23,7 +23,7 @@ mod builder {
constants::{BEACON_NONCE, EMPTY_RECEIPTS, EMPTY_TRANSACTIONS},
proofs,
revm::env::tx_env_with_recovered,
Block, Hardfork, Header, IntoRecoveredTransaction, Receipt, Receipts,
Block, Hardfork, Header, IntoRecoveredTransaction, Receipt, Receipts, TxType,
EMPTY_OMMER_ROOT_HASH, U256,
};
use reth_provider::{BundleStateWithReceipts, StateProviderFactory};
@ -269,6 +269,13 @@ mod builder {
return Ok(BuildOutcome::Cancelled)
}
// A sequencer's block should never contain blob transactions.
if matches!(sequencer_tx.tx_type(), TxType::EIP4844) {
return Err(PayloadBuilderError::other(
OptimismPayloadBuilderError::BlobTransactionRejected,
))
}
// Convert the transaction to a [TransactionSignedEcRecovered]. This is
// purely for the purposes of utilizing the [tx_env_with_recovered] function.
// Deposit transactions do not have signatures, so if the tx is a deposit, this

View File

@ -3,7 +3,9 @@ use reth_interfaces::executor::{
BlockExecutionError, BlockValidationError, OptimismBlockExecutionError,
};
use reth_node_api::ConfigureEvmEnv;
use reth_primitives::{revm_primitives::ResultAndState, BlockWithSenders, Hardfork, Receipt, U256};
use reth_primitives::{
revm_primitives::ResultAndState, BlockWithSenders, Hardfork, Receipt, TxType, U256,
};
use reth_provider::{BlockExecutor, BlockExecutorStats, BundleStateWithReceipts};
use revm::DatabaseCommit;
use std::time::Instant;
@ -95,6 +97,13 @@ where
.into())
}
// An optimism block should never contain blob transactions.
if matches!(transaction.tx_type(), TxType::EIP4844) {
return Err(BlockExecutionError::OptimismBlockExecution(
OptimismBlockExecutionError::BlobTransactionRejected,
))
}
// Cache the depositor account prior to the state transition for the deposit nonce.
//
// Note that this *only* needs to be done post-regolith hardfork, as deposit nonces

View File

@ -143,7 +143,7 @@ where
mut transaction: Tx,
) -> TransactionValidationOutcome<Tx> {
#[cfg(feature = "optimism")]
if transaction.is_deposit() {
if transaction.is_deposit() || transaction.is_eip4844() {
return TransactionValidationOutcome::Invalid(
transaction,
InvalidTransactionError::TxTypeNotSupported.into(),