Skip to content

Commit

Permalink
primitives: rm alloy BlockId reexport (#12303)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Nov 4, 2024
1 parent 566f2b4 commit 0475af8
Show file tree
Hide file tree
Showing 25 changed files with 43 additions and 32 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
GotExpected, Header, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, Withdrawals,
};
use alloc::vec::Vec;
pub use alloy_eips::eip1898::{BlockId, BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash};
pub use alloy_eips::eip1898::{BlockNumHash, BlockNumberOrTag, ForkBlock, RpcBlockHash};
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{Address, Bytes, Sealable, B256};
use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
Expand Down Expand Up @@ -905,7 +905,7 @@ pub(super) mod serde_bincode_compat {
#[cfg(test)]
mod tests {
use super::{BlockNumberOrTag::*, *};
use alloy_eips::eip1898::HexStringMissingPrefixError;
use alloy_eips::{eip1898::HexStringMissingPrefixError, BlockId};
use alloy_primitives::hex_literal::hex;
use alloy_rlp::{Decodable, Encodable};
use std::str::FromStr;
Expand Down
4 changes: 2 additions & 2 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub mod transaction;
#[cfg(any(test, feature = "arbitrary"))]
pub use block::{generate_valid_header, valid_header_strategy};
pub use block::{
Block, BlockBody, BlockId, BlockNumHash, BlockNumberOrTag, BlockWithSenders, ForkBlock,
RpcBlockHash, SealedBlock, SealedBlockWithSenders,
Block, BlockBody, BlockNumHash, BlockNumberOrTag, BlockWithSenders, ForkBlock, RpcBlockHash,
SealedBlock, SealedBlockWithSenders,
};
#[cfg(feature = "reth-codec")]
pub use compression::*;
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,3 +1,4 @@
use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, B256};
use alloy_rpc_types::{Block, Bundle, StateContext};
use alloy_rpc_types_debug::ExecutionWitness;
Expand All @@ -6,7 +7,7 @@ use alloy_rpc_types_trace::geth::{
BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult,
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_primitives::BlockNumberOrTag;

/// Debug rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "debug"))]
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/otterscan.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_eips::BlockId;
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, Bytes, TxHash, B256};
use alloy_rpc_types::Header;
Expand All @@ -6,7 +7,6 @@ use alloy_rpc_types_trace::otterscan::{
TransactionsWithReceipts,
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockId;

/// Otterscan rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "ots"))]
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/reth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy_eips::BlockId;
use alloy_primitives::{Address, U256};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockId;
use std::collections::HashMap;

/// Reth API namespace for reth-specific methods
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/trace.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_eips::BlockId;
use alloy_primitives::{map::HashSet, Bytes, B256};
use alloy_rpc_types::{state::StateOverride, BlockOverrides, Index};
use alloy_rpc_types_eth::transaction::TransactionRequest;
Expand All @@ -7,7 +8,6 @@ use alloy_rpc_types_trace::{
parity::*,
};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockId;

/// Ethereum trace API
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "trace"))]
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-eips.workspace = true

tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
serde_json.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion 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_eips::BlockId;
use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64};
use alloy_rpc_types_eth::{
transaction::TransactionRequest, Block, FeeHistory, Filter, Index, Log,
Expand All @@ -18,7 +19,7 @@ use jsonrpsee::{
types::error::ErrorCode,
};
use reth_network_peers::NodeRecord;
use reth_primitives::{BlockId, BlockNumberOrTag, Receipt};
use reth_primitives::{BlockNumberOrTag, Receipt};
use reth_rpc_api::{
clients::{AdminApiClient, EthApiClient},
DebugApiClient, EthFilterApiClient, NetApiClient, OtterscanClient, TraceApiClient,
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-api/src/core.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Implementation of the [`jsonrpsee`] generated [`EthApiServer`] trait. Handles RPC requests for
//! the `eth_` namespace.
use alloy_dyn_abi::TypedData;
use alloy_eips::eip2930::AccessListResult;
use alloy_eips::{eip2930::AccessListResult, BlockId};
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
Expand All @@ -13,7 +13,7 @@ use alloy_rpc_types::{
};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_primitives::BlockNumberOrTag;
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
use tracing::trace;

Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-api/src/helpers/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

use std::sync::Arc;

use alloy_eips::BlockId;
use alloy_rpc_types::{Header, Index};
use futures::Future;
use reth_primitives::{BlockId, Receipt, SealedBlock, SealedBlockWithSenders};
use reth_primitives::{Receipt, SealedBlock, SealedBlockWithSenders};
use reth_provider::{BlockIdReader, BlockReader, BlockReaderIdExt, HeaderProvider};
use reth_rpc_types_compat::block::{from_block, uncle_block_from_header};

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
Expand Up @@ -2,13 +2,14 @@
//! RPC methods.

use alloy_consensus::constants::KECCAK_EMPTY;
use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rpc_types::{serde_helpers::JsonStorageKey, Account, EIP1186AccountProofResponse};
use futures::Future;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_errors::RethError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{BlockId, Header};
use reth_primitives::Header;
use reth_provider::{
BlockIdReader, BlockNumReader, ChainSpecProvider, StateProvider, StateProviderBox,
StateProviderFactory,
Expand Down
6 changes: 2 additions & 4 deletions crates/rpc/rpc-eth-api/src/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@

use alloy_consensus::Transaction;
use alloy_dyn_abi::TypedData;
use alloy_eips::eip2718::Encodable2718;
use alloy_eips::{eip2718::Encodable2718, BlockId};
use alloy_network::TransactionBuilder;
use alloy_primitives::{Address, Bytes, TxHash, B256};
use alloy_rpc_types::{BlockNumberOrTag, TransactionInfo};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use futures::Future;
use reth_primitives::{
BlockId, Receipt, SealedBlockWithSenders, TransactionMeta, TransactionSigned,
};
use reth_primitives::{Receipt, SealedBlockWithSenders, TransactionMeta, TransactionSigned};
use reth_provider::{BlockNumReader, BlockReaderIdExt, ReceiptProvider, TransactionsProvider};
use reth_rpc_eth_types::{
utils::{binary_search, recover_raw_transaction},
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

use std::time::Duration;

use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, U256};
use alloy_rpc_types::{error::EthRpcErrorCode, request::TransactionInputError, BlockError};
use alloy_sol_types::decode_revert_reason;
use reth_errors::RethError;
use reth_primitives::{revm_primitives::InvalidHeader, BlockId};
use reth_primitives::revm_primitives::InvalidHeader;
use reth_rpc_server_types::result::{
block_id_to_str, internal_rpc_err, invalid_params_rpc_err, rpc_err, rpc_error_with_code,
};
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-eth-types/src/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

use std::time::Instant;

use alloy_eips::BlockId;
use alloy_primitives::B256;
use derive_more::Constructor;
use reth_primitives::{BlockId, BlockNumberOrTag, Receipt, SealedBlockWithSenders, SealedHeader};
use reth_primitives::{BlockNumberOrTag, Receipt, SealedBlockWithSenders, SealedHeader};
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg};

/// Configured [`BlockEnv`] and [`CfgEnvWithHandlerCfg`] for a pending block.
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-server-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ workspace = true
[dependencies]
reth-errors.workspace = true
reth-network-api.workspace = true
reth-primitives.workspace = true

# ethereum
alloy-primitives.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-eips.workspace = true

# rpc
jsonrpsee-core.workspace = true
Expand All @@ -27,4 +27,3 @@ jsonrpsee-types.workspace = true
# misc
strum = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive"] }

2 changes: 1 addition & 1 deletion crates/rpc/rpc-server-types/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use std::fmt;

use alloy_eips::BlockId;
use alloy_rpc_types_engine::PayloadError;
use jsonrpsee_core::RpcResult;
use reth_errors::ConsensusError;
use reth_primitives::BlockId;

/// Helper trait to easily convert various `Result` types into [`RpcResult`]
pub trait ToRpcResult<Ok, Err>: Sized {
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc-testing-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
alloy-rpc-types.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-eips.workspace = true

# async
futures.workspace = true
Expand All @@ -36,4 +37,4 @@ similar-asserts.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "rt"] }
reth-rpc-eth-api.workspace = true
jsonrpsee-http-client.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-rpc-types-trace.workspace = true
3 changes: 2 additions & 1 deletion crates/rpc/rpc-testing-util/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
task::{Context, Poll},
};

