Skip to content

Commit f8dd4a1

Browse files
committed
Merge remote-tracking branch 'origin/breaking-changes' into alexey/rename-tables
2 parents 5154fc7 + e0128c7 commit f8dd4a1

File tree

23 files changed

+64
-22
lines changed

23 files changed

+64
-22
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ethereum-forks/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
1212
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
1313
)]
14+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
15+
#![allow(unknown_lints, non_local_definitions)]
1416
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1517

1618
mod forkid;

crates/net/eth-wire/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
1111
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
1212
)]
13+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
14+
#![allow(unknown_lints, non_local_definitions)]
1315
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1416

1517
pub mod builder;

crates/net/eth-wire/tests/fuzz_roundtrip.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! Round-trip encoding fuzzing for the `eth-wire` crate.
22
3+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
4+
#![allow(unknown_lints, non_local_definitions)]
5+
36
use alloy_rlp::{Decodable, Encodable};
47
use serde::Serialize;
58
use std::fmt::Debug;

crates/net/network/src/transactions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ where
451451
return propagated
452452
}
453453

454-
// send full transactions to a fraction fo the connected peers (square root of the total
454+
// send full transactions to a fraction of the connected peers (square root of the total
455455
// number of connected peers)
456456
let max_num_full = (self.peers.len() as f64).sqrt() as usize + 1;
457457

crates/primitives/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
1313
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
1414
)]
15+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
16+
#![allow(unknown_lints, non_local_definitions)]
1517
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1618

1719
mod account;

crates/revm/src/processor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,9 @@ mod tests {
591591
Account, Bytecode, Bytes, ChainSpecBuilder, ForkCondition, Signature, StorageKey,
592592
Transaction, TransactionKind, TxEip1559, MAINNET,
593593
};
594-
use reth_provider::{
595-
AccountReader, BlockHashReader, BundleStateWithReceipts, StateRootProvider,
596-
};
594+
#[cfg(feature = "optimism")]
595+
use reth_provider::BundleStateWithReceipts;
596+
use reth_provider::{AccountReader, BlockHashReader, StateRootProvider};
597597
use reth_trie::updates::TrieUpdates;
598598
use revm::{Database, TransitionState};
599599
use std::collections::HashMap;

crates/stages/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ revm.workspace = true
3333
# async
3434
tokio = { workspace = true, features = ["sync"] }
3535
tokio-stream.workspace = true
36-
async-trait.workspace = true
3736
futures-util.workspace = true
3837
pin-project.workspace = true
3938

crates/stages/src/stage.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use reth_primitives::{
77
use reth_provider::{BlockReader, DatabaseProviderRW, ProviderError, TransactionsProvider};
88
use std::{
99
cmp::{max, min},
10-
future::poll_fn,
10+
future::{poll_fn, Future},
1111
ops::{Range, RangeInclusive},
1212
task::{Context, Poll},
1313
};
@@ -96,7 +96,7 @@ impl ExecInput {
9696

9797
if all_tx_cnt == 0 {
9898
// if there is no more transaction return back.
99-
return Ok((first_tx_num..first_tx_num, start_block..=target_block, true))
99+
return Ok((first_tx_num..first_tx_num, start_block..=target_block, true));
100100
}
101101

102102
// get block of this tx
@@ -247,12 +247,14 @@ pub trait Stage<DB: Database>: Send + Sync {
247247
}
248248

249249
/// [Stage] trait extension.
250-
#[async_trait::async_trait]
251250
pub trait StageExt<DB: Database>: Stage<DB> {
252251
/// Utility extension for the `Stage` trait that invokes `Stage::poll_execute_ready`
253252
/// with [poll_fn] context. For more information see [Stage::poll_execute_ready].
254-
async fn execute_ready(&mut self, input: ExecInput) -> Result<(), StageError> {
255-
poll_fn(|cx| self.poll_execute_ready(cx, input)).await
253+
fn execute_ready(
254+
&mut self,
255+
input: ExecInput,
256+
) -> impl Future<Output = Result<(), StageError>> + Send {
257+
poll_fn(move |cx| self.poll_execute_ready(cx, input))
256258
}
257259
}
258260

crates/stages/src/stages/bodies.rs

-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ mod tests {
565565
}
566566
}
567567

568-
#[async_trait::async_trait]
569568
impl ExecuteStageTestRunner for BodyTestRunner {
570569
type Seed = Vec<SealedBlock>;
571570

crates/stages/src/stages/hashing_account.rs

-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ mod tests {
520520
}
521521
}
522522

523-
#[async_trait::async_trait]
524523
impl ExecuteStageTestRunner for AccountHashingTestRunner {
525524
type Seed = Vec<(Address, Account)>;
526525

crates/stages/src/stages/hashing_storage.rs

-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ mod tests {
477477
}
478478
}
479479

480-
#[async_trait::async_trait]
481480
impl ExecuteStageTestRunner for StorageHashingTestRunner {
482481
type Seed = Vec<SealedBlock>;
483482

crates/stages/src/stages/headers.rs

-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ mod tests {
382382
}
383383
}
384384

385-
#[async_trait::async_trait]
386385
impl<D: HeaderDownloader + 'static> ExecuteStageTestRunner for HeadersTestRunner<D> {
387386
type Seed = Vec<SealedHeader>;
388387

crates/stages/src/stages/merkle.rs

-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ mod tests {
457457
}
458458
}
459459

460-
#[async_trait::async_trait]
461460
impl ExecuteStageTestRunner for MerkleTestRunner {
462461
type Seed = Vec<SealedBlock>;
463462

crates/stages/src/stages/total_difficulty.rs

-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ mod tests {
224224
}
225225
}
226226

227-
#[async_trait::async_trait]
228227
impl ExecuteStageTestRunner for TotalDifficultyTestRunner {
229228
type Seed = Vec<SealedHeader>;
230229

crates/stages/src/test_utils/runner.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub(crate) trait StageTestRunner {
2727
fn stage(&self) -> Self::S;
2828
}
2929

30-
#[async_trait::async_trait]
3130
pub(crate) trait ExecuteStageTestRunner: StageTestRunner {
3231
type Seed: Send + Sync;
3332

@@ -63,7 +62,6 @@ pub(crate) trait ExecuteStageTestRunner: StageTestRunner {
6362
}
6463
}
6564

66-
#[async_trait::async_trait]
6765
pub(crate) trait UnwindStageTestRunner: StageTestRunner {
6866
/// Validate the unwind
6967
fn validate_unwind(&self, input: UnwindInput) -> Result<(), TestRunnerError>;
@@ -78,7 +76,7 @@ pub(crate) trait UnwindStageTestRunner: StageTestRunner {
7876
provider.commit().expect("failed to commit");
7977
tx.send(result).expect("failed to send result");
8078
});
81-
Box::pin(rx).await.unwrap()
79+
rx.await.unwrap()
8280
}
8381

8482
/// Run a hook before [Stage::unwind]. Required for MerkleStage.

crates/storage/codecs/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
77
)]
88
#![warn(unused_crate_dependencies)]
9+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
10+
#![allow(unknown_lints, non_local_definitions)]
911
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1012
#![cfg_attr(not(feature = "std"), no_std)]
1113

