-
Notifications
You must be signed in to change notification settings - Fork 27
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
Contracts cleanup #361
Contracts cleanup #361
Conversation
@AntoineRondelet once we'v confirmed that #362 builds correctly, rebasing on to that should fix the CI error here. |
4e32a14
to
026233d
Compare
See also: #335 |
28c329c
to
6d96302
Compare
This branch contains all the solidity changes. Not sure why some of the "file renamings" do not appear as such and are rather treated a deleted files + new files... this makes this PR extremely annoying to review. Probably did something fishy here, or maybe the set of changes on the files has reached the "diff threshold" above which git doesn't detect "renames" anymore (se e.g. https://chelseatroy.com/2020/05/09/question-how-does-git-detect-renames/), not sure. |
Co-authored-by: Duncan Tebbs <dtebbs@users.noreply.github.com>
c671041
to
93e36c6
Compare
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.
LGTM
Refactor the solidity code to comply with the styling guide of the language and added more restrictions on function visibility and state mutation (which also allows to save gas by reading straight in the calldata instead of having the args copied).
Also removed
MerkleTreeSha256.sol
which wasn't used anymore and wasn't compiling.Ran
slither
(https://github.com/crytic/slither) on the contracts. We're not fully compliant (still some contracts names that aren't fully in Caps, some variables that are unused in inherited contracts, uninitialized variables and ignored returns to only name a few) but the set of flags raised aren't very worrying when we dig into the code (the ignoredreturn
values are alwaystrue
and come from the ERC standard etc etc). We can surely make the whole set of contracts tick all boxes but that will take a bit more time and will affect the perfs if we want to move away from low level calls and assembly - which isn't desired for now.[EDIT] Slither doesn't seem to fully support the latest versions of Solidity (i.e. not above 0.7), so using the tool as part of the CI with the current code base (in Solidity
0.8
) isn't possible for now. Running the tool manually can be done however, with a few tricks to remove syntax not yet supported (e.g.vk.slot
) by modifying the code (e.g.mstore(pad, vk.slot)
->mstore(pad, 0x20)
to satisfy the tool and get reports for all other "Detectors")[EDIT 2]: The full 0.7 syntax (including
.slot
and.offset
) will soon be supported (see: crytic/slither#831 for more details)