Skip to content
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
202 changes: 109 additions & 93 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ revm = { git = "https://github.com/bluealloy/revm", branch = "main", features =
revm-primitives = { git = "https://github.com/bluealloy/revm", branch = "main", features = [
"std",
], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", branch = "main" }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", branch = "onbjerg/rm-callrequest" }

# eth
alloy-chains = { version = "0.1", feature = ["serde", "rlp", "arbitrary"] }
Expand All @@ -184,11 +184,11 @@ alloy-dyn-abi = "0.6"
alloy-sol-types = "0.6"
alloy-rlp = "0.3"
alloy-trie = "0.2"
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
alloy-rpc-engine-types = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", branch = "main" }
ethers-core = { version = "2.0", default-features = false }
ethers-providers = { version = "2.0", default-features = false }
ethers-signers = { version = "2.0", default-features = false }
Expand Down
7 changes: 4 additions & 3 deletions crates/primitives/src/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn calculate_receipt_root(

return ordered_trie_root_with_encoder(receipts.as_slice(), |r, buf| {
r.encode_inner(buf, false)
})
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we doing this again 😭😭😭😭😭😭😭😭😭😭😭

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bro i legit don't know why it does this. will fmt on linux before merging

}

ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false))
Expand Down Expand Up @@ -144,7 +144,7 @@ pub fn calculate_receipt_root_ref(

return ordered_trie_root_with_encoder(&receipts, |r, buf| {
ReceiptWithBloomRef::from(r).encode_inner(buf, false)
})
});
}