use alloy_eips::BlockId;
use alloy_primitives::{TxHash, B256};
use alloy_rpc_types::{Block, Transaction};
use alloy_rpc_types_eth::transaction::TransactionRequest;
Expand All @@ -15,7 +16,7 @@ use alloy_rpc_types_trace::{
};
use futures::{Stream, StreamExt};
use jsonrpsee::core::client::Error as RpcError;
use reth_primitives::{BlockId, Receipt};
use reth_primitives::Receipt;
use reth_rpc_api::{clients::DebugApiClient, EthApiClient};

const NOOP_TRACER: &str = include_str!("../assets/noop-tracer.js");
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-testing-util/src/trace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Helpers for testing trace calls.

use alloy_eips::BlockId;
use alloy_primitives::{map::HashSet, Bytes, TxHash, B256};
use alloy_rpc_types::Index;
use alloy_rpc_types_eth::transaction::TransactionRequest;
Expand All @@ -10,7 +11,6 @@ use alloy_rpc_types_trace::{
};
use futures::{Stream, StreamExt};
use jsonrpsee::core::client::Error as RpcError;
use reth_primitives::BlockId;
use reth_rpc_api::clients::TraceApiClient;
use std::{
pin::Pin,
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_eips::eip2718::Encodable2718;
use alloy_eips::{eip2718::Encodable2718, BlockId};
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rlp::{Decodable, Encodable};
use alloy_rpc_types::{
Expand All @@ -19,7 +19,7 @@ use reth_evm::{
system_calls::SystemCaller,
ConfigureEvmEnv,
};
use reth_primitives::{Block, BlockId, BlockNumberOrTag, TransactionSignedEcRecovered};
use reth_primitives::{Block, BlockNumberOrTag, TransactionSignedEcRecovered};
use reth_provider::{
BlockReaderIdExt, ChainSpecProvider, HeaderProvider, StateProofProvider, StateProviderFactory,
TransactionVariant,
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc/src/engine.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, B256, U256, U64};
use alloy_rpc_types::{
state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, Log, SyncStatus,
};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use alloy_serde::JsonStorageKey;
use jsonrpsee::core::RpcResult as Result;
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_primitives::BlockNumberOrTag;
use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer};
/// Re-export for convenience
pub use reth_rpc_engine_api::EngineApi;
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc/src/otterscan.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use alloy_consensus::Transaction;
use alloy_eips::BlockId;
use alloy_network::{ReceiptResponse, TransactionResponse};
use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
use alloy_rpc_types::{BlockTransactions, Header, TransactionReceipt};
Expand All @@ -11,7 +12,7 @@ use alloy_rpc_types_trace::{
};
use async_trait::async_trait;
use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_primitives::BlockNumberOrTag;
use reth_rpc_api::{EthApiServer, OtterscanServer};
use reth_rpc_eth_api::{
helpers::{EthTransactions, TraceExt},
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/reth.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::{collections::HashMap, future::Future, sync::Arc};

use alloy_eips::BlockId;
use alloy_primitives::{Address, U256};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_errors::RethResult;
use reth_primitives::BlockId;
use reth_provider::{BlockReaderIdExt, ChangeSetReader, StateProviderFactory};
use reth_rpc_api::RethApiServer;
use reth_rpc_eth_types::{EthApiError, EthResult};
Expand Down
3 changes: 2 additions & 1 deletion crates/rpc/rpc/src/trace.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_eips::BlockId;
use alloy_primitives::{map::HashSet, Bytes, B256, U256};
use alloy_rpc_types::{
state::{EvmOverrides, StateOverride},
Expand All @@ -17,7 +18,7 @@ use reth_consensus_common::calc::{
base_block_reward, base_block_reward_pre_merge, block_reward, ommer_reward,
};
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{BlockId, Header};
use reth_primitives::Header;
use reth_provider::{BlockReader, ChainSpecProvider, EvmEnvProvider, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;
use reth_rpc_api::TraceApiServer;
Expand Down

0 comments on commit 0475af8

Please sign in to comment.