From 01d5b9f27386f925854a3f55f9ccb8be2b0510ce Mon Sep 17 00:00:00 2001 From: Adam Egyed <5456061+adamegyed@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:49:30 -0400 Subject: [PATCH] fix: detect compiler warnings in CI (#235) --- foundry.toml | 4 ++++ package.json | 2 +- test/modules/AllowlistModule.t.sol | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/foundry.toml b/foundry.toml index a48c150a..5623af0d 100644 --- a/foundry.toml +++ b/foundry.toml @@ -26,6 +26,7 @@ fail_on_revert = true depth = 10 [profile.optimized-build] +deny_warnings = true via_ir = true test = 'src' optimizer_runs = 10000 @@ -33,9 +34,11 @@ out = 'out-optimized' cache_path = 'cache-optimized' [profile.optimized-test] +deny_warnings = true src = 'test' [profile.optimized-test-deep] +deny_warnings = true src = 'test' [profile.optimized-test-deep.fuzz] @@ -54,6 +57,7 @@ depth = 32 [profile.gas] via_ir = true +deny_warnings = true test = 'gas' optimizer_runs = 10000 out = 'out-optimized' diff --git a/package.json b/package.json index 456cda36..f555af0b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "lint:test": "solhint --max-warnings 0 -c ./config/solhint-test.json './test/**/*.sol'", "lint:gas": "solhint --max-warnings 0 -c ./config/solhint-gas.json './gas/**/*.sol'", "lint:script": "solhint --max-warnings 0 -c ./config/solhint-script.json './script/**/*.sol'", - "prep": "pnpm fmt && forge b && pnpm lint && pnpm test && pnpm gas", + "prep": "pnpm fmt && forge b --deny-warnings && pnpm lint && pnpm test && pnpm gas", "test": "forge test" } } diff --git a/test/modules/AllowlistModule.t.sol b/test/modules/AllowlistModule.t.sol index 3199c6c1..94ecad2b 100644 --- a/test/modules/AllowlistModule.t.sol +++ b/test/modules/AllowlistModule.t.sol @@ -487,7 +487,7 @@ contract AllowlistModuleTest is CustomValidationTestBase { /// - case 1 - a selector (Counter.setNumber) + address (counters[0]) should match /// - case 2 - wildcard selector (Counter.increment), any address works /// - case 3 - wildcard address (counters[1]), any selector works - function _getInputsForTests() internal returns (AllowlistModule.AllowlistInput[] memory) { + function _getInputsForTests() internal view returns (AllowlistModule.AllowlistInput[] memory) { AllowlistModule.AllowlistInput[] memory inputs = new AllowlistModule.AllowlistInput[](3); // case 1 - a selector (Counter.setNumber) + address (counters[0]) should match bytes4[] memory selectors1 = new bytes4[](1);