From e4ba4676acc35f1f1e0f8a05c4819612b608c644 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Mon, 22 Jan 2024 11:38:51 +0100 Subject: [PATCH 1/2] add has_access_list method to TxType --- crates/primitives/src/transaction/tx_type.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index 8154fe8b1e4f..d26eb3252300 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -44,6 +44,18 @@ pub enum TxType { DEPOSIT = 126_isize, } +impl TxType { + /// Check if the transaction type has an access list. + pub fn has_access_list(&self) -> bool { + match self { + TxType::Legacy => false, + TxType::EIP2930 | TxType::EIP1559 | TxType::EIP4844 => true, + #[cfg(feature = "optimism")] + TxType::DEPOSIT => false, + } + } +} + impl From for u8 { fn from(value: TxType) -> Self { match value { From cdc1a9c4d1550fce6ddc1ca0fb0a50ead18e4da1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 22 Jan 2024 13:19:46 +0100 Subject: [PATCH 2/2] Update crates/primitives/src/transaction/tx_type.rs --- crates/primitives/src/transaction/tx_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index d26eb3252300..579853a00871 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -46,7 +46,7 @@ pub enum TxType { impl TxType { /// Check if the transaction type has an access list. - pub fn has_access_list(&self) -> bool { + pub const fn has_access_list(&self) -> bool { match self { TxType::Legacy => false, TxType::EIP2930 | TxType::EIP1559 | TxType::EIP4844 => true,