Skip to content

Commit

Permalink
update revm to v5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Wollac committed Feb 13, 2024
1 parent 923049a commit f9fc117
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 69 deletions.
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 @@ -103,12 +103,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 @@ -119,7 +115,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 @@ -156,7 +155,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::{debug, trace};
use revm::{
interpreter::Host,
optimism,
primitives::{Address, ResultAndState, SpecId, TransactTo, TxEnv},
Database, DatabaseCommit, Evm,
};
Expand Down Expand Up @@ -101,12 +100,9 @@ impl TxExecStrategy<OptimismTxEssence> for OpTxExecStrategy {
}

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 @@ -117,8 +113,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 @@ -164,10 +162,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

0 comments on commit f9fc117

Please sign in to comment.