From 916c924d63592c4665a2d25933a2b1f4369a14f5 Mon Sep 17 00:00:00 2001 From: "clandestine.eth" <96172957+0xClandestine@users.noreply.github.com> Date: Fri, 31 Jan 2025 15:08:22 -0500 Subject: [PATCH] fix: enforce no compile warnings (#1057) * feat: deny compile warnings * fix: compile warnings * fix: ci --- .github/workflows/foundry.yml | 2 +- foundry.toml | 2 +- src/test/integration/IntegrationChecks.t.sol | 2 +- src/test/integration/tests/Deposit_Delegate_Allocate.t.sol | 1 - src/test/unit/libraries/SnapshotsUnit.t.sol | 6 +++--- src/test/unit/mixins/SignatureUtilsUnit.t.sol | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index 17dd5a73c2..26adf74bc3 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -180,7 +180,7 @@ jobs: # Run Forge coverage with LCOV report format, excluding test and script files - name: Forge Coverage run: | - FOUNDRY_PROFILE=ci forge coverage --report lcov --no-match-coverage "src/test/*","script/*","*Storage" + FOUNDRY_DENY_WARNINGS=false FOUNDRY_PROFILE=ci forge coverage --report lcov --no-match-coverage "src/test/*","script/*","*Storage" genhtml -q -o report ./lcov.info # Upload coverage report as artifact before potential failure diff --git a/foundry.toml b/foundry.toml index bf2c6d3a36..3464360501 100644 --- a/foundry.toml +++ b/foundry.toml @@ -24,7 +24,7 @@ # Specifies the exact version of Solidity to use, overriding auto-detection. solc_version = '0.8.27' # If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present. - deny_warnings = false + deny_warnings = true # If set to true, changes compilation pipeline to go through the new IR optimizer. via_ir = false # Whether or not to enable the Solidity optimizer. diff --git a/src/test/integration/IntegrationChecks.t.sol b/src/test/integration/IntegrationChecks.t.sol index c01db4e72b..e4a48fc762 100644 --- a/src/test/integration/IntegrationChecks.t.sol +++ b/src/test/integration/IntegrationChecks.t.sol @@ -394,7 +394,7 @@ contract IntegrationCheckUtils is IntegrationBase { User staker, User operator, IDelegationManagerTypes.Withdrawal memory withdrawal, - IAllocationManagerTypes.AllocateParams memory allocateParams, // TODO - was this needed? + IAllocationManagerTypes.AllocateParams memory, // TODO - was this needed? IAllocationManagerTypes.SlashingParams memory slashingParams ) internal { IERC20[] memory tokens = new IERC20[](withdrawal.strategies.length); diff --git a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol index 48cc93ff63..03f9ede012 100644 --- a/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Allocate.t.sol @@ -166,7 +166,6 @@ contract Integration_Deposit_Delegate_Allocate is IntegrationCheckUtils { // 1. Deposit Into Strategies staker.depositIntoEigenlayer(strategies, tokenBalances); - uint256[] memory shares = _calculateExpectedShares(strategies, tokenBalances); // TODO - post-deposit and post-delegate checks? // 2. Delegate to an operator diff --git a/src/test/unit/libraries/SnapshotsUnit.t.sol b/src/test/unit/libraries/SnapshotsUnit.t.sol index 804bdb4e71..55b61ad4a5 100644 --- a/src/test/unit/libraries/SnapshotsUnit.t.sol +++ b/src/test/unit/libraries/SnapshotsUnit.t.sol @@ -30,15 +30,15 @@ contract SnapshotsUnitTests is Test { assertEq(history.length(), 1); } - function test_UpperLookup_InitiallyWad(uint32 r) public { + function test_UpperLookup_InitiallyWad(uint32 r) public view { assertEq(history.upperLookup(r), 1e18); } - function test_Latest_InitiallyWad() public { + function test_Latest_InitiallyWad() public view { assertEq(history.latest(), 1e18); } - function test_Length_InitiallyZero() public { + function test_Length_InitiallyZero() public view { assertEq(history.length(), 0); } } \ No newline at end of file diff --git a/src/test/unit/mixins/SignatureUtilsUnit.t.sol b/src/test/unit/mixins/SignatureUtilsUnit.t.sol index b6dffecfda..6f998923f3 100644 --- a/src/test/unit/mixins/SignatureUtilsUnit.t.sol +++ b/src/test/unit/mixins/SignatureUtilsUnit.t.sol @@ -42,7 +42,7 @@ contract SignatureUtilsUnit is Test, SignatureUtils { ); } - function test_domainSeparator_NonZero() public { + function test_domainSeparator_NonZero() public view { assertTrue(_INITIAL_DOMAIN_SEPARATOR != 0, "The initial domain separator should be non-zero"); assertTrue(domainSeparator() != 0, "The domain separator should be non-zero"); assertTrue(domainSeparator() == expectedDomainSeparator, "The domain separator should be as expected"); @@ -70,7 +70,7 @@ contract SignatureUtilsUnit is Test, SignatureUtils { _checkIsValidSignatureNow(signer, digest, abi.encode(r, s, v), block.timestamp - 1); } - function testFail_checkIsValidSignatureNow_InvalidSignature() public { + function testFail_checkIsValidSignatureNow_InvalidSignature() public view { _checkIsValidSignatureNow(signer, digest, "", block.timestamp); } } \ No newline at end of file