Skip to content

Commit

Permalink
update reth remove alloy-rpc-types and use reth-rpc-types
Browse files Browse the repository at this point in the history
  • Loading branch information
eyusufatik committed Mar 29, 2024
1 parent 855bc31 commit 1cf8f6b
Show file tree
Hide file tree
Showing 14 changed files with 351 additions and 289 deletions.
555 changes: 312 additions & 243 deletions Cargo.lock

Large diffs are not rendered by default.

29 changes: 13 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,23 @@ ethers-providers = { version = "2.0", default-features = false }
ethers-signers = { version = "2.0", default-features = false }
ethers-middleware = { version = "2.0", default-features = false }

reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-interfaces = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.2" }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "d7317c7" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-interfaces = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "0ad0338" }

revm = { version = "7.1.0", features = [
revm = { version = "7.2.0", features = [
"std",
"secp256k1",
], default-features = false }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "9ac2c90", features = [
"jsonrpsee-types",
] }
alloy-primitives = "0.6"
alloy-sol-types = "0.6"
secp256k1 = { version = "0.27.0", default-features = false, features = [
Expand Down
2 changes: 0 additions & 2 deletions crates/ethereum-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ reth-primitives = { workspace = true }
reth-rpc-types = { workspace = true }
reth-rpc-types-compat = { workspace = true }

alloy-rpc-types = { workspace = true }

ethers = { workspace = true }
tokio = { workspace = true }
schnellru = "0.2.1"
Expand Down
1 change: 0 additions & 1 deletion crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ ethers = { workspace = true }

alloy-primitives = { workspace = true, features = ["rand", "rlp", "serde"] }
alloy-sol-types = { workspace = true }
alloy-rpc-types = { workspace = true }
alloy-rlp = { workspace = true }
revm = { workspace = true, features = [
"optional_block_gas_limit",
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/evm/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub(crate) fn prepare_call_env(
transact_to: to.map(TransactTo::Call).unwrap_or_else(TransactTo::create),
value: value.unwrap_or_default(),
data: input.try_into_unique_input()?.unwrap_or_default(),
chain_id: chain_id.map(|c| c.to::<u64>()),
chain_id,
access_list: access_list
.map(reth_rpc_types::AccessList::into_flattened)
.unwrap_or_default(),
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use reth_primitives::TransactionKind::{Call, Create};
use reth_primitives::{
Block, BlockId, BlockNumberOrTag, SealedHeader, TransactionSignedEcRecovered, U128, U256, U64,
};
use reth_revm::access_list::AccessListInspector;
use reth_revm::tracing::{TracingInspector, TracingInspectorConfig};
use reth_rpc_types::other::OtherFields;
use reth_rpc_types::trace::geth::{GethDebugTracingOptions, GethTrace};
Expand All @@ -20,7 +21,6 @@ use revm::primitives::{
TxEnv, KECCAK_EMPTY,
};
use revm::{Database, DatabaseCommit};
use revm_inspectors::access_list::AccessListInspector;
use sov_modules_api::macros::rpc_gen;
use sov_modules_api::prelude::*;
use sov_modules_api::WorkingSet;
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/rpc_helpers/tracing_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use reth_primitives::revm::env::{fill_tx_env, fill_tx_env_with_recovered};
use reth_primitives::revm_primitives::TxEnv;
use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered, TxHash, U256};
use reth_revm::tracing::{FourByteInspector, TracingInspector, TracingInspectorConfig};
use reth_rpc_types::trace::geth::{
FourByteFrame, GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingOptions,
GethTrace, NoopFrame,
Expand All @@ -9,7 +10,6 @@ use revm::precompile::{PrecompileSpecId, Precompiles};
use revm::primitives::db::Database;
use revm::primitives::{Address, BlockEnv, CfgEnvWithHandlerCfg, EVMError, ResultAndState, SpecId};
use revm::{inspector_handle_register, Inspector};
use revm_inspectors::tracing::{FourByteInspector, TracingInspector, TracingInspectorConfig};

use crate::error::rpc::{EthApiError, EthResult};
use crate::evm::db::EvmDb;
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/tests/call_tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::str::FromStr;

use alloy_rpc_types::request::{TransactionInput, TransactionRequest};
use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use reth_primitives::{Address, BlockNumberOrTag, Bytes, TransactionKind, U64};
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::{SpecId, KECCAK_EMPTY, U256};
use sov_modules_api::default_context::DefaultContext;
use sov_modules_api::utils::generate_address;
Expand Down Expand Up @@ -438,7 +438,7 @@ fn test_block_hash_in_evm() {
),
},
nonce: Some(U64::from(0u64)),
chain_id: Some(U64::from(DEFAULT_CHAIN_ID)),
chain_id: Some(DEFAULT_CHAIN_ID),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down
8 changes: 4 additions & 4 deletions crates/evm/src/tests/queries/basic_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::collections::BTreeMap;
use std::str::FromStr;

use alloy_primitives::FixedBytes;
use alloy_rpc_types::request::{TransactionInput, TransactionRequest};
use hex::FromHex;
use reth_primitives::{Address, BlockId, BlockNumberOrTag, U64};
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use reth_rpc_types::{Block, Rich, TransactionReceipt};
use revm::primitives::{B256, U256};
use serde_json::json;
Expand Down Expand Up @@ -204,7 +204,7 @@ fn call_test() {
value: Some(U256::from(100000000)),
input: None.into(),
nonce: Some(U64::from(7)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down Expand Up @@ -235,7 +235,7 @@ fn call_test() {
value: Some(U256::from(100000000)),
input: TransactionInput::new(alloy_primitives::Bytes::from_str(&call_data).unwrap()),
nonce: Some(U64::from(7)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down Expand Up @@ -266,7 +266,7 @@ fn call_test() {
alloy_primitives::Bytes::from_str(&call_data).unwrap(),
),
nonce: None,
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down
10 changes: 5 additions & 5 deletions crates/evm/src/tests/queries/estimate_gas_tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::str::FromStr;

use alloy_primitives::{FixedBytes, Uint};
use alloy_rpc_types::request::{TransactionInput, TransactionRequest};
use hex::FromHex;
use jsonrpsee::core::RpcResult;
use reth_primitives::hex::ToHexExt;
use reth_primitives::{AccessList, AccessListItem, Address, BlockNumberOrTag, Bytes, U64};
use reth_rpc::eth::error::RpcInvalidTransactionError;
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use reth_rpc_types::AccessListWithGasUsed;
use revm::primitives::U256;
use sov_modules_api::default_context::DefaultContext;
Expand Down Expand Up @@ -36,7 +36,7 @@ fn payable_contract_value_test() {
data: None,
},
nonce: Some(U64::from(1)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down Expand Up @@ -66,7 +66,7 @@ fn test_tx_request_fields_gas() {
data: None,
},
nonce: Some(U64::from(1)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down Expand Up @@ -161,7 +161,7 @@ fn test_tx_request_fields_gas() {
working_set.unset_archival_version();

let tx_req_invalid_chain_id = TransactionRequest {
chain_id: Some(U64::from(3u64)),
chain_id: Some(3u64),
..tx_req_contract_call.clone()
};

Expand Down Expand Up @@ -297,7 +297,7 @@ fn test_access_list() {
value: None,
input: TransactionInput::new(input_data),
nonce: Some(U64::from(3)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down
6 changes: 3 additions & 3 deletions crates/evm/src/tests/queries/evm_call_tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::str::FromStr;

use alloy_rpc_types::request::{TransactionInput, TransactionRequest};
use hex::FromHex;
use jsonrpsee::core::RpcResult;
use reth_primitives::{Address, BlockNumberOrTag, Bytes, U64};
use reth_rpc::eth::error::RpcInvalidTransactionError;
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::U256;
use sov_modules_api::WorkingSet;

Expand Down Expand Up @@ -333,7 +333,7 @@ fn eth_call_eip1559(
value: None,
input: TransactionInput::new(contract.get_call_data().to_vec().into()),
nonce: Some(U64::from(9)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
..Default::default()
};

Expand All @@ -357,7 +357,7 @@ fn gas_price_call_test() {
value: Some(U256::from(1000)),
input: None.into(),
nonce: Some(U64::from(1u64)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
blob_versioned_hashes: None,
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/tests/tx_tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::str::FromStr;

use alloy_rpc_types::request::{TransactionInput, TransactionRequest};
use ethers_core::types::transaction::eip2718::TypedTransaction;
use ethers_core::types::{Bytes, Eip1559TransactionRequest};
use ethers_core::utils::rlp::Rlp;
use ethers_signers::{LocalWallet, Signer};
use reth_primitives::{Address, TransactionSignedEcRecovered, U256, U64, U8};
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::{TransactTo, TxEnv};

use crate::evm::prepare_call_env;
Expand Down Expand Up @@ -83,7 +83,7 @@ fn prepare_call_env_conversion() {
value: Some(U256::from(300u64)),
input: TransactionInput::default(),
nonce: Some(U64::from(1u64)),
chain_id: Some(U64::from(1u64)),
chain_id: Some(1u64),
access_list: None,
transaction_type: Some(U8::from(2u8)),
blob_versioned_hashes: None,
Expand Down
2 changes: 2 additions & 0 deletions crates/sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ reth-db = { workspace = true }
reth-trie = { workspace = true }
reth-rpc-types-compat = { workspace = true }

revm = { workspace = true }

ethers = { workspace = true }
tokio = { workspace = true }
schnellru = "0.2.1"
Expand Down
13 changes: 5 additions & 8 deletions crates/sequencer/src/db_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use reth_primitives::{
};
use reth_provider::{
AccountReader, BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt,
BundleStateWithReceipts, ChainSpecProvider, HeaderProvider, ReceiptProvider,
ReceiptProviderIdExt, StateProvider, StateProviderFactory, StateRootProvider,
TransactionsProvider, WithdrawalsProvider,
ChainSpecProvider, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, StateProvider,
StateProviderFactory, StateRootProvider, TransactionsProvider, WithdrawalsProvider,
};
use reth_rpc_types::{Block, BlockTransactions};
use reth_trie::updates::TrieUpdates;
use revm::db::states::bundle_state::BundleState;
use sov_modules_api::WorkingSet;

#[derive(Clone)]
Expand Down Expand Up @@ -525,15 +525,12 @@ impl<C: sov_modules_api::Context> StateProviderFactory for DbProvider<C> {

impl<C: sov_modules_api::Context> StateRootProvider for DbProvider<C> {
#[doc = r" Returns the state root of the BundleState on top of the current state."]
fn state_root(
&self,
_bundle_state: &BundleStateWithReceipts,
) -> ProviderResult<reth_primitives::B256> {
fn state_root(&self, _bundle_state: &BundleState) -> ProviderResult<reth_primitives::B256> {
unimplemented!("state_root")
}
fn state_root_with_updates(
&self,
_bundle_state: &BundleStateWithReceipts,
_bundle_state: &BundleState,
) -> reth_interfaces::provider::ProviderResult<(reth_primitives::B256, TrieUpdates)> {
unimplemented!("state_root_with_updates")
}
Expand Down

0 comments on commit 1cf8f6b

Please sign in to comment.