ordered_trie_root_with_encoder(receipts, |r, buf| {
Expand All @@ -156,7 +156,7 @@ pub fn calculate_receipt_root_ref(
pub fn calculate_ommers_root(ommers: &[Header]) -> B256 {
// Check if `ommers` list is empty
if ommers.is_empty() {
return EMPTY_OMMER_ROOT_HASH
return EMPTY_OMMER_ROOT_HASH;
}
// RLP Encode
let mut ommers_rlp = Vec::new();
Expand Down Expand Up @@ -627,6 +627,7 @@ mod tests {
let mut genesis_alloc = HashMap::new();
genesis_alloc
.insert(test_addr, GenesisAccount { balance: U256::MAX, ..Default::default() });

let root = state_root_unhashed(genesis_alloc);

assert_eq!(root, expected_root);
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-api/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use reth_rpc_types::{
BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace,
TraceResult,
},
Bundle, CallRequest, RichBlock, StateContext,
Bundle, RichBlock, StateContext, TransactionRequest,
};

/// Debug rpc interface.
Expand Down Expand Up @@ -102,7 +102,7 @@ pub trait DebugApi {
#[method(name = "traceCall")]
async fn debug_trace_call(
&self,
request: CallRequest,
request: TransactionRequest,
block_number: Option<BlockId>,
opts: Option<GethDebugTracingCallOptions>,
) -> RpcResult<GethTrace>;
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use reth_rpc_types::{
ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration,
},
state::StateOverride,
BlockOverrides, CallRequest, Filter, Log, RichBlock, SyncStatus,
BlockOverrides, Filter, Log, RichBlock, SyncStatus, TransactionRequest,
};

// NOTE: We can't use associated types in the `EngineApi` trait because of jsonrpsee, so we use a
Expand Down Expand Up @@ -183,7 +183,7 @@ pub trait EngineEthApi {
#[method(name = "call")]
async fn call(
&self,
request: CallRequest,
request: TransactionRequest,
block_number: Option<BlockId>,
state_overrides: Option<StateOverride>,
block_overrides: Option<Box<BlockOverrides>>,
Expand Down
10 changes: 5 additions & 5 deletions crates/rpc/rpc-api/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use reth_primitives::{
Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64,
};
use reth_rpc_types::{
state::StateOverride, AccessListWithGasUsed, BlockOverrides, Bundle, CallRequest,
state::StateOverride, AccessListWithGasUsed, BlockOverrides, Bundle,
EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Index, RichBlock, StateContext,
SyncStatus, Transaction, TransactionReceipt, TransactionRequest, Work,
};
Expand Down Expand Up @@ -146,7 +146,7 @@ pub trait EthApi {
#[method(name = "call")]
async fn call(
&self,
request: CallRequest,
request: TransactionRequest,
block_number: Option<BlockId>,
state_overrides: Option<StateOverride>,
block_overrides: Option<Box<BlockOverrides>>,
Expand Down Expand Up @@ -179,7 +179,7 @@ pub trait EthApi {
#[method(name = "createAccessList")]
async fn create_access_list(
&self,
request: CallRequest,
request: TransactionRequest,
block_number: Option<BlockId>,
) -> RpcResult<AccessListWithGasUsed>;

Expand All @@ -188,7 +188,7 @@ pub trait EthApi {
#[method(name = "estimateGas")]
async fn estimate_gas(
&self,
request: CallRequest,
request: TransactionRequest,
block_number: Option<BlockId>,
state_override: Option<StateOverride>,
) -> RpcResult<U256>;
Expand Down Expand Up @@ -262,7 +262,7 @@ pub trait EthApi {
/// Signs a transaction that can be submitted to the network at a later time using with
/// `sendRawTransaction.`
#[method(name = "signTransaction")]
async fn sign_transaction(&self, transaction: CallRequest) -> RpcResult<Bytes>;
async fn sign_transaction(&self, transaction: TransactionRequest) -> RpcResult<Bytes>;

/// Signs data via [EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md).
#[method(name = "signTypedData")]
Expand Down
6 changes: 3 additions & 3 deletions crates/rpc/rpc-api/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use reth_primitives::{BlockId, Bytes, B256};
use reth_rpc_types::{
state::StateOverride,
trace::{filter::TraceFilter, parity::*},
BlockOverrides, CallRequest, Index,
BlockOverrides, Index, TransactionRequest,
};
use std::collections::HashSet;

Expand All @@ -15,7 +15,7 @@ pub trait TraceApi {
#[method(name = "call")]
async fn trace_call(
&self,
call: CallRequest,
call: TransactionRequest,
trace_types: HashSet<TraceType>,
block_id: Option<BlockId>,
state_overrides: Option<StateOverride>,
Expand All @@ -28,7 +28,7 @@ pub trait TraceApi {
#[method(name = "callMany")]
async fn trace_call_many(
&self,
calls: Vec<(CallRequest, HashSet<TraceType>)>,
calls: Vec<(TransactionRequest, HashSet<TraceType>)>,
block_id: Option<BlockId>,
) -> RpcResult<Vec<TraceResults>>;

Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-builder/tests/it/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use reth_rpc_api::{
};
use reth_rpc_builder::RethRpcModule;
use reth_rpc_types::{
trace::filter::TraceFilter, CallRequest, Filter, Index, Log, PendingTransactionFilterKind,
trace::filter::TraceFilter, Filter, Index, Log, PendingTransactionFilterKind,
TransactionRequest,
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -129,7 +129,7 @@ where
let hash = B256::default();
let tx_hash = TxHash::default();
let block_number = BlockNumberOrTag::default();
let call_request = CallRequest::default();
let call_request = TransactionRequest::default();
let transaction_request = TransactionRequest::default();
let bytes = Bytes::default();
let tx = Bytes::from(hex!("02f871018303579880850555633d1b82520894eee27662c2b8eba3cd936a23f039f3189633e4c887ad591c62bdaeb180c080a07ea72c68abfb8fca1bd964f0f99132ed9280261bdca3e549546c0205e800f7d0a05b4ef3039e9c9b9babc179a1878fb825b5aaf5aed2fa8744854150157b08d6f3"));
Expand Down
8 changes: 4 additions & 4 deletions crates/rpc/rpc-testing-util/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use reth_primitives::{BlockId, TxHash, B256};
use reth_rpc_api::{clients::DebugApiClient, EthApiClient};
use reth_rpc_types::{
trace::geth::{GethDebugTracerType, GethDebugTracingOptions},
CallRequest,
TransactionRequest,
};
use std::{
pin::Pin,
Expand Down Expand Up @@ -42,7 +42,7 @@ pub trait DebugApiExt {
/// method for debug_traceCall
async fn debug_trace_call_json(
&self,
request: CallRequest,
request: TransactionRequest,
opts: GethDebugTracingOptions,
) -> Result<serde_json::Value, jsonrpsee::core::Error>;

Expand Down Expand Up @@ -98,7 +98,7 @@ where
}
async fn debug_trace_call_json(
&self,
request: CallRequest,
request: TransactionRequest,
opts: GethDebugTracingOptions,
) -> Result<serde_json::Value, jsonrpsee::core::Error> {
let mut params = jsonrpsee::core::params::ArrayParams::new();
Expand All @@ -112,7 +112,7 @@ where
request_json: String,
opts_json: String,
) -> Result<serde_json::Value, RpcError> {
let request = serde_json::from_str::<CallRequest>(&request_json)
let request = serde_json::from_str::<TransactionRequest>(&request_json)
.map_err(|e| RpcError::Custom(e.to_string()))?;
let opts = serde_json::from_str::<GethDebugTracingOptions>(&opts_json)
.map_err(|e| RpcError::Custom(e.to_string()))?;
Expand Down
14 changes: 7 additions & 7 deletions crates/rpc/rpc-testing-util/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use reth_rpc_types::{
parity::{LocalizedTransactionTrace, TraceResults, TraceType},
tracerequest::TraceCallRequest,
},
CallRequest, Index,
Index, TransactionRequest,
};
use std::{
collections::HashSet,
Expand All @@ -29,8 +29,8 @@ pub type ReplayTransactionResult = Result<(TraceResults, TxHash), (RpcError, TxH
/// A type representing the result of calling `trace_call_many` method.

pub type CallManyTraceResult = Result<
(Vec<TraceResults>, Vec<(CallRequest, HashSet<TraceType>)>),
(RpcError, Vec<(CallRequest, HashSet<TraceType>)>),
(Vec<TraceResults>, Vec<(TransactionRequest, HashSet<TraceType>)>),
(RpcError, Vec<(TransactionRequest, HashSet<TraceType>)>),
>;
/// Result type for the `trace_get` method that also captures the requested transaction hash and
/// index.
Expand Down Expand Up @@ -91,7 +91,7 @@ pub trait TraceApiExt {
block_id: Option<BlockId>,
) -> CallManyTraceStream<'_>
where
I: IntoIterator<Item = (CallRequest, HashSet<TraceType>)>;
I: IntoIterator<Item = (TransactionRequest, HashSet<TraceType>)>;
/// Returns a new stream that yields the traces for the given transaction hash and indices.
fn trace_get_stream<I>(&self, hash: B256, indices: I) -> TraceGetStream<'_>
where
Expand Down Expand Up @@ -306,7 +306,7 @@ impl<T: TraceApiClient + Sync> TraceApiExt for T {
block_id: Option<BlockId>,
) -> CallManyTraceStream<'_>
where
I: IntoIterator<Item = (CallRequest, HashSet<TraceType>)>,
I: IntoIterator<Item = (TransactionRequest, HashSet<TraceType>)>,
{
let call_set = calls.into_iter().collect::<Vec<_>>();
let stream = futures::stream::once(async move {
Expand Down Expand Up @@ -569,8 +569,8 @@ mod tests {
async fn can_create_trace_call_many_stream() {
let client = HttpClientBuilder::default().build("http://localhost:8545").unwrap();

let call_request_1 = CallRequest::default();
let call_request_2 = CallRequest::default();
let call_request_1 = TransactionRequest::default();
let call_request_2 = TransactionRequest::default();
let trace_types = HashSet::from([TraceType::StateDiff, TraceType::VmTrace]);
let calls = vec![(call_request_1, trace_types.clone()), (call_request_2, trace_types)];

Expand Down
16 changes: 11 additions & 5 deletions crates/rpc/rpc-types-compat/src/transaction/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
//! Compatibility functions for rpc `Transaction` type.
mod signature;
mod typed;
use alloy_rpc_types::{
other::OtherFields,
request::{TransactionInput, TransactionRequest},
};
use reth_primitives::{
BlockNumber, Transaction as PrimitiveTransaction, TransactionKind as PrimitiveTransactionKind,
TransactionSignedEcRecovered, TxType, B256, U128, U256, U64,
};
#[cfg(feature = "optimism")]
use reth_rpc_types::optimism::OptimismTransactionFields;
use reth_rpc_types::{AccessListItem, CallInput, CallRequest, Transaction};
use reth_rpc_types::{AccessListItem, Transaction};
use signature::from_primitive_signature;
pub use typed::*;
/// Create a new rpc transaction result for a mined transaction, using the given block hash,
Expand Down Expand Up @@ -167,8 +171,8 @@ pub fn from_primitive_access_list(
)
}

/// Convert [TransactionSignedEcRecovered] to [CallRequest]
pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> CallRequest {
/// Convert [TransactionSignedEcRecovered] to [TransactionRequest]
pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> TransactionRequest {
let from = tx.signer();
let to = tx.transaction.to();
let gas = tx.transaction.gas_limit();
Expand All @@ -189,20 +193,22 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> CallRequ
};
let max_priority_fee_per_gas = tx.transaction.max_priority_fee_per_gas();

CallRequest {
TransactionRequest {
from: Some(from),
to,
gas_price: gas_price.map(U256::from),
max_fee_per_gas: max_fee_per_gas.map(U256::from),
max_priority_fee_per_gas: max_priority_fee_per_gas.map(U256::from),
gas: Some(U256::from(gas)),
value: Some(value.into()),
input: CallInput::new(input),
input: TransactionInput::new(input),
nonce: Some(U64::from(nonce)),
chain_id: chain_id.map(U64::from),
access_list,
max_fee_per_blob_gas: max_fee_per_blob_gas.map(U256::from),
blob_versioned_hashes,
transaction_type: Some(tx_type.into()),
sidecar: None,
other: OtherFields::default(),
}
}
Loading