From abbd535fd67debc1243453b2497b11d5b12a5bd9 Mon Sep 17 00:00:00 2001 From: Morty Date: Mon, 26 Jan 2026 10:49:24 +0800 Subject: [PATCH 1/8] feat: NetworkHandle support announce block to peer --- Untitled | 1 + crates/net/network-api/src/block.rs | 3 +++ crates/net/network-api/src/noop.rs | 9 +++++++++ crates/net/network/src/network.rs | 13 +++++++++++-- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 Untitled diff --git a/Untitled b/Untitled new file mode 100644 index 00000000000..08cad252e9d --- /dev/null +++ b/Untitled @@ -0,0 +1 @@ +alloy-provider \ No newline at end of file diff --git a/crates/net/network-api/src/block.rs b/crates/net/network-api/src/block.rs index 994c90a09a8..76a627c84a7 100644 --- a/crates/net/network-api/src/block.rs +++ b/crates/net/network-api/src/block.rs @@ -23,4 +23,7 @@ pub trait EthWireProvider { /// Announce a new block to the network over the eth wire protocol. fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256); + + /// Announce a new block to the network over the eth wire protocol. + fn eth_wire_announce_block_to(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256); } diff --git a/crates/net/network-api/src/noop.rs b/crates/net/network-api/src/noop.rs index a40f21270a9..8d18a339572 100644 --- a/crates/net/network-api/src/noop.rs +++ b/crates/net/network-api/src/noop.rs @@ -223,6 +223,15 @@ impl EthWireProvider for NoopNetwork { ) { unreachable!() } + + fn eth_wire_announce_block_to( + &self, + _peer_id: PeerId, + _block: ::NewBlockPayload, + _hash: alloy_primitives::B256, + ) { + unreachable!() + } } impl NetworkPeersEvents for NoopNetwork diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index 9e01cff13ae..ef87b7c1022 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -1,6 +1,10 @@ use crate::{ - config::NetworkMode, message::PeerMessage, protocol::RlpxSubProtocol, - swarm::NetworkConnectionState, transactions::TransactionsHandle, FetchClient, + config::NetworkMode, + message::{NewBlockMessage, PeerMessage}, + protocol::RlpxSubProtocol, + swarm::NetworkConnectionState, + transactions::TransactionsHandle, + FetchClient, }; use alloy_primitives::B256; use enr::Enr; @@ -237,6 +241,11 @@ impl EthWireProvider for NetworkHandle { fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256) { self.announce_block(block, hash) } + + fn eth_wire_announce_block_to(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256) { + let msg = NewBlockMessage { hash, block: Arc::new(block) }; + self.send_eth_message(peer_id, PeerMessage::NewBlock(msg)) + } } impl NetworkProtocols for NetworkHandle { From 5e21e5208f1c8d21f819e1c15bb3fb4cbc832ec9 Mon Sep 17 00:00:00 2001 From: Morty Date: Mon, 26 Jan 2026 10:51:47 +0800 Subject: [PATCH 2/8] update comment --- crates/net/network-api/src/block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/net/network-api/src/block.rs b/crates/net/network-api/src/block.rs index 76a627c84a7..fffe5091e4e 100644 --- a/crates/net/network-api/src/block.rs +++ b/crates/net/network-api/src/block.rs @@ -24,6 +24,6 @@ pub trait EthWireProvider { /// Announce a new block to the network over the eth wire protocol. fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256); - /// Announce a new block to the network over the eth wire protocol. + /// Announce a new block to a specific peer over the eth wire protocol. fn eth_wire_announce_block_to(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256); } From c549be92bdf8006b36a657aa3dc1bc6ade3c1e4d Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 15:54:30 +0800 Subject: [PATCH 3/8] remove unused file --- Untitled | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Untitled diff --git a/Untitled b/Untitled deleted file mode 100644 index 08cad252e9d..00000000000 --- a/Untitled +++ /dev/null @@ -1 +0,0 @@ -alloy-provider \ No newline at end of file From dda11bbdc0d6a91a68e1efbc4b7d074d099a10ca Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 17:27:29 +0800 Subject: [PATCH 4/8] fix clippy --- crates/era-downloader/src/fs.rs | 2 +- crates/net/discv4/src/lib.rs | 2 +- crates/scroll/alloy/evm/src/block/curie.rs | 2 +- crates/scroll/alloy/evm/src/block/feynman.rs | 2 +- crates/scroll/alloy/evm/src/block/galileo_v2.rs | 2 +- crates/scroll/evm/src/execute.rs | 2 +- crates/stages/stages/src/stages/hashing_account.rs | 2 +- crates/trie/common/src/updates.rs | 4 ++-- crates/trie/trie/src/verify.rs | 2 +- deny.toml | 1 + 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/era-downloader/src/fs.rs b/crates/era-downloader/src/fs.rs index 19532f01cff..ca3e173986a 100644 --- a/crates/era-downloader/src/fs.rs +++ b/crates/era-downloader/src/fs.rs @@ -43,7 +43,7 @@ pub fn read_dir( .collect::>>()?; let mut checksums = checksums.ok_or_eyre("Missing file `checksums.txt` in the `dir`")?; - entries.sort_by(|(left, _), (right, _)| left.cmp(right)); + entries.sort_by_key(|(left, _)| *left); Ok(stream::iter(entries.into_iter().skip(start_from as usize / BLOCKS_PER_FILE).map( move |(_, path)| { diff --git a/crates/net/discv4/src/lib.rs b/crates/net/discv4/src/lib.rs index 83106cbbe6e..d5e4be52a46 100644 --- a/crates/net/discv4/src/lib.rs +++ b/crates/net/discv4/src/lib.rs @@ -1628,7 +1628,7 @@ impl Discv4Service { .filter(|entry| entry.node.value.is_expired()) .map(|n| n.node.value) .collect::>(); - nodes.sort_by(|a, b| a.last_seen.cmp(&b.last_seen)); + nodes.sort_by_key(|a| a.last_seen); let to_ping = nodes.into_iter().map(|n| n.record).take(MAX_NODES_PING).collect::>(); for node in to_ping { self.try_ping(node, PingReason::RePing) diff --git a/crates/scroll/alloy/evm/src/block/curie.rs b/crates/scroll/alloy/evm/src/block/curie.rs index 4678d42c409..7e25e143443 100644 --- a/crates/scroll/alloy/evm/src/block/curie.rs +++ b/crates/scroll/alloy/evm/src/block/curie.rs @@ -151,7 +151,7 @@ mod tests { // check oracle storage changeset let mut storage = oracle.storage.into_iter().collect::>(); - storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + storage.sort_by_key(|(a, _)| *a); for (got, expected) in storage.into_iter().zip(CURIE_L1_GAS_PRICE_ORACLE_STORAGE) { assert_eq!(got.0, expected.0); assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); diff --git a/crates/scroll/alloy/evm/src/block/feynman.rs b/crates/scroll/alloy/evm/src/block/feynman.rs index 555338e3cb6..173ec66b8d4 100644 --- a/crates/scroll/alloy/evm/src/block/feynman.rs +++ b/crates/scroll/alloy/evm/src/block/feynman.rs @@ -148,7 +148,7 @@ mod tests { // check oracle storage changeset let mut storage = oracle.storage.into_iter().collect::>(); - storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + storage.sort_by_key(|(a, _)| *a); for (got, expected) in storage.into_iter().zip(FEYNMAN_L1_GAS_PRICE_ORACLE_STORAGE) { assert_eq!(got.0, expected.0); assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); diff --git a/crates/scroll/alloy/evm/src/block/galileo_v2.rs b/crates/scroll/alloy/evm/src/block/galileo_v2.rs index b48dce60ac9..410aacef30c 100644 --- a/crates/scroll/alloy/evm/src/block/galileo_v2.rs +++ b/crates/scroll/alloy/evm/src/block/galileo_v2.rs @@ -148,7 +148,7 @@ mod tests { // check oracle storage changeset let mut storage = oracle.storage.into_iter().collect::>(); - storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + storage.sort_by_key(|(a, _)| *a); for (got, expected) in storage.into_iter().zip(GALILEO_V2_L1_GAS_PRICE_ORACLE_STORAGE) { assert_eq!(got.0, expected.0); assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 49fe874c64b..39f29fbeb2a 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -446,7 +446,7 @@ mod tests { // check oracle contract contains storage changeset let mut storage = oracle.storage.into_iter().collect::>(); - storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + storage.sort_by_key(|(a, _)| *a); for (got, expected) in storage.into_iter().zip(CURIE_L1_GAS_PRICE_ORACLE_STORAGE) { assert_eq!(got.0, expected.0); assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); diff --git a/crates/stages/stages/src/stages/hashing_account.rs b/crates/stages/stages/src/stages/hashing_account.rs index cc86db14d38..231838519be 100644 --- a/crates/stages/stages/src/stages/hashing_account.rs +++ b/crates/stages/stages/src/stages/hashing_account.rs @@ -99,7 +99,7 @@ impl AccountHashingStage { // Account State generator let mut account_cursor = provider.tx_ref().cursor_write::()?; - accounts.sort_by(|a, b| a.0.cmp(&b.0)); + accounts.sort_by_key(|a| a.0); for (addr, acc) in &accounts { account_cursor.append(*addr, acc)?; } diff --git a/crates/trie/common/src/updates.rs b/crates/trie/common/src/updates.rs index 441e407db16..0c8a618ad42 100644 --- a/crates/trie/common/src/updates.rs +++ b/crates/trie/common/src/updates.rs @@ -130,7 +130,7 @@ impl TrieUpdates { .collect::>(); account_nodes.extend(self.removed_nodes.drain().map(|path| (path, None))); - account_nodes.sort_unstable_by(|a, b| a.0.cmp(&b.0)); + account_nodes.sort_unstable_by_key(|a| a.0); let storage_tries = self .storage_tries @@ -276,7 +276,7 @@ impl StorageTrieUpdates { .collect::>(); storage_nodes.extend(self.removed_nodes.into_iter().map(|path| (path, None))); - storage_nodes.sort_unstable_by(|a, b| a.0.cmp(&b.0)); + storage_nodes.sort_unstable_by_key(|a| a.0); StorageTrieUpdatesSorted { is_deleted: self.is_deleted, storage_nodes } } diff --git a/crates/trie/trie/src/verify.rs b/crates/trie/trie/src/verify.rs index 96059211458..454aff8ef9a 100644 --- a/crates/trie/trie/src/verify.rs +++ b/crates/trie/trie/src/verify.rs @@ -141,7 +141,7 @@ impl Iterator for StateRootBranchNodesIter { // By sorting by the account we ensure that we continue with the partially processed // trie (the last of the previous run) first. We sort in reverse order because we pop // off of this Vec. - self.storage_tries.sort_unstable_by(|a, b| b.0.cmp(&a.0)); + self.storage_tries.sort_unstable_by_key(|b| std::cmp::Reverse(b.0)); // loop back to the top. } diff --git a/deny.toml b/deny.toml index 82bacf4df6d..395ef4a1a6f 100644 --- a/deny.toml +++ b/deny.toml @@ -62,6 +62,7 @@ exceptions = [ # TODO: decide on MPL-2.0 handling # These dependencies are grandfathered in https://github.com/paradigmxyz/reth/pull/6980 { allow = ["MPL-2.0"], name = "option-ext" }, + { allow = ["MPL-2.0"], name = "webpki-root-certs" }, ] # Skip the poseidon-bn254, bn254 and zktrie crates for license verification. We should at some point publish a license for them. From a4056f7b79a44b644f5603e3190617d864fd4ada Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 17:48:18 +0800 Subject: [PATCH 5/8] fix deny --- deny.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deny.toml b/deny.toml index 395ef4a1a6f..02abdd578d9 100644 --- a/deny.toml +++ b/deny.toml @@ -22,7 +22,11 @@ highlight = "all" # List of crates to deny # TODO issue #201 deny = [{ name = "openssl" }] # Certain crates/versions that will be skipped when doing duplicate detection. -skip = [] +skip = [ + # Multiple versions of base64 due to transitive dependencies + { name = "base64", version = "=0.13.1" }, # Used by http-types + { name = "base64", version = "=0.21.7" }, # Used by coins-core +] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is @@ -53,7 +57,6 @@ allow = [ # https://github.com/rustls/webpki/blob/main/LICENSE ISC Style "LicenseRef-rustls-webpki", "CDLA-Permissive-2.0", - "MPL-2.0", ] # Allow 1 or more licenses on a per-crate basis, so that particular licenses @@ -62,7 +65,6 @@ exceptions = [ # TODO: decide on MPL-2.0 handling # These dependencies are grandfathered in https://github.com/paradigmxyz/reth/pull/6980 { allow = ["MPL-2.0"], name = "option-ext" }, - { allow = ["MPL-2.0"], name = "webpki-root-certs" }, ] # Skip the poseidon-bn254, bn254 and zktrie crates for license verification. We should at some point publish a license for them. From c14b5a384be4473a20351252f84ed0fc5026226a Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 17:52:16 +0800 Subject: [PATCH 6/8] fix deny --- deny.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/deny.toml b/deny.toml index 02abdd578d9..f0437750659 100644 --- a/deny.toml +++ b/deny.toml @@ -22,11 +22,6 @@ highlight = "all" # List of crates to deny # TODO issue #201 deny = [{ name = "openssl" }] # Certain crates/versions that will be skipped when doing duplicate detection. -skip = [ - # Multiple versions of base64 due to transitive dependencies - { name = "base64", version = "=0.13.1" }, # Used by http-types - { name = "base64", version = "=0.21.7" }, # Used by coins-core -] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is @@ -57,6 +52,7 @@ allow = [ # https://github.com/rustls/webpki/blob/main/LICENSE ISC Style "LicenseRef-rustls-webpki", "CDLA-Permissive-2.0", + "MPL-2.0", ] # Allow 1 or more licenses on a per-crate basis, so that particular licenses From bb9e9024a6ec9278c9e68ed2ed80c5a4255235c3 Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 17:53:52 +0800 Subject: [PATCH 7/8] fix: comment --- crates/net/network-api/src/block.rs | 2 +- crates/net/network-api/src/noop.rs | 2 +- crates/net/network/src/network.rs | 2 +- deny.toml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/net/network-api/src/block.rs b/crates/net/network-api/src/block.rs index fffe5091e4e..a329ed39a44 100644 --- a/crates/net/network-api/src/block.rs +++ b/crates/net/network-api/src/block.rs @@ -25,5 +25,5 @@ pub trait EthWireProvider { fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256); /// Announce a new block to a specific peer over the eth wire protocol. - fn eth_wire_announce_block_to(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256); + fn eth_wire_announce_block_to_peer(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256); } diff --git a/crates/net/network-api/src/noop.rs b/crates/net/network-api/src/noop.rs index 8d18a339572..3dd2a6dd153 100644 --- a/crates/net/network-api/src/noop.rs +++ b/crates/net/network-api/src/noop.rs @@ -224,7 +224,7 @@ impl EthWireProvider for NoopNetwork { unreachable!() } - fn eth_wire_announce_block_to( + fn eth_wire_announce_block_to_peer( &self, _peer_id: PeerId, _block: ::NewBlockPayload, diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index ef87b7c1022..8a4f22c30dd 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -242,7 +242,7 @@ impl EthWireProvider for NetworkHandle { self.announce_block(block, hash) } - fn eth_wire_announce_block_to(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256) { + fn eth_wire_announce_block_to_peer(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256) { let msg = NewBlockMessage { hash, block: Arc::new(block) }; self.send_eth_message(peer_id, PeerMessage::NewBlock(msg)) } diff --git a/deny.toml b/deny.toml index f0437750659..82bacf4df6d 100644 --- a/deny.toml +++ b/deny.toml @@ -22,6 +22,7 @@ highlight = "all" # List of crates to deny # TODO issue #201 deny = [{ name = "openssl" }] # Certain crates/versions that will be skipped when doing duplicate detection. +skip = [] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is From be84e755bd64a370527e06a7707fbdb0eb3d71d4 Mon Sep 17 00:00:00 2001 From: Morty Date: Fri, 30 Jan 2026 17:55:35 +0800 Subject: [PATCH 8/8] fix: fmt --- crates/net/network-api/src/block.rs | 7 ++++++- crates/net/network/src/network.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/net/network-api/src/block.rs b/crates/net/network-api/src/block.rs index a329ed39a44..0cd38ee915e 100644 --- a/crates/net/network-api/src/block.rs +++ b/crates/net/network-api/src/block.rs @@ -25,5 +25,10 @@ pub trait EthWireProvider { fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256); /// Announce a new block to a specific peer over the eth wire protocol. - fn eth_wire_announce_block_to_peer(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256); + fn eth_wire_announce_block_to_peer( + &self, + peer_id: PeerId, + block: N::NewBlockPayload, + hash: B256, + ); } diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index 8a4f22c30dd..e89ebb52d4d 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -242,7 +242,12 @@ impl EthWireProvider for NetworkHandle { self.announce_block(block, hash) } - fn eth_wire_announce_block_to_peer(&self, peer_id: PeerId, block: N::NewBlockPayload, hash: B256) { + fn eth_wire_announce_block_to_peer( + &self, + peer_id: PeerId, + block: N::NewBlockPayload, + hash: B256, + ) { let msg = NewBlockMessage { hash, block: Arc::new(block) }; self.send_eth_message(peer_id, PeerMessage::NewBlock(msg)) }