Skip to content

Commit 11c5d4a

Browse files
authored
feat(deps): bump revm (#114)
Bumps to 27.0.1, with the necessary version bump
1 parent a32d151 commit 11c5d4a

File tree

17 files changed

+109
-271
lines changed

17 files changed

+109
-271
lines changed

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "trevm"
3-
version = "0.23.8"
3+
version = "0.27.0"
44
rust-version = "1.83.0"
55
edition = "2021"
66
authors = ["init4"]
@@ -34,7 +34,7 @@ name = "fork_ref_transact"
3434
required-features = ["alloy-db"]
3535

3636
[dependencies]
37-
alloy = { version = "1.0.5", default-features = false, features = [
37+
alloy = { version = "1.0.13", default-features = false, features = [
3838
"consensus",
3939
"rpc-types-mev",
4040
"eips",
@@ -44,7 +44,7 @@ alloy = { version = "1.0.5", default-features = false, features = [
4444
"sol-types",
4545
] }
4646

47-
revm = { version = "23.1.0", default-features = false }
47+
revm = { version = "27.0.1", default-features = false }
4848

4949
dashmap = { version = "6.1.0", optional = true }
5050
tracing = { version = "0.1.41", optional = true }
@@ -53,10 +53,10 @@ thiserror = "2.0.11"
5353
tokio = { version = "1.44", optional = true }
5454

5555
[dev-dependencies]
56-
revm = { version = "23.1.0", features = ["serde-json", "std", "alloydb"] }
56+
revm = { version = "27.0.1", features = ["serde-json", "std", "alloydb"] }
5757
trevm = { path = ".", features = ["test-utils"] }
5858

59-
alloy = { version = "1.0.5", features = ["providers", "transports"] }
59+
alloy = { version = "1.0.13", features = ["providers", "transports"] }
6060

6161
# misc
6262
eyre = "0.6"
@@ -87,7 +87,6 @@ estimate_gas = ["optional_eip3607", "optional_no_base_fee", "dep:tracing"]
8787
test-utils = ["revm/std", "revm/serde-json", "revm/alloydb"]
8888

8989
secp256k1 = ["revm/secp256k1"]
90-
secp256r1 = ["revm/secp256r1"]
9190
c-kzg = ["revm/c-kzg"]
9291
blst = ["revm/blst"]
9392

src/driver/alloy.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ impl<Db: Database> core::fmt::Display for BundleError<Db> {
5757
Self::BundleEmpty => write!(f, "bundle has no transactions"),
5858
Self::Eip4844BlobGasExceeded => write!(f, "max blob gas limit exceeded"),
5959
Self::UnsupportedTransactionType => write!(f, "unsupported transaction type"),
60-
Self::TransactionDecodingError(err) => write!(f, "transaction decoding error: {}", err),
60+
Self::TransactionDecodingError(err) => write!(f, "transaction decoding error: {err}"),
6161
Self::TransactionSenderRecoveryError(err) => {
62-
write!(f, "transaction sender recovery error: {}", err)
62+
write!(f, "transaction sender recovery error: {err}")
6363
}
64-
Self::EVMError { inner } => write!(f, "internal EVM error: {}", inner),
64+
Self::EVMError { inner } => write!(f, "internal EVM error: {inner}"),
6565
}
6666
}
6767
}
@@ -107,11 +107,11 @@ impl<Db: Database> core::fmt::Debug for BundleError<Db> {
107107
Self::BlockNumberMismatch => write!(f, "BlockNumberMismatch"),
108108
Self::BundleEmpty => write!(f, "BundleEmpty"),
109109
Self::BundleReverted => write!(f, "BundleReverted"),
110-
Self::TransactionDecodingError(e) => write!(f, "TransactionDecodingError({:?})", e),
110+
Self::TransactionDecodingError(e) => write!(f, "TransactionDecodingError({e:?})"),
111111
Self::UnsupportedTransactionType => write!(f, "UnsupportedTransactionType"),
112112
Self::Eip4844BlobGasExceeded => write!(f, "Eip4844BlobGasExceeded"),
113113
Self::TransactionSenderRecoveryError(e) => {
114-
write!(f, "TransactionSenderRecoveryError({:?})", e)
114+
write!(f, "TransactionSenderRecoveryError({e:?})")
115115
}
116116
Self::EVMError { .. } => write!(f, "EVMError"),
117117
}
@@ -278,7 +278,7 @@ where
278278
) -> DriveBundleResult<Self, Db, Insp> {
279279
// Check if the block we're in is valid for this bundle. Both must match
280280
trevm_ensure!(
281-
trevm.inner().block.number == self.bundle.block_number,
281+
trevm.inner().block.number == U256::from(self.bundle.block_number),
282282
trevm,
283283
BundleError::BlockNumberMismatch
284284
);
@@ -296,7 +296,7 @@ where
296296

297297
// Set the state block number this simulation was based on
298298
self.response.state_block_number =
299-
self.bundle.state_block_number.as_number().unwrap_or(trevm.inner().block.number);
299+
self.bundle.state_block_number.as_number().unwrap_or(trevm.block_number().to());
300300

301301
let bundle_filler = BundleBlockFiller::from(&self.bundle);
302302

@@ -416,15 +416,15 @@ where
416416
{
417417
// Check if the block we're in is valid for this bundle. Both must match
418418
trevm_ensure!(
419-
trevm.inner().block.number == self.bundle.block_number,
419+
trevm.block_number() == U256::from(self.bundle.block_number),
420420
trevm,
421421
BundleError::BlockNumberMismatch
422422
);
423423

424424
// Check for start timestamp range validity
425425
if let Some(min_timestamp) = self.bundle.min_timestamp {
426426
trevm_ensure!(
427-
trevm.inner().block.timestamp >= min_timestamp,
427+
trevm.block_timestamp() >= U256::from(min_timestamp),
428428
trevm,
429429
BundleError::TimestampOutOfRange
430430
);
@@ -433,7 +433,7 @@ where
433433
// Check for end timestamp range validity
434434
if let Some(max_timestamp) = self.bundle.max_timestamp {
435435
trevm_ensure!(
436-
trevm.inner().block.timestamp <= max_timestamp,
436+
trevm.block_timestamp() <= U256::from(max_timestamp),
437437
trevm,
438438
BundleError::TimestampOutOfRange
439439
);
@@ -503,9 +503,9 @@ struct BundleBlockFiller {
503503
impl Block for BundleBlockFiller {
504504
fn fill_block_env(&self, block_env: &mut revm::context::block::BlockEnv) {
505505
if let Some(timestamp) = self.timestamp {
506-
block_env.timestamp = timestamp;
506+
block_env.timestamp = U256::from(timestamp);
507507
} else {
508-
block_env.timestamp += 12;
508+
block_env.timestamp += U256::from(12);
509509
}
510510
if let Some(gas_limit) = self.gas_limit {
511511
block_env.gas_limit = gas_limit;
@@ -517,7 +517,7 @@ impl Block for BundleBlockFiller {
517517
block_env.basefee = base_fee.try_into().unwrap_or(u64::MAX);
518518
}
519519
if let Some(block_number) = self.block_number.as_number() {
520-
block_env.number = block_number;
520+
block_env.number = U256::from(block_number);
521521
}
522522
}
523523
}
@@ -559,7 +559,7 @@ where
559559
) -> DriveBundleResult<Self, Db, Insp> {
560560
// Check if the block we're in is valid for this bundle. Both must match
561561
trevm_ensure!(
562-
trevm.inner().block.number == self.block_number,
562+
trevm.block_number() == U256::from(self.block_number),
563563
trevm,
564564
BundleError::BlockNumberMismatch
565565
);
@@ -650,7 +650,7 @@ where
650650
) -> DriveBundleResult<Self, Db, Insp> {
651651
// Check if the block we're in is valid for this bundle. Both must match
652652
trevm_ensure!(
653-
trevm.inner().block.number == self.block_number,
653+
trevm.block_number() == U256::from(self.block_number),
654654
trevm,
655655
BundleError::BlockNumberMismatch
656656
);
@@ -659,7 +659,7 @@ where
659659

660660
if let Some(min_timestamp) = self.min_timestamp {
661661
trevm_ensure!(
662-
trevm.inner().block.timestamp >= min_timestamp,
662+
trevm.block_timestamp() >= U256::from(min_timestamp),
663663
trevm,
664664
BundleError::TimestampOutOfRange
665665
);
@@ -668,7 +668,7 @@ where
668668
// Check for end timestamp range validity
669669
if let Some(max_timestamp) = self.max_timestamp {
670670
trevm_ensure!(
671-
trevm.inner().block.timestamp <= max_timestamp,
671+
trevm.block_timestamp() <= U256::from(max_timestamp),
672672
trevm,
673673
BundleError::TimestampOutOfRange
674674
);

src/evm.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ where
275275
&mut self,
276276
address: Address,
277277
) -> Result<Option<AccountInfo>, <Db as Database>::Error> {
278-
self.inner.db().basic(address)
278+
self.inner.db_mut().basic(address)
279279
}
280280

281281
/// Get the current nonce for a specific address
@@ -300,7 +300,7 @@ where
300300
address: Address,
301301
slot: U256,
302302
) -> Result<U256, <Db as Database>::Error> {
303-
self.inner.db().storage(address, slot)
303+
self.inner.db_mut().storage(address, slot)
304304
}
305305

306306
/// Get the code at the given account, if any.
@@ -312,7 +312,7 @@ where
312312
) -> Result<Option<Bytecode>, <Db as Database>::Error> {
313313
let acct_info = self.try_read_account(address)?;
314314
match acct_info {
315-
Some(acct) => Ok(Some(self.inner.db().code_by_hash(acct.code_hash)?)),
315+
Some(acct) => Ok(Some(self.inner.db_mut().code_by_hash(acct.code_hash)?)),
316316
None => Ok(None),
317317
}
318318
}
@@ -409,7 +409,7 @@ where
409409
///
410410
/// Note: due to revm's DB model, this requires a mutable pointer.
411411
pub fn read_account(&mut self, address: Address) -> Option<AccountInfo> {
412-
self.inner.db().basic(address).expect("infallible")
412+
self.inner.db_mut().basic(address).expect("infallible")
413413
}
414414

415415
/// Get the current nonce for a specific address
@@ -430,15 +430,15 @@ where
430430
///
431431
/// Note: due to revm's DB model, this requires a mutable pointer.
432432
pub fn read_storage(&mut self, address: Address, slot: U256) -> U256 {
433-
self.inner.db().storage(address, slot).expect("infallible")
433+
self.inner.db_mut().storage(address, slot).expect("infallible")
434434
}
435435

436436
/// Get the code at the given account, if any.
437437
///
438438
/// Note: due to revm's DB model, this requires a mutable pointer.
439439
pub fn read_code(&mut self, address: Address) -> Option<Bytecode> {
440440
let acct_info = self.read_account(address)?;
441-
Some(self.inner.db().code_by_hash(acct_info.code_hash).expect("infallible"))
441+
Some(self.inner.db_mut().code_by_hash(acct_info.code_hash).expect("infallible"))
442442
}
443443
}
444444

@@ -493,7 +493,7 @@ where
493493
where
494494
Db: DatabaseCommit,
495495
{
496-
self.inner.db().commit(state);
496+
self.inner.db_mut().commit(state);
497497
}
498498

499499
/// Modify an account with a closure and commit the modified account. This
@@ -735,7 +735,7 @@ where
735735
/// Set the [EIP-161] state clear flag, activated in the Spurious Dragon
736736
/// hardfork.
737737
pub fn set_state_clear_flag(&mut self, flag: bool) {
738-
self.inner.db().set_state_clear_flag(flag)
738+
self.inner.db_mut().set_state_clear_flag(flag)
739739
}
740740
}
741741

@@ -753,7 +753,7 @@ where
753753
&mut self,
754754
flag: bool,
755755
) -> Result<(), <Db as TryStateAcc>::Error> {
756-
self.inner.db().try_set_state_clear_flag(flag)
756+
self.inner.db_mut().try_set_state_clear_flag(flag)
757757
}
758758
}
759759

@@ -1129,12 +1129,12 @@ where
11291129
}
11301130

11311131
/// Get the current block number.
1132-
pub fn block_number(&self) -> u64 {
1132+
pub fn block_number(&self) -> U256 {
11331133
self.block().number()
11341134
}
11351135

11361136
/// Get the current block timestamp.
1137-
pub fn block_timestamp(&self) -> u64 {
1137+
pub fn block_timestamp(&self) -> U256 {
11381138
self.block().timestamp()
11391139
}
11401140

@@ -1204,8 +1204,8 @@ where
12041204
/// [`State::take_bundle`]: revm::database::State::take_bundle
12051205
pub fn finish(self) -> BundleState {
12061206
let Self { inner: mut evm, .. } = self;
1207-
evm.db().merge_transitions(BundleRetention::Reverts);
1208-
let bundle = evm.db().take_bundle();
1207+
evm.db_mut().merge_transitions(BundleRetention::Reverts);
1208+
let bundle = evm.db_mut().take_bundle();
12091209

12101210
bundle
12111211
}
@@ -1231,7 +1231,7 @@ where
12311231
pub fn try_finish(
12321232
mut self,
12331233
) -> Result<BundleState, EvmErrored<Db, Insp, <Db as TryStateAcc>::Error>> {
1234-
let db = self.inner.db();
1234+
let db = self.inner.db_mut();
12351235

12361236
trevm_try!(db.try_merge_transitions(BundleRetention::Reverts), self);
12371237

@@ -1544,7 +1544,7 @@ where
15441544
overrides.fill_block(&mut self.inner);
15451545

15461546
if let Some(hashes) = overrides.block_hash.as_ref() {
1547-
self.inner.db().set_block_hashes(hashes)
1547+
self.inner.db_mut().set_block_hashes(hashes)
15481548
}
15491549

15501550
self
@@ -1590,7 +1590,7 @@ where
15901590
overrides.fill_block(&mut self.inner);
15911591

15921592
if let Some(hashes) = overrides.block_hash.as_ref() {
1593-
trevm_try!(self.inner.db().try_set_block_hashes(hashes), self);
1593+
trevm_try!(self.inner.db_mut().try_set_block_hashes(hashes), self);
15941594
}
15951595

15961596
Ok(self)
@@ -1636,10 +1636,10 @@ where
16361636
}
16371637

16381638
/// Execute the loaded transaction. This is a wrapper around
1639-
/// [`InspectEvm::inspect_replay`] and produces either [`EvmTransacted`] or
1639+
/// [`InspectEvm::inspect_tx`] and produces either [`EvmTransacted`] or
16401640
/// [`EvmErrored`].
16411641
pub fn run(mut self) -> Result<EvmTransacted<Db, Insp>, EvmErrored<Db, Insp>> {
1642-
let result = self.inner.inspect_replay();
1642+
let result = self.inner.inspect_tx(self.tx().clone());
16431643

16441644
let Self { inner, .. } = self;
16451645

@@ -2110,7 +2110,7 @@ where
21102110
{
21112111
let Self { mut inner, state: TransactedState { result } } = self;
21122112

2113-
inner.db().commit(result.state);
2113+
inner.db_mut().commit(result.state);
21142114

21152115
(result.result, Trevm { inner, state: NeedsTx::new() })
21162116
}
@@ -2133,7 +2133,7 @@ where
21332133
{
21342134
let Self { mut inner, state: TransactedState { result } } = self;
21352135

2136-
trevm_try!(inner.db().try_commit(result.state), Trevm { inner, state: NeedsTx::new() });
2136+
trevm_try!(inner.db_mut().try_commit(result.state), Trevm { inner, state: NeedsTx::new() });
21372137
Ok((result.result, Trevm { inner, state: NeedsTx::new() }))
21382138
}
21392139

src/ext.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub trait EvmExtUnchecked<Db: Database> {
8383
let mut acct = self.account(address)?;
8484
let old = self.storage(address, index)?;
8585

86-
let change = EvmStorageSlot::new_changed(old, value);
86+
let change = EvmStorageSlot::new_changed(old, value, 0);
8787
acct.storage.insert(index, change);
8888
acct.mark_touch();
8989

@@ -171,11 +171,11 @@ pub trait EvmExtUnchecked<Db: Database> {
171171
}
172172
}
173173

174-
impl<Ctx, Insp, Inst, Prec> EvmExtUnchecked<Ctx::Db> for Evm<Ctx, Insp, Inst, Prec>
174+
impl<Ctx, Insp, Inst, Prec, Frame> EvmExtUnchecked<Ctx::Db> for Evm<Ctx, Insp, Inst, Prec, Frame>
175175
where
176176
Ctx: ContextTr,
177177
{
178178
fn db_mut_ext(&mut self) -> &mut Ctx::Db {
179-
self.ctx.db()
179+
self.ctx.db_mut()
180180
}
181181
}

0 commit comments

Comments
 (0)