Skip to content

Commit 92d7b35

Browse files
onbjerggrandizzy
andauthored
chore: rm extra --celo arg (#12038)
* chore: rm extra `--celo` arg * Fix - add support for network configs --------- Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
1 parent d21d4d6 commit 92d7b35

File tree

8 files changed

+19
-22
lines changed

8 files changed

+19
-22
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/src/opts/evm.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ pub struct EvmArgs {
136136
#[arg(long)]
137137
#[serde(skip)]
138138
pub isolate: bool,
139-
140-
/// Whether to enable Celo precompiles.
141-
#[arg(long)]
142-
#[serde(skip)]
143-
pub celo: bool,
144139
}
145140

146141
// Make this set of options a `figment::Provider` so that it can be merged into the `Config`
@@ -167,10 +162,6 @@ impl Provider for EvmArgs {
167162
dict.insert("isolate".to_string(), self.isolate.into());
168163
}
169164

170-
if self.celo {
171-
dict.insert("celo".to_string(), self.celo.into());
172-
}
173-
174165
if self.always_use_create_2_factory {
175166
dict.insert(
176167
"always_use_create_2_factory".to_string(),

crates/config/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ foundry-compilers = { workspace = true, features = ["svm-solc"] }
2020
alloy-chains = { workspace = true, features = ["serde"] }
2121
alloy-primitives = { workspace = true, features = ["serde"] }
2222

23+
foundry-evm-networks.workspace = true
24+
2325
revm.workspace = true
2426

2527
solar.workspace = true

crates/config/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub use compilation::{CompilationRestrictions, SettingsOverrides};
128128
pub mod extend;
129129
use extend::Extends;
130130

131+
use foundry_evm_networks::NetworkConfigs;
131132
pub use semver;
132133

133134
/// Foundry configuration
@@ -530,9 +531,9 @@ pub struct Config {
530531
#[serde(default, skip_serializing_if = "Vec::is_empty")]
531532
pub extra_args: Vec<String>,
532533

533-
/// Whether to enable Celo precompiles.
534-
#[serde(default)]
535-
pub celo: bool,
534+
/// Networks with enabled features.
535+
#[serde(flatten)]
536+
pub networks: NetworkConfigs,
536537

537538
/// Timeout for transactions in seconds.
538539
pub transaction_timeout: u64,
@@ -2568,7 +2569,7 @@ impl Default for Config {
25682569
legacy_assertions: false,
25692570
warnings: vec![],
25702571
extra_args: vec![],
2571-
celo: false,
2572+
networks: Default::default(),
25722573
transaction_timeout: 120,
25732574
additional_compiler_profiles: Default::default(),
25742575
compilation_restrictions: Default::default(),

crates/evm/networks/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::collections::BTreeMap;
1414

1515
pub mod celo;
1616

17-
#[derive(Clone, Debug, Default, Parser, Copy, Serialize, Deserialize)]
17+
#[derive(Clone, Debug, Default, Parser, Copy, Serialize, Deserialize, PartialEq)]
1818
pub struct NetworkConfigs {
1919
/// Enable Optimism network features.
2020
#[arg(help_heading = "Networks", long, visible_alias = "optimism", conflicts_with = "celo")]
@@ -23,6 +23,7 @@ pub struct NetworkConfigs {
2323
optimism: bool,
2424
/// Enable Celo network features.
2525
#[arg(help_heading = "Networks", long, conflicts_with = "optimism")]
26+
#[serde(default)]
2627
celo: bool,
2728
}
2829

crates/forge/src/multi_runner.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ impl TestRunnerConfig {
319319

320320
self.spec_id = config.evm_spec_id();
321321
self.sender = config.sender;
322-
if config.celo {
323-
self.networks = NetworkConfigs::with_celo();
324-
}
322+
self.networks = config.networks;
325323
self.isolation = config.isolate;
326324

327325
// Specific to Forge, not present in config.

crates/forge/tests/cli/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ forgetest!(can_extract_config_values, |prj, cmd| {
348348
assertions_revert: true,
349349
legacy_assertions: false,
350350
extra_args: vec![],
351-
celo: false,
351+
networks: Default::default(),
352352
transaction_timeout: 120,
353353
additional_compiler_profiles: Default::default(),
354354
compilation_restrictions: Default::default(),

crates/forge/tests/cli/precompiles.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
//! Contains various tests for `forge test` with precompiles.
22
3+
use foundry_evm_networks::NetworkConfigs;
34
use foundry_test_utils::str;
45

56
// tests transfer using celo precompile.
67
// <https://github.com/foundry-rs/foundry/issues/11622>
78
forgetest_init!(celo_transfer, |prj, cmd| {
9+
prj.update_config(|config| {
10+
config.networks = NetworkConfigs::with_celo();
11+
});
12+
813
prj.add_test(
914
"CeloTransfer.t.sol",
1015
r#"
@@ -38,8 +43,7 @@ contract CeloTransferTest is Test {
3843
"#,
3944
);
4045

41-
cmd.args(["test", "--mt", "testCeloBalance", "--celo", "-vvv"]).assert_success().stdout_eq(
42-
str![[r#"
46+
cmd.args(["test", "--mt", "testCeloBalance", "-vvv"]).assert_success().stdout_eq(str![[r#"
4347
[COMPILING_FILES] with [SOLC_VERSION]
4448
[SOLC_VERSION] [ELAPSED]
4549
Compiler run successful!
@@ -54,6 +58,5 @@ Suite result: ok. 1 passed; 0 failed; 0 skipped; [ELAPSED]
5458
5559
Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
5660
57-
"#]],
58-
);
61+
"#]]);
5962
});

0 commit comments

Comments
 (0)