Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/primitives-traits/src/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ mod op {
Self::Legacy(receipt) |
Self::Eip2930(receipt) |
Self::Eip1559(receipt) |
Self::Eip4844(receipt) |
Self::Eip7702(receipt) => receipt.size(),
Self::Deposit(receipt) => receipt.size(),
}
Expand All @@ -166,6 +167,7 @@ mod op {
Self::Legacy(tx) => tx.size(),
Self::Eip2930(tx) => tx.size(),
Self::Eip1559(tx) => tx.size(),
Self::Eip4844(tx) => tx.size(),
Self::Eip7702(tx) => tx.size(),
Self::Deposit(tx) => tx.size(),
}
Expand All @@ -178,6 +180,7 @@ mod op {
Self::Legacy(tx) => tx.size(),
Self::Eip2930(tx) => tx.size(),
Self::Eip1559(tx) => tx.size(),
Self::Eip4844(tx) => tx.size(),
Self::Eip7702(tx) => tx.size(),
}
}
Expand All @@ -189,6 +192,7 @@ mod op {
Self::Legacy(tx) => tx.size(),
Self::Eip2930(tx) => tx.size(),
Self::Eip1559(tx) => tx.size(),
Self::Eip4844(tx) => tx.size(),
Self::Eip7702(tx) => tx.size(),
Self::Deposit(tx) => tx.size(),
}
Expand Down
1 change: 1 addition & 0 deletions crates/storage/codecs/src/alloy/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl From<CompactOpReceipt<'_>> for OpReceipt {
OpTxType::Legacy => Self::Legacy(inner),
OpTxType::Eip2930 => Self::Eip2930(inner),
OpTxType::Eip1559 => Self::Eip1559(inner),
OpTxType::Eip4844 => Self::Eip4844(inner),
OpTxType::Eip7702 => Self::Eip7702(inner),
OpTxType::Deposit => {
Self::Deposit(OpDepositReceipt { inner, deposit_nonce, deposit_receipt_version })
Expand Down
20 changes: 19 additions & 1 deletion crates/storage/codecs/src/alloy/transaction/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use crate::{
Compact,
};
use alloy_consensus::{
constants::EIP7702_TX_TYPE_ID, Signed, TxEip1559, TxEip2930, TxEip7702, TxLegacy,
constants::{EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID},
Signed, TxEip1559, TxEip2930, TxEip4844, TxEip7702, TxLegacy,
};
use alloy_primitives::{Address, Bytes, Sealed, Signature, TxKind, B256, U256};
use bytes::BufMut;
Expand Down Expand Up @@ -93,6 +94,10 @@ impl crate::Compact for OpTxType {
Self::Legacy => COMPACT_IDENTIFIER_LEGACY,
Self::Eip2930 => COMPACT_IDENTIFIER_EIP2930,
Self::Eip1559 => COMPACT_IDENTIFIER_EIP1559,
Self::Eip4844 => {
buf.put_u8(EIP4844_TX_TYPE_ID);
COMPACT_EXTENDED_IDENTIFIER_FLAG
}
Self::Eip7702 => {
buf.put_u8(EIP7702_TX_TYPE_ID);
COMPACT_EXTENDED_IDENTIFIER_FLAG
Expand All @@ -117,6 +122,7 @@ impl crate::Compact for OpTxType {
COMPACT_EXTENDED_IDENTIFIER_FLAG => {
let extended_identifier = buf.get_u8();
match extended_identifier {
EIP4844_TX_TYPE_ID => Self::Eip4844,
EIP7702_TX_TYPE_ID => Self::Eip7702,
op_alloy_consensus::DEPOSIT_TX_TYPE_ID => Self::Deposit,
_ => panic!("Unsupported OpTxType identifier: {extended_identifier}"),
Expand All @@ -139,6 +145,7 @@ impl Compact for OpTypedTransaction {
Self::Legacy(tx) => tx.to_compact(out),
Self::Eip2930(tx) => tx.to_compact(out),
Self::Eip1559(tx) => tx.to_compact(out),
Self::Eip4844(tx) => tx.to_compact(out),
Self::Eip7702(tx) => tx.to_compact(out),
Self::Deposit(tx) => tx.to_compact(out),
};
Expand All @@ -160,6 +167,10 @@ impl Compact for OpTypedTransaction {
let (tx, buf) = Compact::from_compact(buf, buf.len());
(Self::Eip1559(tx), buf)
}
OpTxType::Eip4844 => {
let (tx, buf) = Compact::from_compact(buf, buf.len());
(Self::Eip4844(tx), buf)
}
OpTxType::Eip7702 => {
let (tx, buf) = Compact::from_compact(buf, buf.len());
(Self::Eip7702(tx), buf)
Expand All @@ -178,6 +189,7 @@ impl ToTxCompact for OpTxEnvelope {
Self::Legacy(tx) => tx.tx().to_compact(buf),
Self::Eip2930(tx) => tx.tx().to_compact(buf),
Self::Eip1559(tx) => tx.tx().to_compact(buf),
Self::Eip4844(tx) => tx.tx().to_compact(buf),
Self::Eip7702(tx) => tx.tx().to_compact(buf),
Self::Deposit(tx) => tx.to_compact(buf),
};
Expand All @@ -204,6 +216,11 @@ impl FromTxCompact for OpTxEnvelope {
let tx = Signed::new_unhashed(tx, signature);
(Self::Eip1559(tx), buf)
}
OpTxType::Eip4844 => {
let (tx, buf) = TxEip4844::from_compact(buf, buf.len());
let tx = Signed::new_unhashed(tx, signature);
(Self::Eip4844(tx), buf)
}
OpTxType::Eip7702 => {
let (tx, buf) = TxEip7702::from_compact(buf, buf.len());
let tx = Signed::new_unhashed(tx, signature);
Expand All @@ -226,6 +243,7 @@ impl Envelope for OpTxEnvelope {
Self::Legacy(tx) => tx.signature(),
Self::Eip2930(tx) => tx.signature(),
Self::Eip1559(tx) => tx.signature(),
Self::Eip4844(tx) => tx.signature(),
Self::Eip7702(tx) => tx.signature(),
Self::Deposit(_) => &DEPOSIT_SIGNATURE,
}
Expand Down