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.
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
fix!: apply audit suggestions #1925
fix!: apply audit suggestions #1925
Changes from 6 commits
6f5a9bb
1d7b85d
4d62294
1d13c9b
48849a4
a7b8791
4bc5c35
c180ed8
902cc4d
03226f9
e6ce423
54afcba
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 is not audit specific but was added after a question raised by @LexaMichaelides (Hypha):
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.
Consider rephrasing to avoid repetition and enhance readability.
Committable suggestion
Tools
LanguageTool
Markdownlint
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.
We fixed a rounding issue based on "Inaccurate Rounding of maxPower" suggestion and hence those numbers had to be changed.
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.
Changed due to the "math.LegacyNewDec(totalPower) should be initialized once before entering the loop" suggestion.
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.
Taken from "Minor Code Improvements" and specifically "The new allocation.Rewards value (code) should match the changeCoins value from [...]"
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.
Changed due to the "The comment in the function ComputeConsumerTotalVotingPower incorrectly states that it sums the voting powers of opted-in validators. Instead, it sums the voting powers of the actual validator set." comment.
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.
Changes in this file stem from the "Minor Code Improvements" suggestions.
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.
We had by reference to be able to show that it's optional but following "Minor Code Improvements" we remove the reference to
msg.ConsumerKey
.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.
Note that:
and because of this I use
%s
witherr.Error()
here.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.
Using directly
NewDec
here and above because of "Code Efficiency Improvements and Optimization Opportunities" suggestions.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.
Changed based on "Code Efficiency Improvements and Optimization Opportunities" suggestions.
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.
Changed due to "Inaccurate Rounding of maxPower" suggestion.
Note that I did not apply the "Potential Optimization in Max Power Capping Logic" suggestion because it seems to me that if we do everything in one
for
loop, we would make the code slightly harder to read with no real performance benefit (i.e., number of validators are a few hundreds).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.
Renamed based on "Potential Optimization in Max Power Capping Logic" suggestion: