diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 15a5a2308dfb..57cbdcc6d0d5 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -147,6 +147,9 @@ impl Decodable for ReceiptWithBloom { } else if receipt_type == 0x02 { buf.advance(1); Self::decode_receipt(buf, TxType::EIP1559) + } else if receipt_type == 0x03 { + buf.advance(1); + Self::decode_receipt(buf, TxType::EIP4844) } else { Err(reth_rlp::DecodeError::Custom("invalid receipt type")) } @@ -251,6 +254,9 @@ impl<'a> ReceiptWithBloomEncoder<'a> { TxType::EIP1559 => { out.put_u8(0x02); } + TxType::EIP4844 => { + out.put_u8(0x03); + } _ => unreachable!("legacy handled; qed."), } out.put_slice(payload.as_ref()); @@ -270,7 +276,7 @@ impl<'a> Encodable for ReceiptWithBloomEncoder<'a> { fn length(&self) -> usize { let mut payload_len = self.receipt_length(); // account for eip-2718 type prefix and set the list - if matches!(self.receipt.tx_type, TxType::EIP1559 | TxType::EIP2930) { + if matches!(self.receipt.tx_type, TxType::EIP1559 | TxType::EIP2930 | TxType::EIP4844) { payload_len += 1; // we include a string header for typed receipts, so include the length here payload_len += length_of_length(payload_len); diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index c0a6b71a0e80..64788e46568c 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -27,6 +27,8 @@ pub enum TxType { EIP2930 = 1_isize, /// Transaction with Priority fee EIP1559 = 2_isize, + /// Shard Blob Transactions - EIP-4844 + EIP4844 = 3_isize, } impl From for u8 { @@ -35,6 +37,7 @@ impl From for u8 { TxType::Legacy => LEGACY_TX_TYPE_ID, TxType::EIP2930 => EIP2930_TX_TYPE_ID, TxType::EIP1559 => EIP1559_TX_TYPE_ID, + TxType::EIP4844 => EIP4844_TX_TYPE_ID, } } } @@ -54,6 +57,7 @@ impl Compact for TxType { TxType::Legacy => 0, TxType::EIP2930 => 1, TxType::EIP1559 => 2, + TxType::EIP4844 => 3, } } @@ -62,7 +66,8 @@ impl Compact for TxType { match identifier { 0 => TxType::Legacy, 1 => TxType::EIP2930, - _ => TxType::EIP1559, + 2 => TxType::EIP1559, + _ => TxType::EIP4844, }, buf, ) diff --git a/crates/rpc/rpc-types/src/eth/transaction/mod.rs b/crates/rpc/rpc-types/src/eth/transaction/mod.rs index 24005376c82f..cb920df7cf0a 100644 --- a/crates/rpc/rpc-types/src/eth/transaction/mod.rs +++ b/crates/rpc/rpc-types/src/eth/transaction/mod.rs @@ -112,7 +112,7 @@ impl Transaction { let (gas_price, max_fee_per_gas) = match signed_tx.tx_type() { TxType::Legacy => (Some(U128::from(signed_tx.max_fee_per_gas())), None), TxType::EIP2930 => (Some(U128::from(signed_tx.max_fee_per_gas())), None), - TxType::EIP1559 => { + TxType::EIP1559 | TxType::EIP4844 => { // the gas price field for EIP1559 is set to `min(tip, gasFeeCap - baseFee) + // baseFee` let gas_price = base_fee