mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: Add Transaction AT to ConfigureEvm (#13106)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -9031,6 +9031,7 @@ dependencies = [
|
|||||||
"reth-network-api",
|
"reth-network-api",
|
||||||
"reth-node-api",
|
"reth-node-api",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
|
"reth-primitives-traits",
|
||||||
"reth-provider",
|
"reth-provider",
|
||||||
"reth-revm",
|
"reth-revm",
|
||||||
"reth-rpc-eth-types",
|
"reth-rpc-eth-types",
|
||||||
|
|||||||
@ -8,8 +8,8 @@ use reth_engine_primitives::InvalidBlockHook;
|
|||||||
use reth_evm::{
|
use reth_evm::{
|
||||||
state_change::post_block_balance_increments, system_calls::SystemCaller, ConfigureEvm,
|
state_change::post_block_balance_increments, system_calls::SystemCaller, ConfigureEvm,
|
||||||
};
|
};
|
||||||
use reth_primitives::{NodePrimitives, SealedBlockWithSenders, SealedHeader, TransactionSigned};
|
use reth_primitives::{NodePrimitives, SealedBlockWithSenders, SealedHeader};
|
||||||
use reth_primitives_traits::{HeaderTy, SignedTransaction};
|
use reth_primitives_traits::SignedTransaction;
|
||||||
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
|
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
|
||||||
use reth_revm::{
|
use reth_revm::{
|
||||||
database::StateProviderDatabase, db::states::bundle_state::BundleRetention,
|
database::StateProviderDatabase, db::states::bundle_state::BundleRetention,
|
||||||
@ -63,8 +63,8 @@ where
|
|||||||
trie_updates: Option<(&TrieUpdates, B256)>,
|
trie_updates: Option<(&TrieUpdates, B256)>,
|
||||||
) -> eyre::Result<()>
|
) -> eyre::Result<()>
|
||||||
where
|
where
|
||||||
N: NodePrimitives<SignedTx = TransactionSigned>,
|
N: NodePrimitives,
|
||||||
EvmConfig: ConfigureEvm<Header = N::BlockHeader>,
|
EvmConfig: ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>,
|
||||||
{
|
{
|
||||||
// TODO(alexey): unify with `DebugApi::debug_execution_witness`
|
// TODO(alexey): unify with `DebugApi::debug_execution_witness`
|
||||||
|
|
||||||
@ -298,13 +298,13 @@ where
|
|||||||
|
|
||||||
impl<P, EvmConfig, N> InvalidBlockHook<N> for InvalidBlockWitnessHook<P, EvmConfig>
|
impl<P, EvmConfig, N> InvalidBlockHook<N> for InvalidBlockWitnessHook<P, EvmConfig>
|
||||||
where
|
where
|
||||||
N: NodePrimitives<SignedTx = TransactionSigned>,
|
N: NodePrimitives,
|
||||||
P: StateProviderFactory
|
P: StateProviderFactory
|
||||||
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
||||||
+ Send
|
+ Send
|
||||||
+ Sync
|
+ Sync
|
||||||
+ 'static,
|
+ 'static,
|
||||||
EvmConfig: ConfigureEvm<Header = HeaderTy<N>>,
|
EvmConfig: ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>,
|
||||||
{
|
{
|
||||||
fn on_invalid_block(
|
fn on_invalid_block(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@ -110,7 +110,7 @@ where
|
|||||||
S: Stream<Item = BeaconEngineMessage<Engine>>,
|
S: Stream<Item = BeaconEngineMessage<Engine>>,
|
||||||
Engine: EngineTypes,
|
Engine: EngineTypes,
|
||||||
Provider: BlockReader<Block = reth_primitives::Block> + StateProviderFactory,
|
Provider: BlockReader<Block = reth_primitives::Block> + StateProviderFactory,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = reth_primitives::TransactionSigned>,
|
||||||
Spec: EthereumHardforks,
|
Spec: EthereumHardforks,
|
||||||
{
|
{
|
||||||
type Item = S::Item;
|
type Item = S::Item;
|
||||||
@ -257,7 +257,7 @@ fn create_reorg_head<Provider, Evm, Spec>(
|
|||||||
) -> RethResult<(ExecutionPayload, ExecutionPayloadSidecar)>
|
) -> RethResult<(ExecutionPayload, ExecutionPayloadSidecar)>
|
||||||
where
|
where
|
||||||
Provider: BlockReader<Block = reth_primitives::Block> + StateProviderFactory,
|
Provider: BlockReader<Block = reth_primitives::Block> + StateProviderFactory,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = reth_primitives::TransactionSigned>,
|
||||||
Spec: EthereumHardforks,
|
Spec: EthereumHardforks,
|
||||||
{
|
{
|
||||||
let chain_spec = payload_validator.chain_spec();
|
let chain_spec = payload_validator.chain_spec();
|
||||||
|
|||||||
@ -58,8 +58,15 @@ impl<EvmConfig> EthExecutionStrategyFactory<EvmConfig> {
|
|||||||
|
|
||||||
impl<EvmConfig> BlockExecutionStrategyFactory for EthExecutionStrategyFactory<EvmConfig>
|
impl<EvmConfig> BlockExecutionStrategyFactory for EthExecutionStrategyFactory<EvmConfig>
|
||||||
where
|
where
|
||||||
EvmConfig:
|
EvmConfig: Clone
|
||||||
Clone + Unpin + Sync + Send + 'static + ConfigureEvm<Header = alloy_consensus::Header>,
|
+ Unpin
|
||||||
|
+ Sync
|
||||||
|
+ Send
|
||||||
|
+ 'static
|
||||||
|
+ ConfigureEvm<
|
||||||
|
Header = alloy_consensus::Header,
|
||||||
|
Transaction = reth_primitives::TransactionSigned,
|
||||||
|
>,
|
||||||
{
|
{
|
||||||
type Primitives = EthPrimitives;
|
type Primitives = EthPrimitives;
|
||||||
|
|
||||||
@ -128,7 +135,10 @@ where
|
|||||||
impl<DB, EvmConfig> BlockExecutionStrategy for EthExecutionStrategy<DB, EvmConfig>
|
impl<DB, EvmConfig> BlockExecutionStrategy for EthExecutionStrategy<DB, EvmConfig>
|
||||||
where
|
where
|
||||||
DB: Database<Error: Into<ProviderError> + Display>,
|
DB: Database<Error: Into<ProviderError> + Display>,
|
||||||
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header>,
|
EvmConfig: ConfigureEvm<
|
||||||
|
Header = alloy_consensus::Header,
|
||||||
|
Transaction = reth_primitives::TransactionSigned,
|
||||||
|
>,
|
||||||
{
|
{
|
||||||
type DB = DB;
|
type DB = DB;
|
||||||
type Error = BlockExecutionError;
|
type Error = BlockExecutionError;
|
||||||
|
|||||||
@ -62,6 +62,7 @@ impl EthEvmConfig {
|
|||||||
|
|
||||||
impl ConfigureEvmEnv for EthEvmConfig {
|
impl ConfigureEvmEnv for EthEvmConfig {
|
||||||
type Header = Header;
|
type Header = Header;
|
||||||
|
type Transaction = TransactionSigned;
|
||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
|
|
||||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
||||||
|
|||||||
@ -32,8 +32,6 @@ reth-primitives.workspace = true
|
|||||||
reth-revm = { workspace = true, features = ["std"] }
|
reth-revm = { workspace = true, features = ["std"] }
|
||||||
reth-trie-db.workspace = true
|
reth-trie-db.workspace = true
|
||||||
|
|
||||||
alloy-consensus.workspace = true
|
|
||||||
|
|
||||||
# revm with required ethereum features
|
# revm with required ethereum features
|
||||||
revm = { workspace = true, features = ["secp256k1", "blst", "c-kzg"] }
|
revm = { workspace = true, features = ["secp256k1", "blst", "c-kzg"] }
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use alloy_consensus::Header;
|
|
||||||
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
|
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
|
||||||
use reth_beacon_consensus::EthBeaconConsensus;
|
use reth_beacon_consensus::EthBeaconConsensus;
|
||||||
use reth_chainspec::ChainSpec;
|
use reth_chainspec::ChainSpec;
|
||||||
@ -13,7 +12,8 @@ use reth_evm::execute::BasicBlockExecutorProvider;
|
|||||||
use reth_evm_ethereum::execute::EthExecutionStrategyFactory;
|
use reth_evm_ethereum::execute::EthExecutionStrategyFactory;
|
||||||
use reth_network::{NetworkHandle, PeersInfo};
|
use reth_network::{NetworkHandle, PeersInfo};
|
||||||
use reth_node_api::{
|
use reth_node_api::{
|
||||||
AddOnsContext, ConfigureEvm, EngineValidator, FullNodeComponents, NodeTypesWithDB, TxTy,
|
AddOnsContext, ConfigureEvm, EngineValidator, FullNodeComponents, HeaderTy, NodeTypesWithDB,
|
||||||
|
TxTy,
|
||||||
};
|
};
|
||||||
use reth_node_builder::{
|
use reth_node_builder::{
|
||||||
components::{
|
components::{
|
||||||
@ -242,7 +242,7 @@ impl EthereumPayloadBuilder {
|
|||||||
where
|
where
|
||||||
Types: NodeTypesWithEngine<ChainSpec = ChainSpec, Primitives = EthPrimitives>,
|
Types: NodeTypesWithEngine<ChainSpec = ChainSpec, Primitives = EthPrimitives>,
|
||||||
Node: FullNodeTypes<Types = Types>,
|
Node: FullNodeTypes<Types = Types>,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = HeaderTy<Types>, Transaction = TxTy<Node::Types>>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
|
|||||||
@ -91,7 +91,7 @@ where
|
|||||||
// Default implementation of [PayloadBuilder] for unit type
|
// Default implementation of [PayloadBuilder] for unit type
|
||||||
impl<EvmConfig, Pool, Client> PayloadBuilder<Pool, Client> for EthereumPayloadBuilder<EvmConfig>
|
impl<EvmConfig, Pool, Client> PayloadBuilder<Pool, Client> for EthereumPayloadBuilder<EvmConfig>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
|
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||||
{
|
{
|
||||||
@ -155,7 +155,7 @@ pub fn default_ethereum_payload<EvmConfig, Pool, Client, F>(
|
|||||||
best_txs: F,
|
best_txs: F,
|
||||||
) -> Result<BuildOutcome<EthBuiltPayload>, PayloadBuilderError>
|
) -> Result<BuildOutcome<EthBuiltPayload>, PayloadBuilderError>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
|
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||||
F: FnOnce(BestTransactionsAttributes) -> BestTransactionsIter<Pool>,
|
F: FnOnce(BestTransactionsAttributes) -> BestTransactionsIter<Pool>,
|
||||||
|
|||||||
@ -20,7 +20,6 @@ extern crate alloc;
|
|||||||
use crate::builder::RethEvmBuilder;
|
use crate::builder::RethEvmBuilder;
|
||||||
use alloy_consensus::BlockHeader as _;
|
use alloy_consensus::BlockHeader as _;
|
||||||
use alloy_primitives::{Address, Bytes, B256, U256};
|
use alloy_primitives::{Address, Bytes, B256, U256};
|
||||||
use reth_primitives::TransactionSigned;
|
|
||||||
use reth_primitives_traits::BlockHeader;
|
use reth_primitives_traits::BlockHeader;
|
||||||
use revm::{Database, Evm, GetInspector};
|
use revm::{Database, Evm, GetInspector};
|
||||||
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg, SpecId, TxEnv};
|
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, Env, EnvWithHandlerCfg, SpecId, TxEnv};
|
||||||
@ -116,18 +115,21 @@ pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static {
|
|||||||
/// The header type used by the EVM.
|
/// The header type used by the EVM.
|
||||||
type Header: BlockHeader;
|
type Header: BlockHeader;
|
||||||
|
|
||||||
|
/// The transaction type.
|
||||||
|
type Transaction;
|
||||||
|
|
||||||
/// The error type that is returned by [`Self::next_cfg_and_block_env`].
|
/// The error type that is returned by [`Self::next_cfg_and_block_env`].
|
||||||
type Error: core::error::Error + Send + Sync;
|
type Error: core::error::Error + Send + Sync;
|
||||||
|
|
||||||
/// Returns a [`TxEnv`] from a [`TransactionSigned`] and [`Address`].
|
/// Returns a [`TxEnv`] from a transaction and [`Address`].
|
||||||
fn tx_env(&self, transaction: &TransactionSigned, signer: Address) -> TxEnv {
|
fn tx_env(&self, transaction: &Self::Transaction, signer: Address) -> TxEnv {
|
||||||
let mut tx_env = TxEnv::default();
|
let mut tx_env = TxEnv::default();
|
||||||
self.fill_tx_env(&mut tx_env, transaction, signer);
|
self.fill_tx_env(&mut tx_env, transaction, signer);
|
||||||
tx_env
|
tx_env
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fill transaction environment from a [`TransactionSigned`] and the given sender address.
|
/// Fill transaction environment from a transaction and the given sender address.
|
||||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address);
|
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &Self::Transaction, sender: Address);
|
||||||
|
|
||||||
/// Fill transaction environment with a system contract call.
|
/// Fill transaction environment with a system contract call.
|
||||||
fn fill_tx_env_system_contract_call(
|
fn fill_tx_env_system_contract_call(
|
||||||
|
|||||||
@ -49,7 +49,7 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
|
|||||||
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Self::Types>>> + Unpin;
|
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Self::Types>>> + Unpin;
|
||||||
|
|
||||||
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
||||||
type Evm: ConfigureEvm<Header = HeaderTy<Self::Types>>;
|
type Evm: ConfigureEvm<Header = HeaderTy<Self::Types>, Transaction = TxTy<Self::Types>>;
|
||||||
|
|
||||||
/// The type that knows how to execute blocks.
|
/// The type that knows how to execute blocks.
|
||||||
type Executor: BlockExecutorProvider<Primitives = <Self::Types as NodeTypes>::Primitives>;
|
type Executor: BlockExecutorProvider<Primitives = <Self::Types as NodeTypes>::Primitives>;
|
||||||
|
|||||||
@ -377,7 +377,7 @@ where
|
|||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>>,
|
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
//! EVM component for the node builder.
|
//! EVM component for the node builder.
|
||||||
use crate::{BuilderContext, FullNodeTypes};
|
use crate::{BuilderContext, FullNodeTypes};
|
||||||
use reth_evm::execute::BlockExecutorProvider;
|
use reth_evm::execute::BlockExecutorProvider;
|
||||||
use reth_node_api::{ConfigureEvm, HeaderTy};
|
use reth_node_api::{ConfigureEvm, HeaderTy, TxTy};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
||||||
/// A type that knows how to build the executor types.
|
/// A type that knows how to build the executor types.
|
||||||
@ -9,7 +9,7 @@ pub trait ExecutorBuilder<Node: FullNodeTypes>: Send {
|
|||||||
/// The EVM config to use.
|
/// The EVM config to use.
|
||||||
///
|
///
|
||||||
/// This provides the node with the necessary configuration to configure an EVM.
|
/// This provides the node with the necessary configuration to configure an EVM.
|
||||||
type EVM: ConfigureEvm<Header = HeaderTy<Node::Types>>;
|
type EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>;
|
||||||
|
|
||||||
/// The type that knows how to execute blocks.
|
/// The type that knows how to execute blocks.
|
||||||
type Executor: BlockExecutorProvider<
|
type Executor: BlockExecutorProvider<
|
||||||
@ -26,7 +26,7 @@ pub trait ExecutorBuilder<Node: FullNodeTypes>: Send {
|
|||||||
impl<Node, F, Fut, EVM, Executor> ExecutorBuilder<Node> for F
|
impl<Node, F, Fut, EVM, Executor> ExecutorBuilder<Node> for F
|
||||||
where
|
where
|
||||||
Node: FullNodeTypes,
|
Node: FullNodeTypes,
|
||||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>>,
|
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||||
Executor:
|
Executor:
|
||||||
BlockExecutorProvider<Primitives = <Node::Types as reth_node_api::NodeTypes>::Primitives>,
|
BlockExecutorProvider<Primitives = <Node::Types as reth_node_api::NodeTypes>::Primitives>,
|
||||||
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
||||||
|
|||||||
@ -40,7 +40,7 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
|
|||||||
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<T::Types>>> + Unpin;
|
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<T::Types>>> + Unpin;
|
||||||
|
|
||||||
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
||||||
type Evm: ConfigureEvm<Header = HeaderTy<T::Types>>;
|
type Evm: ConfigureEvm<Header = HeaderTy<T::Types>, Transaction = TxTy<T::Types>>;
|
||||||
|
|
||||||
/// The type that knows how to execute blocks.
|
/// The type that knows how to execute blocks.
|
||||||
type Executor: BlockExecutorProvider<Primitives = <T::Types as NodeTypes>::Primitives>;
|
type Executor: BlockExecutorProvider<Primitives = <T::Types as NodeTypes>::Primitives>;
|
||||||
@ -99,7 +99,7 @@ where
|
|||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>>,
|
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ impl<Node, Pool, EVM, Executor, Cons> Clone for Components<Node, Pool, EVM, Exec
|
|||||||
where
|
where
|
||||||
Node: FullNodeTypes,
|
Node: FullNodeTypes,
|
||||||
Pool: TransactionPool,
|
Pool: TransactionPool,
|
||||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>>,
|
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||||
Executor: BlockExecutorProvider,
|
Executor: BlockExecutorProvider,
|
||||||
Cons: Clone,
|
Cons: Clone,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use reth_optimism_chainspec::OpChainSpec;
|
|||||||
use reth_optimism_consensus::validate_block_post_execution;
|
use reth_optimism_consensus::validate_block_post_execution;
|
||||||
use reth_optimism_forks::OpHardfork;
|
use reth_optimism_forks::OpHardfork;
|
||||||
use reth_optimism_primitives::OpPrimitives;
|
use reth_optimism_primitives::OpPrimitives;
|
||||||
use reth_primitives::{BlockWithSenders, Receipt, TxType};
|
use reth_primitives::{BlockWithSenders, Receipt, TransactionSigned, TxType};
|
||||||
use reth_revm::{Database, State};
|
use reth_revm::{Database, State};
|
||||||
use revm_primitives::{db::DatabaseCommit, EnvWithHandlerCfg, ResultAndState, U256};
|
use revm_primitives::{db::DatabaseCommit, EnvWithHandlerCfg, ResultAndState, U256};
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
@ -52,8 +52,12 @@ impl<EvmConfig> OpExecutionStrategyFactory<EvmConfig> {
|
|||||||
|
|
||||||
impl<EvmConfig> BlockExecutionStrategyFactory for OpExecutionStrategyFactory<EvmConfig>
|
impl<EvmConfig> BlockExecutionStrategyFactory for OpExecutionStrategyFactory<EvmConfig>
|
||||||
where
|
where
|
||||||
EvmConfig:
|
EvmConfig: Clone
|
||||||
Clone + Unpin + Sync + Send + 'static + ConfigureEvm<Header = alloy_consensus::Header>,
|
+ Unpin
|
||||||
|
+ Sync
|
||||||
|
+ Send
|
||||||
|
+ 'static
|
||||||
|
+ ConfigureEvm<Header = alloy_consensus::Header, Transaction = TransactionSigned>,
|
||||||
{
|
{
|
||||||
type Primitives = OpPrimitives;
|
type Primitives = OpPrimitives;
|
||||||
type Strategy<DB: Database<Error: Into<ProviderError> + Display>> =
|
type Strategy<DB: Database<Error: Into<ProviderError> + Display>> =
|
||||||
@ -115,7 +119,7 @@ where
|
|||||||
impl<DB, EvmConfig> BlockExecutionStrategy for OpExecutionStrategy<DB, EvmConfig>
|
impl<DB, EvmConfig> BlockExecutionStrategy for OpExecutionStrategy<DB, EvmConfig>
|
||||||
where
|
where
|
||||||
DB: Database<Error: Into<ProviderError> + Display>,
|
DB: Database<Error: Into<ProviderError> + Display>,
|
||||||
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header>,
|
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header, Transaction = TransactionSigned>,
|
||||||
{
|
{
|
||||||
type DB = DB;
|
type DB = DB;
|
||||||
type Primitives = OpPrimitives;
|
type Primitives = OpPrimitives;
|
||||||
|
|||||||
@ -57,6 +57,7 @@ impl OpEvmConfig {
|
|||||||
|
|
||||||
impl ConfigureEvmEnv for OpEvmConfig {
|
impl ConfigureEvmEnv for OpEvmConfig {
|
||||||
type Header = Header;
|
type Header = Header;
|
||||||
|
type Transaction = TransactionSigned;
|
||||||
type Error = DecodeError;
|
type Error = DecodeError;
|
||||||
|
|
||||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ use reth_optimism_rpc::{
|
|||||||
OpEthApi, SequencerClient,
|
OpEthApi, SequencerClient,
|
||||||
};
|
};
|
||||||
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
||||||
use reth_primitives::BlockBody;
|
use reth_primitives::{BlockBody, TransactionSigned};
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
providers::ChainStorage, BlockBodyReader, BlockBodyWriter, CanonStateSubscriptions,
|
providers::ChainStorage, BlockBodyReader, BlockBodyWriter, CanonStateSubscriptions,
|
||||||
ChainSpecProvider, DBProvider, EthStorage, ProviderResult, ReadBodyInput,
|
ChainSpecProvider, DBProvider, EthStorage, ProviderResult, ReadBodyInput,
|
||||||
@ -468,7 +468,7 @@ where
|
|||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
{
|
{
|
||||||
let payload_builder = reth_optimism_payload_builder::OpPayloadBuilder::new(evm_config)
|
let payload_builder = reth_optimism_payload_builder::OpPayloadBuilder::new(evm_config)
|
||||||
.with_transactions(self.best_transactions)
|
.with_transactions(self.best_transactions)
|
||||||
|
|||||||
@ -98,7 +98,7 @@ impl<EvmConfig, Txs> OpPayloadBuilder<EvmConfig, Txs> {
|
|||||||
}
|
}
|
||||||
impl<EvmConfig, Txs> OpPayloadBuilder<EvmConfig, Txs>
|
impl<EvmConfig, Txs> OpPayloadBuilder<EvmConfig, Txs>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
Txs: OpPayloadTransactions,
|
Txs: OpPayloadTransactions,
|
||||||
{
|
{
|
||||||
/// Constructs an Optimism payload from the transactions sent via the
|
/// Constructs an Optimism payload from the transactions sent via the
|
||||||
@ -155,7 +155,7 @@ where
|
|||||||
|
|
||||||
impl<EvmConfig, Txs> OpPayloadBuilder<EvmConfig, Txs>
|
impl<EvmConfig, Txs> OpPayloadBuilder<EvmConfig, Txs>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
{
|
{
|
||||||
/// Returns the configured [`CfgEnvWithHandlerCfg`] and [`BlockEnv`] for the targeted payload
|
/// Returns the configured [`CfgEnvWithHandlerCfg`] and [`BlockEnv`] for the targeted payload
|
||||||
/// (that has the `parent` as its parent).
|
/// (that has the `parent` as its parent).
|
||||||
@ -217,7 +217,7 @@ impl<Pool, Client, EvmConfig, Txs> PayloadBuilder<Pool, Client> for OpPayloadBui
|
|||||||
where
|
where
|
||||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = OpChainSpec>,
|
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = OpChainSpec>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TransactionSigned>>,
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
Txs: OpPayloadTransactions,
|
Txs: OpPayloadTransactions,
|
||||||
{
|
{
|
||||||
type Attributes = OpPayloadBuilderAttributes;
|
type Attributes = OpPayloadBuilderAttributes;
|
||||||
@ -294,7 +294,7 @@ where
|
|||||||
ctx: &OpPayloadBuilderCtx<EvmConfig>,
|
ctx: &OpPayloadBuilderCtx<EvmConfig>,
|
||||||
) -> Result<BuildOutcomeKind<ExecutedPayload>, PayloadBuilderError>
|
) -> Result<BuildOutcomeKind<ExecutedPayload>, PayloadBuilderError>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
DB: Database<Error = ProviderError>,
|
DB: Database<Error = ProviderError>,
|
||||||
{
|
{
|
||||||
let Self { pool, best } = self;
|
let Self { pool, best } = self;
|
||||||
@ -339,7 +339,7 @@ where
|
|||||||
ctx: OpPayloadBuilderCtx<EvmConfig>,
|
ctx: OpPayloadBuilderCtx<EvmConfig>,
|
||||||
) -> Result<BuildOutcomeKind<OpBuiltPayload>, PayloadBuilderError>
|
) -> Result<BuildOutcomeKind<OpBuiltPayload>, PayloadBuilderError>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
DB: Database<Error = ProviderError> + AsRef<P>,
|
DB: Database<Error = ProviderError> + AsRef<P>,
|
||||||
P: StateRootProvider + HashedPostStateProvider,
|
P: StateRootProvider + HashedPostStateProvider,
|
||||||
{
|
{
|
||||||
@ -465,7 +465,7 @@ where
|
|||||||
ctx: &OpPayloadBuilderCtx<EvmConfig>,
|
ctx: &OpPayloadBuilderCtx<EvmConfig>,
|
||||||
) -> Result<ExecutionWitness, PayloadBuilderError>
|
) -> Result<ExecutionWitness, PayloadBuilderError>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
DB: Database<Error = ProviderError> + AsRef<P>,
|
DB: Database<Error = ProviderError> + AsRef<P>,
|
||||||
P: StateProofProvider,
|
P: StateProofProvider,
|
||||||
{
|
{
|
||||||
@ -700,7 +700,7 @@ impl<EvmConfig> OpPayloadBuilderCtx<EvmConfig> {
|
|||||||
|
|
||||||
impl<EvmConfig> OpPayloadBuilderCtx<EvmConfig>
|
impl<EvmConfig> OpPayloadBuilderCtx<EvmConfig>
|
||||||
where
|
where
|
||||||
EvmConfig: ConfigureEvm<Header = Header>,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
{
|
{
|
||||||
/// apply eip-4788 pre block contract call
|
/// apply eip-4788 pre block contract call
|
||||||
pub fn apply_pre_beacon_root_contract_call<DB>(
|
pub fn apply_pre_beacon_root_contract_call<DB>(
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use alloy_primitives::{BlockNumber, B256};
|
|||||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||||
use reth_evm::ConfigureEvm;
|
use reth_evm::ConfigureEvm;
|
||||||
use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
|
use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
|
||||||
use reth_primitives::{Receipt, SealedBlockWithSenders};
|
use reth_primitives::{Receipt, SealedBlockWithSenders, TransactionSigned};
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ExecutionOutcome, ProviderTx,
|
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ExecutionOutcome, ProviderTx,
|
||||||
ReceiptProvider, StateProviderFactory,
|
ReceiptProvider, StateProviderFactory,
|
||||||
@ -33,7 +33,7 @@ where
|
|||||||
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
||||||
+ StateProviderFactory,
|
+ StateProviderFactory,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<N::Provider>>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<N::Provider>>>,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
>,
|
>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use reth_chainspec::ChainSpecProvider;
|
|||||||
use reth_evm::ConfigureEvm;
|
use reth_evm::ConfigureEvm;
|
||||||
use reth_optimism_chainspec::OpChainSpec;
|
use reth_optimism_chainspec::OpChainSpec;
|
||||||
use reth_optimism_payload_builder::OpPayloadBuilder;
|
use reth_optimism_payload_builder::OpPayloadBuilder;
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives::{SealedHeader, TransactionSigned};
|
||||||
use reth_provider::{BlockReaderIdExt, ProviderError, ProviderResult, StateProviderFactory};
|
use reth_provider::{BlockReaderIdExt, ProviderError, ProviderResult, StateProviderFactory};
|
||||||
pub use reth_rpc_api::DebugExecutionWitnessApiServer;
|
pub use reth_rpc_api::DebugExecutionWitnessApiServer;
|
||||||
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
||||||
@ -49,7 +49,7 @@ where
|
|||||||
+ StateProviderFactory
|
+ StateProviderFactory
|
||||||
+ ChainSpecProvider<ChainSpec = OpChainSpec>
|
+ ChainSpecProvider<ChainSpec = OpChainSpec>
|
||||||
+ 'static,
|
+ 'static,
|
||||||
EvmConfig: ConfigureEvm<Header = Header> + 'static,
|
EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned> + 'static,
|
||||||
{
|
{
|
||||||
fn execute_payload(
|
fn execute_payload(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
//! Network: NetworkInfo + Peers + Clone + 'static,
|
//! Network: NetworkInfo + Peers + Clone + 'static,
|
||||||
//! Events:
|
//! Events:
|
||||||
//! CanonStateSubscriptions<Primitives = reth_primitives::EthPrimitives> + Clone + 'static,
|
//! CanonStateSubscriptions<Primitives = reth_primitives::EthPrimitives> + Clone + 'static,
|
||||||
//! EvmConfig: ConfigureEvm<Header = Header>,
|
//! EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
//! BlockExecutor: BlockExecutorProvider<Primitives = Events::Primitives>,
|
//! BlockExecutor: BlockExecutorProvider<Primitives = Events::Primitives>,
|
||||||
//! Consensus: reth_consensus::FullConsensus + Clone + 'static,
|
//! Consensus: reth_consensus::FullConsensus + Clone + 'static,
|
||||||
//! {
|
//! {
|
||||||
@ -135,7 +135,7 @@
|
|||||||
//! CanonStateSubscriptions<Primitives = reth_primitives::EthPrimitives> + Clone + 'static,
|
//! CanonStateSubscriptions<Primitives = reth_primitives::EthPrimitives> + Clone + 'static,
|
||||||
//! EngineApi: EngineApiServer<EngineT>,
|
//! EngineApi: EngineApiServer<EngineT>,
|
||||||
//! EngineT: EngineTypes,
|
//! EngineT: EngineTypes,
|
||||||
//! EvmConfig: ConfigureEvm<Header = Header>,
|
//! EvmConfig: ConfigureEvm<Header = Header, Transaction = TransactionSigned>,
|
||||||
//! BlockExecutor: BlockExecutorProvider<Primitives = Events::Primitives>,
|
//! BlockExecutor: BlockExecutorProvider<Primitives = Events::Primitives>,
|
||||||
//! Consensus: reth_consensus::FullConsensus + Clone + 'static,
|
//! Consensus: reth_consensus::FullConsensus + Clone + 'static,
|
||||||
//! {
|
//! {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ workspace = true
|
|||||||
revm.workspace = true
|
revm.workspace = true
|
||||||
revm-inspectors.workspace = true
|
revm-inspectors.workspace = true
|
||||||
revm-primitives = { workspace = true, features = ["dev"] }
|
revm-primitives = { workspace = true, features = ["dev"] }
|
||||||
|
reth-primitives-traits.workspace = true
|
||||||
reth-errors.workspace = true
|
reth-errors.workspace = true
|
||||||
reth-evm.workspace = true
|
reth-evm.workspace = true
|
||||||
reth-primitives.workspace = true
|
reth-primitives.workspace = true
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use futures::Future;
|
|||||||
use reth_chainspec::EthChainSpec;
|
use reth_chainspec::EthChainSpec;
|
||||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||||
use reth_node_api::BlockBody;
|
use reth_node_api::BlockBody;
|
||||||
use reth_primitives::TransactionSigned;
|
use reth_primitives_traits::SignedTransaction;
|
||||||
use reth_provider::{BlockIdReader, ChainSpecProvider, HeaderProvider};
|
use reth_provider::{BlockIdReader, ChainSpecProvider, HeaderProvider};
|
||||||
use reth_revm::{
|
use reth_revm::{
|
||||||
database::StateProviderDatabase,
|
database::StateProviderDatabase,
|
||||||
@ -664,14 +664,15 @@ pub trait Call: LoadState<Evm: ConfigureEvm<Header = Header>> + SpawnBlocking {
|
|||||||
where
|
where
|
||||||
DB: Database + DatabaseCommit,
|
DB: Database + DatabaseCommit,
|
||||||
EthApiError: From<DB::Error>,
|
EthApiError: From<DB::Error>,
|
||||||
I: IntoIterator<Item = (&'a Address, &'a TransactionSigned)>,
|
I: IntoIterator<Item = (&'a Address, &'a <Self::Evm as ConfigureEvmEnv>::Transaction)>,
|
||||||
|
<Self::Evm as ConfigureEvmEnv>::Transaction: SignedTransaction,
|
||||||
{
|
{
|
||||||
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, Default::default());
|
let env = EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, Default::default());
|
||||||
|
|
||||||
let mut evm = self.evm_config().evm_with_env(db, env);
|
let mut evm = self.evm_config().evm_with_env(db, env);
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
for (sender, tx) in transactions {
|
for (sender, tx) in transactions {
|
||||||
if tx.hash() == target_tx_hash {
|
if *tx.tx_hash() == target_tx_hash {
|
||||||
// reached the target transaction
|
// reached the target transaction
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,7 @@ pub trait LoadPendingBlock:
|
|||||||
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
|
||||||
+ StateProviderFactory,
|
+ StateProviderFactory,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = ProviderTx<Self::Provider>>,
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
/// Returns a handle to the pending block.
|
/// Returns a handle to the pending block.
|
||||||
|
|||||||
@ -31,7 +31,7 @@ where
|
|||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
|
Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>,
|
||||||
>,
|
>,
|
||||||
Evm: ConfigureEvm<Header = Header>,
|
Evm: ConfigureEvm<Header = Header, Transaction = ProviderTx<Self::Provider>>,
|
||||||
>,
|
>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@ -84,6 +84,8 @@ impl MyEvmConfig {
|
|||||||
|
|
||||||
impl ConfigureEvmEnv for MyEvmConfig {
|
impl ConfigureEvmEnv for MyEvmConfig {
|
||||||
type Header = Header;
|
type Header = Header;
|
||||||
|
type Transaction = TransactionSigned;
|
||||||
|
|
||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
|
|
||||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
||||||
|
|||||||
@ -148,6 +148,7 @@ impl StatefulPrecompileMut for WrappedPrecompile {
|
|||||||
|
|
||||||
impl ConfigureEvmEnv for MyEvmConfig {
|
impl ConfigureEvmEnv for MyEvmConfig {
|
||||||
type Header = Header;
|
type Header = Header;
|
||||||
|
type Transaction = TransactionSigned;
|
||||||
type Error = Infallible;
|
type Error = Infallible;
|
||||||
|
|
||||||
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) {
|
||||||
|
|||||||
Reference in New Issue
Block a user