Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use reth_primitives instead of revm_primitives #5434

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/interfaces/src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::RethError;
use reth_primitives::{
BlockNumHash, Bloom, GotExpected, GotExpectedBoxed, PruneSegmentError, B256,
revm_primitives::EVMError, BlockNumHash, Bloom, GotExpected, GotExpectedBoxed,
PruneSegmentError, B256,
};
use revm_primitives::EVMError;
use thiserror::Error;

/// Transaction validation errors
Expand Down
11 changes: 7 additions & 4 deletions crates/payload/builder/src/database.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
//! Database adapters for payload building.

use reth_primitives::U256;
use revm_primitives::{
db::{Database, DatabaseRef},
AccountInfo, Address, Bytecode, B256,
use reth_primitives::{
revm_primitives::{
db::{Database, DatabaseRef},
AccountInfo, Address, Bytecode, B256,
},
U256,
};

use std::{
cell::RefCell,
collections::{hash_map::Entry, HashMap},
Expand Down
3 changes: 1 addition & 2 deletions crates/payload/builder/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! Error types emitted by types or implementations of this crate.

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

/// Possible error variants during payload building.
Expand Down
6 changes: 3 additions & 3 deletions crates/payload/builder/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use alloy_rlp::{Encodable, Error as DecodeError};
use reth_primitives::{
revm::config::revm_spec_by_timestamp_after_merge, Address, BlobTransactionSidecar, ChainSpec,
Header, SealedBlock, Withdrawal, B256, U256,
revm::config::revm_spec_by_timestamp_after_merge,
revm_primitives::{BlobExcessGasAndPrice, BlockEnv, CfgEnv, SpecId},
Address, BlobTransactionSidecar, ChainSpec, Header, SealedBlock, Withdrawal, B256, U256,
};
use reth_rpc_types::engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadV1, PayloadAttributes,
Expand All @@ -14,7 +15,6 @@ use reth_rpc_types_compat::engine::payload::{
block_to_payload_v3, convert_block_to_payload_field_v2,
convert_standalone_withdraw_to_withdrawal, try_block_to_payload_v1,
};
use revm_primitives::{BlobExcessGasAndPrice, BlockEnv, CfgEnv, SpecId};

#[cfg(feature = "optimism")]
use reth_primitives::TransactionSigned;
Expand Down
6 changes: 4 additions & 2 deletions crates/primitives/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::{B256, KECCAK_EMPTY, U256};
use crate::{
revm_primitives::{Bytecode as RevmBytecode, BytecodeState, Bytes, JumpMap},
B256, KECCAK_EMPTY, U256,
};
use byteorder::{BigEndian, ReadBytesExt};
use bytes::Buf;
use reth_codecs::{main_codec, Compact};
use revm_primitives::{Bytecode as RevmBytecode, BytecodeState, Bytes, JumpMap};
use serde::{Deserialize, Serialize};
use std::ops::Deref;

Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use crate::{
forkid::ForkFilterKey,
header::Head,
proofs::genesis_state_root,
revm_primitives::{address, b256},
Address, BlockNumber, Chain, ForkFilter, ForkHash, ForkId, Genesis, Hardfork, Header,
SealedHeader, B256, EMPTY_OMMER_ROOT_HASH, U256,
};
use once_cell::sync::Lazy;
use revm_primitives::{address, b256};
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
Expand Down
6 changes: 4 additions & 2 deletions crates/primitives/src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! Ethereum protocol-related constants

use crate::{Address, B256, U256};
use revm_primitives::{address, b256};
use crate::{
revm_primitives::{address, b256},
Address, B256, U256,
};
use std::time::Duration;

/// [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844#parameters) constants.
Expand Down
4 changes: 3 additions & 1 deletion crates/primitives/src/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use crate::{constants::eip4844::VERSIONED_HASH_VERSION_KZG, B256};
use sha2::{Digest, Sha256};

// re-exports from revm for calculating blob fee
pub use revm_primitives::{calc_blob_gasprice, calc_excess_blob_gas as calculate_excess_blob_gas};
pub use crate::revm_primitives::{
calc_blob_gasprice, calc_excess_blob_gas as calculate_excess_blob_gas,
};

/// Calculates the versioned hash for a KzgCommitment
///
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/forkid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ impl Cache {
#[cfg(test)]
mod tests {
use super::*;
use crate::hex_literal::hex;
use revm_primitives::b256;
use crate::{hex_literal::hex, revm_primitives::b256};

const GENESIS_HASH: B256 =
b256!("d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3");
Expand Down
3 changes: 1 addition & 2 deletions crates/primitives/src/transaction/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,9 @@ impl TxDeposit {
#[cfg(test)]
mod tests {
use super::*;
use crate::{Bytes, TransactionSigned};
use crate::{revm_primitives::hex_literal::hex, Bytes, TransactionSigned};
use alloy_rlp::Decodable;
use bytes::BytesMut;
use revm_primitives::hex_literal::hex;

#[test]
fn test_rlp_roundtrip() {
Expand Down
12 changes: 6 additions & 6 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ use alloy_rlp::{Decodable, Encodable};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_primitives::{
revm::env::tx_env_with_recovered, Account, Address, Block, BlockId, BlockNumberOrTag, Bytes,
TransactionSigned, B256,
revm::env::tx_env_with_recovered,
revm_primitives::{
db::{DatabaseCommit, DatabaseRef},
BlockEnv, CfgEnv,
},
Account, Address, Block, BlockId, BlockNumberOrTag, Bytes, TransactionSigned, B256,
};
use reth_provider::{BlockReaderIdExt, HeaderProvider, StateProviderBox};
use reth_revm::{
Expand All @@ -38,10 +42,6 @@ use revm::{
db::{CacheDB, EmptyDB},
primitives::Env,
};
use revm_primitives::{
db::{DatabaseCommit, DatabaseRef},
BlockEnv, CfgEnv,
};
use std::sync::Arc;
use tokio::sync::{mpsc, AcquireError, OwnedSemaphorePermit};
use tokio_stream::{wrappers::ReceiverStream, StreamExt};
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use async_trait::async_trait;
use reth_interfaces::RethResult;
use reth_network_api::NetworkInfo;
use reth_primitives::{
revm_primitives::{BlockEnv, CfgEnv},
Address, BlockId, BlockNumberOrTag, ChainInfo, SealedBlock, B256, U256, U64,
};
use reth_provider::{
Expand All @@ -22,7 +23,6 @@ use reth_provider::{
use reth_rpc_types::{SyncInfo, SyncStatus};
use reth_tasks::{TaskSpawner, TokioTaskExecutor};
use reth_transaction_pool::TransactionPool;
use revm_primitives::{BlockEnv, CfgEnv};
use std::{
future::Future,
sync::Arc,
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc/src/eth/api/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use reth_primitives::{
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
proofs,
revm::{compat::into_reth_log, env::tx_env_with_recovered},
revm_primitives::{
BlockEnv, CfgEnv, EVMError, Env, InvalidTransaction, ResultAndState, SpecId,
},
Block, BlockId, BlockNumberOrTag, ChainSpec, Header, IntoRecoveredTransaction, Receipt,
Receipts, SealedBlock, SealedHeader, B256, EMPTY_OMMER_ROOT_HASH, U256,
};
Expand All @@ -15,9 +18,6 @@ use reth_revm::{
};
use reth_transaction_pool::TransactionPool;
use revm::{db::states::bundle_state::BundleRetention, Database, DatabaseCommit, State};
use revm_primitives::{
BlockEnv, CfgEnv, EVMError, Env, InvalidTransaction, ResultAndState, SpecId,
};
use std::time::Instant;

/// Configured [BlockEnv] and [CfgEnv] for a pending block
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/eth/api/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ mod tests {
use reth_network_api::noop::NoopNetwork;
use reth_primitives::{
basefee::calculate_next_block_base_fee, constants::ETHEREUM_BLOCK_GAS_LIMIT, BaseFeeParams,
Block, BlockNumberOrTag, Header, TransactionSigned, U256,
Block, BlockNumberOrTag, Header, TransactionSigned, B256, U256,
};
use reth_provider::{
test_utils::{MockEthProvider, NoopProvider},
Expand All @@ -408,7 +408,6 @@ mod tests {
use reth_rpc_api::EthApiServer;
use reth_rpc_types::FeeHistory;
use reth_transaction_pool::test_utils::{testing_pool, TestPool};
use revm_primitives::B256;

fn build_test_eth_api<
P: BlockReaderIdExt
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use reth_network_api::NetworkInfo;
use reth_primitives::{
eip4844::calc_blob_gasprice,
revm::env::{fill_block_env_with_coinbase, tx_env_with_recovered},
revm_primitives::{db::DatabaseCommit, Env, ExecutionResult, ResultAndState, SpecId, State},
Address, BlockId, BlockNumberOrTag, Bytes, FromRecoveredPooledTransaction, Header,
IntoRecoveredTransaction, Receipt, SealedBlock,
TransactionKind::{Call, Create},
Expand All @@ -39,7 +40,6 @@ use revm::{
primitives::{BlockEnv, CfgEnv},
Inspector,
};
use revm_primitives::{db::DatabaseCommit, Env, ExecutionResult, ResultAndState, SpecId, State};

#[cfg(feature = "optimism")]
use crate::eth::api::optimism::OptimismTxMeta;
Expand Down
7 changes: 5 additions & 2 deletions crates/rpc/rpc/src/eth/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ use crate::{
},
BlockingTaskGuard,
};
use reth_primitives::{keccak256, U256};
use reth_primitives::{
keccak256,
revm_primitives::db::{DatabaseCommit, DatabaseRef},
U256,
};
use reth_revm::database::StateProviderDatabase;
use reth_rpc_types::{EthCallBundle, EthCallBundleResponse, EthCallBundleTransactionResult};
use revm::{
db::CacheDB,
primitives::{Env, ResultAndState, TxEnv},
};
use revm_primitives::db::{DatabaseCommit, DatabaseRef};
use std::sync::Arc;

/// `Eth` bundle implementation.
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/eth/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ use jsonrpsee::{
types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObject},
};
use reth_interfaces::RethError;
use reth_primitives::{Address, Bytes, U256};
use reth_primitives::{revm_primitives::InvalidHeader, Address, Bytes, U256};
use reth_revm::tracing::js::JsInspectorError;
use reth_rpc_types::{error::EthRpcErrorCode, BlockError, CallInputError};
use reth_transaction_pool::error::{
Eip4844PoolTransactionError, InvalidPoolTransactionError, PoolError, PoolErrorKind,
PoolTransactionError,
};
use revm::primitives::{EVMError, ExecutionResult, Halt, OutOfGasError};
use revm_primitives::InvalidHeader;
use std::time::Duration;

/// Result alias
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use async_trait::async_trait;
use jsonrpsee::core::RpcResult as Result;
use reth_consensus_common::calc::{base_block_reward, block_reward};
use reth_primitives::{
revm::env::tx_env_with_recovered, BlockId, BlockNumberOrTag, Bytes, SealedHeader, B256, U256,
revm::env::tx_env_with_recovered, revm_primitives::db::DatabaseCommit, BlockId,
BlockNumberOrTag, Bytes, SealedHeader, B256, U256,
};
use reth_provider::{BlockReader, ChainSpecProvider, EvmEnvProvider, StateProviderFactory};
use reth_revm::{
Expand All @@ -25,7 +26,6 @@ use reth_rpc_types::{
BlockError, BlockOverrides, CallRequest, Index,
};
use revm::{db::CacheDB, primitives::Env};
use revm_primitives::db::DatabaseCommit;
use std::{collections::HashSet, sync::Arc};
use tokio::sync::{AcquireError, OwnedSemaphorePermit};

Expand Down