feat: integrate ExecutorProvider (#7798)

This commit is contained in:
Matthias Seitz
2024-05-03 13:39:46 +02:00
committed by GitHub
parent ec45ae679f
commit 067b0ff420
74 changed files with 1087 additions and 2027 deletions

View File

@ -44,7 +44,8 @@ tracing.workspace = true
reth-beacon-consensus.workspace = true
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-network-api.workspace = true
reth-node-ethereum.workspace = true
reth-evm-ethereum.workspace = true
reth-ethereum-engine-primitives.workspace = true
reth-payload-builder = { workspace = true, features = ["test-utils"] }
reth-primitives.workspace = true
reth-provider = { workspace = true, features = ["test-utils"] }

View File

@ -2,7 +2,7 @@
use crate::utils::launch_auth;
use jsonrpsee::core::client::{ClientT, SubscriptionClientT};
use reth_node_ethereum::EthEngineTypes;
use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_primitives::{Block, U64};
use reth_rpc::JwtSecret;
use reth_rpc_api::clients::EngineApiClient;

View File

@ -1,6 +1,7 @@
use reth_beacon_consensus::BeaconConsensusEngineHandle;
use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_evm_ethereum::EthEvmConfig;
use reth_network_api::noop::NoopNetwork;
use reth_node_ethereum::{EthEngineTypes, EthEvmConfig};
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::MAINNET;
use reth_provider::test_utils::{NoopProvider, TestCanonStateSubscriptions};

View File

@ -29,6 +29,8 @@ revm-inspectors.workspace = true
reth-evm.workspace = true
reth-network-types.workspace = true
reth-evm-optimism = { workspace = true, optional = true }
# eth
alloy-rlp.workspace = true
alloy-dyn-abi = { workspace = true, features = ["eip712"] }
@ -89,4 +91,6 @@ optimism = [
"reth-primitives/optimism",
"reth-rpc-types-compat/optimism",
"reth-provider/optimism",
"dep:reth-evm-optimism",
"reth-evm-optimism/optimism",
]

View File

@ -84,7 +84,7 @@ where
#[cfg(feature = "optimism")]
let (block_timestamp, l1_block_info) = {
let body = reth_revm::optimism::extract_l1_info(&block);
let body = reth_evm_optimism::extract_l1_info(&block);
(block.timestamp, body.ok())
};

View File

@ -49,17 +49,9 @@ use revm::{
};
use std::future::Future;
#[cfg(feature = "optimism")]
use crate::eth::api::optimism::OptimismTxMeta;
#[cfg(feature = "optimism")]
use crate::eth::optimism::OptimismEthApiError;
use crate::eth::revm_utils::FillableTransaction;
#[cfg(feature = "optimism")]
use reth_revm::optimism::RethL1BlockInfo;
#[cfg(feature = "optimism")]
use reth_rpc_types::OptimismTransactionReceiptFields;
#[cfg(feature = "optimism")]
use revm::L1BlockInfo;
use revm_primitives::db::{Database, DatabaseRef};
/// Helper alias type for the state's [CacheDB]
@ -1498,7 +1490,7 @@ where
.ok_or(EthApiError::UnknownBlockNumber)?;
let block = block.unseal();
let l1_block_info = reth_revm::optimism::extract_l1_info(&block).ok();
let l1_block_info = reth_evm_optimism::extract_l1_info(&block).ok();
let optimism_tx_meta = self.build_op_tx_meta(&tx, l1_block_info, block.timestamp)?;
build_transaction_receipt_with_block_receipts(
@ -1510,17 +1502,19 @@ where
)
}
/// Builds [OptimismTxMeta] object using the provided [TransactionSigned],
/// [L1BlockInfo] and `block_timestamp`. The [L1BlockInfo] is used to calculate
/// the l1 fee and l1 data gas for the transaction.
/// If the [L1BlockInfo] is not provided, the [OptimismTxMeta] will be empty.
/// Builds op metadata object using the provided [TransactionSigned], L1 block info and
/// `block_timestamp`. The L1BlockInfo is used to calculate the l1 fee and l1 data gas for the
/// transaction. If the L1BlockInfo is not provided, the meta info will be empty.
#[cfg(feature = "optimism")]
pub(crate) fn build_op_tx_meta(
&self,
tx: &TransactionSigned,
l1_block_info: Option<L1BlockInfo>,
l1_block_info: Option<revm::L1BlockInfo>,
block_timestamp: u64,
) -> EthResult<OptimismTxMeta> {
) -> EthResult<crate::eth::api::optimism::OptimismTxMeta> {
use crate::eth::{api::optimism::OptimismTxMeta, optimism::OptimismEthApiError};
use reth_evm_optimism::RethL1BlockInfo;
let Some(l1_block_info) = l1_block_info else { return Ok(OptimismTxMeta::default()) };
let (l1_fee, l1_data_gas) = if !tx.is_deposit() {
@ -1711,7 +1705,7 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
meta: TransactionMeta,
receipt: Receipt,
all_receipts: &[Receipt],
#[cfg(feature = "optimism")] optimism_tx_meta: OptimismTxMeta,
#[cfg(feature = "optimism")] optimism_tx_meta: crate::eth::api::optimism::OptimismTxMeta,
) -> EthResult<AnyTransactionReceipt> {
// Note: we assume this transaction is valid, because it's mined (or part of pending block) and
// we don't need to check for pre EIP-2