rpc-types: replace reth TransactionRequest by alloy (#11091)

This commit is contained in:
Thomas Coratger
2024-09-21 20:52:59 +02:00
committed by GitHub
parent 5113e29074
commit b9712c5ec5
27 changed files with 43 additions and 24 deletions

7
Cargo.lock generated
View File

@ -8105,6 +8105,7 @@ name = "reth-optimism-rpc"
version = "1.0.7"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
"derive_more",
"jsonrpsee-types",
"op-alloy-consensus",
@ -8378,6 +8379,7 @@ dependencies = [
"alloy-network",
"alloy-primitives",
"alloy-rlp",
"alloy-rpc-types-eth",
"async-trait",
"derive_more",
"futures",
@ -8434,6 +8436,7 @@ dependencies = [
"alloy-eips",
"alloy-json-rpc",
"alloy-primitives",
"alloy-rpc-types-eth",
"jsonrpsee",
"reth-engine-primitives",
"reth-network-peers",
@ -8448,6 +8451,7 @@ name = "reth-rpc-api-testing-util"
version = "1.0.7"
dependencies = [
"alloy-primitives",
"alloy-rpc-types-eth",
"futures",
"jsonrpsee",
"jsonrpsee-http-client",
@ -8466,6 +8470,7 @@ version = "1.0.7"
dependencies = [
"alloy-network",
"alloy-primitives",
"alloy-rpc-types-eth",
"clap",
"http",
"jsonrpsee",
@ -8552,6 +8557,7 @@ dependencies = [
"alloy-json-rpc",
"alloy-network",
"alloy-primitives",
"alloy-rpc-types-eth",
"async-trait",
"auto_impl",
"dyn-clone",
@ -8588,6 +8594,7 @@ dependencies = [
"alloy-consensus",
"alloy-primitives",
"alloy-rpc-types",
"alloy-rpc-types-eth",
"alloy-sol-types",
"derive_more",
"futures",

View File

@ -34,6 +34,7 @@ reth-optimism-forks.workspace = true
# ethereum
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
op-alloy-network.workspace = true
op-alloy-rpc-types.workspace = true
op-alloy-consensus.workspace = true

View File

@ -1,4 +1,5 @@
use alloy_primitives::{Bytes, TxKind, U256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use reth_chainspec::ChainSpec;
use reth_evm::ConfigureEvm;
use reth_node_api::{FullNodeComponents, NodeTypes};
@ -11,7 +12,6 @@ use reth_rpc_eth_api::{
FromEthApiError, IntoEthApiError,
};
use reth_rpc_eth_types::{revm_utils::CallFees, RpcInvalidTransactionError};
use reth_rpc_types::TransactionRequest;
use crate::{OpEthApi, OpEthApiError};

View File

@ -23,6 +23,7 @@ reth-network-peers.workspace = true
alloy-eips.workspace = true
alloy-json-rpc.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
# misc
jsonrpsee = { workspace = true, features = ["server", "macros"] }

View File

@ -1,4 +1,5 @@
use alloy_primitives::{Address, Bytes, B256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_rpc_types::{
@ -7,7 +8,7 @@ use reth_rpc_types::{
BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace,
TraceResult,
},
Block, Bundle, StateContext, TransactionRequest,
Block, Bundle, StateContext,
};
/// Debug rpc interface.

View File

@ -6,6 +6,7 @@
use alloy_eips::{eip4844::BlobAndProofV1, BlockId, BlockNumberOrTag};
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, BlockHash, Bytes, B256, U256, U64};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_engine_primitives::EngineTypes;
use reth_rpc_types::{
@ -16,7 +17,6 @@ use reth_rpc_types::{
},
state::StateOverride,
BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, SyncStatus,
TransactionRequest,
};
// NOTE: We can't use associated types in the `EngineApi` trait because of jsonrpsee, so we use a
// generic here. It would be nice if the rpc macro would understand which types need to have serde.

View File

@ -1,4 +1,5 @@
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::BlockId;
use reth_rpc_types::{
@ -8,7 +9,7 @@ use reth_rpc_types::{
opcode::{BlockOpcodeGas, TransactionOpcodeGas},
parity::*,
},
BlockOverrides, Index, TransactionRequest,
BlockOverrides, Index,
};
use std::collections::HashSet;

View File

@ -69,6 +69,7 @@ reth-node-api.workspace = true
reth-rpc-types-compat.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
serde_json.workspace = true

View File

@ -3,6 +3,7 @@
use crate::utils::{launch_http, launch_http_ws, launch_ws};
use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{
core::{
client::{ClientT, SubscriptionClientT},
@ -22,7 +23,7 @@ use reth_rpc_api::{
use reth_rpc_server_types::RethRpcModule;
use reth_rpc_types::{
trace::filter::TraceFilter, Block, FeeHistory, Filter, Index, Log,
PendingTransactionFilterKind, SyncStatus, Transaction, TransactionReceipt, TransactionRequest,
PendingTransactionFilterKind, SyncStatus, Transaction, TransactionReceipt,
};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::Value;

View File

@ -37,6 +37,7 @@ alloy-dyn-abi = { workspace = true, features = ["eip712"] }
alloy-json-rpc.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
# rpc
jsonrpsee = { workspace = true, features = ["server", "macros"] }

View File

@ -3,6 +3,7 @@
use alloy_dyn_abi::TypedData;
use alloy_json_rpc::RpcObject;
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{transaction::AccessListResult, BlockId, BlockNumberOrTag};
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
@ -11,7 +12,7 @@ use reth_rpc_types::{
simulate::{SimulatePayload, SimulatedBlock},
state::{EvmOverrides, StateOverride},
BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header,
Index, StateContext, SyncStatus, TransactionRequest, Work,
Index, StateContext, SyncStatus, Work,
};
use tracing::trace;

View File

@ -5,6 +5,7 @@ use crate::{
AsEthApiError, FromEthApiError, FromEvmError, FullEthApiTypes, IntoEthApiError, RpcBlock,
};
use alloy_primitives::{Bytes, TxKind, B256, U256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use futures::Future;
use reth_chainspec::MIN_TRANSACTION_GAS;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
@ -33,7 +34,7 @@ use reth_rpc_server_types::constants::gas_oracle::{CALL_STIPEND_GAS, ESTIMATE_GA
use reth_rpc_types::{
simulate::{SimBlock, SimulatePayload, SimulatedBlock},
state::{EvmOverrides, StateOverride},
BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, TransactionRequest,
BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo,
};
use revm::{Database, DatabaseCommit, GetInspector};
use revm_inspectors::{access_list::AccessListInspector, transfer::TransferInspector};

View File

@ -3,6 +3,7 @@
use alloy_dyn_abi::TypedData;
use alloy_primitives::{Address, Bytes, TxHash, TxKind, B256, U256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use futures::Future;
use reth_primitives::{
BlockId, Receipt, SealedBlockWithSenders, TransactionMeta, TransactionSigned,
@ -17,7 +18,7 @@ use reth_rpc_types::{
EIP1559TransactionRequest, EIP2930TransactionRequest, EIP4844TransactionRequest,
LegacyTransactionRequest,
},
BlockNumberOrTag, TransactionInfo, TransactionRequest, TypedTransactionRequest,
BlockNumberOrTag, TransactionInfo, TypedTransactionRequest,
};
use reth_rpc_types_compat::transaction::{from_recovered, from_recovered_with_block_context};
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};

View File

@ -32,6 +32,7 @@ reth-trie.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true
alloy-sol-types.workspace = true
alloy-rpc-types-eth.workspace = true
revm.workspace = true
revm-inspectors.workspace = true
revm-primitives = { workspace = true, features = ["dev"] }

View File

@ -66,7 +66,7 @@ where
.unwrap_or_default())
}
/// Helper type for representing the fees of a [`reth_rpc_types::TransactionRequest`]
/// Helper type for representing the fees of a `TransactionRequest`
#[derive(Debug)]
pub struct CallFees {
/// EIP-1559 priority fee
@ -85,7 +85,7 @@ pub struct CallFees {
// === impl CallFees ===
impl CallFees {
/// Ensures the fields of a [`reth_rpc_types::TransactionRequest`] are not conflicting.
/// Ensures the fields of a `TransactionRequest` are not conflicting.
///
/// # EIP-4844 transactions
///

View File

@ -1,6 +1,7 @@
//! Utilities for serving `eth_simulateV1`
use alloy_consensus::{TxEip4844Variant, TxType, TypedTransaction};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee_types::ErrorObject;
use reth_primitives::{
logs_bloom,
@ -11,7 +12,7 @@ use reth_revm::database::StateProviderDatabase;
use reth_rpc_server_types::result::rpc_err;
use reth_rpc_types::{
simulate::{SimCallResult, SimulateError, SimulatedBlock},
Block, BlockTransactionsKind, ToRpcError, TransactionRequest,
Block, BlockTransactionsKind, ToRpcError,
};
use reth_rpc_types_compat::{block::from_block, TransactionCompat};
use reth_storage_api::StateRootProvider;

View File

@ -19,6 +19,7 @@ reth-rpc-api = { workspace = true, features = ["client"] }
# ethereum
alloy-primitives.workspace = true
alloy-rpc-types-eth.workspace = true
# async
futures.workspace = true

View File

@ -7,6 +7,7 @@ use std::{
};
use alloy_primitives::{TxHash, B256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use futures::{Stream, StreamExt};
use jsonrpsee::core::client::Error as RpcError;
use reth_primitives::{BlockId, Receipt};
@ -16,7 +17,7 @@ use reth_rpc_types::{
common::TraceResult,
geth::{GethDebugTracerType, GethDebugTracingOptions, GethTrace},
},
Block, Transaction, TransactionRequest,
Block, Transaction,
};
const NOOP_TRACER: &str = include_str!("../assets/noop-tracer.js");

View File

@ -1,6 +1,7 @@
//! Helpers for testing trace calls.
use alloy_primitives::{Bytes, TxHash, B256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use futures::{Stream, StreamExt};
use jsonrpsee::core::client::Error as RpcError;
use reth_primitives::BlockId;
@ -11,7 +12,7 @@ use reth_rpc_types::{
parity::{LocalizedTransactionTrace, TraceResults, TraceType},
tracerequest::TraceCallRequest,
},
Index, TransactionRequest,
Index,
};
use std::{
collections::HashSet,

View File

@ -1,5 +1,3 @@
//! RPC types for transactions
mod request;
mod typed;
pub use request::TransactionRequest;
pub use typed::*;

View File

@ -1 +0,0 @@
pub use alloy_rpc_types::request::TransactionRequest;

View File

@ -1,7 +1,3 @@
//! The [`TransactionRequest`][crate::TransactionRequest] is a universal representation for a
//! transaction deserialized from the json input of an RPC call. Depending on what fields are set,
//! it can be converted into the container type [`TypedTransactionRequest`].
use alloy_primitives::{Address, Bytes, TxKind, B256, U256};
use alloy_rpc_types::{AccessList, BlobTransactionSidecar};

View File

@ -52,7 +52,7 @@ pub use alloy_rpc_types_debug as debug;
// Ethereum specific rpc types related to typed transaction requests and the engine API.
#[cfg(feature = "jsonrpsee-types")]
pub use eth::error::ToRpcError;
pub use eth::transaction::{self, TransactionRequest, TypedTransactionRequest};
pub use eth::transaction::{self, TypedTransactionRequest};
#[cfg(feature = "jsonrpsee-types")]
pub use eth::{
engine,

View File

@ -42,6 +42,7 @@ alloy-genesis.workspace = true
alloy-network.workspace = true
alloy-primitives.workspace = true
alloy-rlp.workspace = true
alloy-rpc-types-eth.workspace = true
revm = { workspace = true, features = [
"optional_block_gas_limit",
"optional_eip3607",

View File

@ -1,5 +1,6 @@
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rlp::{Decodable, Encodable};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::{ChainSpec, EthereumHardforks};
@ -27,7 +28,7 @@ use reth_rpc_types::{
BlockTraceResult, FourByteFrame, GethDebugBuiltInTracerType, GethDebugTracerType,
GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, NoopFrame, TraceResult,
},
Block as RpcBlock, BlockError, Bundle, StateContext, TransactionRequest,
Block as RpcBlock, BlockError, Bundle, StateContext,
};
use reth_tasks::pool::BlockingTaskGuard;
use reth_trie::{HashedPostState, HashedStorage};

View File

@ -1,4 +1,5 @@
use alloy_primitives::{Address, Bytes, B256, U256, U64};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use jsonrpsee::core::RpcResult as Result;
use reth_primitives::{BlockId, BlockNumberOrTag};
use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer};
@ -7,7 +8,7 @@ pub use reth_rpc_engine_api::EngineApi;
use reth_rpc_eth_api::{FullEthApiTypes, RpcBlock, RpcReceipt, RpcTransaction};
use reth_rpc_types::{
state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log,
SyncStatus, TransactionRequest,
SyncStatus,
};
use tracing_futures::Instrument;

View File

@ -1,6 +1,7 @@
use std::{collections::HashSet, sync::Arc};
use alloy_primitives::{Bytes, B256, U256};
use alloy_rpc_types_eth::transaction::TransactionRequest;
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::{ChainSpec, EthereumHardforks};
@ -25,7 +26,7 @@ use reth_rpc_types::{
parity::*,
tracerequest::TraceCallRequest,
},
BlockOverrides, Index, TransactionRequest,
BlockOverrides, Index,
};
use reth_tasks::pool::BlockingTaskGuard;
use revm::{