mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: use primitive transaction as PoolTransaction::Consensus (#13086)
This commit is contained in:
@ -19,12 +19,13 @@ use reth_payload_builder_primitives::PayloadBuilderError;
|
||||
use reth_payload_primitives::PayloadBuilderAttributes;
|
||||
use reth_payload_util::PayloadTransactions;
|
||||
use reth_primitives::{
|
||||
proofs, Block, BlockBody, BlockExt, Receipt, SealedHeader, TransactionSigned, TxType,
|
||||
proofs, transaction::SignedTransactionIntoRecoveredExt, Block, BlockBody, BlockExt, Receipt,
|
||||
SealedHeader, TransactionSigned, TxType,
|
||||
};
|
||||
use reth_provider::{ProviderError, StateProofProvider, StateProviderFactory, StateRootProvider};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_transaction_pool::{
|
||||
noop::NoopTransactionPool, BestTransactionsAttributes, TransactionPool,
|
||||
noop::NoopTransactionPool, BestTransactionsAttributes, PoolTransaction, TransactionPool,
|
||||
};
|
||||
use reth_trie::HashedPostState;
|
||||
use revm::{
|
||||
@ -112,7 +113,7 @@ where
|
||||
) -> Result<BuildOutcome<OpBuiltPayload>, PayloadBuilderError>
|
||||
where
|
||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = OpChainSpec>,
|
||||
Pool: TransactionPool,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||
{
|
||||
let (initialized_cfg, initialized_block_env) = self
|
||||
.cfg_and_block_env(&args.config.attributes, &args.config.parent_header)
|
||||
@ -213,7 +214,7 @@ where
|
||||
impl<Pool, Client, EvmConfig, Txs> PayloadBuilder<Pool, Client> for OpPayloadBuilder<EvmConfig, Txs>
|
||||
where
|
||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = OpChainSpec>,
|
||||
Pool: TransactionPool,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
Txs: OpPayloadTransactions,
|
||||
{
|
||||
@ -281,7 +282,7 @@ pub struct OpBuilder<Pool, Txs> {
|
||||
|
||||
impl<Pool, Txs> OpBuilder<Pool, Txs>
|
||||
where
|
||||
Pool: TransactionPool,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||
Txs: OpPayloadTransactions,
|
||||
{
|
||||
/// Executes the payload and returns the outcome.
|
||||
@ -479,19 +480,23 @@ where
|
||||
pub trait OpPayloadTransactions: Clone + Send + Sync + Unpin + 'static {
|
||||
/// Returns an iterator that yields the transaction in the order they should get included in the
|
||||
/// new payload.
|
||||
fn best_transactions<Pool: TransactionPool>(
|
||||
fn best_transactions<
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||
>(
|
||||
&self,
|
||||
pool: Pool,
|
||||
attr: BestTransactionsAttributes,
|
||||
) -> impl PayloadTransactions;
|
||||
) -> impl PayloadTransactions<Transaction = TransactionSigned>;
|
||||
}
|
||||
|
||||
impl OpPayloadTransactions for () {
|
||||
fn best_transactions<Pool: TransactionPool>(
|
||||
fn best_transactions<
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||
>(
|
||||
&self,
|
||||
pool: Pool,
|
||||
attr: BestTransactionsAttributes,
|
||||
) -> impl PayloadTransactions {
|
||||
) -> impl PayloadTransactions<Transaction = TransactionSigned> {
|
||||
BestPayloadTransactions::new(pool.best_transactions_with_attributes(attr))
|
||||
}
|
||||
}
|
||||
@ -830,11 +835,10 @@ where
|
||||
&self,
|
||||
info: &mut ExecutionInfo,
|
||||
db: &mut State<DB>,
|
||||
mut best_txs: impl PayloadTransactions,
|
||||
mut best_txs: impl PayloadTransactions<Transaction = TransactionSigned>,
|
||||
) -> Result<Option<()>, PayloadBuilderError>
|
||||
where
|
||||
DB: Database<Error = ProviderError>,
|
||||
Pool: TransactionPool,
|
||||
{
|
||||
let block_gas_limit = self.block_gas_limit();
|
||||
let base_fee = self.base_fee();
|
||||
|
||||
Reference in New Issue
Block a user