Skip to content

Commit

Permalink
rpc: replace reth-primitive imports (#10812)
Browse files Browse the repository at this point in the history
  • Loading branch information
estensen authored Sep 11, 2024
1 parent 5614a02 commit 60dcea8
Show file tree
Hide file tree
Showing 72 changed files with 143 additions and 97 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/rpc/rpc-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ reth-network-peers.workspace = true

# ethereum
alloy-json-rpc.workspace = true
alloy-primitives.workspace = true

# misc
jsonrpsee = { workspace = true, features = ["server", "macros"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/anvil.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use jsonrpsee::{core::RpcResult, proc_macros::rpc};

use reth_primitives::{Address, Bytes, B256, U256};
use alloy_primitives::{Address, Bytes, B256, U256};
use reth_rpc_types::{
anvil::{Forking, Metadata, MineOptions, NodeInfo},
Block,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{Address, Bytes, B256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_rpc_types::{
debug::ExecutionWitness,
trace::geth::{
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
//! the consensus client.
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, BlockHash, Bytes, B256, U256, U64};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_engine_primitives::EngineTypes;
use reth_primitives::{Address, BlockHash, BlockId, BlockNumberOrTag, Bytes, B256, U256, U64};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_rpc_types::{
engine::{
ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadBodiesV2,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/ganache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::U256;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::U256;
use reth_rpc_types::anvil::MineOptions;

/// Ganache rpc interface.
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/hardhat.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::{Address, Bytes, B256, U256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{Address, Bytes, B256, U256};
use reth_rpc_types::anvil::{Forking, Metadata};

/// Hardhat rpc interface.
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/net.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::U64;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::U64;

/// Net rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))]
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/otterscan.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{Address, Bytes, TxHash, B256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{Address, BlockId, Bytes, TxHash, B256};
use reth_primitives::BlockId;
use reth_rpc_types::{
trace::otterscan::{
BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/reth.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{Address, U256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{Address, BlockId, U256};
use reth_primitives::BlockId;
use std::collections::HashMap;

/// Reth API namespace for reth-specific methods
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/trace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::{Bytes, B256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{BlockId, Bytes, B256};
use reth_primitives::BlockId;
use reth_rpc_types::{
state::StateOverride,
trace::{
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/txpool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::Address;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::Address;
use reth_rpc_types::{
txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus},
Transaction, WithOtherFields,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/web3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::{Bytes, B256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{Bytes, B256};

/// Web3 rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "web3"))]
Expand Down
2 changes: 2 additions & 0 deletions crates/rpc/rpc-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ reth-transaction-pool = { workspace = true, features = ["test-utils"] }
reth-tokio-util.workspace = true
reth-node-api.workspace = true

alloy-primitives.workspace = true

tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
serde_json.workspace = true
clap = { workspace = true, features = ["derive"] }
3 changes: 2 additions & 1 deletion crates/rpc/rpc-builder/tests/it/auth.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! Auth server tests
use crate::utils::launch_auth;
use alloy_primitives::U64;
use jsonrpsee::core::client::{ClientT, SubscriptionClientT};
use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_primitives::{Block, U64};
use reth_primitives::Block;
use reth_rpc_api::clients::EngineApiClient;
use reth_rpc_layer::JwtSecret;
use reth_rpc_types::engine::{ForkchoiceState, PayloadId, TransitionConfiguration};
Expand Down
6 changes: 2 additions & 4 deletions crates/rpc/rpc-builder/tests/it/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! Standalone http tests
use crate::utils::{launch_http, launch_http_ws, launch_ws};
use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64};
use jsonrpsee::{
core::{
client::{ClientT, SubscriptionClientT},
Expand All @@ -12,10 +13,7 @@ use jsonrpsee::{
types::error::ErrorCode,
};
use reth_network_peers::NodeRecord;
use reth_primitives::{
hex_literal::hex, Address, BlockId, BlockNumberOrTag, Bytes, Receipt, TxHash, B256, B64, U256,
U64,
};
use reth_primitives::{BlockId, BlockNumberOrTag, Receipt};
use reth_rpc_api::{
clients::{AdminApiClient, EthApiClient},
DebugApiClient, EthFilterApiClient, NetApiClient, OtterscanClient, TraceApiClient,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-builder/tests/it/serde.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! various serde test
use crate::utils::launch_http;
use alloy_primitives::U256;
use jsonrpsee::{
core::{client::ClientT, traits::ToRpcParams},
types::Request,
};
use reth_primitives::U256;
use reth_rpc_server_types::RethRpcModule;
use serde_json::value::RawValue;

Expand Down
3 changes: 3 additions & 0 deletions crates/rpc/rpc-engine-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ reth-engine-primitives.workspace = true
reth-evm.workspace = true
reth-transaction-pool.workspace = true

# ethereum
alloy-primitives.workspace = true

# async
tokio = { workspace = true, features = ["sync"] }

Expand Down
7 changes: 3 additions & 4 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult,
};
use alloy_primitives::{BlockHash, BlockNumber, B256, U64};
use async_trait::async_trait;
use jsonrpsee_core::RpcResult;
use reth_beacon_consensus::BeaconConsensusEngineHandle;
Expand All @@ -12,9 +13,7 @@ use reth_payload_primitives::{
validate_payload_timestamp, EngineApiMessageVersion, PayloadAttributes,
PayloadBuilderAttributes, PayloadOrAttributes,
};
use reth_primitives::{
Block, BlockHash, BlockHashOrNumber, BlockNumber, EthereumHardfork, B256, U64,
};
use reth_primitives::{Block, BlockHashOrNumber, EthereumHardfork};
use reth_rpc_api::EngineApiServer;
use reth_rpc_types::{
engine::{
Expand Down Expand Up @@ -1147,7 +1146,7 @@ mod tests {
// https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#specification-3
mod exchange_transition_configuration {
use super::*;
use reth_primitives::U256;
use alloy_primitives::U256;
use reth_testing_utils::generators::{self, BlockParams};

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-engine-api/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use alloy_primitives::{B256, U256};
use jsonrpsee_types::error::{
INTERNAL_ERROR_CODE, INVALID_PARAMS_CODE, INVALID_PARAMS_MSG, SERVER_ERROR_MSG,
};
use reth_beacon_consensus::{BeaconForkChoiceUpdateError, BeaconOnNewPayloadError};
use reth_payload_builder::error::PayloadBuilderError;
use reth_payload_primitives::EngineObjectValidationError;
use reth_primitives::{B256, U256};
use reth_rpc_types::ToRpcError;
use thiserror::Error;

Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-engine-api/tests/it/payload.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! Some payload tests
use alloy_primitives::{Bytes, U256};
use alloy_rlp::{Decodable, Error as RlpError};
use assert_matches::assert_matches;
use reth_primitives::{proofs, Block, Bytes, SealedBlock, TransactionSigned, Withdrawals, U256};
use reth_primitives::{proofs, Block, SealedBlock, TransactionSigned, Withdrawals};
use reth_rpc_types::engine::{
ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadV1, PayloadError,
};
Expand Down
5 changes: 3 additions & 2 deletions crates/rpc/rpc-eth-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ reth-trie.workspace = true

# ethereum
alloy-dyn-abi = { workspace = true, features = ["eip712"] }
alloy-network.workspace = true
alloy-json-rpc.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true

# rpc
jsonrpsee = { workspace = true, features = ["server", "macros"] }
Expand All @@ -59,4 +60,4 @@ optimism = [
"reth-primitives/optimism",
"revm/optimism",
"reth-provider/optimism",
]
]
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//!
//! See also <https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint>
use alloy_primitives::{Bytes, B256};
use jsonrpsee::proc_macros::rpc;
use reth_primitives::{Bytes, B256};
use reth_rpc_types::mev::{
CancelBundleRequest, CancelPrivateTransactionRequest, EthBundleHash, EthCallBundle,
EthCallBundleResponse, EthSendBundle, PrivateTransactionRequest,
Expand Down
5 changes: 2 additions & 3 deletions crates/rpc/rpc-eth-api/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
use alloy_dyn_abi::TypedData;
use alloy_json_rpc::RpcObject;
use alloy_network::Network;
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{
transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
};
use reth_primitives::{transaction::AccessListResult, BlockId, BlockNumberOrTag};
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
use reth_rpc_types::{
serde_helpers::JsonStorageKey,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! methods.
use crate::{AsEthApiError, FromEthApiError, FromEvmError, IntoEthApiError};
use alloy_primitives::{Bytes, TxKind, B256, U256};
use futures::Future;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{
Expand All @@ -10,7 +11,7 @@ use reth_primitives::{
ResultAndState, TransactTo, TxEnv,
},
transaction::AccessListResult,
Bytes, TransactionSignedEcRecovered, TxKind, B256, U256,
TransactionSignedEcRecovered,
};
use reth_provider::{ChainSpecProvider, StateProvider};
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/helpers/fee.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Loads fee history from database. Helper trait for `eth_` fee and transaction RPC methods.
use alloy_primitives::U256;
use futures::Future;
use reth_chainspec::ChainSpec;
use reth_primitives::U256;
use reth_provider::{BlockIdReader, BlockReaderIdExt, ChainSpecProvider, HeaderProvider};
use reth_rpc_eth_types::{
fee_history::calculate_reward_percentiles_for_block, EthApiError, EthStateCache,
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-eth-api/src/helpers/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use std::time::{Duration, Instant};

use crate::{EthApiTypes, FromEthApiError, FromEvmError};
use alloy_primitives::{BlockNumber, B256, U256};
use futures::Future;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_evm::{
Expand All @@ -18,9 +19,8 @@ use reth_primitives::{
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
ResultAndState, SpecId,
},
Block, BlockNumber, Header, IntoRecoveredTransaction, Receipt, Requests,
SealedBlockWithSenders, SealedHeader, TransactionSignedEcRecovered, B256,
EMPTY_OMMER_ROOT_HASH, U256,
Block, Header, IntoRecoveredTransaction, Receipt, Requests, SealedBlockWithSenders,
SealedHeader, TransactionSignedEcRecovered, EMPTY_OMMER_ROOT_HASH,
};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-api/src/helpers/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
use std::result;

use alloy_dyn_abi::TypedData;
use alloy_primitives::Address;
use dyn_clone::DynClone;
use reth_primitives::{Address, Signature, TransactionSigned};
use reth_primitives::{Signature, TransactionSigned};
use reth_rpc_eth_types::SignError;
use reth_rpc_types::TypedTransactionRequest;

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/helpers/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
use std::sync::Arc;

use alloy_primitives::{Address, U256, U64};
use futures::Future;
use reth_chainspec::{ChainInfo, ChainSpec};
use reth_errors::{RethError, RethResult};
use reth_network_api::NetworkInfo;
use reth_primitives::{Address, U256, U64};
use reth_provider::{BlockNumReader, ChainSpecProvider, StageCheckpointReader};
use reth_rpc_types::{Stage, SyncInfo, SyncStatus};

Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-api/src/helpers/state.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Loads a pending block from database. Helper trait for `eth_` block, transaction, call and trace
//! RPC methods.
use alloy_primitives::{Address, Bytes, B256, U256};
use futures::Future;
use reth_chainspec::ChainSpec;
use reth_errors::RethError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{Address, BlockId, Bytes, Header, B256, KECCAK_EMPTY, U256};
use reth_primitives::{BlockId, Header, KECCAK_EMPTY};
use reth_provider::{
BlockIdReader, ChainSpecProvider, StateProvider, StateProviderBox, StateProviderFactory,
};
Expand Down
Loading

0 comments on commit 60dcea8

Please sign in to comment.