From e02b935e94cf00f504a4502e3ffda805c1f24161 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:42:25 +0200 Subject: [PATCH] add `match_same_arms` clippy lint (#8549) --- Cargo.toml | 1 + bin/reth/src/commands/db/diff.rs | 3 +- crates/blockchain-tree-api/src/error.rs | 5 +- crates/ethereum-forks/src/hardfork.rs | 376 +++++++++--------- crates/evm/execution-errors/src/trie.rs | 2 +- crates/net/discv4/src/test_utils.rs | 3 +- crates/net/discv5/src/lib.rs | 1 + .../src/headers/reverse_headers.rs | 30 +- crates/net/eth-wire-types/src/status.rs | 3 +- crates/net/eth-wire/src/capability.rs | 3 +- crates/net/eth-wire/src/errors/p2p.rs | 2 +- crates/net/eth-wire/src/p2pstream.rs | 3 +- crates/net/eth-wire/src/test_utils.rs | 3 +- crates/net/network/src/discovery.rs | 5 +- crates/net/network/src/fetch/mod.rs | 5 +- crates/net/network/src/state.rs | 8 +- .../network/src/transactions/validation.rs | 2 +- crates/net/network/tests/it/connect.rs | 5 +- crates/net/network/tests/it/multiplex.rs | 7 +- crates/net/p2p/src/error.rs | 8 +- crates/primitives/src/chain/spec.rs | 4 +- crates/primitives/src/transaction/sidecar.rs | 6 +- crates/rpc/ipc/src/server/mod.rs | 7 +- .../rpc-types-compat/src/transaction/mod.rs | 3 +- crates/rpc/rpc/src/eth/error.rs | 19 +- crates/rpc/rpc/src/eth/filter.rs | 8 +- crates/static-file-types/src/segment.rs | 7 +- .../codecs/derive/src/compact/enums.rs | 6 +- .../codecs/derive/src/compact/structs.rs | 6 +- crates/storage/libmdbx-rs/src/error.rs | 4 +- crates/storage/provider/src/traits/chain.rs | 6 +- crates/transaction-pool/src/error.rs | 10 +- crates/transaction-pool/src/traits.rs | 2 +- testing/ef-tests/src/models.rs | 6 +- 34 files changed, 259 insertions(+), 310 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cca8753c6..3e0f74959 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -156,6 +156,7 @@ use_self = "warn" missing_const_for_fn = "warn" empty_line_after_doc_comments = "warn" iter_on_single_items = "warn" +match_same_arms = "warn" doc_markdown = "warn" unnecessary_struct_initialization = "warn" string_lit_as_bytes = "warn" diff --git a/bin/reth/src/commands/db/diff.rs b/bin/reth/src/commands/db/diff.rs index 162797d81..b9c10b755 100644 --- a/bin/reth/src/commands/db/diff.rs +++ b/bin/reth/src/commands/db/diff.rs @@ -340,8 +340,7 @@ impl ExtraTableElement { /// Return the key for the extra element const fn key(&self) -> &T::Key { match self { - Self::First { key, .. } => key, - Self::Second { key, .. } => key, + Self::First { key, .. } | Self::Second { key, .. } => key, } } } diff --git a/crates/blockchain-tree-api/src/error.rs b/crates/blockchain-tree-api/src/error.rs index b791d747c..8e0cef425 100644 --- a/crates/blockchain-tree-api/src/error.rs +++ b/crates/blockchain-tree-api/src/error.rs @@ -280,6 +280,7 @@ impl InsertBlockErrorKind { /// Returns true if the error is caused by an invalid block /// /// This is intended to be used to determine if the block should be marked as invalid. + #[allow(clippy::match_same_arms)] pub const fn is_invalid_block(&self) -> bool { match self { Self::SenderRecovery | Self::Consensus(_) => true, @@ -321,9 +322,9 @@ impl InsertBlockErrorKind { CanonicalError::BlockchainTree(_) | CanonicalError::CanonicalCommit(_) | CanonicalError::CanonicalRevert(_) | - CanonicalError::OptimisticTargetRevert(_) => false, - CanonicalError::Validation(_) => true, + CanonicalError::OptimisticTargetRevert(_) | CanonicalError::Provider(_) => false, + CanonicalError::Validation(_) => true, }, Self::BlockchainTree(_) => false, } diff --git a/crates/ethereum-forks/src/hardfork.rs b/crates/ethereum-forks/src/hardfork.rs index 6a7792727..2f61b40e1 100644 --- a/crates/ethereum-forks/src/hardfork.rs +++ b/crates/ethereum-forks/src/hardfork.rs @@ -133,8 +133,7 @@ impl Hardfork { Self::Tangerine => Some(2463000), Self::SpuriousDragon => Some(2675000), Self::Byzantium => Some(4370000), - Self::Constantinople => Some(7280000), - Self::Petersburg => Some(7280000), + Self::Constantinople | Self::Petersburg => Some(7280000), Self::Istanbul => Some(9069000), Self::MuirGlacier => Some(9200000), Self::Berlin => Some(12244000), @@ -156,19 +155,19 @@ impl Hardfork { Self::Paris => Some(1735371), Self::Shanghai => Some(2990908), Self::Cancun => Some(5187023), - Self::Frontier => Some(0), - Self::Homestead => Some(0), - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | Self::GrayGlacier => Some(0), _ => None, } @@ -178,20 +177,20 @@ impl Hardfork { pub const fn arbitrum_sepolia_activation_block(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(0), - Self::Homestead => Some(0), - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), - Self::GrayGlacier => Some(0), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(0), Self::Shanghai => Some(10653737), // Hardfork::ArbOS11 => Some(10653737), @@ -205,20 +204,20 @@ impl Hardfork { pub const fn arbitrum_activation_block(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(0), - Self::Homestead => Some(0), - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), - Self::GrayGlacier => Some(0), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(0), Self::Shanghai => Some(184097479), // Hardfork::ArbOS11 => Some(184097479), @@ -233,27 +232,25 @@ impl Hardfork { pub const fn base_sepolia_activation_block(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(0), - Self::Homestead => Some(0), - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), - Self::GrayGlacier => Some(0), - Self::Paris => Some(0), - Self::Bedrock => Some(0), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | + Self::Paris | + Self::Bedrock | Self::Regolith => Some(0), - Self::Shanghai => Some(2106456), - Self::Canyon => Some(2106456), - Self::Cancun => Some(6383256), - Self::Ecotone => Some(6383256), + Self::Shanghai | Self::Canyon => Some(2106456), + Self::Cancun | Self::Ecotone => Some(6383256), _ => None, } } @@ -263,27 +260,25 @@ impl Hardfork { pub const fn base_mainnet_activation_block(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(0), - Self::Homestead => Some(0), - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), - Self::GrayGlacier => Some(0), - Self::Paris => Some(0), - Self::Bedrock => Some(0), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | + Self::Paris | + Self::Bedrock | Self::Regolith => Some(0), - Self::Shanghai => Some(9101527), - Self::Canyon => Some(9101527), - Self::Cancun => Some(11188936), - Self::Ecotone => Some(11188936), + Self::Shanghai | Self::Canyon => Some(9101527), + Self::Cancun | Self::Ecotone => Some(11188936), _ => None, } } @@ -292,18 +287,18 @@ impl Hardfork { const fn holesky_activation_block(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Dao => Some(0), - Self::Tangerine => Some(0), - Self::SpuriousDragon => Some(0), - Self::Byzantium => Some(0), - Self::Constantinople => Some(0), - Self::Petersburg => Some(0), - Self::Istanbul => Some(0), - Self::MuirGlacier => Some(0), - Self::Berlin => Some(0), - Self::London => Some(0), - Self::ArrowGlacier => Some(0), - Self::GrayGlacier => Some(0), + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(0), Self::Shanghai => Some(6698), Self::Cancun => Some(894733), @@ -345,8 +340,7 @@ impl Hardfork { Self::Tangerine => Some(1476753571), Self::SpuriousDragon => Some(1479788144), Self::Byzantium => Some(1508131331), - Self::Constantinople => Some(1551340324), - Self::Petersburg => Some(1551340324), + Self::Constantinople | Self::Petersburg => Some(1551340324), Self::Istanbul => Some(1575807909), Self::MuirGlacier => Some(1577953849), Self::Berlin => Some(1618481223), @@ -366,20 +360,20 @@ impl Hardfork { pub const fn sepolia_activation_timestamp(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(1633267481), - Self::Homestead => Some(1633267481), - Self::Dao => Some(1633267481), - Self::Tangerine => Some(1633267481), - Self::SpuriousDragon => Some(1633267481), - Self::Byzantium => Some(1633267481), - Self::Constantinople => Some(1633267481), - Self::Petersburg => Some(1633267481), - Self::Istanbul => Some(1633267481), - Self::MuirGlacier => Some(1633267481), - Self::Berlin => Some(1633267481), - Self::London => Some(1633267481), - Self::ArrowGlacier => Some(1633267481), - Self::GrayGlacier => Some(1633267481), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(1633267481), Self::Shanghai => Some(1677557088), Self::Cancun => Some(1706655072), @@ -393,20 +387,20 @@ impl Hardfork { match self { Self::Shanghai => Some(1696000704), Self::Cancun => Some(1707305664), - Self::Frontier => Some(1695902100), - Self::Homestead => Some(1695902100), - Self::Dao => Some(1695902100), - Self::Tangerine => Some(1695902100), - Self::SpuriousDragon => Some(1695902100), - Self::Byzantium => Some(1695902100), - Self::Constantinople => Some(1695902100), - Self::Petersburg => Some(1695902100), - Self::Istanbul => Some(1695902100), - Self::MuirGlacier => Some(1695902100), - Self::Berlin => Some(1695902100), - Self::London => Some(1695902100), - Self::ArrowGlacier => Some(1695902100), - Self::GrayGlacier => Some(1695902100), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(1695902100), _ => None, } @@ -417,20 +411,20 @@ impl Hardfork { pub const fn arbitrum_sepolia_activation_timestamp(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(1692726996), - Self::Homestead => Some(1692726996), - Self::Dao => Some(1692726996), - Self::Tangerine => Some(1692726996), - Self::SpuriousDragon => Some(1692726996), - Self::Byzantium => Some(1692726996), - Self::Constantinople => Some(1692726996), - Self::Petersburg => Some(1692726996), - Self::Istanbul => Some(1692726996), - Self::MuirGlacier => Some(1692726996), - Self::Berlin => Some(1692726996), - Self::London => Some(1692726996), - Self::ArrowGlacier => Some(1692726996), - Self::GrayGlacier => Some(1692726996), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(1692726996), Self::Shanghai => Some(1706634000), // Hardfork::ArbOS11 => Some(1706634000), @@ -444,20 +438,20 @@ impl Hardfork { pub const fn arbitrum_activation_timestamp(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(1622240000), - Self::Homestead => Some(1622240000), - Self::Dao => Some(1622240000), - Self::Tangerine => Some(1622240000), - Self::SpuriousDragon => Some(1622240000), - Self::Byzantium => Some(1622240000), - Self::Constantinople => Some(1622240000), - Self::Petersburg => Some(1622240000), - Self::Istanbul => Some(1622240000), - Self::MuirGlacier => Some(1622240000), - Self::Berlin => Some(1622240000), - Self::London => Some(1622240000), - Self::ArrowGlacier => Some(1622240000), - Self::GrayGlacier => Some(1622240000), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | Self::Paris => Some(1622240000), Self::Shanghai => Some(1708804873), // Hardfork::ArbOS11 => Some(1708804873), @@ -472,27 +466,25 @@ impl Hardfork { pub const fn base_sepolia_activation_timestamp(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(1695768288), - Self::Homestead => Some(1695768288), - Self::Dao => Some(1695768288), - Self::Tangerine => Some(1695768288), - Self::SpuriousDragon => Some(1695768288), - Self::Byzantium => Some(1695768288), - Self::Constantinople => Some(1695768288), - Self::Petersburg => Some(1695768288), - Self::Istanbul => Some(1695768288), - Self::MuirGlacier => Some(1695768288), - Self::Berlin => Some(1695768288), - Self::London => Some(1695768288), - Self::ArrowGlacier => Some(1695768288), - Self::GrayGlacier => Some(1695768288), - Self::Paris => Some(1695768288), - Self::Bedrock => Some(1695768288), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | + Self::Paris | + Self::Bedrock | Self::Regolith => Some(1695768288), - Self::Shanghai => Some(1699981200), - Self::Canyon => Some(1699981200), - Self::Cancun => Some(1708534800), - Self::Ecotone => Some(1708534800), + Self::Shanghai | Self::Canyon => Some(1699981200), + Self::Cancun | Self::Ecotone => Some(1708534800), _ => None, } } @@ -502,27 +494,25 @@ impl Hardfork { pub const fn base_mainnet_activation_timestamp(&self) -> Option { #[allow(unreachable_patterns)] match self { - Self::Frontier => Some(1686789347), - Self::Homestead => Some(1686789347), - Self::Dao => Some(1686789347), - Self::Tangerine => Some(1686789347), - Self::SpuriousDragon => Some(1686789347), - Self::Byzantium => Some(1686789347), - Self::Constantinople => Some(1686789347), - Self::Petersburg => Some(1686789347), - Self::Istanbul => Some(1686789347), - Self::MuirGlacier => Some(1686789347), - Self::Berlin => Some(1686789347), - Self::London => Some(1686789347), - Self::ArrowGlacier => Some(1686789347), - Self::GrayGlacier => Some(1686789347), - Self::Paris => Some(1686789347), - Self::Bedrock => Some(1686789347), + Self::Frontier | + Self::Homestead | + Self::Dao | + Self::Tangerine | + Self::SpuriousDragon | + Self::Byzantium | + Self::Constantinople | + Self::Petersburg | + Self::Istanbul | + Self::MuirGlacier | + Self::Berlin | + Self::London | + Self::ArrowGlacier | + Self::GrayGlacier | + Self::Paris | + Self::Bedrock | Self::Regolith => Some(1686789347), - Self::Shanghai => Some(1704992401), - Self::Canyon => Some(1704992401), - Self::Cancun => Some(1710374401), - Self::Ecotone => Some(1710374401), + Self::Shanghai | Self::Canyon => Some(1704992401), + Self::Cancun | Self::Ecotone => Some(1710374401), _ => None, } } diff --git a/crates/evm/execution-errors/src/trie.rs b/crates/evm/execution-errors/src/trie.rs index 146f72f48..ee511611b 100644 --- a/crates/evm/execution-errors/src/trie.rs +++ b/crates/evm/execution-errors/src/trie.rs @@ -17,7 +17,7 @@ pub enum StateRootError { impl From for DatabaseError { fn from(err: StateRootError) -> Self { match err { - StateRootError::DB(err) => err, + StateRootError::DB(err) | StateRootError::StorageRootError(StorageRootError::DB(err)) => err, } } diff --git a/crates/net/discv4/src/test_utils.rs b/crates/net/discv4/src/test_utils.rs index 412488ace..71c4a543b 100644 --- a/crates/net/discv4/src/test_utils.rs +++ b/crates/net/discv4/src/test_utils.rs @@ -167,7 +167,7 @@ impl Stream for MockDiscovery { })) } } - Message::Pong(_) => {} + Message::Pong(_) | Message::Neighbours(_) => {} Message::FindNode(msg) => { if let Some(nodes) = this.pending_neighbours.remove(&msg.id) { let msg = Message::Neighbours(Neighbours { @@ -181,7 +181,6 @@ impl Stream for MockDiscovery { })) } } - Message::Neighbours(_) => {} Message::EnrRequest(_) | Message::EnrResponse(_) => todo!(), }, } diff --git a/crates/net/discv5/src/lib.rs b/crates/net/discv5/src/lib.rs index de5c07427..4effa1f79 100644 --- a/crates/net/discv5/src/lib.rs +++ b/crates/net/discv5/src/lib.rs @@ -222,6 +222,7 @@ impl Discv5 { /// Process an event from the underlying [`discv5::Discv5`] node. pub fn on_discv5_update(&self, update: discv5::Event) -> Option { + #[allow(clippy::match_same_arms)] match update { discv5::Event::SocketUpdated(_) | discv5::Event::TalkRequest(_) | // `Discovered` not unique discovered peers diff --git a/crates/net/downloaders/src/headers/reverse_headers.rs b/crates/net/downloaders/src/headers/reverse_headers.rs index 591d1ae6a..9980f1ba7 100644 --- a/crates/net/downloaders/src/headers/reverse_headers.rs +++ b/crates/net/downloaders/src/headers/reverse_headers.rs @@ -378,7 +378,7 @@ where let target = headers.remove(0).seal_slow(); match sync_target { - SyncTargetBlock::Hash(hash) => { + SyncTargetBlock::Hash(hash) | SyncTargetBlock::HashAndNumber { hash, .. } => { if target.hash() != hash { return Err(HeadersResponseError { request, @@ -403,18 +403,6 @@ where .into()) } } - SyncTargetBlock::HashAndNumber { hash, .. } => { - if target.hash() != hash { - return Err(HeadersResponseError { - request, - peer_id: Some(peer_id), - error: DownloadError::InvalidTip( - GotExpected { got: target.hash(), expected: hash }.into(), - ), - } - .into()) - } - } } trace!(target: "downloaders::headers", head=?self.local_block_number(), hash=?target.hash(), number=%target.number, "Received sync target"); @@ -1014,17 +1002,19 @@ impl SyncTargetBlock { const fn with_hash(self, hash: B256) -> Self { match self { Self::Hash(_) => Self::Hash(hash), - Self::Number(number) => Self::HashAndNumber { hash, number }, - Self::HashAndNumber { number, .. } => Self::HashAndNumber { hash, number }, + Self::Number(number) | Self::HashAndNumber { number, .. } => { + Self::HashAndNumber { hash, number } + } } } /// Set a number on the instance. const fn with_number(self, number: u64) -> Self { match self { - Self::Hash(hash) => Self::HashAndNumber { hash, number }, + Self::Hash(hash) | Self::HashAndNumber { hash, .. } => { + Self::HashAndNumber { hash, number } + } Self::Number(_) => Self::Number(number), - Self::HashAndNumber { hash, .. } => Self::HashAndNumber { hash, number }, } } @@ -1054,9 +1044,8 @@ impl SyncTargetBlock { /// Return the hash of the target block, if it is set. const fn hash(&self) -> Option { match self { - Self::Hash(hash) => Some(*hash), + Self::Hash(hash) | Self::HashAndNumber { hash, .. } => Some(*hash), Self::Number(_) => None, - Self::HashAndNumber { hash, .. } => Some(*hash), } } @@ -1064,8 +1053,7 @@ impl SyncTargetBlock { const fn number(&self) -> Option { match self { Self::Hash(_) => None, - Self::Number(number) => Some(*number), - Self::HashAndNumber { number, .. } => Some(*number), + Self::Number(number) | Self::HashAndNumber { number, .. } => Some(*number), } } } diff --git a/crates/net/eth-wire-types/src/status.rs b/crates/net/eth-wire-types/src/status.rs index 93a2371c8..904df65c6 100644 --- a/crates/net/eth-wire-types/src/status.rs +++ b/crates/net/eth-wire-types/src/status.rs @@ -389,8 +389,7 @@ mod tests { let mut forkhash = ForkHash::from(genesis_hash); for (_, condition) in hardforks { forkhash += match condition { - ForkCondition::Block(n) => n, - ForkCondition::Timestamp(n) => n, + ForkCondition::Block(n) | ForkCondition::Timestamp(n) => n, _ => unreachable!("only block and timestamp forks are used in this test"), } } diff --git a/crates/net/eth-wire/src/capability.rs b/crates/net/eth-wire/src/capability.rs index 752e80709..2bf096287 100644 --- a/crates/net/eth-wire/src/capability.rs +++ b/crates/net/eth-wire/src/capability.rs @@ -331,8 +331,7 @@ impl SharedCapability { /// message id space. pub const fn message_id_offset(&self) -> u8 { match self { - Self::Eth { offset, .. } => *offset, - Self::UnknownCapability { offset, .. } => *offset, + Self::Eth { offset, .. } | Self::UnknownCapability { offset, .. } => *offset, } } diff --git a/crates/net/eth-wire/src/errors/p2p.rs b/crates/net/eth-wire/src/errors/p2p.rs index 6b11f497c..a64385fe2 100644 --- a/crates/net/eth-wire/src/errors/p2p.rs +++ b/crates/net/eth-wire/src/errors/p2p.rs @@ -86,7 +86,7 @@ impl P2PStreamError { /// Returns the [`DisconnectReason`] if it is the `Disconnected` variant. pub const fn as_disconnected(&self) -> Option { let reason = match self { - Self::HandshakeError(P2PHandshakeError::Disconnected(reason)) => reason, + Self::HandshakeError(P2PHandshakeError::Disconnected(reason)) | Self::Disconnected(reason) => reason, _ => return None, }; diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index 3fdb68c5e..0bc86dd3b 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -703,8 +703,7 @@ impl Encodable for P2PMessage { Self::Hello(msg) => msg.length(), Self::Disconnect(msg) => msg.length(), // id + snappy encoded payload - Self::Ping => 3, // len([0x01, 0x00, 0xc0]) = 3 - Self::Pong => 3, // len([0x01, 0x00, 0xc0]) = 3 + Self::Ping | Self::Pong => 3, // len([0x01, 0x00, 0xc0]) = 3 }; payload_len + 1 // (1 for length of p2p message id) } diff --git a/crates/net/eth-wire/src/test_utils.rs b/crates/net/eth-wire/src/test_utils.rs index 19d893d0b..4376bc358 100644 --- a/crates/net/eth-wire/src/test_utils.rs +++ b/crates/net/eth-wire/src/test_utils.rs @@ -125,8 +125,7 @@ pub mod proto { let mut buf = BytesMut::new(); buf.put_u8(self.message_type as u8); match &self.message { - TestProtoMessageKind::Ping => {} - TestProtoMessageKind::Pong => {} + TestProtoMessageKind::Ping | TestProtoMessageKind::Pong => {} TestProtoMessageKind::Message(msg) => { buf.put(msg.as_bytes()); } diff --git a/crates/net/network/src/discovery.rs b/crates/net/network/src/discovery.rs index a0e5de8e9..c5af0a556 100644 --- a/crates/net/network/src/discovery.rs +++ b/crates/net/network/src/discovery.rs @@ -215,7 +215,7 @@ impl Discovery { fn on_discv4_update(&mut self, update: DiscoveryUpdate) { match update { - DiscoveryUpdate::Added(record) => { + DiscoveryUpdate::Added(record) | DiscoveryUpdate::DiscoveredAtCapacity(record) => { self.on_node_record_update(record, None); } DiscoveryUpdate::EnrForkId(node, fork_id) => { @@ -229,9 +229,6 @@ impl Discovery { self.on_discv4_update(update); } } - DiscoveryUpdate::DiscoveredAtCapacity(record) => { - self.on_node_record_update(record, None); - } } } diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index d0dfcab59..949cd2b1a 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -431,8 +431,9 @@ impl DownloadRequest { /// Returns the requested priority of this request const fn get_priority(&self) -> &Priority { match self { - Self::GetBlockHeaders { priority, .. } => priority, - Self::GetBlockBodies { priority, .. } => priority, + Self::GetBlockHeaders { priority, .. } | Self::GetBlockBodies { priority, .. } => { + priority + } } } diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index 67172e53e..deee0bf25 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -316,10 +316,7 @@ where self.state_fetcher.on_pending_disconnect(&peer_id); self.queued_messages.push_back(StateAction::Disconnect { peer_id, reason }); } - PeerAction::DisconnectBannedIncoming { peer_id } => { - self.state_fetcher.on_pending_disconnect(&peer_id); - self.queued_messages.push_back(StateAction::Disconnect { peer_id, reason: None }); - } + PeerAction::DisconnectBannedIncoming { peer_id } | PeerAction::DisconnectUntrustedIncoming { peer_id } => { self.state_fetcher.on_pending_disconnect(&peer_id); self.queued_messages.push_back(StateAction::Disconnect { peer_id, reason: None }); @@ -334,8 +331,7 @@ where PeerAction::PeerRemoved(peer_id) => { self.queued_messages.push_back(StateAction::PeerRemoved(peer_id)) } - PeerAction::BanPeer { .. } => {} - PeerAction::UnBanPeer { .. } => {} + PeerAction::BanPeer { .. } | PeerAction::UnBanPeer { .. } => {} } } diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index 9171004bd..931cfdb9e 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -244,7 +244,7 @@ impl ValidateTx68 for EthMessageFilter { fn max_encoded_tx_length(&self, ty: TxType) -> Option { // the biggest transaction so far is a blob transaction, which is currently max 2^17, // encoded length, nonetheless, the blob tx may become bigger in the future. - #[allow(unreachable_patterns)] + #[allow(unreachable_patterns, clippy::match_same_arms)] match ty { TxType::Legacy | TxType::Eip2930 | TxType::Eip1559 => Some(MAX_MESSAGE_SIZE), TxType::Eip4844 => None, diff --git a/crates/net/network/tests/it/connect.rs b/crates/net/network/tests/it/connect.rs index dc5117433..ffb30a4d7 100644 --- a/crates/net/network/tests/it/connect.rs +++ b/crates/net/network/tests/it/connect.rs @@ -54,7 +54,7 @@ async fn test_establish_connections() { let mut established = listener0.take(4); while let Some(ev) = established.next().await { match ev { - NetworkEvent::SessionClosed { .. } => { + NetworkEvent::SessionClosed { .. } | NetworkEvent::PeerRemoved(_) => { panic!("unexpected event") } NetworkEvent::SessionEstablished { peer_id, .. } => { @@ -63,9 +63,6 @@ async fn test_establish_connections() { NetworkEvent::PeerAdded(peer_id) => { assert!(expected_peers.remove(&peer_id)) } - NetworkEvent::PeerRemoved(_) => { - panic!("unexpected event") - } } } assert!(expected_connections.is_empty()); diff --git a/crates/net/network/tests/it/multiplex.rs b/crates/net/network/tests/it/multiplex.rs index 14481f0ce..ae84f43aa 100644 --- a/crates/net/network/tests/it/multiplex.rs +++ b/crates/net/network/tests/it/multiplex.rs @@ -99,11 +99,8 @@ mod proto { let mut buf = BytesMut::new(); buf.put_u8(self.message_type as u8); match &self.message { - PingPongProtoMessageKind::Ping => {} - PingPongProtoMessageKind::Pong => {} - PingPongProtoMessageKind::PingMessage(msg) => { - buf.put(msg.as_bytes()); - } + PingPongProtoMessageKind::Ping | PingPongProtoMessageKind::Pong => {} + PingPongProtoMessageKind::PingMessage(msg) | PingPongProtoMessageKind::PongMessage(msg) => { buf.put(msg.as_bytes()); } diff --git a/crates/net/p2p/src/error.rs b/crates/net/p2p/src/error.rs index 33e0a9d6d..3cc2f2407 100644 --- a/crates/net/p2p/src/error.rs +++ b/crates/net/p2p/src/error.rs @@ -61,11 +61,11 @@ impl EthResponseValidator for RequestResult> { fn reputation_change_err(&self) -> Option { if let Err(err) = self { match err { - RequestError::ChannelClosed => None, - RequestError::ConnectionDropped => None, - RequestError::UnsupportedCapability => None, - RequestError::Timeout => Some(ReputationChangeKind::Timeout), + RequestError::ChannelClosed | + RequestError::ConnectionDropped | + RequestError::UnsupportedCapability | RequestError::BadResponse => None, + RequestError::Timeout => Some(ReputationChangeKind::Timeout), } } else { None diff --git a/crates/primitives/src/chain/spec.rs b/crates/primitives/src/chain/spec.rs index f0389e42d..7da61bf6b 100644 --- a/crates/primitives/src/chain/spec.rs +++ b/crates/primitives/src/chain/spec.rs @@ -848,9 +848,9 @@ impl ChainSpec { // We filter out TTD-based forks w/o a pre-known block since those do not show up in the // fork filter. Some(match condition { - ForkCondition::Block(block) => ForkFilterKey::Block(block), - ForkCondition::Timestamp(time) => ForkFilterKey::Time(time), + ForkCondition::Block(block) | ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), + ForkCondition::Timestamp(time) => ForkFilterKey::Time(time), _ => return None, }) }); diff --git a/crates/primitives/src/transaction/sidecar.rs b/crates/primitives/src/transaction/sidecar.rs index da273db36..5a0574413 100644 --- a/crates/primitives/src/transaction/sidecar.rs +++ b/crates/primitives/src/transaction/sidecar.rs @@ -213,7 +213,7 @@ impl BlobTransaction { // decode the _first_ list header for the rest of the transaction let outer_header = Header::decode(data)?; if !outer_header.list { - return Err(RlpError::Custom("PooledTransactions blob tx must be encoded as a list")) + return Err(RlpError::Custom("PooledTransactions blob tx must be encoded as a list")); } let outer_remaining_len = data.len(); @@ -225,7 +225,7 @@ impl BlobTransaction { if !inner_header.list { return Err(RlpError::Custom( "PooledTransactions inner blob tx must be encoded as a list", - )) + )); } let inner_remaining_len = data.len(); @@ -239,7 +239,7 @@ impl BlobTransaction { // the inner header only decodes the transaction and signature, so we check the length here let inner_consumed = inner_remaining_len - data.len(); if inner_consumed != inner_header.payload_length { - return Err(RlpError::UnexpectedLength) + return Err(RlpError::UnexpectedLength); } // All that's left are the blobs, commitments, and proofs diff --git a/crates/rpc/ipc/src/server/mod.rs b/crates/rpc/ipc/src/server/mod.rs index 1ee6f8bdf..b47c0d86a 100644 --- a/crates/rpc/ipc/src/server/mod.rs +++ b/crates/rpc/ipc/src/server/mod.rs @@ -859,8 +859,8 @@ mod tests { loop { match select(closed, stream.next()).await { - // subscription closed. - Either::Left((_, _)) => break Ok(()), + // subscription closed or stream is closed. + Either::Left((_, _)) | Either::Right((None, _)) => break Ok(()), // received new item from the stream. Either::Right((Some(Ok(item)), c)) => { @@ -878,9 +878,6 @@ mod tests { // Send back back the error. Either::Right((Some(Err(e)), _)) => break Err(e.into()), - - // Stream is closed. - Either::Right((None, _)) => break Ok(()), } } } diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 802ce490b..ed768db4c 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -49,8 +49,7 @@ fn fill( #[allow(unreachable_patterns)] let (gas_price, max_fee_per_gas) = match signed_tx.tx_type() { - TxType::Legacy => (Some(signed_tx.max_fee_per_gas()), None), - TxType::Eip2930 => (Some(signed_tx.max_fee_per_gas()), None), + TxType::Legacy | TxType::Eip2930 => (Some(signed_tx.max_fee_per_gas()), None), TxType::Eip1559 | TxType::Eip4844 => { // the gas price field for EIP1559 is set to `min(tip, gasFeeCap - baseFee) + // baseFee` diff --git a/crates/rpc/rpc/src/eth/error.rs b/crates/rpc/rpc/src/eth/error.rs index 7a6214e52..4a9b6d043 100644 --- a/crates/rpc/rpc/src/eth/error.rs +++ b/crates/rpc/rpc/src/eth/error.rs @@ -150,7 +150,8 @@ impl From for ErrorObject<'static> { EthApiError::InvalidBlockData(_) | EthApiError::Internal(_) | EthApiError::TransactionNotFound | - EthApiError::EvmCustom(_) => internal_rpc_err(error.to_string()), + EthApiError::EvmCustom(_) | + EthApiError::InvalidRewardPercentiles => internal_rpc_err(error.to_string()), EthApiError::UnknownBlockNumber | EthApiError::UnknownBlockOrTxIndex => { rpc_error_with_code(EthRpcErrorCode::ResourceNotFound.code(), error.to_string()) } @@ -160,12 +161,12 @@ impl From for ErrorObject<'static> { EthApiError::Unsupported(msg) => internal_rpc_err(msg), EthApiError::InternalJsTracerError(msg) => internal_rpc_err(msg), EthApiError::InvalidParams(msg) => invalid_params_rpc_err(msg), - EthApiError::InvalidRewardPercentiles => internal_rpc_err(error.to_string()), err @ EthApiError::ExecutionTimedOut(_) => { rpc_error_with_code(CALL_EXECUTION_FAILED_CODE, err.to_string()) } - err @ EthApiError::InternalBlockingTaskError => internal_rpc_err(err.to_string()), - err @ EthApiError::InternalEthError => internal_rpc_err(err.to_string()), + err @ EthApiError::InternalBlockingTaskError | err @ EthApiError::InternalEthError => { + internal_rpc_err(err.to_string()) + } err @ EthApiError::TransactionInputError(_) => invalid_params_rpc_err(err.to_string()), EthApiError::Other(err) => err.to_rpc_error(), EthApiError::MuxTracerError(msg) => internal_rpc_err(msg.to_string()), @@ -392,10 +393,9 @@ impl RpcInvalidTransactionError { pub(crate) const fn out_of_gas(reason: OutOfGasError, gas_limit: u64) -> Self { match reason { OutOfGasError::Basic => Self::BasicOutOfGas(gas_limit), - OutOfGasError::Memory => Self::MemoryOutOfGas(gas_limit), + OutOfGasError::Memory | OutOfGasError::MemoryLimit => Self::MemoryOutOfGas(gas_limit), OutOfGasError::Precompile => Self::PrecompileOutOfGas(gas_limit), OutOfGasError::InvalidOperand => Self::InvalidOperandOutOfGas(gas_limit), - OutOfGasError::MemoryLimit => Self::MemoryOutOfGas(gas_limit), } } } @@ -471,7 +471,7 @@ impl From for RpcInvalidTransactionErr InvalidTransactionError::ChainIdMismatch => Self::InvalidChainId, InvalidTransactionError::Eip2930Disabled | InvalidTransactionError::Eip1559Disabled | - InvalidTransactionError::Eip4844Disabled => Self::TxTypeNotSupported, + InvalidTransactionError::Eip4844Disabled | InvalidTransactionError::TxTypeNotSupported => Self::TxTypeNotSupported, InvalidTransactionError::GasUintOverflow => Self::GasUintOverflow, InvalidTransactionError::GasTooLow => Self::GasTooLow, @@ -589,8 +589,9 @@ impl From for RpcPoolError { match err.kind { PoolErrorKind::ReplacementUnderpriced => Self::ReplaceUnderpriced, PoolErrorKind::FeeCapBelowMinimumProtocolFeeCap(_) => Self::Underpriced, - PoolErrorKind::SpammerExceededCapacity(_) => Self::TxPoolOverflow, - PoolErrorKind::DiscardedOnInsert => Self::TxPoolOverflow, + PoolErrorKind::SpammerExceededCapacity(_) | PoolErrorKind::DiscardedOnInsert => { + Self::TxPoolOverflow + } PoolErrorKind::InvalidTransaction(err) => err.into(), PoolErrorKind::Other(err) => Self::Other(err), PoolErrorKind::AlreadyImported => Self::AlreadyKnown, diff --git a/crates/rpc/rpc/src/eth/filter.rs b/crates/rpc/rpc/src/eth/filter.rs index 6d7950a47..08b22aa74 100644 --- a/crates/rpc/rpc/src/eth/filter.rs +++ b/crates/rpc/rpc/src/eth/filter.rs @@ -711,12 +711,8 @@ impl From for jsonrpsee::types::error::ErrorObject<'static> { rpc_error_with_code(jsonrpsee::types::error::INTERNAL_ERROR_CODE, err.to_string()) } FilterError::EthAPIError(err) => err.into(), - err @ FilterError::InvalidBlockRangeParams => { - rpc_error_with_code(jsonrpsee::types::error::INVALID_PARAMS_CODE, err.to_string()) - } - err @ FilterError::QueryExceedsMaxBlocks(_) => { - rpc_error_with_code(jsonrpsee::types::error::INVALID_PARAMS_CODE, err.to_string()) - } + err @ FilterError::InvalidBlockRangeParams | + err @ FilterError::QueryExceedsMaxBlocks(_) | err @ FilterError::QueryExceedsMaxResults(_) => { rpc_error_with_code(jsonrpsee::types::error::INVALID_PARAMS_CODE, err.to_string()) } diff --git a/crates/static-file-types/src/segment.rs b/crates/static-file-types/src/segment.rs index b325e3e9e..d609f4a98 100644 --- a/crates/static-file-types/src/segment.rs +++ b/crates/static-file-types/src/segment.rs @@ -57,9 +57,7 @@ impl StaticFileSegment { }; match self { - Self::Headers => default_config, - Self::Transactions => default_config, - Self::Receipts => default_config, + Self::Headers | Self::Transactions | Self::Receipts => default_config, } } @@ -67,8 +65,7 @@ impl StaticFileSegment { pub const fn columns(&self) -> usize { match self { Self::Headers => 3, - Self::Transactions => 1, - Self::Receipts => 1, + Self::Transactions | Self::Receipts => 1, } } diff --git a/crates/storage/codecs/derive/src/compact/enums.rs b/crates/storage/codecs/derive/src/compact/enums.rs index 97e2f0e63..4d387e9d7 100644 --- a/crates/storage/codecs/derive/src/compact/enums.rs +++ b/crates/storage/codecs/derive/src/compact/enums.rs @@ -26,8 +26,7 @@ impl<'a> EnumHandler<'a> { // The following method will advance the // `fields_iterator` by itself and stop right before the next variant. FieldTypes::EnumVariant(name) => self.to(name, ident), - FieldTypes::EnumUnnamedField(_) => unreachable!(), - FieldTypes::StructField(_) => unreachable!(), + FieldTypes::EnumUnnamedField(_) | FieldTypes::StructField(_) => unreachable!(), } } self.enum_lines @@ -39,8 +38,7 @@ impl<'a> EnumHandler<'a> { // The following method will advance the // `fields_iterator` by itself and stop right before the next variant. FieldTypes::EnumVariant(name) => self.from(name, ident), - FieldTypes::EnumUnnamedField(_) => unreachable!(), - FieldTypes::StructField(_) => unreachable!(), + FieldTypes::EnumUnnamedField(_) | FieldTypes::StructField(_) => unreachable!(), } } self.enum_lines diff --git a/crates/storage/codecs/derive/src/compact/structs.rs b/crates/storage/codecs/derive/src/compact/structs.rs index a4f32364e..a9c978b21 100644 --- a/crates/storage/codecs/derive/src/compact/structs.rs +++ b/crates/storage/codecs/derive/src/compact/structs.rs @@ -23,8 +23,7 @@ impl<'a> StructHandler<'a> { pub fn generate_to(mut self) -> Vec { while let Some(field) = self.next_field() { match field { - FieldTypes::EnumVariant(_) => unreachable!(), - FieldTypes::EnumUnnamedField(_) => unreachable!(), + FieldTypes::EnumVariant(_) | FieldTypes::EnumUnnamedField(_) => unreachable!(), FieldTypes::StructField(field_descriptor) => self.to(field_descriptor), } } @@ -34,8 +33,7 @@ impl<'a> StructHandler<'a> { pub fn generate_from(&mut self, known_types: &[&str]) -> Vec { while let Some(field) = self.next_field() { match field { - FieldTypes::EnumVariant(_) => unreachable!(), - FieldTypes::EnumUnnamedField(_) => unreachable!(), + FieldTypes::EnumVariant(_) | FieldTypes::EnumUnnamedField(_) => unreachable!(), FieldTypes::StructField(field_descriptor) => { self.from(field_descriptor, known_types) } diff --git a/crates/storage/libmdbx-rs/src/error.rs b/crates/storage/libmdbx-rs/src/error.rs index b66d94398..20a101153 100644 --- a/crates/storage/libmdbx-rs/src/error.rs +++ b/crates/storage/libmdbx-rs/src/error.rs @@ -191,10 +191,10 @@ impl Error { Self::WannaRecovery => ffi::MDBX_WANNA_RECOVERY, Self::KeyMismatch => ffi::MDBX_EKEYMISMATCH, Self::DecodeErrorLenDiff | Self::DecodeError => ffi::MDBX_EINVAL, - Self::Access => ffi::MDBX_EACCESS, Self::TooLarge => ffi::MDBX_TOO_LARGE, Self::BadSignature => ffi::MDBX_EBADSIGN, - Self::WriteTransactionUnsupportedInReadOnlyMode => ffi::MDBX_EACCESS, + Self::Access | + Self::WriteTransactionUnsupportedInReadOnlyMode | Self::NestedTransactionsUnsupportedWithWriteMap => ffi::MDBX_EACCESS, Self::ReadTransactionTimeout => -96000, // Custom non-MDBX error code Self::Other(err_code) => *err_code, diff --git a/crates/storage/provider/src/traits/chain.rs b/crates/storage/provider/src/traits/chain.rs index 00a36e820..407c80fa0 100644 --- a/crates/storage/provider/src/traits/chain.rs +++ b/crates/storage/provider/src/traits/chain.rs @@ -107,8 +107,7 @@ impl CanonStateNotification { /// Returns the new committed [Chain] for [`Self::Reorg`] and [`Self::Commit`] variants. pub fn committed(&self) -> Arc { match self { - Self::Commit { new } => new.clone(), - Self::Reorg { new, .. } => new.clone(), + Self::Commit { new } | Self::Reorg { new, .. } => new.clone(), } } @@ -118,8 +117,7 @@ impl CanonStateNotification { /// 1 new block. pub fn tip(&self) -> &SealedBlockWithSenders { match self { - Self::Commit { new } => new.tip(), - Self::Reorg { new, .. } => new.tip(), + Self::Commit { new } | Self::Reorg { new, .. } => new.tip(), } } diff --git a/crates/transaction-pool/src/error.rs b/crates/transaction-pool/src/error.rs index b670cdf95..c6ed4b2e0 100644 --- a/crates/transaction-pool/src/error.rs +++ b/crates/transaction-pool/src/error.rs @@ -92,6 +92,7 @@ impl PoolError { /// erroneous transaction. #[inline] pub fn is_bad_transaction(&self) -> bool { + #[allow(clippy::match_same_arms)] match &self.kind { PoolErrorKind::AlreadyImported => { // already imported but not bad @@ -213,6 +214,7 @@ impl InvalidPoolTransactionError { /// context of the transaction pool and warrants peer penalization. /// /// See [`PoolError::is_bad_transaction`]. + #[allow(clippy::match_same_arms)] #[inline] fn is_bad_transaction(&self) -> bool { match self { @@ -243,10 +245,10 @@ impl InvalidPoolTransactionError { // settings false } - InvalidTransactionError::OldLegacyChainId => true, - InvalidTransactionError::ChainIdMismatch => true, - InvalidTransactionError::GasUintOverflow => true, - InvalidTransactionError::TxTypeNotSupported => true, + InvalidTransactionError::OldLegacyChainId | + InvalidTransactionError::ChainIdMismatch | + InvalidTransactionError::GasUintOverflow | + InvalidTransactionError::TxTypeNotSupported | InvalidTransactionError::SignerAccountHasBytecode => true, } } diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index b8bd64e44..41d57e941 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -1036,7 +1036,7 @@ impl PoolTransaction for EthPooledTransaction { /// /// This will return `None` for non-EIP1559 transactions fn max_priority_fee_per_gas(&self) -> Option { - #[allow(unreachable_patterns)] + #[allow(unreachable_patterns, clippy::match_same_arms)] match &self.transaction.transaction { Transaction::Legacy(_) | Transaction::Eip2930(_) => None, Transaction::Eip1559(tx) => Some(tx.max_priority_fee_per_gas), diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index c40f89b13..06f0cae62 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -333,9 +333,9 @@ impl From for ChainSpec { ForkSpec::Istanbul => spec_builder.istanbul_activated(), ForkSpec::Berlin => spec_builder.berlin_activated(), ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), - ForkSpec::Merge => spec_builder.paris_activated(), - ForkSpec::MergeEOF => spec_builder.paris_activated(), - ForkSpec::MergeMeterInitCode => spec_builder.paris_activated(), + ForkSpec::Merge | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | ForkSpec::MergePush0 => spec_builder.paris_activated(), ForkSpec::Shanghai => spec_builder.shanghai_activated(), ForkSpec::Cancun => spec_builder.cancun_activated(),