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(deps): bump revm to 6.0 #7125

Merged
merged 39 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cc259a2
migrate revm
mattsse Feb 14, 2024
f091c50
inspector
mattsse Feb 14, 2024
2049bb9
more inspectors
mattsse Feb 14, 2024
cdd4158
port more things
mattsse Feb 14, 2024
042438a
port more
mattsse Feb 14, 2024
36db92c
some simplifications
mattsse Feb 14, 2024
212454b
Merge branch 'master' into matt/migrate-revm5
mattsse Feb 14, 2024
4da6dad
chore: add error variant back
mattsse Feb 14, 2024
623e6a2
use original bytecode
mattsse Feb 14, 2024
367147f
Merge branch 'master' into matt/migrate-revm5
mattsse Feb 27, 2024
5b8607a
bump deps
mattsse Feb 27, 2024
46d579e
feat: migrate evm backend
mattsse Feb 27, 2024
027b171
chore: port more stuf
mattsse Feb 27, 2024
b8d917b
Merge branch 'master' into matt/migrate-revm5
mattsse Mar 5, 2024
8b0ae46
fix compile
mattsse Mar 5, 2024
e9d7558
chore: make compile again
mattsse Mar 5, 2024
6c636d7
fix
mattsse Mar 5, 2024
a957353
more fixes
mattsse Mar 5, 2024
fb83bda
fix anvil
mattsse Mar 5, 2024
b5926aa
fix cast
mattsse Mar 5, 2024
15ce349
chore(clippy): make clippy happy
mattsse Mar 5, 2024
b52abfe
fix: make it fucking compile
DaniPopes Mar 5, 2024
951ac26
nits, clippies
DaniPopes Mar 5, 2024
8ab68c0
fix: try early return None from inspector
DaniPopes Mar 5, 2024
489ee39
chore: finish data -> context renaming
DaniPopes Mar 5, 2024
c460ec1
chore: really finish rename
DaniPopes Mar 5, 2024
5a55bfd
chore: rename context to ecx
DaniPopes Mar 5, 2024
4dc48f8
feat: simpler methods
DaniPopes Mar 5, 2024
23fcaf6
fix anvil test
mattsse Mar 6, 2024
2459c51
fix env bug
mattsse Mar 6, 2024
58984e6
Merge branch 'master' into matt/migrate-revm5
mattsse Mar 7, 2024
74a62d9
chore: rename functions
mattsse Mar 7, 2024
1ff1230
chore: migrate disallow mem write
mattsse Mar 7, 2024
fda1ab4
Update Cargo.toml
mattsse Mar 7, 2024
ba2d2cb
fix: update exc env after transact
mattsse Mar 7, 2024
ca901a3
no clone
mattsse Mar 7, 2024
1ee5ac3
no clone
mattsse Mar 7, 2024
3a70228
Merge branch 'master' into matt/migrate-revm5
mattsse Mar 8, 2024
e79d716
Merge branch 'master' into matt/migrate-revm5
mattsse Mar 8, 2024
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
62 changes: 34 additions & 28 deletions Cargo.lock

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

49 changes: 22 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ foundry-compilers = { version = "0.3.9", default-features = false }

## revm
# no default features to avoid c-kzg
revm = { version = "3", default-features = false }
revm-primitives = { version = "1", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "e90052361276aebcdc67cb24d8e2c4d907b6d299", default-features = false }
revm = { version = "6.1", default-features = false }
revm-primitives = { version = "2", default-features = false }
revm-inspectors = { git = "https://github.com/paradigmxyz/evm-inspectors", rev = "5d560be", features = [
"serde",
] }

## ethers
ethers = { version = "2.0.14", default-features = false }
Expand All @@ -157,22 +159,22 @@ ethers-middleware = { version = "2.0.14", default-features = false }
ethers-solc = { version = "2.0.14", default-features = false }

## alloy
alloy-consensus = { git = "https://github.com/alloy-rs/alloy" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy" }
alloy-network = { git = "https://github.com/alloy-rs/alloy" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy" }
alloy-providers = { git = "https://github.com/alloy-rs/alloy" }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy" }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy" }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "785c667" }
DaniPopes marked this conversation as resolved.
Show resolved Hide resolved
alloy-primitives = { version = "0.6.3", features = ["getrandom"] }
alloy-dyn-abi = "0.6.3"
alloy-json-abi = "0.6.3"
Expand Down Expand Up @@ -203,17 +205,10 @@ tracing = "0.1"
tracing-subscriber = "0.3"
evm-disassembler = "0.4"
vergen = { version = "8", default-features = false }
# TODO: bumping to >=0.13.2 breaks ecrecover: https://github.com/foundry-rs/foundry/pull/6969
# TODO: unpin on next revm release: https://github.com/bluealloy/revm/pull/870
k256 = "=0.13.1"
k256 = "0.13"

