Skip to content
Merged
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
2 changes: 1 addition & 1 deletion crates/era-downloader/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn read_dir(
.collect::<eyre::Result<Vec<_>>>()?;
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)| {
Expand Down
2 changes: 1 addition & 1 deletion crates/net/discv4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ impl Discv4Service {
.filter(|entry| entry.node.value.is_expired())
.map(|n| n.node.value)
.collect::<Vec<_>>();
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::<Vec<_>>();
for node in to_ping {
self.try_ping(node, PingReason::RePing)
Expand Down
8 changes: 8 additions & 0 deletions crates/net/network-api/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@ pub trait EthWireProvider<N: NetworkPrimitives> {

/// 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 a specific peer over the eth wire protocol.
fn eth_wire_announce_block_to_peer(
&self,
peer_id: PeerId,
block: N::NewBlockPayload,
hash: B256,
);
}
9 changes: 9 additions & 0 deletions crates/net/network-api/src/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ impl<N: NetworkPrimitives> EthWireProvider<N> for NoopNetwork<N> {
) {
unreachable!()
}

fn eth_wire_announce_block_to_peer(
&self,
_peer_id: PeerId,
_block: <N as NetworkPrimitives>::NewBlockPayload,
_hash: alloy_primitives::B256,
) {
unreachable!()
}
}

impl<Net> NetworkPeersEvents for NoopNetwork<Net>
Expand Down
18 changes: 16 additions & 2 deletions crates/net/network/src/network.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -237,6 +241,16 @@ impl<N: NetworkPrimitives> EthWireProvider<N> for NetworkHandle<N> {
fn eth_wire_announce_block(&self, block: N::NewBlockPayload, hash: B256) {
self.announce_block(block, hash)
}

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))
}
}

impl<N: NetworkPrimitives> NetworkProtocols for NetworkHandle<N> {
Expand Down
2 changes: 1 addition & 1 deletion crates/scroll/alloy/evm/src/block/curie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ mod tests {

// check oracle storage changeset
let mut storage = oracle.storage.into_iter().collect::<Vec<(U256, StorageSlot)>>();
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() });
Expand Down
2 changes: 1 addition & 1 deletion crates/scroll/alloy/evm/src/block/feynman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {

// check oracle storage changeset
let mut storage = oracle.storage.into_iter().collect::<Vec<(U256, StorageSlot)>>();
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() });
Expand Down
2 changes: 1 addition & 1 deletion crates/scroll/alloy/evm/src/block/galileo_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {

// check oracle storage changeset
let mut storage = oracle.storage.into_iter().collect::<Vec<(U256, StorageSlot)>>();
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() });
Expand Down
2 changes: 1 addition & 1 deletion crates/scroll/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ mod tests {

// check oracle contract contains storage changeset
let mut storage = oracle.storage.into_iter().collect::<Vec<(U256, StorageSlot)>>();
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() });
Expand Down
2 changes: 1 addition & 1 deletion crates/stages/stages/src/stages/hashing_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl AccountHashingStage {
// Account State generator
let mut account_cursor =
provider.tx_ref().cursor_write::<tables::PlainAccountState>()?;
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)?;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/trie/common/src/updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl TrieUpdates {
.collect::<Vec<_>>();

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
Expand Down Expand Up @@ -276,7 +276,7 @@ impl StorageTrieUpdates {
.collect::<Vec<_>>();

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 }
}
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/trie/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<H: HashedCursorFactory + Clone> Iterator for StateRootBranchNodesIter<H> {
// 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.
}
Expand Down
5 changes: 5 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ ignore = [
"RUSTSEC-2024-0384",
# https://rustsec.org/advisories/RUSTSEC-2024-0436 paste! is unmaintained
"RUSTSEC-2024-0436",
# TODO: remove these once the affected dependencies are updated
# https://rustsec.org/advisories/RUSTSEC-2025-0141 bincode is unmaintained
"RUSTSEC-2025-0141",
# https://rustsec.org/advisories/RUSTSEC-2025-0137 reciprocal_mg10 unsoundness
"RUSTSEC-2025-0137",
]

# This section is considered when running `cargo deny check bans`.
Expand Down
Loading