Skip to content

Commit

Permalink
chore(deps): bump revm 10.0, un-git revm-inspectors (#8997)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Jun 20, 2024
1 parent 27d26ac commit 4fcf26c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 46 deletions.
23 changes: 14 additions & 9 deletions Cargo.lock

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

12 changes: 3 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,15 @@ reth-trie-common = { path = "crates/trie/common" }
reth-trie-parallel = { path = "crates/trie/parallel" }

# revm
revm = { version = "9.0.0", features = [
revm = { version = "10.0.0", features = [
"std",
"secp256k1",
"blst",
], default-features = false }
revm-primitives = { version = "4.0.0", features = [
revm-primitives = { version = "5.0.0", features = [
"std",
], default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "4fe17f0" }
revm-inspectors = "0.1"

# eth
alloy-chains = "0.1.15"
Expand Down Expand Up @@ -495,9 +495,3 @@ serial_test = "3"
similar-asserts = "1.5.0"
test-fuzz = "5"
iai-callgrind = "0.11"

[patch.crates-io]
revm = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
revm-interpreter = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
revm-precompile = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "41e2f7f" }
23 changes: 10 additions & 13 deletions crates/primitives/src/revm/env.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
recover_signer_unchecked,
revm_primitives::{BlockEnv, Env, TransactTo, TxEnv},
revm_primitives::{BlockEnv, Env, TxEnv},
Address, Bytes, Header, Transaction, TransactionSignedEcRecovered, TxKind, B256, U256,
};
use reth_chainspec::{Chain, ChainSpec};
Expand Down Expand Up @@ -182,7 +182,7 @@ fn fill_tx_env_with_system_contract_call(
) {
env.tx = TxEnv {
caller,
transact_to: TransactTo::Call(contract),
transact_to: TxKind::Call(contract),
// Explicitly set nonce to None so revm does not do any nonce checks
nonce: None,
gas_limit: 30_000_000,
Expand Down Expand Up @@ -246,8 +246,8 @@ where
tx_env.gas_price = U256::from(tx.gas_price);
tx_env.gas_priority_fee = None;
tx_env.transact_to = match tx.to {
TxKind::Call(to) => TransactTo::Call(to),
TxKind::Create => TransactTo::create(),
TxKind::Call(to) => TxKind::Call(to),
TxKind::Create => TxKind::Create,
};
tx_env.value = tx.value;
tx_env.data = tx.input.clone();
Expand All @@ -262,8 +262,8 @@ where
tx_env.gas_price = U256::from(tx.gas_price);
tx_env.gas_priority_fee = None;
tx_env.transact_to = match tx.to {
TxKind::Call(to) => TransactTo::Call(to),
TxKind::Create => TransactTo::create(),
TxKind::Call(to) => TxKind::Call(to),
TxKind::Create => TxKind::Create,
};
tx_env.value = tx.value;
tx_env.data = tx.input.clone();
Expand All @@ -285,8 +285,8 @@ where
tx_env.gas_price = U256::from(tx.max_fee_per_gas);
tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas));
tx_env.transact_to = match tx.to {
TxKind::Call(to) => TransactTo::Call(to),
TxKind::Create => TransactTo::create(),
TxKind::Call(to) => TxKind::Call(to),
TxKind::Create => TxKind::Create,
};
tx_env.value = tx.value;
tx_env.data = tx.input.clone();
Expand All @@ -307,7 +307,7 @@ where
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::from(tx.max_fee_per_gas);
tx_env.gas_priority_fee = Some(U256::from(tx.max_priority_fee_per_gas));
tx_env.transact_to = TransactTo::Call(tx.to);
tx_env.transact_to = TxKind::Call(tx.to);
tx_env.value = tx.value;
tx_env.data = tx.input.clone();
tx_env.chain_id = Some(tx.chain_id);
Expand All @@ -329,10 +329,7 @@ where
tx_env.gas_limit = tx.gas_limit;
tx_env.gas_price = U256::ZERO;
tx_env.gas_priority_fee = None;
match tx.to {
TxKind::Call(to) => tx_env.transact_to = TransactTo::Call(to),
TxKind::Create => tx_env.transact_to = TransactTo::create(),
}
tx_env.transact_to = tx.to;
tx_env.value = tx.value;
tx_env.data = tx.input.clone();
tx_env.chain_id = None;
Expand Down
8 changes: 3 additions & 5 deletions crates/rpc/rpc/src/eth/api/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ use reth_rpc_types::{
use reth_transaction_pool::TransactionPool;
use revm::{
db::{CacheDB, DatabaseRef},
primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, HaltReason, TransactTo,
},
primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ExecutionResult, HaltReason},
DatabaseCommit,
};
use revm_inspectors::access_list::AccessListInspector;
Expand Down Expand Up @@ -219,7 +217,7 @@ where

// Optimize for simple transfer transactions, potentially reducing the gas estimate.
if env.tx.data.is_empty() {
if let TransactTo::Call(to) = env.tx.transact_to {
if let TxKind::Call(to) = env.tx.transact_to {
if let Ok(code) = db.db.account_code(to) {
let no_code_callee = code.map(|code| code.is_empty()).unwrap_or(true);
if no_code_callee {
Expand Down Expand Up @@ -509,7 +507,7 @@ fn update_estimated_gas_range(
}
ExecutionResult::Halt { reason, .. } => {
match reason {
HaltReason::OutOfGas(_) | HaltReason::InvalidFEOpcode => {
HaltReason::OutOfGas(_) | HaltReason::InvalidEFOpcode => {
// Both `OutOfGas` and `InvalidFEOpcode` can occur dynamically if the gas left
// is too low. Treat this as an out of gas condition,
// knowing that the call succeeds with a higher gas limit.
Expand Down
9 changes: 2 additions & 7 deletions crates/rpc/rpc/src/eth/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use revm::{
db::CacheDB,
precompile::{PrecompileSpecId, Precompiles},
primitives::{
db::DatabaseRef, BlockEnv, Bytecode, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, SpecId,
TransactTo, TxEnv,
db::DatabaseRef, BlockEnv, Bytecode, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, SpecId, TxEnv,
},
Database,
};
Expand Down Expand Up @@ -211,17 +210,13 @@ pub fn create_txn_env(block_env: &BlockEnv, request: TransactionRequest) -> EthR
)?;

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,
transact_to: to.unwrap_or(TxKind::Create),
value: value.unwrap_or_default(),
data: input.try_into_unique_input()?.unwrap_or_default(),
chain_id,
Expand Down
6 changes: 3 additions & 3 deletions examples/exex/rollup/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ mod tests {
bytes,
constants::ETH_TO_WEI,
keccak256, public_key_to_address,
revm_primitives::{AccountInfo, ExecutionResult, Output, TransactTo, TxEnv},
revm_primitives::{AccountInfo, ExecutionResult, Output, TxEnv},
BlockNumber, Receipt, SealedBlockWithSenders, Transaction, TxEip2930, TxKind, U256,
};
use reth_revm::Evm;
Expand Down Expand Up @@ -383,7 +383,7 @@ mod tests {
.with_tx_env(TxEnv {
caller: sender_address,
gas_limit: 50_000_000,
transact_to: TransactTo::Call(weth_address),
transact_to: TxKind::Call(weth_address),
data: WETH::balanceOfCall::new((sender_address,)).abi_encode().into(),
..Default::default()
})
Expand All @@ -408,7 +408,7 @@ mod tests {
.with_tx_env(TxEnv {
caller: sender_address,
gas_limit: 50_000_000,
transact_to: TransactTo::Call(weth_address),
transact_to: TxKind::Call(weth_address),
data: WETH::balanceOfCall::new((sender_address,)).abi_encode().into(),
..Default::default()
})
Expand Down

0 comments on commit 4fcf26c

Please sign in to comment.