mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
feat(op, txpool): introduce OpPooledTx trait (#14926)
This commit is contained in:
@@ -40,7 +40,7 @@ use reth_optimism_rpc::{
|
||||
witness::{DebugExecutionWitnessApiServer, OpDebugWitnessApi},
|
||||
OpEthApi, OpEthApiError, SequencerClient,
|
||||
};
|
||||
use reth_optimism_txpool::conditional::MaybeConditionalTransaction;
|
||||
use reth_optimism_txpool::{conditional::MaybeConditionalTransaction, OpPooledTx};
|
||||
use reth_provider::{providers::ProviderFactoryBuilder, CanonStateSubscriptions, EthStorage};
|
||||
use reth_rpc_eth_api::ext::L2EthApiExtServer;
|
||||
use reth_rpc_eth_types::error::FromEvmError;
|
||||
@@ -280,7 +280,7 @@ where
|
||||
Evm: ConfigureEvm<NextBlockEnvCtx = OpNextBlockEnvAttributes>,
|
||||
>,
|
||||
OpEthApiError: FromEvmError<N::Evm>,
|
||||
<N::Pool as TransactionPool>::Transaction: MaybeConditionalTransaction,
|
||||
<N::Pool as TransactionPool>::Transaction: OpPooledTx,
|
||||
EvmFactoryFor<N::Evm>: EvmFactory<Tx = op_revm::OpTransaction<TxEnv>>,
|
||||
{
|
||||
type Handle = RpcHandle<N, OpEthApi<N>>;
|
||||
@@ -352,7 +352,7 @@ where
|
||||
Evm: ConfigureEvm<NextBlockEnvCtx = OpNextBlockEnvAttributes>,
|
||||
>,
|
||||
OpEthApiError: FromEvmError<N::Evm>,
|
||||
<<N as FullNodeComponents>::Pool as TransactionPool>::Transaction: MaybeConditionalTransaction,
|
||||
<<N as FullNodeComponents>::Pool as TransactionPool>::Transaction: OpPooledTx,
|
||||
EvmFactoryFor<N::Evm>: EvmFactory<Tx = op_revm::OpTransaction<TxEnv>>,
|
||||
{
|
||||
type EthApi = OpEthApi<N>;
|
||||
@@ -680,6 +680,7 @@ where
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Txs: OpPayloadTransactions<Pool::Transaction>,
|
||||
<Pool as TransactionPool>::Transaction: OpPooledTx,
|
||||
{
|
||||
type PayloadBuilder =
|
||||
reth_optimism_payload_builder::OpPayloadBuilder<Pool, Node::Provider, OpEvmConfig, Txs>;
|
||||
|
||||
@@ -33,6 +33,7 @@ reth-payload-validator.workspace = true
|
||||
reth-optimism-evm.workspace = true
|
||||
reth-optimism-forks.workspace = true
|
||||
reth-optimism-primitives = { workspace = true, features = ["reth-codec"] }
|
||||
reth-optimism-txpool.workspace = true
|
||||
|
||||
# ethereum
|
||||
revm.workspace = true
|
||||
|
||||
@@ -25,6 +25,7 @@ use reth_execution_types::ExecutionOutcome;
|
||||
use reth_optimism_evm::OpNextBlockEnvAttributes;
|
||||
use reth_optimism_forks::OpHardforks;
|
||||
use reth_optimism_primitives::transaction::signed::OpTransaction;
|
||||
use reth_optimism_txpool::OpPooledTx;
|
||||
use reth_payload_builder_primitives::PayloadBuilderError;
|
||||
use reth_payload_primitives::PayloadBuilderAttributes;
|
||||
use reth_payload_util::{BestPayloadTransactions, NoopPayloadTransactions, PayloadTransactions};
|
||||
@@ -121,7 +122,7 @@ impl<Pool, Client, Evm, Txs> OpPayloadBuilder<Pool, Client, Evm, Txs> {
|
||||
|
||||
impl<Pool, Client, Evm, N, T> OpPayloadBuilder<Pool, Client, Evm, T>
|
||||
where
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = N::SignedTx>>,
|
||||
Pool: TransactionPool<Transaction: OpPooledTx<Consensus = N::SignedTx>>,
|
||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec: EthChainSpec + OpHardforks>,
|
||||
N: OpPayloadPrimitives,
|
||||
Evm: ConfigureEvm<Primitives = N, NextBlockEnvCtx = OpNextBlockEnvAttributes>,
|
||||
@@ -198,7 +199,7 @@ impl<Pool, Client, Evm, N, Txs> PayloadBuilder for OpPayloadBuilder<Pool, Client
|
||||
where
|
||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec: EthChainSpec + OpHardforks> + Clone,
|
||||
N: OpPayloadPrimitives,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = N::SignedTx>>,
|
||||
Pool: TransactionPool<Transaction: OpPooledTx<Consensus = N::SignedTx>>,
|
||||
Evm: ConfigureEvm<Primitives = N, NextBlockEnvCtx = OpNextBlockEnvAttributes>,
|
||||
Txs: OpPayloadTransactions<Pool::Transaction>,
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ use reth_node_api::NodePrimitives;
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_evm::OpNextBlockEnvAttributes;
|
||||
use reth_optimism_payload_builder::{OpPayloadBuilder, OpPayloadPrimitives};
|
||||
use reth_optimism_txpool::OpPooledTx;
|
||||
use reth_primitives_traits::SealedHeader;
|
||||
use reth_provider::{
|
||||
BlockReaderIdExt, NodePrimitivesProvider, ProviderError, ProviderResult, StateProviderFactory,
|
||||
@@ -17,7 +18,7 @@ use reth_provider::{
|
||||
pub use reth_rpc_api::DebugExecutionWitnessApiServer;
|
||||
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
||||
use reth_tasks::TaskSpawner;
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
use tokio::sync::{oneshot, Semaphore};
|
||||
|
||||
@@ -58,9 +59,7 @@ impl<Pool, Provider, EvmConfig> DebugExecutionWitnessApiServer<OpPayloadAttribut
|
||||
for OpDebugWitnessApi<Pool, Provider, EvmConfig>
|
||||
where
|
||||
Pool: TransactionPool<
|
||||
Transaction: PoolTransaction<
|
||||
Consensus = <Provider::Primitives as NodePrimitives>::SignedTx,
|
||||
>,
|
||||
Transaction: OpPooledTx<Consensus = <Provider::Primitives as NodePrimitives>::SignedTx>,
|
||||
> + 'static,
|
||||
Provider: BlockReaderIdExt<Header = alloy_consensus::Header>
|
||||
+ NodePrimitivesProvider<Primitives: OpPayloadPrimitives>
|
||||
|
||||
@@ -13,7 +13,7 @@ pub use validator::{OpL1BlockInfo, OpTransactionValidator};
|
||||
|
||||
pub mod conditional;
|
||||
mod transaction;
|
||||
pub use transaction::OpPooledTransaction;
|
||||
pub use transaction::{OpPooledTransaction, OpPooledTx};
|
||||
pub mod maintain;
|
||||
|
||||
use reth_transaction_pool::{CoinbaseTipOrdering, Pool, TransactionValidationTaskExecutor};
|
||||
|
||||
@@ -244,6 +244,17 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper trait to provide payload builder with access to conditionals and encoded bytes of
|
||||
/// transaction.
|
||||
pub trait OpPooledTx: MaybeConditionalTransaction + PoolTransaction {}
|
||||
|
||||
impl<Cons, Pooled> OpPooledTx for OpPooledTransaction<Cons, Pooled>
|
||||
where
|
||||
Cons: SignedTransaction + From<Pooled>,
|
||||
Pooled: SignedTransaction + TryFrom<Cons, Error: core::error::Error>,
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{OpPooledTransaction, OpTransactionValidator};
|
||||
|
||||
Reference in New Issue
Block a user