zeta-chain / protocol-contracts

Protocol contracts implementing the core logic of the protocol, deployed on ZetaChain and on connected chains
MIT License
71 stars 58 forks source link

Silence all warnings in `forge build` #396

Closed lumtis closed 1 month ago

lumtis commented 1 month ago

It seems all these warning can be silenced

Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.26;"
--> test/fuzz/ERC20CustodyEchidnaTest.sol

Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.26;"
--> test/fuzz/GatewayEVMEchidnaTest.sol

Warning (6321): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
  --> test/utils/ReceiverEVM.sol:82:18:
   |
82 |         returns (bytes memory)
   |                  ^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> contracts/evm/ZetaConnectorNative.sol:35:9:
   |
35 |         bytes32 internalSendHash
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> contracts/evm/ZetaConnectorNative.sol:57:9:
   |
57 |         bytes32 internalSendHash
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> contracts/evm/ZetaConnectorNative.sol:85:9:
   |
85 |         bytes32 internalSendHash,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/ReceiverEVM.sol:77:9:
   |
77 |         MessageContext calldata messageContext,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/ReceiverEVM.sol:78:9:
   |
78 |         bytes calldata message
   |         ^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/ERC20Custody.t.sol:527:9:
    |
527 |         uint256 tssZetaBalanceBefore = zeta.balanceOf(tssAddress);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/TestUniversalContract.sol:33:9:
   |
33 |         address zrc20,
   |         ^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/TestUniversalContract.sol:34:9:
   |
34 |         uint256 amount,
   |         ^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/GatewayZEVM.t.sol:545:9:
    |
545 |         uint256 ownerBalanceBefore = zetaToken.balanceOf(owner);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/GatewayZEVM.t.sol:546:9:
    |
546 |         uint256 gatewayBalanceBefore = zetaToken.balanceOf(address(gateway));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/GatewayZEVM.t.sol:547:9:
    |
547 |         uint256 protocolAddressBalanceBefore = protocolAddress.balance;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
    --> test/GatewayZEVM.t.sol:1008:9:
     |
1008 |         uint256 destinationBalanceBefore = address(testUniversalContract).balance;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/ZRC20.t.sol:226:10:
    |
226 |         (address gasZRC20, uint256 gasFee) = zrc20.withdrawGasFee();
    |          ^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/ZRC20.t.sol:226:28:
    |
226 |         (address gasZRC20, uint256 gasFee) = zrc20.withdrawGasFee();
    |                            ^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/ZRC20.t.sol:234:10:
    |
234 |         (address gasZRC20, uint256 gasFee) = zrc20.withdrawGasFee();
    |          ^^^^^^^^^^^^^^^^

Warning (2072): Unused local variable.
   --> test/ZRC20.t.sol:234:28:
    |
234 |         (address gasZRC20, uint256 gasFee) = zrc20.withdrawGasFee();
    |                            ^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/upgrades/ZetaConnectorNativeUpgradeTest.sol:39:9:
   |
39 |         bytes32 internalSendHash
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/upgrades/ZetaConnectorNativeUpgradeTest.sol:61:9:
   |
61 |         bytes32 internalSendHash
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> test/utils/upgrades/ZetaConnectorNativeUpgradeTest.sol:89:9:
   |
89 |         bytes32 internalSendHash,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^

Warning (2018): Function state mutability can be restricted to view
  --> test/ZRC20.t.sol:52:5:
   |
52 |     function testZRC20BasicInfo() public {
   |     ^ (Relevant source part starts here and spans across multiple lines).