Skip to content

Commit

Permalink
Update reth to beta 5 (#474)
Browse files Browse the repository at this point in the history
* update reth

* fix cargo.toml

* update rustls

* lint
  • Loading branch information
eyusufatik authored May 1, 2024
1 parent bb44779 commit a774bb4
Show file tree
Hide file tree
Showing 11 changed files with 593 additions and 182 deletions.
644 changes: 521 additions & 123 deletions Cargo.lock

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,28 @@ 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.4", default-features = false }
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-node-api = { 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" }
reth-stages = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.4" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5", default-features = false }
reth-interfaces = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }
reth-stages = { git = "https://github.com/paradigmxyz/reth", tag = "v0.2.0-beta.5" }

revm = { version = "7.2.0", features = ["serde"], default-features = false }
# forcing cargo for this version or else chooses 3.1.1 and there is some dependency conflicts
revm-primitives = { version = "=3.1.0", default-features = false }
# forcing cargo for this version or else chooses 0.3.1 and there is some dependency conflicts
alloy-trie = { version = "=0.3.0", default-features = false }
alloy-primitives = "0.6"
alloy-sol-types = "0.6"
alloy-primitives = "0.6.4"
alloy-sol-types = "0.6.4"

secp256k1 = { version = "0.27.0", default-features = false, features = [
"global-context",
"recovery",
Expand Down
51 changes: 34 additions & 17 deletions bin/citrea/provers/risc0/guest-mock/Cargo.lock

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

6 changes: 3 additions & 3 deletions crates/ethereum-rpc/src/gas_price/gas_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;
use citrea_evm::{EthApiError, EthResult, Evm, RpcInvalidTransactionError};
use reth_primitives::basefee::calculate_next_block_base_fee;
use reth_primitives::constants::GWEI_TO_WEI;
use reth_primitives::{BlockNumberOrTag, B256, U256, U64};
use reth_primitives::{BlockNumberOrTag, B256, U256, U8};
use reth_rpc_types::{BlockTransactions, FeeHistory};
use serde::{Deserialize, Serialize};
use sov_modules_api::WorkingSet;
Expand Down Expand Up @@ -424,7 +424,7 @@ pub(crate) fn effective_gas_tip(
) -> Option<U256> {
let priority_fee_or_price = U256::from(match transaction.transaction_type {
Some(tx_type) => {
if tx_type == U64::from(2) {
if tx_type == U8::from(2) {
transaction.max_priority_fee_per_gas.unwrap()
} else {
transaction.gas_price.unwrap()
Expand All @@ -436,7 +436,7 @@ pub(crate) fn effective_gas_tip(
if let Some(base_fee) = base_fee {
let max_fee_per_gas = U256::from(match transaction.transaction_type {
Some(tx_type) => {
if tx_type == U64::from(2) {
if tx_type == U8::from(2) {
transaction.max_priority_fee_per_gas.unwrap()
} else {
transaction.gas_price.unwrap()
Expand Down
11 changes: 3 additions & 8 deletions crates/evm/src/evm/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,17 @@ pub(crate) fn prepare_call_env(
}

let env = TxEnv {
gas_price,
nonce,
chain_id,
gas_limit: gas_limit
.try_into()
.map_err(|_| RpcInvalidTransactionError::GasUintOverflow)?,
nonce: nonce
.map(|n| {
n.try_into()
.map_err(|_| RpcInvalidTransactionError::NonceTooHigh)
})
.transpose()?,
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),
value: value.unwrap_or_default(),
data: input.try_into_unique_input()?.unwrap_or_default(),
chain_id,
access_list: access_list
.map(reth_rpc_types::AccessList::into_flattened)
.unwrap_or_default(),
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ pub(crate) fn build_rpc_receipt(
let transaction: TransactionSignedEcRecovered = tx.into();
let transaction_kind = transaction.kind();

let transaction_hash = Some(transaction.hash);
let transaction_hash = transaction.hash;
let transaction_index = tx_number - block.transactions.start;
let block_hash = Some(block.header.hash());
let block_number = Some(U256::from(block.header.number));
Expand Down Expand Up @@ -1605,7 +1605,7 @@ pub(crate) fn build_rpc_receipt(
data: log.data,
block_hash,
block_number,
transaction_hash,
transaction_hash: Some(transaction_hash),
transaction_index: Some(U256::from(transaction_index)),
log_index: Some(U256::from(receipt.log_index_start + idx as u64)),
removed: false,
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,7 +1,7 @@
use std::str::FromStr;

use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use reth_primitives::{Address, BlockNumberOrTag, Bytes, TransactionKind, U64};
use reth_primitives::{Address, BlockNumberOrTag, Bytes, TransactionKind};
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::{SpecId, KECCAK_EMPTY, U256};
use sov_modules_api::default_context::DefaultContext;
Expand Down Expand Up @@ -517,7 +517,7 @@ fn test_block_hash_in_evm() {
.into(),
),
},
nonce: Some(U64::from(0u64)),
nonce: Some(0u64),
chain_id: Some(DEFAULT_CHAIN_ID),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/tests/queries/basic_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fn call_test() {
max_priority_fee_per_gas: None,
value: Some(U256::from(100000000)),
input: None.into(),
nonce: Some(U64::from(7)),
nonce: Some(7u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down Expand Up @@ -280,7 +280,7 @@ fn call_test() {
max_priority_fee_per_gas: None,
value: Some(U256::from(100000000)),
input: TransactionInput::new(alloy_primitives::Bytes::from_str(&call_data).unwrap()),
nonce: Some(U64::from(7)),
nonce: Some(7u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down
6 changes: 3 additions & 3 deletions crates/evm/src/tests/queries/estimate_gas_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn payable_contract_value_test() {
input: None,
data: None,
},
nonce: Some(U64::from(1)),
nonce: Some(1u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down Expand Up @@ -65,7 +65,7 @@ fn test_tx_request_fields_gas() {
input: None,
data: None,
},
nonce: Some(U64::from(1)),
nonce: Some(1u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down Expand Up @@ -293,7 +293,7 @@ fn test_access_list() {
max_priority_fee_per_gas: None,
value: None,
input: TransactionInput::new(input_data),
nonce: Some(U64::from(3)),
nonce: Some(3u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: None,
Expand Down
10 changes: 5 additions & 5 deletions crates/evm/src/tests/queries/evm_call_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::str::FromStr;

use hex::FromHex;
use jsonrpsee::core::RpcResult;
use reth_primitives::{Address, BlockNumberOrTag, Bytes, U64};
use reth_primitives::{Address, BlockNumberOrTag, Bytes};
use reth_rpc::eth::error::RpcInvalidTransactionError;
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::U256;
Expand Down Expand Up @@ -148,7 +148,7 @@ fn call_contract_with_invalid_nonce() {

let contract_call_data = Bytes::from(contract.set_call_data(5).to_vec());

let invalid_nonce = U64::from(100);
let invalid_nonce = 100u64;

let call_result = evm.get_call(
TransactionRequest {
Expand All @@ -168,7 +168,7 @@ fn call_contract_with_invalid_nonce() {

assert_eq!(call_result, Ok(Bytes::from_str("0x").unwrap()));

let low_nonce = U64::from(2);
let low_nonce = 2u64;

let call_result = evm.get_call(
TransactionRequest {
Expand Down Expand Up @@ -345,7 +345,7 @@ fn eth_call_eip1559(
max_priority_fee_per_gas,
value: None,
input: TransactionInput::new(contract.get_call_data().to_vec().into()),
nonce: Some(U64::from(9)),
nonce: Some(9u64),
chain_id: Some(1u64),
..Default::default()
};
Expand All @@ -369,7 +369,7 @@ fn gas_price_call_test() {
to: Some(Address::from_str("0x819c5497b157177315e1204f52e588b393771719").unwrap()),
value: Some(U256::from(1000)),
input: None.into(),
nonce: Some(U64::from(1u64)),
nonce: Some(1u64),
chain_id: Some(1u64),
access_list: None,
max_fee_per_blob_gas: 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
Expand Up @@ -4,7 +4,7 @@ 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_primitives::{Address, TransactionSignedEcRecovered, U256, U8};
use reth_rpc_types::request::{TransactionInput, TransactionRequest};
use revm::primitives::{TransactTo, TxEnv};

Expand Down Expand Up @@ -86,7 +86,7 @@ fn prepare_call_env_conversion() {
gas: Some(U256::from(200u64)),
value: Some(U256::from(300u64)),
input: TransactionInput::default(),
nonce: Some(U64::from(1u64)),
nonce: Some(1u64),
chain_id: Some(1u64),
access_list: None,
transaction_type: Some(U8::from(2u8)),
Expand Down

0 comments on commit a774bb4

Please sign in to comment.