axum = "0.6"
hyper = "0.14"
tower = "0.4"
tower-http = "0.4"

[patch.crates-io]
revm = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-primitives = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-interpreter = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-precompile = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
25 changes: 14 additions & 11 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use foundry_evm::{
constants::DEFAULT_CREATE2_DEPLOYER,
fork::{BlockchainDb, BlockchainDbMeta, SharedBackend},
revm,
revm::primitives::{BlockEnv, CfgEnv, SpecId, TxEnv},
revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, SpecId, TxEnv},
utils::apply_chain_and_block_specific_env_changes,
};
use parking_lot::RwLock;
Expand Down Expand Up @@ -820,27 +820,30 @@ impl NodeConfig {
pub(crate) async fn setup(&mut self) -> mem::Backend {
// configure the revm environment

let mut cfg = CfgEnv::default();
cfg.spec_id = self.get_hardfork().into();
let mut cfg =
CfgEnvWithHandlerCfg::new_with_spec_id(CfgEnv::default(), self.get_hardfork().into());
cfg.chain_id = self.get_chain_id();
cfg.limit_contract_code_size = self.code_size_limit;
// EIP-3607 rejects transactions from senders with deployed code.
// If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the
// caller is a contract. So we disable the check by default.
cfg.disable_eip3607 = true;
cfg.disable_block_gas_limit = self.disable_block_gas_limit;
cfg.optimism = self.enable_optimism;
cfg.handler_cfg.is_optimism = self.enable_optimism;

let mut env = revm::primitives::Env {
cfg,
let env = revm::primitives::Env {
cfg: cfg.cfg_env,
block: BlockEnv {
gas_limit: self.gas_limit,
basefee: self.get_base_fee(),
..Default::default()
},
tx: TxEnv { chain_id: self.get_chain_id().into(), ..Default::default() },
};
let fees = FeeManager::new(env.cfg.spec_id, self.get_base_fee(), self.get_gas_price());
let mut env = EnvWithHandlerCfg::new(Box::new(env), cfg.handler_cfg);

let fees =
FeeManager::new(cfg.handler_cfg.spec_id, self.get_base_fee(), self.get_gas_price());

let (db, fork): (Arc<tokio::sync::RwLock<Box<dyn Db>>>, Option<ClientFork>) =
if let Some(eth_rpc_url) = self.eth_rpc_url.clone() {
Expand Down Expand Up @@ -910,7 +913,7 @@ impl NodeConfig {
pub async fn setup_fork_db(
&mut self,
eth_rpc_url: String,
env: &mut revm::primitives::Env,
env: &mut EnvWithHandlerCfg,
fees: &FeeManager,
) -> (Arc<tokio::sync::RwLock<Box<dyn Db>>>, Option<ClientFork>) {
let (db, config) = self.setup_fork_db_config(eth_rpc_url, env, fees).await;
Expand All @@ -932,7 +935,7 @@ impl NodeConfig {
pub async fn setup_fork_db_config(
&mut self,
eth_rpc_url: String,
env: &mut revm::primitives::Env,
env: &mut EnvWithHandlerCfg,
fees: &FeeManager,
) -> (ForkedDatabase, ClientForkConfig) {
// TODO make provider agnostic
Expand Down Expand Up @@ -961,7 +964,7 @@ impl NodeConfig {
provider.get_chain_id().await.expect("Failed to fetch network chain ID");
if alloy_chains::NamedChain::Mainnet == chain_id.to::<u64>() {
let hardfork: Hardfork = fork_block_number.into();
env.cfg.spec_id = hardfork.into();
env.handler_cfg.spec_id = hardfork.into();
self.hardfork = Some(hardfork);
}
Some(U256::from(chain_id))
Expand Down Expand Up @@ -1070,7 +1073,7 @@ latest block number: {latest_block}"
};
let override_chain_id = self.chain_id;

let meta = BlockchainDbMeta::new(env.clone(), eth_rpc_url.clone());
let meta = BlockchainDbMeta::new(*env.env.clone(), eth_rpc_url.clone());
let block_chain_db = if self.fork_chain_id.is_some() {
BlockchainDb::new_skip_check(meta, self.block_cache_path(fork_block_number))
} else {
Expand Down
Loading
Loading