From df78c372560442b35bc204e1bf450c412d48e39d Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 22 Feb 2024 12:35:24 +0100 Subject: [PATCH 1/7] chore: bump foundry-compilers 0.3.8 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 422ebd05ae4f..6e7da65931ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3092,9 +3092,9 @@ dependencies = [ [[package]] name = "foundry-compilers" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba64504d49ebda9141869b2ba23db2d685ae4cf17bcddf5e61f0e4bc515ebb25" +checksum = "040732d9acfd36d2025724afea6c644228cc2d1459305aeab3c688a4d963da85" dependencies = [ "alloy-json-abi", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 2c650152f186..06b070dfd19d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,7 +135,7 @@ foundry-wallets = { path = "crates/wallets" } # solc & compilation utilities foundry-block-explorers = { version = "0.2.3", default-features = false } -foundry-compilers = { version = "0.3.6", default-features = false } +foundry-compilers = { version = "0.3.8", default-features = false } ## revm # no default features to avoid c-kzg From 81b35e65f165f731cc7d911f201b4a0d2c0d3b59 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:44:19 +0100 Subject: [PATCH 2/7] chore: update test --- crates/forge/tests/cli/cmd.rs | 31 +++++-------------- crates/forge/tests/cli/config.rs | 9 ++---- .../fixtures/can_set_yul_optimizer.stderr | 3 +- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/crates/forge/tests/cli/cmd.rs b/crates/forge/tests/cli/cmd.rs index a187169fae98..e5d7f712d364 100644 --- a/crates/forge/tests/cli/cmd.rs +++ b/crates/forge/tests/cli/cmd.rs @@ -536,31 +536,10 @@ contract Greeter { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains( - " -Compiler run successful with warnings: -Warning (5667): Warning: Unused function parameter. Remove or comment out the variable name to silence this warning. -", - )); + assert!(output.contains("Warning"), "{output}"); }); // Tests that direct import paths are handled correctly -// -// NOTE(onbjerg): Disabled for Windows -- for some reason solc fails with a bogus error message -// here: error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit -// conversion from struct Bar memory to struct Bar memory requested. --> src\Foo.sol:12:22: -// | -// 12 | FooLib.check(b); -// | ^ -// -// -// -// error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit conversion -// from contract Foo to contract Foo requested. --> src\Foo.sol:15:23: -// | -// 15 | FooLib.check2(this); -// | ^^^^ -#[cfg(not(target_os = "windows"))] forgetest!(can_handle_direct_imports_into_src, |prj, cmd| { prj.add_source( "Foo", @@ -1572,8 +1551,12 @@ forgetest_init!(can_install_missing_deps_build, |prj, cmd| { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains("Missing dependencies found. Installing now"), "{}", output); - assert!(output.contains("No files changed, compilation skipped"), "{}", output); + assert!(output.contains("Missing dependencies found. Installing now"), "{output}"); + + // re-run + let output = cmd.stdout_lossy(); + assert!(!output.contains("Missing dependencies found. Installing now"), "{output}"); + assert!(output.contains("No files changed, compilation skipped"), "{output}"); }); // checks that extra output works diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index 0c540d65a4fc..0848b8446eee 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -380,7 +380,7 @@ contract Foo {} // test to ensure yul optimizer can be set as intended forgetest!(can_set_yul_optimizer, |prj, cmd| { prj.add_source( - "Foo", + "foo.sol", r" contract Foo { function bar() public pure { @@ -405,12 +405,7 @@ contract Foo { ..Default::default() }; prj.write_config(config); - - assert!(cmd.stdout_lossy().ends_with( - " -Compiler run successful! -", - )); + cmd.assert_success(); }); // tests that the lib triple can be parsed diff --git a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr index c7c847bf96e1..0dd4db95b6eb 100644 --- a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr +++ b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr @@ -1,9 +1,8 @@ Error: Compiler run failed: -Error (6553): SyntaxError: The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. +Error (6553): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. --> src/Foo.sol:6:8: | 6 | assembly { | ^ (Relevant source part starts here and spans across multiple lines). - From cedf9271f48fa4adadc0848f696fb1745cf7f432 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:44:23 +0100 Subject: [PATCH 3/7] tmp: pin to git --- Cargo.lock | 3 +-- Cargo.toml | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e7da65931ea..a780989564b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3093,8 +3093,7 @@ dependencies = [ [[package]] name = "foundry-compilers" version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "040732d9acfd36d2025724afea6c644228cc2d1459305aeab3c688a4d963da85" +source = "git+https://github.com/foundry-rs/compilers?branch=dani/i-love-solc#a94508f7ce9cf612db19a5282f0629f61bea414a" dependencies = [ "alloy-json-abi", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 06b070dfd19d..266cb42fb996 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -181,10 +181,7 @@ alloy-rlp = "0.3.3" solang-parser = "=0.3.3" ## misc -chrono = { version = "0.4", default-features = false, features = [ - "clock", - "std", -] } +chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } color-eyre = "0.6" derive_more = "0.99" eyre = "0.6" @@ -238,3 +235,5 @@ 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" } + +foundry-compilers = { git = "https://github.com/foundry-rs/compilers", branch = "dani/i-love-solc" } From fff32b2626af14b561d3413381063692c7cfe2d0 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:59:09 +0100 Subject: [PATCH 4/7] Revert "chore: update test" This reverts commit 81b35e65f165f731cc7d911f201b4a0d2c0d3b59. --- crates/forge/tests/cli/cmd.rs | 31 ++++++++++++++----- crates/forge/tests/cli/config.rs | 9 ++++-- .../fixtures/can_set_yul_optimizer.stderr | 3 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/crates/forge/tests/cli/cmd.rs b/crates/forge/tests/cli/cmd.rs index e5d7f712d364..a187169fae98 100644 --- a/crates/forge/tests/cli/cmd.rs +++ b/crates/forge/tests/cli/cmd.rs @@ -536,10 +536,31 @@ contract Greeter { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains("Warning"), "{output}"); + assert!(output.contains( + " +Compiler run successful with warnings: +Warning (5667): Warning: Unused function parameter. Remove or comment out the variable name to silence this warning. +", + )); }); // Tests that direct import paths are handled correctly +// +// NOTE(onbjerg): Disabled for Windows -- for some reason solc fails with a bogus error message +// here: error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit +// conversion from struct Bar memory to struct Bar memory requested. --> src\Foo.sol:12:22: +// | +// 12 | FooLib.check(b); +// | ^ +// +// +// +// error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit conversion +// from contract Foo to contract Foo requested. --> src\Foo.sol:15:23: +// | +// 15 | FooLib.check2(this); +// | ^^^^ +#[cfg(not(target_os = "windows"))] forgetest!(can_handle_direct_imports_into_src, |prj, cmd| { prj.add_source( "Foo", @@ -1551,12 +1572,8 @@ forgetest_init!(can_install_missing_deps_build, |prj, cmd| { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains("Missing dependencies found. Installing now"), "{output}"); - - // re-run - let output = cmd.stdout_lossy(); - assert!(!output.contains("Missing dependencies found. Installing now"), "{output}"); - assert!(output.contains("No files changed, compilation skipped"), "{output}"); + assert!(output.contains("Missing dependencies found. Installing now"), "{}", output); + assert!(output.contains("No files changed, compilation skipped"), "{}", output); }); // checks that extra output works diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index 0848b8446eee..0c540d65a4fc 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -380,7 +380,7 @@ contract Foo {} // test to ensure yul optimizer can be set as intended forgetest!(can_set_yul_optimizer, |prj, cmd| { prj.add_source( - "foo.sol", + "Foo", r" contract Foo { function bar() public pure { @@ -405,7 +405,12 @@ contract Foo { ..Default::default() }; prj.write_config(config); - cmd.assert_success(); + + assert!(cmd.stdout_lossy().ends_with( + " +Compiler run successful! +", + )); }); // tests that the lib triple can be parsed diff --git a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr index 0dd4db95b6eb..c7c847bf96e1 100644 --- a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr +++ b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr @@ -1,8 +1,9 @@ Error: Compiler run failed: -Error (6553): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. +Error (6553): SyntaxError: The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. --> src/Foo.sol:6:8: | 6 | assembly { | ^ (Relevant source part starts here and spans across multiple lines). + From 9328339026bf83e7e13689feb43bd19301dee7d4 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:59:58 +0100 Subject: [PATCH 5/7] el bumpo --- Cargo.lock | 10 ++++++++-- Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a780989564b1..b86cca84dbad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3092,8 +3092,9 @@ dependencies = [ [[package]] name = "foundry-compilers" -version = "0.3.8" -source = "git+https://github.com/foundry-rs/compilers?branch=dani/i-love-solc#a94508f7ce9cf612db19a5282f0629f61bea414a" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1b77c95e79bff02ddaa38426fc6809a3a438dce0e6a2eb212dac97da7c157b4" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -8622,3 +8623,8 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "foundry-compilers" +version = "0.3.8" +source = "git+https://github.com/foundry-rs/compilers?branch=dani/i-love-solc#a94508f7ce9cf612db19a5282f0629f61bea414a" diff --git a/Cargo.toml b/Cargo.toml index 266cb42fb996..f717822ae9eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,7 +135,7 @@ foundry-wallets = { path = "crates/wallets" } # solc & compilation utilities foundry-block-explorers = { version = "0.2.3", default-features = false } -foundry-compilers = { version = "0.3.8", default-features = false } +foundry-compilers = { version = "0.3.9", default-features = false } ## revm # no default features to avoid c-kzg From 586864d63b2e7c167925d85c6157667e9264b06c Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:00:49 +0100 Subject: [PATCH 6/7] el fixo --- Cargo.lock | 5 ----- Cargo.toml | 2 -- 2 files changed, 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b86cca84dbad..3d431ea31f80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8623,8 +8623,3 @@ dependencies = [ "cc", "pkg-config", ] - -[[patch.unused]] -name = "foundry-compilers" -version = "0.3.8" -source = "git+https://github.com/foundry-rs/compilers?branch=dani/i-love-solc#a94508f7ce9cf612db19a5282f0629f61bea414a" diff --git a/Cargo.toml b/Cargo.toml index f717822ae9eb..cddf4bae26a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -235,5 +235,3 @@ 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" } - -foundry-compilers = { git = "https://github.com/foundry-rs/compilers", branch = "dani/i-love-solc" } From 58530aa9be7b15f645e9a1f31428072b5ae39189 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:01:02 +0100 Subject: [PATCH 7/7] Reapply "chore: update test" This reverts commit fff32b2626af14b561d3413381063692c7cfe2d0. --- crates/forge/tests/cli/cmd.rs | 31 +++++-------------- crates/forge/tests/cli/config.rs | 9 ++---- .../fixtures/can_set_yul_optimizer.stderr | 3 +- 3 files changed, 10 insertions(+), 33 deletions(-) diff --git a/crates/forge/tests/cli/cmd.rs b/crates/forge/tests/cli/cmd.rs index a187169fae98..e5d7f712d364 100644 --- a/crates/forge/tests/cli/cmd.rs +++ b/crates/forge/tests/cli/cmd.rs @@ -536,31 +536,10 @@ contract Greeter { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains( - " -Compiler run successful with warnings: -Warning (5667): Warning: Unused function parameter. Remove or comment out the variable name to silence this warning. -", - )); + assert!(output.contains("Warning"), "{output}"); }); // Tests that direct import paths are handled correctly -// -// NOTE(onbjerg): Disabled for Windows -- for some reason solc fails with a bogus error message -// here: error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit -// conversion from struct Bar memory to struct Bar memory requested. --> src\Foo.sol:12:22: -// | -// 12 | FooLib.check(b); -// | ^ -// -// -// -// error[9553]: TypeError: Invalid type for argument in function call. Invalid implicit conversion -// from contract Foo to contract Foo requested. --> src\Foo.sol:15:23: -// | -// 15 | FooLib.check2(this); -// | ^^^^ -#[cfg(not(target_os = "windows"))] forgetest!(can_handle_direct_imports_into_src, |prj, cmd| { prj.add_source( "Foo", @@ -1572,8 +1551,12 @@ forgetest_init!(can_install_missing_deps_build, |prj, cmd| { cmd.arg("build"); let output = cmd.stdout_lossy(); - assert!(output.contains("Missing dependencies found. Installing now"), "{}", output); - assert!(output.contains("No files changed, compilation skipped"), "{}", output); + assert!(output.contains("Missing dependencies found. Installing now"), "{output}"); + + // re-run + let output = cmd.stdout_lossy(); + assert!(!output.contains("Missing dependencies found. Installing now"), "{output}"); + assert!(output.contains("No files changed, compilation skipped"), "{output}"); }); // checks that extra output works diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index 0c540d65a4fc..0848b8446eee 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -380,7 +380,7 @@ contract Foo {} // test to ensure yul optimizer can be set as intended forgetest!(can_set_yul_optimizer, |prj, cmd| { prj.add_source( - "Foo", + "foo.sol", r" contract Foo { function bar() public pure { @@ -405,12 +405,7 @@ contract Foo { ..Default::default() }; prj.write_config(config); - - assert!(cmd.stdout_lossy().ends_with( - " -Compiler run successful! -", - )); + cmd.assert_success(); }); // tests that the lib triple can be parsed diff --git a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr index c7c847bf96e1..0dd4db95b6eb 100644 --- a/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr +++ b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr @@ -1,9 +1,8 @@ Error: Compiler run failed: -Error (6553): SyntaxError: The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. +Error (6553): The msize instruction cannot be used when the Yul optimizer is activated because it can change its semantics. Either disable the Yul optimizer or do not use the instruction. --> src/Foo.sol:6:8: | 6 | assembly { | ^ (Relevant source part starts here and spans across multiple lines). -