Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade revm to v5.0 #90

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 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 @@ -21,8 +21,8 @@ bonsai-sdk = { version = "0.6.0", features = ["async"] }
hashbrown = { version = "0.14.3", features = ["inline-more"] }
risc0-build = { version = "0.20.1" }
risc0-zkvm = { version = "0.20.1", default-features = false }
revm-primitives = { git = "https://github.com/bluealloy/revm.git", rev = "6cd0bfc96da64513affe01c1964dd80beeb8c620", default_features = false }
revm = { git = "https://github.com/bluealloy/revm.git", rev = "6cd0bfc96da64513affe01c1964dd80beeb8c620", default-features = false, features = [
revm-primitives = { version = "2.0", default_features = false }
revm = { version = "5.0", default-features = false, features = [
"std",
"serde",
"optimism",
Expand Down
22 changes: 14 additions & 8 deletions guests/eth-block/Cargo.lock

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

22 changes: 14 additions & 8 deletions guests/op-block/Cargo.lock

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

22 changes: 14 additions & 8 deletions guests/op-compose/Cargo.lock

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

22 changes: 14 additions & 8 deletions guests/op-derive/Cargo.lock

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

15 changes: 7 additions & 8 deletions lib/src/builder/execute/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ impl TxExecStrategy<EthereumTxEssence> for EthTxExecStrategy {

// initialize the Evm
let mut evm = Evm::builder()
.spec_id(spec_id)
.modify_cfg_env(|cfg_env| {
// set the EVM configuration
cfg_env.chain_id = block_builder.chain_spec.chain_id();
cfg_env.optimism = false;
})
.with_db(block_builder.db.take().unwrap())
.with_spec_id(spec_id)
.modify_block_env(|blk_env| {
// set the EVM block environment
blk_env.number = header.number.try_into().unwrap();
Expand All @@ -109,7 +105,10 @@ impl TxExecStrategy<EthereumTxEssence> for EthTxExecStrategy {
blk_env.basefee = header.base_fee_per_gas;
blk_env.gas_limit = block_builder.input.state_input.gas_limit;
})
.with_db(block_builder.db.take().unwrap())
.modify_cfg_env(|cfg_env| {
// set the EVM configuration
cfg_env.chain_id = block_builder.chain_spec.chain_id();
})
.build();

// bloom filter over all transaction logs
Expand Down Expand Up @@ -146,7 +145,7 @@ impl TxExecStrategy<EthereumTxEssence> for EthTxExecStrategy {
}

// process the transaction
fill_eth_tx_env(&mut evm.env().tx, &tx.essence, tx_from);
fill_eth_tx_env(&mut evm.env_mut().tx, &tx.essence, tx_from);
let ResultAndState { result, state } = evm
.transact()
.map_err(|evm_err| anyhow!("Error at transaction {}: {:?}", tx_no, evm_err))
Expand Down
25 changes: 14 additions & 11 deletions lib/src/builder/execute/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use anyhow::{anyhow, bail, Context, Result};
use log::trace;
use revm::{
interpreter::Host,
optimism,
primitives::{Address, ResultAndState, SpecId, TransactTo, TxEnv},
Database, DatabaseCommit, Evm,
};
Expand Down Expand Up @@ -91,12 +90,9 @@ impl TxExecStrategy<OptimismTxEssence> for OpTxExecStrategy {

let chain_id = block_builder.chain_spec.chain_id();
let mut evm = Evm::builder()
.spec_id(spec_id)
.modify_cfg_env(|cfg_env| {
// set the EVM configuration
cfg_env.chain_id = chain_id;
cfg_env.optimism = true;
})
.with_db(block_builder.db.take().unwrap())
.optimism()
.with_spec_id(spec_id)
.modify_block_env(|blk_env| {
// set the EVM block environment
blk_env.number = header.number.try_into().unwrap();
Expand All @@ -107,8 +103,10 @@ impl TxExecStrategy<OptimismTxEssence> for OpTxExecStrategy {
blk_env.basefee = header.base_fee_per_gas;
blk_env.gas_limit = block_builder.input.state_input.gas_limit;
})
.with_db(block_builder.db.take().unwrap())
.append_handler_register(optimism::optimism_handle_register)
.modify_cfg_env(|cfg_env| {
// set the EVM configuration
cfg_env.chain_id = chain_id;
})
.build();

// bloom filter over all transaction logs
Expand Down Expand Up @@ -163,10 +161,15 @@ impl TxExecStrategy<OptimismTxEssence> for OpTxExecStrategy {
}

// Initialize tx environment
fill_deposit_tx_env(&mut evm.env().tx, deposit, tx_from);
fill_deposit_tx_env(&mut evm.env_mut().tx, deposit, tx_from);
}
OptimismTxEssence::Ethereum(essence) => {
fill_eth_tx_env(&mut evm.env().tx, alloy_rlp::encode(&tx), essence, tx_from);
fill_eth_tx_env(
&mut evm.env_mut().tx,
alloy_rlp::encode(&tx),
essence,
tx_from,
);
}
};

Expand Down
Loading
Loading