diff --git a/crates/primitives/src/transaction/eip4844.rs b/crates/primitives/src/transaction/eip4844.rs index 73cb22bf3e12..84ee89fad7a8 100644 --- a/crates/primitives/src/transaction/eip4844.rs +++ b/crates/primitives/src/transaction/eip4844.rs @@ -139,14 +139,14 @@ impl TxEip4844 { // convert to KzgCommitment let commitment = KzgCommitment::from(*commitment.deref()); - // Calculate the versioned hash - // - // TODO: should this method distinguish the type of validation failure? For example - // whether a certain versioned hash does not match, or whether the blob proof - // validation failed? + // calculate & verify the versioned hash + // https://eips.ethereum.org/EIPS/eip-4844#execution-layer-validation let calculated_versioned_hash = kzg_to_versioned_hash(commitment); if *versioned_hash != calculated_versioned_hash { - return Err(BlobTransactionValidationError::InvalidProof) + return Err(BlobTransactionValidationError::WrongVersionedHash { + have: *versioned_hash, + expected: calculated_versioned_hash, + }) } } diff --git a/crates/primitives/src/transaction/sidecar.rs b/crates/primitives/src/transaction/sidecar.rs index ae56084a97bb..ec4c141485f0 100644 --- a/crates/primitives/src/transaction/sidecar.rs +++ b/crates/primitives/src/transaction/sidecar.rs @@ -11,7 +11,7 @@ use crate::{ kzg::{ self, Blob, Bytes48, KzgSettings, BYTES_PER_BLOB, BYTES_PER_COMMITMENT, BYTES_PER_PROOF, }, - Signature, Transaction, TransactionSigned, TxEip4844, TxHash, EIP4844_TX_TYPE_ID, + Signature, Transaction, TransactionSigned, TxEip4844, TxHash, B256, EIP4844_TX_TYPE_ID, }; use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header}; use bytes::BufMut; @@ -35,6 +35,14 @@ pub enum BlobTransactionValidationError { /// The inner transaction is not a blob transaction. #[error("unable to verify proof for non blob transaction: {0}")] NotBlobTransaction(u8), + /// The versioned hash is incorrect. + #[error("wrong versioned hash: have {have}, expected {expected}")] + WrongVersionedHash { + /// The versioned hash we got + have: B256, + /// The versioned hash we expected + expected: B256, + }, } /// A response to `GetPooledTransactions` that includes blob data, their commitments, and their diff --git a/crates/revm/src/eth_dao_fork.rs b/crates/revm/src/eth_dao_fork.rs index 8da91c35af35..66e772c4cf4e 100644 --- a/crates/revm/src/eth_dao_fork.rs +++ b/crates/revm/src/eth_dao_fork.rs @@ -1,4 +1,4 @@ -//! DAO FOrk related constants from [EIP-779](https://eips.ethereum.org/EIPS/eip-779). +//! DAO Fork related constants from [EIP-779](https://eips.ethereum.org/EIPS/eip-779). //! It happened on Ethereum block 1_920_000 use reth_primitives::{address, Address}; diff --git a/crates/transaction-pool/src/error.rs b/crates/transaction-pool/src/error.rs index 51e0cf22e52c..f4ebfbf9f581 100644 --- a/crates/transaction-pool/src/error.rs +++ b/crates/transaction-pool/src/error.rs @@ -143,10 +143,10 @@ pub enum Eip4844PoolTransactionError { /// Thrown if we're unable to find the blob for a transaction that was previously extracted #[error("blob sidecar not found for EIP4844 transaction")] MissingEip4844BlobSidecar, - /// Thrown if an EIP-4844 without any blobs arrives + /// Thrown if an EIP-4844 transaction without any blobs arrives #[error("blobless blob transaction")] NoEip4844Blobs, - /// Thrown if an EIP-4844 without any blobs arrives + /// Thrown if an EIP-4844 transaction without any blobs arrives #[error("too many blobs in transaction: have {have}, permitted {permitted}")] TooManyEip4844Blobs { /// Number of blobs the transaction has