-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: use forge lint over solhint and adjust code accordingly
#63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| [lint] | ||
| lint_on_build = false # Since we are using our own linting solution, we can disable built in one | ||
| exclude_lints = ["mixed-case-variable", "mixed-case-function"] | ||
| ignore = ["src/utils/ERC20VotesUpgradeable.sol"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasoning for the above:
- I've excluded mixed case rules for variables and functions because we have plenty of usages were we don't want to use mixed case intentionally (upgradeable
__init()functions being one example). - I've ignored
ERC20VotesUpgradeablebecause it violates many of the linting rules but is 99% library code we don't really maintain (we just changed one line in that contract)
| "verify:emergency_mode": "certoraRun certora/confs/EmergencyMode.conf", | ||
| "verify:karma": "certoraRun certora/confs/Karma.conf", | ||
| "lint:sol": "forge fmt --check && pnpm solhint {script,src,test,certora}/**/*.sol", | ||
| "lint:sol": "forge fmt --check && forge lint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI and pnpm lint now uses forge lint
| if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender) && !hasRole(OPERATOR_ROLE, msg.sender)) { | ||
| revert Karma__Unauthorized(); | ||
| } | ||
| _onlyAdminOrOperator(msg.sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifier functionality has been moved into internal functions, because otherwise, the logic gets inlined into every function where the modifier is used.
| uint256 claimedBitIndex = index % 256; | ||
| uint256 claimedWord = claimedBitMap[epoch][claimedWordIndex]; | ||
| uint256 mask = (1 << claimedBitIndex); | ||
| uint256 mask = (BITMAP_MASK_BASE << claimedBitIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to avoid a warning that one might have swapped the two operands.
| external | ||
| view | ||
| returns (bool); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one I've removed because it's not used anywhere
| return(0, 0x20) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The verifier is also not used anywhere.
4c3e85e to
d99e526
Compare
No description provided.