crates/storage/db/src/tables/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
//!
1313
//! TODO(onbjerg): Find appropriate format for this...
1414
15+
// TODO: remove when https://github.com/proptest-rs/proptest/pull/427 is merged
16+
#![allow(unknown_lints, non_local_definitions)]
17+
1518
pub mod codecs;
1619
pub mod models;
1720

crates/transaction-pool/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ where
417417
self.pool.get_pooled_transaction_elements(tx_hashes, limit)
418418
}
419419

420+
fn get_pooled_transaction_element(&self, tx_hash: TxHash) -> Option<PooledTransactionsElement> {
421+
self.pool.get_pooled_transaction_element(tx_hash)
422+
}
423+
420424
fn best_transactions(
421425
&self,
422426
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>> {

crates/transaction-pool/src/noop.rs

+7
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ impl TransactionPool for NoopTransactionPool {
135135
vec![]
136136
}
137137

138+
fn get_pooled_transaction_element(
139+
&self,
140+
_tx_hash: TxHash,
141+
) -> Option<PooledTransactionsElement> {
142+
None
143+
}
144+
138145
fn best_transactions(
139146
&self,
140147
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>> {

crates/transaction-pool/src/pool/mod.rs

+15
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,21 @@ where
341341
elements
342342
}
343343

344+
/// Returns converted [PooledTransactionsElement] for the given transaction hash.
345+
pub(crate) fn get_pooled_transaction_element(
346+
&self,
347+
tx_hash: TxHash,
348+
) -> Option<PooledTransactionsElement> {
349+
self.get(&tx_hash).and_then(|transaction| {
350+
let tx = transaction.to_recovered_transaction().into_signed();
351+
if tx.is_eip4844() {
352+
self.get_blob_transaction(tx).map(PooledTransactionsElement::BlobTransaction)
353+
} else {
354+
Some(PooledTransactionsElement::from(tx))
355+
}
356+
})
357+
}
358+
344359
/// Updates the entire pool after a new block was executed.
345360
pub(crate) fn on_canonical_state_change(&self, update: CanonicalStateUpdate<'_>) {
346361
trace!(target: "txpool", ?update, "updating pool on canonical state change");

crates/transaction-pool/src/traits.rs

+10
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ pub trait TransactionPool: Send + Sync + Clone {
221221
limit: GetPooledTransactionLimit,
222222
) -> Vec<PooledTransactionsElement>;
223223

224+
/// Returns converted [PooledTransactionsElement] for the given transaction hash.
225+
///
226+
/// This adheres to the expected behavior of
227+
/// [`GetPooledTransactions`](https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getpooledtransactions-0x09):
228+
///
229+
/// If the transaction is a blob transaction, the sidecar will be included.
230+
///
231+
/// Consumer: P2P
232+
fn get_pooled_transaction_element(&self, tx_hash: TxHash) -> Option<PooledTransactionsElement>;
233+
224234
/// Returns an iterator that yields transactions that are ready for block production.
225235
///
226236
/// Consumer: Block production

docs/crates/network.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ struct Peer {
834834

835835
Note that the `Peer` struct contains a field `transactions`, which is an [LRU cache](https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)) of the transactions this peer is aware of.
836836

837-
The `request_tx` field on the `Peer` is used at the sender end of a channel to send requests to the session with the peer.
837+
The `request_tx` field on the `Peer` is used as the sender end of a channel to send requests to the session with the peer.
838838

839839
After the `Peer` is added to `TransactionsManager.peers`, the hashes of all of the transactions in the node's transaction pool are sent to the peer in a [`NewPooledTransactionHashes` message](https://github.com/ethereum/devp2p/blob/master/caps/eth.md#newpooledtransactionhashes-0x08).
840840

@@ -911,7 +911,7 @@ fn propagate_transactions(
911911
) -> PropagatedTransactions {
912912
let mut propagated = PropagatedTransactions::default();
913913
914-
// send full transactions to a fraction fo the connected peers (square root of the total
914+
// send full transactions to a fraction of the connected peers (square root of the total
915915
// number of connected peers)
916916
let max_num_full = (self.peers.len() as f64).sqrt() as usize + 1;
917917

0 commit comments

Comments
 (0)