diff --git a/Cargo.lock b/Cargo.lock index 5a68ee773..c046501c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,7 +133,7 @@ dependencies = [ [[package]] name = "alloy-consensus" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-eips", "alloy-primitives", @@ -166,7 +166,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -185,11 +185,12 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "alloy-serde", "serde", + "serde_json", ] [[package]] @@ -207,7 +208,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "serde", @@ -219,7 +220,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-consensus", "alloy-eips", @@ -227,6 +228,7 @@ dependencies = [ "alloy-primitives", "alloy-rpc-types", "alloy-signer", + "alloy-sol-types", "async-trait", "futures-utils-wasm", "thiserror", @@ -235,7 +237,7 @@ dependencies = [ [[package]] name = "alloy-node-bindings" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -277,7 +279,7 @@ dependencies = [ [[package]] name = "alloy-provider" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-eips", "alloy-json-rpc", @@ -327,7 +329,7 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -347,7 +349,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-consensus", "alloy-eips", @@ -369,7 +371,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "alloy-serde", @@ -379,7 +381,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-consensus", "alloy-eips", @@ -390,6 +392,8 @@ dependencies = [ "ethereum_ssz", "ethereum_ssz_derive", "jsonrpsee-types", + "jsonwebtoken 9.3.0", + "rand 0.8.5", "serde", "thiserror", ] @@ -397,7 +401,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -409,7 +413,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "serde", @@ -419,7 +423,7 @@ dependencies = [ [[package]] name = "alloy-signer" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-primitives", "async-trait", @@ -432,7 +436,7 @@ dependencies = [ [[package]] name = "alloy-signer-wallet" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-consensus", "alloy-network", @@ -507,7 +511,7 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-json-rpc", "base64 0.22.0", @@ -525,7 +529,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=39b8695#39b869585955d95e9c64c3e1b66f16432ae4f132" +source = "git+https://github.com/alloy-rs/alloy?rev=4e22b9e#4e22b9e1de80f1b1cc5dfdcd9461d44b27cf27ca" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -3199,8 +3203,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -4341,13 +4347,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ "base64 0.21.7", - "pem", + "pem 1.1.1", "ring 0.16.20", "serde", "serde_json", "simple_asn1", ] +[[package]] +name = "jsonwebtoken" +version = "9.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +dependencies = [ + "base64 0.21.7", + "js-sys", + "pem 3.0.4", + "ring 0.17.8", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "k256" version = "0.13.3" @@ -5413,6 +5434,16 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.0", + "serde", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -7459,7 +7490,7 @@ dependencies = [ "http-body 0.4.6", "hyper 0.14.28", "jsonrpsee", - "jsonwebtoken", + "jsonwebtoken 8.3.0", "metrics", "parking_lot 0.12.2", "pin-project", @@ -7849,7 +7880,7 @@ dependencies = [ [[package]] name = "revm-inspectors" version = "0.1.0" -source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=dc614ee#dc614eec85ee4d4af938865b121fad58ec7dad5f" +source = "git+https://github.com/paradigmxyz/evm-inspectors?rev=848d568#848d5688d0c499c538b9a78b423a7061525aa580" dependencies = [ "alloy-primitives", "alloy-rpc-types", diff --git a/Cargo.toml b/Cargo.toml index bd4fd5fd9..b62467405 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -277,7 +277,7 @@ reth-optimism-consensus = { path = "crates/optimism/consensus" } # revm revm = { version = "8.0.0", features = ["std", "secp256k1"], default-features = false } revm-primitives = { version = "3.1.0", features = ["std"], default-features = false } -revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "dc614ee" } +revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "848d568" } # eth alloy-chains = "0.1.15" @@ -286,20 +286,20 @@ alloy-dyn-abi = "0.7.1" alloy-sol-types = "0.7.1" alloy-rlp = "0.3.4" alloy-trie = "0.3.1" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695", default-features = false, features = [ +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e", default-features = false, features = [ "reqwest", ] } -alloy-eips = { git = "https://github.com/alloy-rs/alloy", default-features = false, rev = "39b8695" } -alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } -alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "39b8695" } +alloy-eips = { git = "https://github.com/alloy-rs/alloy", default-features = false, rev = "4e22b9e" } +alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } +alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "4e22b9e" } # misc auto_impl = "1" diff --git a/crates/e2e-test-utils/src/transaction.rs b/crates/e2e-test-utils/src/transaction.rs index a2c40052c..ea066304b 100644 --- a/crates/e2e-test-utils/src/transaction.rs +++ b/crates/e2e-test-utils/src/transaction.rs @@ -69,7 +69,7 @@ fn tx(chain_id: u64, data: Option, nonce: u64) -> TransactionRequest { TransactionRequest { nonce: Some(nonce), value: Some(U256::from(100)), - to: Some(Address::random()), + to: Some(reth_primitives::TxKind::Call(Address::random())), gas: Some(210000), max_fee_per_gas: Some(20e9 as u128), max_priority_fee_per_gas: Some(20e9 as u128), diff --git a/crates/primitives/src/withdrawal.rs b/crates/primitives/src/withdrawal.rs index 730fb291c..a348b6a05 100644 --- a/crates/primitives/src/withdrawal.rs +++ b/crates/primitives/src/withdrawal.rs @@ -1,4 +1,4 @@ -use crate::{constants::GWEI_TO_WEI, serde_helper::u64_hex, Address}; +use crate::{constants::GWEI_TO_WEI, serde_helper::u64_via_ruint, Address}; use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use reth_codecs::{main_codec, Compact}; use std::{ @@ -11,15 +11,15 @@ use std::{ #[derive(Debug, Clone, PartialEq, Eq, Default, Hash, RlpEncodable, RlpDecodable)] pub struct Withdrawal { /// Monotonically increasing identifier issued by consensus layer. - #[serde(with = "u64_hex")] + #[serde(with = "u64_via_ruint")] pub index: u64, /// Index of validator associated with withdrawal. - #[serde(with = "u64_hex", rename = "validatorIndex")] + #[serde(with = "u64_via_ruint", rename = "validatorIndex")] pub validator_index: u64, /// Target address for withdrawn ether. pub address: Address, /// Value of the withdrawal in gwei. - #[serde(with = "u64_hex")] + #[serde(with = "u64_via_ruint")] pub amount: u64, } diff --git a/crates/rpc/rpc-api/src/eth.rs b/crates/rpc/rpc-api/src/eth.rs index c878a7e1c..8811ef87d 100644 --- a/crates/rpc/rpc-api/src/eth.rs +++ b/crates/rpc/rpc-api/src/eth.rs @@ -1,7 +1,6 @@ use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{ - serde_helper::{num::U64HexOrNumber, JsonStorageKey}, - Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, + serde_helper::JsonStorageKey, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, }; use reth_rpc_types::{ state::StateOverride, AccessListWithGasUsed, AnyTransactionReceipt, BlockOverrides, Bundle, @@ -247,7 +246,7 @@ pub trait EthApi { #[method(name = "feeHistory")] async fn fee_history( &self, - block_count: U64HexOrNumber, + block_count: u64, newest_block: BlockNumberOrTag, reward_percentiles: Option>, ) -> RpcResult; diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index 7fc714a2d..42fecb87d 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -167,7 +167,7 @@ where EthApiClient::block_number(client).await.unwrap(); EthApiClient::get_code(client, address, None).await.unwrap(); EthApiClient::send_raw_transaction(client, tx).await.unwrap(); - EthApiClient::fee_history(client, 0.into(), block_number, None).await.unwrap(); + EthApiClient::fee_history(client, 0, block_number, None).await.unwrap(); EthApiClient::balance(client, address, None).await.unwrap(); EthApiClient::transaction_count(client, address, None).await.unwrap(); EthApiClient::storage_at(client, address, U256::default().into(), None).await.unwrap(); diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 1004e93e2..d0f4672a2 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -181,7 +181,7 @@ pub fn from_primitive_access_list( /// Convert [TransactionSignedEcRecovered] to [TransactionRequest] pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> TransactionRequest { let from = tx.signer(); - let to = tx.transaction.to(); + let to = Some(tx.transaction.to().into()); let gas = tx.transaction.gas_limit(); let value = tx.transaction.value(); let input = tx.transaction.input().clone(); diff --git a/crates/rpc/rpc/src/eth/api/call.rs b/crates/rpc/rpc/src/eth/api/call.rs index 62be2612c..d556249c3 100644 --- a/crates/rpc/rpc/src/eth/api/call.rs +++ b/crates/rpc/rpc/src/eth/api/call.rs @@ -14,7 +14,9 @@ use crate::{ }; use reth_evm::ConfigureEvm; use reth_network_api::NetworkInfo; -use reth_primitives::{revm::env::tx_env_with_recovered, BlockId, BlockNumberOrTag, Bytes, U256}; +use reth_primitives::{ + revm::env::tx_env_with_recovered, BlockId, BlockNumberOrTag, Bytes, TxKind, U256, +}; use reth_provider::{ BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, StateProvider, StateProviderFactory, }; @@ -411,7 +413,7 @@ where } let from = request.from.unwrap_or_default(); - let to = if let Some(to) = request.to { + let to = if let Some(TxKind::Call(to)) = request.to { to } else { let nonce = db.basic_ref(from)?.unwrap_or_default().nonce; diff --git a/crates/rpc/rpc/src/eth/api/server.rs b/crates/rpc/rpc/src/eth/api/server.rs index 6be1a88af..2648df08f 100644 --- a/crates/rpc/rpc/src/eth/api/server.rs +++ b/crates/rpc/rpc/src/eth/api/server.rs @@ -8,8 +8,7 @@ use tracing::trace; use reth_evm::ConfigureEvm; use reth_network_api::NetworkInfo; use reth_primitives::{ - serde_helper::{num::U64HexOrNumber, JsonStorageKey}, - Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, + serde_helper::JsonStorageKey, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, }; use reth_provider::{ BlockIdReader, BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, @@ -353,14 +352,12 @@ where /// Handler for: `eth_feeHistory` async fn fee_history( &self, - block_count: U64HexOrNumber, + block_count: u64, newest_block: BlockNumberOrTag, reward_percentiles: Option>, ) -> Result { trace!(target: "rpc::eth", ?block_count, ?newest_block, ?reward_percentiles, "Serving eth_feeHistory"); - return Ok( - EthApi::fee_history(self, block_count.to(), newest_block, reward_percentiles).await? - ) + return Ok(EthApi::fee_history(self, block_count, newest_block, reward_percentiles).await?) } /// Handler for: `eth_mining` @@ -585,7 +582,7 @@ mod tests { async fn test_fee_history_empty() { let response = as EthApiServer>::fee_history( &build_test_eth_api(NoopProvider::default()), - 1.into(), + 1, BlockNumberOrTag::Latest, None, ) @@ -607,7 +604,7 @@ mod tests { let response = as EthApiServer>::fee_history( ð_api, - (newest_block + 1).into(), + newest_block + 1, newest_block.into(), Some(vec![10.0]), ) @@ -630,7 +627,7 @@ mod tests { let response = as EthApiServer>::fee_history( ð_api, - 1.into(), + 1, (newest_block + 1000).into(), Some(vec![10.0]), ) @@ -653,7 +650,7 @@ mod tests { let response = as EthApiServer>::fee_history( ð_api, - 0.into(), + 0, newest_block.into(), None, ) diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 1ca8ed119..3e582821b 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -919,10 +919,7 @@ where gas_limit: U256::from(gas.unwrap_or_default()), value: value.unwrap_or_default(), input: data.into_input().unwrap_or_default(), - kind: match to { - Some(to) => RpcTransactionKind::Call(to), - None => RpcTransactionKind::Create, - }, + kind: to.unwrap_or(RpcTransactionKind::Create), chain_id: None, })) } @@ -935,10 +932,7 @@ where gas_limit: U256::from(gas.unwrap_or_default()), value: value.unwrap_or_default(), input: data.into_input().unwrap_or_default(), - kind: match to { - Some(to) => RpcTransactionKind::Call(to), - None => RpcTransactionKind::Create, - }, + kind: to.unwrap_or(RpcTransactionKind::Create), chain_id: 0, access_list, })) @@ -958,10 +952,7 @@ where gas_limit: U256::from(gas.unwrap_or_default()), value: value.unwrap_or_default(), input: data.into_input().unwrap_or_default(), - kind: match to { - Some(to) => RpcTransactionKind::Call(to), - None => RpcTransactionKind::Create, - }, + kind: to.unwrap_or(RpcTransactionKind::Create), chain_id: 0, access_list: access_list.unwrap_or_default(), })) @@ -987,10 +978,7 @@ where gas_limit: U256::from(gas.unwrap_or_default()), value: value.unwrap_or_default(), input: data.into_input().unwrap_or_default(), - kind: match to { - Some(to) => RpcTransactionKind::Call(to), - None => RpcTransactionKind::Create, - }, + kind: to.unwrap_or(RpcTransactionKind::Create), access_list: access_list.unwrap_or_default(), // eip-4844 specific. diff --git a/crates/rpc/rpc/src/eth/revm_utils.rs b/crates/rpc/rpc/src/eth/revm_utils.rs index 4b00d4662..c80aee99d 100644 --- a/crates/rpc/rpc/src/eth/revm_utils.rs +++ b/crates/rpc/rpc/src/eth/revm_utils.rs @@ -7,7 +7,7 @@ use reth_primitives::revm::env::fill_op_tx_env; use reth_primitives::revm::env::fill_tx_env; use reth_primitives::{ revm::env::fill_tx_env_with_recovered, Address, TransactionSigned, - TransactionSignedEcRecovered, TxHash, B256, U256, + TransactionSignedEcRecovered, TxHash, TxKind, B256, U256, }; use reth_rpc_types::{ state::{AccountOverride, StateOverride}, @@ -250,13 +250,17 @@ pub(crate) fn create_txn_env( )?; let gas_limit = gas.unwrap_or_else(|| block_env.gas_limit.min(U256::from(u64::MAX)).to()); + let transact_to = match to { + Some(TxKind::Call(to)) => TransactTo::call(to), + _ => TransactTo::create(), + }; let env = TxEnv { gas_limit: gas_limit.try_into().map_err(|_| RpcInvalidTransactionError::GasUintOverflow)?, nonce, caller: from.unwrap_or_default(), gas_price, gas_priority_fee: max_priority_fee_per_gas, - transact_to: to.map(TransactTo::Call).unwrap_or_else(TransactTo::create), + transact_to, value: value.unwrap_or_default(), data: input.try_into_unique_input()?.unwrap_or_default(), chain_id,