Skip to content

feat: implemented initialization of evm_opts and env in TestRunnerCon… #10542

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
13 changes: 5 additions & 8 deletions crates/forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ foundry-common.workspace = true
foundry-compilers = { workspace = true, features = ["full"] }
foundry-config.workspace = true
foundry-evm.workspace = true
foundry-evm-core.workspace = true
foundry-wallets.workspace = true
foundry-linking.workspace = true
forge-script-sequence.workspace = true
Expand Down Expand Up @@ -58,8 +57,6 @@ alloy-serde.workspace = true
alloy-signer.workspace = true
alloy-transport.workspace = true

revm.workspace = true

clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
clap_complete = "4"
clap_complete_fig = "4"
Expand All @@ -81,9 +78,9 @@ thiserror.workspace = true
tokio = { workspace = true, features = ["time"] }
toml = { workspace = true, features = ["preserve_order"] }
toml_edit = "0.22"
watchexec = "8.0"
watchexec-events = "6.0"
watchexec-signals = "5.0"
watchexec = "6.0"
watchexec-events = "5.0"
watchexec-signals = "4.0"
clearscreen = "4.0"
evm-disassembler.workspace = true

Expand All @@ -96,6 +93,8 @@ opener = "0.7"
soldeer-commands.workspace = true
quick-junit = "0.5.0"

figment = "0.10"

[dev-dependencies]
anvil.workspace = true
foundry-test-utils.workspace = true
Expand All @@ -116,8 +115,6 @@ alloy-signer-local.workspace = true
default = ["jemalloc"]
asm-keccak = ["alloy-primitives/asm-keccak"]
jemalloc = ["foundry-cli/jemalloc"]
mimalloc = ["foundry-cli/mimalloc"]
tracy-allocator = ["foundry-cli/tracy-allocator"]
aws-kms = ["foundry-wallets/aws-kms"]
gcp-kms = ["foundry-wallets/gcp-kms"]
isolate-by-default = ["foundry-config/isolate-by-default"]
17 changes: 8 additions & 9 deletions crates/forge/src/multi_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ impl TestRunnerConfig {
self.odyssey = config.odyssey;
self.isolation = config.isolate;

// Specific to Forge, not present in config.
// TODO: self.evm_opts
// TODO: self.env
// Update evm_opts and env from the new config
self.evm_opts = figment::Figment::from(&*config).extract::<EvmOpts>().expect("Failed to extract EvmOpts from config");
self.env = self.evm_opts.local_evm_env();
// self.coverage = N/A;
// self.debug = N/A;
// self.decode_internal = N/A;
Expand All @@ -321,10 +321,9 @@ impl TestRunnerConfig {

/// Configures the given executor with this configuration.
pub fn configure_executor(&self, executor: &mut Executor) {
// TODO: See above

// Apply env and evm_opts to the executor
let inspector = executor.inspector_mut();
// inspector.set_env(&self.env);
inspector.set_env(&self.env);
if let Some(cheatcodes) = inspector.cheatcodes.as_mut() {
cheatcodes.config =
Arc::new(cheatcodes.config.clone_with(&self.config, self.evm_opts.clone()));
Expand All @@ -333,11 +332,11 @@ impl TestRunnerConfig {
inspector.collect_coverage(self.coverage);
inspector.enable_isolation(self.isolation);
inspector.odyssey(self.odyssey);
// inspector.set_create2_deployer(self.evm_opts.create2_deployer);
inspector.set_create2_deployer(self.evm_opts.create2_deployer);

// executor.env_mut().clone_from(&self.env);
executor.env_mut().clone_from(&self.env);
executor.set_spec_id(self.spec_id);
// executor.set_gas_limit(self.evm_opts.gas_limit());
executor.set_gas_limit(self.evm_opts.gas_limit());
executor.set_legacy_assertions(self.config.legacy_assertions);
}

Expand Down