Skip to content

Commit

Permalink
chore: upgrade revm to v40 (#1360)
Browse files Browse the repository at this point in the history
* upgrade revm

* fix upgrade

* fix

* upgrade to v38

* fix

* upgrade to v40
  • Loading branch information
lightsing authored Jul 17, 2024
1 parent 6f199a1 commit 2a99204
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 38 deletions.
60 changes: 44 additions & 16 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ strum_macros = "0.25"
subtle = "2.4"
tokio = { version = "1.13", features = ["macros", "rt-multi-thread"] }
url = "2.2"
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v36", default-features = false, features = ["std"] } # v36
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v36", default-features = false, features = ["std"] } # v36
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v40", default-features = false, features = ["std"] } # v40
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v40", default-features = false, features = ["std"] } # v40
c-kzg = "1.0.2"

[patch.crates-io]
Expand Down
20 changes: 10 additions & 10 deletions bus-mapping/src/precompile.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! precompile helpers

use eth_types::{evm_types::GasCost, Address, ToBigEndian, Word};
use revm_precompile::{Precompile, PrecompileError, Precompiles};
use revm_precompile::{Precompile, PrecompileError, PrecompileErrors, Precompiles};
use strum_macros::EnumIter;

use crate::circuit_input_builder::{EcMulOp, EcPairingOp};
Expand All @@ -27,15 +27,15 @@ pub(crate) fn execute_precompiled(
hex::encode(input)
);
let (return_data, gas_cost, is_oog, is_ok) = match precompile_fn(&input.to_vec().into(), gas) {
Ok((gas_cost, return_value)) => (return_value.to_vec(), gas_cost, false, true),
Err(err) => match err {
PrecompileError::OutOfGas => (vec![], gas, true, false),
PrecompileError::NotImplemented => (vec![], gas, false, false),
_ => {
log::warn!("unknown precompile err {err:?}");
(vec![], gas, false, false)
}
},
Ok(output) => (output.bytes.to_vec(), output.gas_used, false, true),
Err(PrecompileErrors::Error(PrecompileError::OutOfGas)) => (vec![], gas, true, false),
Err(PrecompileErrors::Error(PrecompileError::NotImplemented)) => {
(vec![], gas, false, false)
}
Err(err) => {
log::warn!("unknown precompile err {err:?}");
(vec![], gas, false, false)
}
};
log::trace!("called precompile with is_ok {is_ok} is_oog {is_oog}, gas_cost {gas_cost}, return_data len {}, return_data {}", return_data.len(), hex::encode(&return_data));
(return_data, gas_cost, is_oog)
Expand Down
17 changes: 7 additions & 10 deletions eth-types/src/l2_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,13 @@ impl From<&TransactionTrace> for revm_primitives::TxEnv {
.as_ref()
.map(|v| {
v.iter()
.map(|e| {
(
e.address.0.into(),
e.storage_keys
.iter()
.map(|s| {
revm_primitives::U256::from_be_bytes(s.to_fixed_bytes())
})
.collect(),
)
.map(|e| revm_primitives::AccessListItem {
address: e.address.0.into(),
storage_keys: e
.storage_keys
.iter()
.map(|s| s.to_fixed_bytes().into())
.collect(),
})
.collect()
})
Expand Down

0 comments on commit 2a99204

Please sign in to comment.