Skip to content

Commit

Permalink
chore: remove revm-primitives re-export
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Nov 16, 2024
1 parent 3614a37 commit 1118887
Show file tree
Hide file tree
Showing 28 changed files with 94 additions and 105 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ use reth_node_api::{
};
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider};
use reth_primitives::{
revm_primitives::KzgSettings, BlobTransaction, PooledTransactionsElement, SealedBlock,
SealedBlockWithSenders, SealedHeader, Transaction, TransactionSigned,
BlobTransaction, PooledTransactionsElement, SealedBlock, SealedBlockWithSenders, SealedHeader,
Transaction, TransactionSigned,
};
use reth_provider::{
providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider,
ProviderFactory, StageCheckpointReader, StateProviderFactory,
};
use reth_revm::{cached::CachedReads, database::StateProviderDatabase, primitives::EnvKzgSettings};
use reth_revm::{
cached::CachedReads,
database::StateProviderDatabase,
primitives::{EnvKzgSettings, KzgSettings},
};
use reth_stages::StageId;
use reth_transaction_pool::{
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,
Expand Down
2 changes: 1 addition & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,6 @@ mod tests {
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_primitives::{
proofs::{calculate_receipt_root, calculate_transaction_root},
revm_primitives::AccountInfo,
Account, BlockBody, Transaction, TransactionSigned, TransactionSignedEcRecovered,
};
use reth_provider::{
Expand All @@ -1398,6 +1397,7 @@ mod tests {
},
ProviderFactory,
};
use reth_revm::primitives::AccountInfo;
use reth_stages_api::StageCheckpoint;
use reth_trie::{root::state_root_unhashed, StateRoot};
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ mod tests {
use alloy_primitives::{B256, U256};
use reth_chainspec::{Chain, ChainSpec, MAINNET};
use reth_evm::execute::ProviderError;
use reth_primitives::revm_primitives::{BlockEnv, CfgEnv, SpecId};
use reth_revm::{
db::{CacheDB, EmptyDBTyped},
inspectors::NoOpInspector,
primitives::{BlockEnv, CfgEnv, SpecId},
JournaledState,
};
use revm_primitives::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg};
Expand Down
1 change: 0 additions & 1 deletion crates/ethereum/payload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ reth-chainspec.workspace = true

# ethereum
revm.workspace = true
revm-primitives.workspace = true

# alloy
alloy-eips.workspace = true
Expand Down
7 changes: 4 additions & 3 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use reth_payload_builder::{EthBuiltPayload, EthPayloadBuilderAttributes};
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
use reth_primitives::{
proofs::{self},
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, EthereumHardforks, Receipt,
};
use reth_provider::{ChainSpecProvider, StateProviderFactory};
Expand All @@ -38,10 +37,12 @@ use reth_transaction_pool::{
use reth_trie::HashedPostState;
use revm::{
db::{states::bundle_state::BundleRetention, State},
primitives::{EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState},
primitives::{
calc_excess_blob_gas, BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg,
InvalidTransaction, ResultAndState, TxEnv,
},
DatabaseCommit,
};
use revm_primitives::{calc_excess_blob_gas, TxEnv};
use std::sync::Arc;
use tracing::{debug, trace, warn};

Expand Down
1 change: 1 addition & 0 deletions crates/node/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ reth-transaction-pool.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] }
alloy-consensus.workspace = true
revm-primitives.workspace = true

## async
futures.workspace = true
Expand Down
15 changes: 7 additions & 8 deletions crates/node/builder/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

#![allow(clippy::type_complexity, missing_debug_implementations)]

pub mod add_ons;
mod states;

pub use states::*;

use std::sync::Arc;

use crate::{
common::WithConfigs,
components::NodeComponentsBuilder,
Expand Down Expand Up @@ -38,13 +31,19 @@ use reth_node_core::{
node_config::NodeConfig,
primitives::Head,
};
use reth_primitives::revm_primitives::EnvKzgSettings;
use reth_provider::{providers::BlockchainProvider, ChainSpecProvider, FullProvider};
use reth_tasks::TaskExecutor;
use reth_transaction_pool::{PoolConfig, TransactionPool};
use revm_primitives::EnvKzgSettings;
use secp256k1::SecretKey;
use std::sync::Arc;
use tracing::{info, trace, warn};

pub mod add_ons;

mod states;
pub use states::*;

/// The adapter type for a reth node with the builtin provider type
// Note: we need to hardcode this because custom components might depend on it in associated types.
pub type RethFullAdapter<DB, Types> = FullNodeTypesAdapter<
Expand Down
16 changes: 7 additions & 9 deletions crates/optimism/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use alloy_consensus::Header;
use alloy_primitives::{Address, U256};
use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes};
use reth_optimism_chainspec::{DecodeError, OpChainSpec};
use reth_primitives::{
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
transaction::FillTxEnv,
Head, TransactionSigned,
use reth_primitives::{transaction::FillTxEnv, Head, TransactionSigned};
use reth_revm::{
inspector_handle_register,
primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
Database, Evm, EvmBuilder, GetInspector,
};
use reth_revm::{inspector_handle_register, Database, Evm, EvmBuilder, GetInspector};

mod config;
pub use config::{revm_spec, revm_spec_by_timestamp_after_bedrock};
Expand Down Expand Up @@ -211,14 +211,12 @@ mod tests {
AccountRevertInit, BundleStateInit, Chain, ExecutionOutcome, RevertsInit,
};
use reth_optimism_chainspec::BASE_MAINNET;
use reth_primitives::{
revm_primitives::{AccountInfo, BlockEnv, CfgEnv, SpecId},
Account, Log, Receipt, Receipts, SealedBlockWithSenders, TxType,
};
use reth_primitives::{Account, Log, Receipt, Receipts, SealedBlockWithSenders, TxType};

use reth_revm::{
db::{BundleState, CacheDB, EmptyDBTyped},
inspectors::NoOpInspector,
primitives::{AccountInfo, BlockEnv, CfgEnv, SpecId},
JournaledState,
};
use revm_primitives::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg};
Expand Down
11 changes: 5 additions & 6 deletions crates/optimism/payload/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
use reth_optimism_forks::OpHardforks;
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
use reth_payload_util::PayloadTransactions;
use reth_primitives::{
proofs,
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, Receipt, SealedHeader, TransactionSigned, TxType,
};
use reth_primitives::{proofs, Block, BlockBody, Receipt, SealedHeader, TransactionSigned, TxType};
use reth_provider::{ProviderError, StateProofProvider, StateProviderFactory, StateRootProvider};
use reth_revm::database::StateProviderDatabase;
use reth_transaction_pool::{
Expand All @@ -30,7 +26,10 @@ use reth_transaction_pool::{
use reth_trie::HashedPostState;
use revm::{
db::{states::bundle_state::BundleRetention, State},
primitives::{EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState, TxEnv},
primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, InvalidTransaction,
ResultAndState, TxEnv,
},
Database, DatabaseCommit,
};
use tracing::{debug, trace, warn};
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/rpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
use alloy_rpc_types_eth::{error::EthRpcErrorCode, BlockError};
use jsonrpsee_types::error::INTERNAL_ERROR_CODE;
use reth_optimism_evm::OpBlockExecutionError;
use reth_primitives::revm_primitives::{InvalidTransaction, OptimismInvalidTransaction};
use reth_rpc_eth_api::AsEthApiError;
use reth_rpc_eth_types::EthApiError;
use reth_rpc_server_types::result::{internal_rpc_err, rpc_err};
use revm::primitives::{InvalidTransaction, OptimismInvalidTransaction};

/// Optimism specific errors, that extend [`EthApiError`].
#[derive(Debug, thiserror::Error)]
Expand Down
5 changes: 2 additions & 3 deletions crates/optimism/rpc/src/eth/call.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use crate::{OpEthApi, OpEthApiError};
use alloy_consensus::Header;
use alloy_primitives::{Bytes, TxKind, U256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use reth_evm::ConfigureEvm;
use reth_primitives::revm_primitives::{BlockEnv, OptimismFields, TxEnv};
use reth_rpc_eth_api::{
helpers::{estimate::EstimateCall, Call, EthCall, LoadPendingBlock, LoadState, SpawnBlocking},
FromEthApiError, IntoEthApiError, RpcNodeCore,
};
use reth_rpc_eth_types::{revm_utils::CallFees, RpcInvalidTransactionError};

use crate::{OpEthApi, OpEthApiError};
use revm::primitives::{BlockEnv, OptimismFields, TxEnv};

impl<N> EthCall for OpEthApi<N>
where
Expand Down
6 changes: 3 additions & 3 deletions crates/optimism/rpc/src/eth/pending_block.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! Loads OP pending block for a RPC response.

use crate::OpEthApi;
use alloy_consensus::Header;
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{BlockNumber, B256};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::ConfigureEvm;
use reth_optimism_consensus::calculate_receipt_root_no_memo_optimism;
use reth_primitives::{revm_primitives::BlockEnv, Receipt, SealedBlockWithSenders};
use reth_primitives::{Receipt, SealedBlockWithSenders};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ExecutionOutcome,
ReceiptProvider, StateProviderFactory,
Expand All @@ -17,8 +18,7 @@ use reth_rpc_eth_api::{
};
use reth_rpc_eth_types::{EthApiError, PendingBlock};
use reth_transaction_pool::TransactionPool;

use crate::OpEthApi;
use revm::primitives::BlockEnv;

impl<N> LoadPendingBlock for OpEthApi<N>
where
Expand Down
2 changes: 2 additions & 0 deletions crates/payload/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ alloy-primitives.workspace = true
alloy-rpc-types-engine = { workspace = true, features = ["serde"] }
op-alloy-rpc-types-engine = { workspace = true, optional = true }

revm-primitives.workspace = true

# async
async-trait.workspace = true
tokio = { workspace = true, features = ["sync"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/payload/primitives/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use alloy_primitives::B256;
use reth_errors::{ProviderError, RethError};
use reth_primitives::revm_primitives::EVMError;
use reth_transaction_pool::BlobStoreError;
use revm_primitives::EVMError;
use tokio::sync::oneshot;

/// Possible error variants during payload building.
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ pub use transaction::{

// Re-exports
pub use reth_ethereum_forks::*;
pub use revm_primitives::{self, JumpTable};

#[cfg(any(test, feature = "arbitrary"))]
pub use arbitrary;
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ impl Encodable for ReceiptWithBloomEncoder<'_> {
#[cfg(test)]
mod tests {
use super::*;
use crate::revm_primitives::Bytes;
use alloy_primitives::{address, b256, bytes, hex_literal::hex};
use alloy_primitives::{address, b256, bytes, hex_literal::hex, Bytes};
use reth_codecs::Compact;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy_primitives::{
Address, B256, U256,
};
use core::cell::RefCell;
use reth_primitives::revm_primitives::{
use revm::primitives::{
db::{Database, DatabaseRef},
AccountInfo, Bytecode,
};
Expand Down
12 changes: 7 additions & 5 deletions crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ use alloy_rpc_types_eth::{
use futures::Future;
use reth_chainspec::EthChainSpec;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{
revm_primitives::{
use reth_primitives::TransactionSigned;
use reth_provider::{BlockIdReader, ChainSpecProvider, HeaderProvider};
use reth_revm::{
database::StateProviderDatabase,
db::CacheDB,
primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, ResultAndState, TxEnv,
},
TransactionSigned,
DatabaseRef,
};
use reth_provider::{BlockIdReader, ChainSpecProvider, HeaderProvider};
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};
use reth_rpc_eth_types::{
cache::db::{StateCacheDbRefMutWrapper, StateProviderTraitObjWrapper},
error::ensure_success,
Expand Down
9 changes: 5 additions & 4 deletions crates/rpc/rpc-eth-api/src/helpers/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use alloy_primitives::U256;
use alloy_rpc_types_eth::{state::StateOverride, transaction::TransactionRequest, BlockId};
use futures::Future;
use reth_chainspec::{EthChainSpec, MIN_TRANSACTION_GAS};
use reth_primitives::revm_primitives::{
BlockEnv, CfgEnvWithHandlerCfg, ExecutionResult, HaltReason, TransactTo,
};
use reth_provider::{ChainSpecProvider, StateProvider};
use reth_revm::{database::StateProviderDatabase, db::CacheDB};
use reth_revm::{
database::StateProviderDatabase,
db::CacheDB,
primitives::{BlockEnv, CfgEnvWithHandlerCfg, ExecutionResult, HaltReason, TransactTo},
};
use reth_rpc_eth_types::{
revm_utils::{apply_state_overrides, caller_gas_allowance},
EthApiError, RevertError, RpcInvalidTransactionError,
Expand Down
23 changes: 11 additions & 12 deletions crates/rpc/rpc-eth-api/src/helpers/pending_block.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//! Loads a pending block from database. Helper trait for `eth_` block, transaction, call and trace
//! RPC methods.

use std::time::{Duration, Instant};

use super::SpawnBlocking;
use crate::{EthApiTypes, FromEthApiError, FromEvmError, RpcNodeCore};

use alloy_consensus::{Header, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{
eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::EMPTY_REQUESTS_HASH, merge::BEACON_NONCE,
Expand All @@ -19,27 +17,28 @@ use reth_evm::{
};
use reth_execution_types::ExecutionOutcome;
use reth_primitives::{
proofs::calculate_transaction_root,
revm_primitives::{
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
ResultAndState, SpecId,
},
Block, BlockBody, Receipt, SealedBlockWithSenders, SealedHeader, TransactionSignedEcRecovered,
proofs::calculate_transaction_root, Block, BlockBody, Receipt, SealedBlockWithSenders,
SealedHeader, TransactionSignedEcRecovered,
};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,
ReceiptProvider, StateProviderFactory,
};
use reth_revm::database::StateProviderDatabase;
use reth_revm::{
database::StateProviderDatabase,
primitives::{
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
ResultAndState, SpecId,
},
};
use reth_rpc_eth_types::{EthApiError, PendingBlock, PendingBlockEnv, PendingBlockEnvOrigin};
use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool};
use reth_trie::HashedPostState;
use revm::{db::states::bundle_state::BundleRetention, DatabaseCommit, State};
use std::time::{Duration, Instant};
use tokio::sync::Mutex;
use tracing::debug;

use super::SpawnBlocking;

/// Loads a pending block from database.
///
/// Behaviour shared by several `eth_` RPC methods, not exclusive to `eth_` blocks RPC methods.
Expand Down
Loading

0 comments on commit 1118887

Please sign in to comment.