Skip to content

Commit a57dc5f

Browse files
committed
chore(deps): bump revm 11
1 parent 05ad783 commit a57dc5f

File tree

11 files changed

+59
-75
lines changed

11 files changed

+59
-75
lines changed

Cargo.lock

+13-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,15 @@ reth-trie-common = { path = "crates/trie/common" }
375375
reth-trie-parallel = { path = "crates/trie/parallel" }
376376

377377
# revm
378-
revm = { version = "10.0.0", features = [
378+
revm = { version = "11.0.0", features = [
379379
"std",
380380
"secp256k1",
381381
"blst",
382382
], default-features = false }
383-
revm-primitives = { version = "5.0.0", features = [
383+
revm-primitives = { version = "6.0.0", features = [
384384
"std",
385385
], default-features = false }
386-
revm-inspectors = "0.1"
386+
revm-inspectors = "0.4"
387387

388388
# eth
389389
alloy-chains = "0.1.15"

crates/payload/builder/src/database.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::{
3535
pub struct CachedReads {
3636
accounts: HashMap<Address, CachedAccount>,
3737
contracts: HashMap<B256, Bytecode>,
38-
block_hashes: HashMap<U256, B256>,
38+
block_hashes: HashMap<u64, B256>,
3939
}
4040

4141
// === impl CachedReads ===
@@ -114,7 +114,7 @@ impl<'a, DB: DatabaseRef> Database for CachedReadsDbMut<'a, DB> {
114114
}
115115
}
116116

117-
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
117+
fn block_hash(&mut self, number: u64) -> Result<B256, Self::Error> {
118118
let code = match self.cached.block_hashes.entry(number) {
119119
Entry::Occupied(entry) => *entry.get(),
120120
Entry::Vacant(entry) => *entry.insert(self.db.block_hash_ref(number)?),
@@ -148,7 +148,7 @@ impl<'a, DB: DatabaseRef> DatabaseRef for CachedReadsDBRef<'a, DB> {
148148
self.inner.borrow_mut().storage(address, index)
149149
}
150150

151-
fn block_hash_ref(&self, number: U256) -> Result<B256, Self::Error> {
151+
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
152152
self.inner.borrow_mut().block_hash(number)
153153
}
154154
}

crates/primitives/src/transaction/compat.rs

+3-30
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,7 @@ impl FillTxEnv for TransactionSigned {
4040
tx_env.data = tx.input.clone();
4141
tx_env.chain_id = Some(tx.chain_id);
4242
tx_env.nonce = Some(tx.nonce);
43-
tx_env.access_list = tx
44-
.access_list
45-
.iter()
46-
.map(|l| {
47-
(
48-
l.address,
49-
l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect(),
50-
)
51-
})
52-
.collect();
43+
tx_env.access_list = tx.access_list.0.clone();
5344
tx_env.blob_hashes.clear();
5445
tx_env.max_fee_per_blob_gas.take();
5546
}
@@ -62,16 +53,7 @@ impl FillTxEnv for TransactionSigned {
6253
tx_env.data = tx.input.clone();
6354
tx_env.chain_id = Some(tx.chain_id);
6455
tx_env.nonce = Some(tx.nonce);
65-
tx_env.access_list = tx
66-
.access_list
67-
.iter()
68-
.map(|l| {
69-
(
70-
l.address,
71-
l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect(),
72-
)
73-
})
74-
.collect();
56+
tx_env.access_list = tx.access_list.0.clone();
7557
tx_env.blob_hashes.clear();
7658
tx_env.max_fee_per_blob_gas.take();
7759
}
@@ -84,16 +66,7 @@ impl FillTxEnv for TransactionSigned {
8466
tx_env.data = tx.input.clone();
8567
tx_env.chain_id = Some(tx.chain_id);
8668
tx_env.nonce = Some(tx.nonce);
87-
tx_env.access_list = tx
88-
.access_list
89-
.iter()
90-
.map(|l| {
91-
(
92-
l.address,
93-
l.storage_keys.iter().map(|k| U256::from_be_bytes(k.0)).collect(),
94-
)
95-
})
96-
.collect();
69+
tx_env.access_list = tx.access_list.0.clone();
9770
tx_env.blob_hashes.clone_from(&tx.blob_versioned_hashes);
9871
tx_env.max_fee_per_blob_gas = Some(U256::from(tx.max_fee_per_blob_gas));
9972
}

crates/revm/src/database.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<DB: EvmStateProvider> Database for StateProviderDatabase<DB> {
121121
///
122122
/// Returns `Ok` with the block hash if found, or the default hash otherwise.
123123
/// Note: It safely casts the `number` to `u64`.
124-
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
124+
fn block_hash(&mut self, number: u64) -> Result<B256, Self::Error> {
125125
DatabaseRef::block_hash_ref(self, number)
126126
}
127127
}
@@ -154,11 +154,8 @@ impl<DB: EvmStateProvider> DatabaseRef for StateProviderDatabase<DB> {
154154
/// Retrieves the block hash for a given block number.
155155
///
156156
/// Returns `Ok` with the block hash if found, or the default hash otherwise.
157-
fn block_hash_ref(&self, number: U256) -> Result<B256, Self::Error> {
157+
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
158158
// Get the block hash or default hash with an attempt to convert U256 block number to u64
159-
Ok(self
160-
.0
161-
.block_hash(number.try_into().map_err(|_| Self::Error::BlockNumberOverflow(number))?)?
162-
.unwrap_or_default())
159+
Ok(self.0.block_hash(number)?.unwrap_or_default())
163160
}
164161
}

crates/rpc/rpc-eth-api/src/helpers/call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ pub trait Call: LoadState + SpawnBlocking {
718718
}
719719
ExecutionResult::Halt { reason, .. } => {
720720
match reason {
721-
HaltReason::OutOfGas(_) | HaltReason::InvalidEFOpcode => {
721+
HaltReason::OutOfGas(_) | HaltReason::InvalidFEOpcode => {
722722
// Both `OutOfGas` and `InvalidEFOpcode` can occur dynamically if the gas
723723
// left is too low. Treat this as an out of gas
724724
// condition, knowing that the call succeeds with a

crates/rpc/rpc-eth-types/src/cache/db.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ impl<'a, 'b> Database for StateCacheDbRefMutWrapper<'a, 'b> {
127127
self.0.basic(address)
128128
}
129129

130-
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
131-
self.0.block_hash(number)
132-
}
133-
134130
fn code_by_hash(&mut self, code_hash: B256) -> Result<revm_primitives::Bytecode, Self::Error> {
135131
self.0.code_by_hash(code_hash)
136132
}
@@ -142,6 +138,10 @@ impl<'a, 'b> Database for StateCacheDbRefMutWrapper<'a, 'b> {
142138
) -> Result<U256, Self::Error> {
143139
self.0.storage(address, index)
144140
}
141+
142+
fn block_hash(&mut self, number: u64) -> Result<B256, Self::Error> {
143+
self.0.block_hash(number)
144+
}
145145
}
146146

147147
impl<'a, 'b> DatabaseRef for StateCacheDbRefMutWrapper<'a, 'b> {
@@ -154,10 +154,6 @@ impl<'a, 'b> DatabaseRef for StateCacheDbRefMutWrapper<'a, 'b> {
154154
self.0.basic_ref(address)
155155
}
156156

157-
fn block_hash_ref(&self, number: U256) -> Result<B256, Self::Error> {
158-
self.0.block_hash_ref(number)
159-
}
160-
161157
fn code_by_hash_ref(&self, code_hash: B256) -> Result<revm_primitives::Bytecode, Self::Error> {
162158
self.0.code_by_hash_ref(code_hash)
163159
}
@@ -169,4 +165,8 @@ impl<'a, 'b> DatabaseRef for StateCacheDbRefMutWrapper<'a, 'b> {
169165
) -> Result<U256, Self::Error> {
170166
self.0.storage_ref(address, index)
171167
}
168+
169+
fn block_hash_ref(&self, number: u64) -> Result<B256, Self::Error> {
170+
self.0.block_hash_ref(number)
171+
}
172172
}

crates/rpc/rpc-eth-types/src/error.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,15 @@ pub enum RpcInvalidTransactionError {
360360
/// Blob transaction is a create transaction
361361
#[error("blob transaction is a create transaction")]
362362
BlobTransactionIsCreate,
363+
/// EOF crate should have `to` address
364+
#[error("EOF crate should have `to` address")]
365+
EofCrateShouldHaveToAddress,
366+
/// EIP-7702 is not enabled.
367+
#[error("EIP-7702 authorization list not supported")]
368+
AuthorizationListNotSupported,
369+
/// EIP-7702 transaction has invalid fields set.
370+
#[error("EIP-7702 authorization list has invalid fields")]
371+
AuthorizationListInvalidFields,
363372
/// Optimism related error
364373
#[error(transparent)]
365374
#[cfg(feature = "optimism")]
@@ -462,8 +471,13 @@ impl From<revm::primitives::InvalidTransaction> for RpcInvalidTransactionError {
462471
InvalidTransaction::HaltedDepositPostRegolith => {
463472
Self::Optimism(OptimismInvalidTransactionError::HaltedDepositPostRegolith)
464473
}
465-
// TODO(EOF)
466-
InvalidTransaction::EofCrateShouldHaveToAddress => todo!("EOF"),
474+
InvalidTransaction::EofCrateShouldHaveToAddress => Self::EofCrateShouldHaveToAddress,
475+
InvalidTransaction::AuthorizationListNotSupported => {
476+
Self::AuthorizationListNotSupported
477+
}
478+
InvalidTransaction::AuthorizationListInvalidFields => {
479+
Self::AuthorizationListInvalidFields
480+
}
467481
}
468482
}
469483
}

crates/rpc/rpc-eth-types/src/revm_utils.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,11 @@ pub fn create_txn_env(block_env: &BlockEnv, request: TransactionRequest) -> EthR
165165
value: value.unwrap_or_default(),
166166
data: input.try_into_unique_input()?.unwrap_or_default(),
167167
chain_id,
168-
access_list: access_list
169-
.map(reth_rpc_types::AccessList::into_flattened)
170-
.unwrap_or_default(),
168+
access_list: access_list.unwrap_or_default().into(),
171169
// EIP-4844 fields
172170
blob_hashes: blob_versioned_hashes.unwrap_or_default(),
173171
max_fee_per_blob_gas,
172+
authorization_list: None,
174173
#[cfg(feature = "optimism")]
175174
optimism: OptimismFields { enveloped_tx: Some(Bytes::new()), ..Default::default() },
176175
};

crates/transaction-pool/src/validate/eth.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use crate::{
1212
use reth_chainspec::{ChainSpec, EthereumHardforks};
1313
use reth_primitives::{
1414
constants::{eip4844::MAX_BLOBS_PER_BLOCK, ETHEREUM_BLOCK_GAS_LIMIT},
15-
Address, GotExpected, InvalidTransactionError, SealedBlock, TxKind, EIP1559_TX_TYPE_ID,
16-
EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID, U256,
15+
GotExpected, InvalidTransactionError, SealedBlock, TxKind, EIP1559_TX_TYPE_ID,
16+
EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID,
1717
};
1818
use reth_provider::{AccountReader, BlockReaderIdExt, StateProviderFactory};
1919
use reth_tasks::TaskSpawner;
2020
use revm::{
2121
interpreter::gas::validate_initial_tx_gas,
22-
primitives::{EnvKzgSettings, SpecId},
22+
primitives::{AccessListItem, EnvKzgSettings, SpecId},
2323
};
2424
use std::{
2525
marker::PhantomData,
@@ -712,12 +712,11 @@ pub fn ensure_intrinsic_gas<T: PoolTransaction>(
712712
transaction: &T,
713713
is_shanghai: bool,
714714
) -> Result<(), InvalidPoolTransactionError> {
715-
let access_list = transaction.access_list().map(|list| list.flattened()).unwrap_or_default();
716715
if transaction.gas_limit() <
717716
calculate_intrinsic_gas_after_merge(
718717
transaction.input(),
719718
&transaction.kind(),
720-
&access_list,
719+
transaction.access_list().map(|list| list.0.as_slice()).as_deref().unwrap_or(&[]),
721720
is_shanghai,
722721
)
723722
{
@@ -734,11 +733,11 @@ pub fn ensure_intrinsic_gas<T: PoolTransaction>(
734733
pub fn calculate_intrinsic_gas_after_merge(
735734
input: &[u8],
736735
kind: &TxKind,
737-
access_list: &[(Address, Vec<U256>)],
736+
access_list: &[AccessListItem],
738737
is_shanghai: bool,
739738
) -> u64 {
740739
let spec_id = if is_shanghai { SpecId::SHANGHAI } else { SpecId::MERGE };
741-
validate_initial_tx_gas(spec_id, input, kind.is_create(), access_list)
740+
validate_initial_tx_gas(spec_id, input, kind.is_create(), access_list, 0)
742741
}
743742

744743
#[cfg(test)]

examples/exex/rollup/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl reth_revm::Database for Database {
443443
get_storage(&self.connection(), address, index.into()).map(|data| data.unwrap_or_default())
444444
}
445445

446-
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
446+
fn block_hash(&mut self, number: u64) -> Result<B256, Self::Error> {
447447
let block_hash = self.connection().query_row::<String, _, _>(
448448
"SELECT hash FROM block WHERE number = ?",
449449
(number.to_string(),),

0 commit comments

Comments
 (0)