From 0019b5c568ed310942541345d680aa7d99994e0f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 12 Nov 2024 13:20:03 +0100 Subject: [PATCH] chore: add is dynamic fee --- Cargo.toml | 20 ++++++++++---------- crates/consensus/src/transaction/deposit.rs | 4 ++++ crates/consensus/src/transaction/envelope.rs | 10 ++++++++++ crates/consensus/src/transaction/typed.rs | 10 ++++++++++ crates/rpc-types/src/transaction.rs | 4 ++++ 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fbdba5be..d4119e0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,16 +46,16 @@ op-alloy-rpc-jsonrpsee = { version = "0.6.3", path = "crates/rpc-jsonrpsee", def op-alloy-rpc-types-engine = { version = "0.6.3", path = "crates/rpc-types-engine", default-features = false } # Alloy -alloy-eips = { version = "0.6.2", default-features = false } -alloy-serde = { version = "0.6.2", default-features = false } -alloy-signer = { version = "0.6.2", default-features = false } -alloy-network = { version = "0.6.2", default-features = false } -alloy-provider = { version = "0.6.2", default-features = false } -alloy-transport = { version = "0.6.2", default-features = false } -alloy-consensus = { version = "0.6.2", default-features = false } -alloy-rpc-types-eth = { version = "0.6.2", default-features = false } -alloy-rpc-types-engine = { version = "0.6.2", default-features = false } -alloy-network-primitives = { version = "0.6.2", default-features = false } +alloy-eips = { version = "0.6.3", default-features = false } +alloy-serde = { version = "0.6.3", default-features = false } +alloy-signer = { version = "0.6.3", default-features = false } +alloy-network = { version = "0.6.3", default-features = false } +alloy-provider = { version = "0.6.3", default-features = false } +alloy-transport = { version = "0.6.3", default-features = false } +alloy-consensus = { version = "0.6.3", default-features = false } +alloy-rpc-types-eth = { version = "0.6.3", default-features = false } +alloy-rpc-types-engine = { version = "0.6.3", default-features = false } +alloy-network-primitives = { version = "0.6.3", default-features = false } # Alloy RLP alloy-rlp = { version = "0.3", default-features = false } diff --git a/crates/consensus/src/transaction/deposit.rs b/crates/consensus/src/transaction/deposit.rs index 646216a3..3a245eb3 100644 --- a/crates/consensus/src/transaction/deposit.rs +++ b/crates/consensus/src/transaction/deposit.rs @@ -254,6 +254,10 @@ impl Transaction for TxDeposit { 0 } + fn is_dynamic_fee(&self) -> bool { + false + } + fn kind(&self) -> TxKind { self.to } diff --git a/crates/consensus/src/transaction/envelope.rs b/crates/consensus/src/transaction/envelope.rs index d21577ed..ef738551 100644 --- a/crates/consensus/src/transaction/envelope.rs +++ b/crates/consensus/src/transaction/envelope.rs @@ -300,6 +300,16 @@ impl Transaction for OpTxEnvelope { Self::Deposit(tx) => tx.authorization_list(), } } + + fn is_dynamic_fee(&self) -> bool { + match self { + Self::Legacy(tx) => tx.tx().is_dynamic_fee(), + Self::Eip2930(tx) => tx.tx().is_dynamic_fee(), + Self::Eip1559(tx) => tx.tx().is_dynamic_fee(), + Self::Eip7702(tx) => tx.tx().is_dynamic_fee(), + Self::Deposit(tx) => tx.is_dynamic_fee(), + } + } } impl OpTxEnvelope { diff --git a/crates/consensus/src/transaction/typed.rs b/crates/consensus/src/transaction/typed.rs index dfb6c52e..353f41b8 100644 --- a/crates/consensus/src/transaction/typed.rs +++ b/crates/consensus/src/transaction/typed.rs @@ -275,6 +275,16 @@ impl Transaction for OpTypedTransaction { Self::Deposit(tx) => tx.authorization_list(), } } + + fn is_dynamic_fee(&self) -> bool { + match self { + Self::Legacy(tx) => tx.is_dynamic_fee(), + Self::Eip2930(tx) => tx.is_dynamic_fee(), + Self::Eip1559(tx) => tx.is_dynamic_fee(), + Self::Eip7702(tx) => tx.is_dynamic_fee(), + Self::Deposit(tx) => tx.is_dynamic_fee(), + } + } } #[cfg(feature = "serde")] diff --git a/crates/rpc-types/src/transaction.rs b/crates/rpc-types/src/transaction.rs index f69b85c5..ef07cfc8 100644 --- a/crates/rpc-types/src/transaction.rs +++ b/crates/rpc-types/src/transaction.rs @@ -90,6 +90,10 @@ impl ConsensusTransaction for Transaction { fn authorization_list(&self) -> Option<&[SignedAuthorization]> { self.inner.authorization_list() } + + fn is_dynamic_fee(&self) -> bool { + self.inner.is_dynamic_fee() + } } impl alloy_network_primitives::TransactionResponse for Transaction {