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
[RFP12] CToken Cleanup #152
[RFP12] CToken Cleanup #152
Conversation
d4d81c1
to
9703b0f
Compare
9703b0f
to
018f227
Compare
Cool! So what's the gas impact looking like? |
@jflatow Just ran the profiler and pushed, modest savings. We can save a bit more doing another pass at the optimizations with more code changes (found that removing the localvar structs did save some memory) but wanted to get this version out first edit: Just removed the |
proposals[newProposal.id] = newProposal; | ||
uint proposalId = proposalCount; | ||
Proposal storage newProposal = proposals[proposalId]; | ||
newProposal.id = proposalCount; |
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.
Should be newProposal.id = proposalId
to avoid discrepancies
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 comment applies to Governor Bravo as well.
|
||
proposals[newProposal.id] = newProposal; | ||
uint proposalId = proposalCount; | ||
Proposal storage newProposal = proposals[proposalId]; |
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.
Let's add a revert below this line if newProposal has any data set. This should never be the case, but if so, we don't want to overwrite anything.
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 comment applies to Governor Bravo as well.
14c0f7c
to
c945f35
Compare
Fix L07: Outdated Solidity versions
Partial Fix: N13 - Typos
Partial Fix: L08 - Unreachable code
Partial Fix: L05 - Missing or erroneous docstrings and comments
Partial Fix: L03 - Gas inefficiencies
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.
I wonder what broke in linting? But I guess this is the future and we need to merge 💪
@jflatow I think the current linter (solium) doesn't support newer syntax, it might make sense to switch to |
@jflatow migrated to
Hopefully CI will pass now 🙏 |
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.
👏
@jflatow it seems like the failing tests are due to Circle rather than the tests themselves? What are your thoughts on merging this in and then investigating CI separately (I'm happy to help here)? I know people are developing on top of these changes so it might be nice to have it in master |
Hi ! Good clean up here 💅🏻 How do you plan to use these changes ? Do you have any intention to audit them ? |
This change has been audited and the cTokens have been upgraded on mainnet. See the forum post for more details |
This PR Implements RFP 12:
Changes
revert
s insteadreturn
ingChange Notes
Since Saddle and
solc
don't support multiple versions within a repo, we thought the best way forward was to upgrade all contracts and remove legacy Comptroller implementations (ComptrollerGN
). In order to ensure tests still work, legacy build artifacts were added totests/LegacyBuilds/legacy.json
for usage in tests. We're open to a cleaner solution to this issue - perhaps by supporting multiple solidity versions within a single repo through Hardhat.We introduce a new
CustomError
matcher in both regular JS tests and Scenarios - these work by comparing the ABI encoding of the custom error and theresults
field of the transaction output.Most math errors with explicit messages (
addition overflow
,subtraction underflow
,divide by zero
, etc) have been removed and now just have a genericrevert
message. This is how Solidity exposes these reverts with checked math, and generally these errors can be debugged using more modern transaction tracing tooling.