Fix (most) forge compilation warnings #960
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes most compilation warnings when running
npm run compile
(forge compilation).Only .sol changes that won't change the contract's bytecode are included.
Most warnings were in Mock contracts or forge test files.
There are a bunch of warnings left during compilation, detailed below :
12 warnings in
node_modules/@orcaprotocol/contracts/....
, not much we can do about it without copying the Solidity in our own repo, so I did not take this decision. Tom notified Orca about it (but it's not a big deal).5 warnings in
WETH9.sol
, it's using an old version of Solidity and usesthis.balance
instead ofaddress(this).balance
and does not prefix event emissions with theemit
keyword, but I didn't change because this contract compiles in Solidity 0.4.181 warning in
PSMRouter.sol
"This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.", I did not fix because it would change the bytecode of the contract. PSMRouter is not used anywhere and the only mainnet deployment is deprecated because it's a wrapper above the ETH PSM that is itself deprecated (I'm doing a separate PR to deprecate theethPSMRouter
)2 warnings in
FuseGuardian.sol
, I think these are important warnings because the Solidity code does not have the intended behavior and I think this was missed because of all the "warnings pollution" and nobody reading warnings anymore. The functions_setBorrowPaused
and_setMintPausedByUnderlying
return booleans, but they always return false, instead of the result of the internal functions. I don't think there's any harm in it, and I did not fix the warnings because it would introduce bytecode changes, but it's definitely not the intended behavior. Reducing the amounts of warnings will allow us to catch this kind of errors in the future.