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
feat!: only distribute rewards to validators that have been validating a consumer chain for some time #1929
feat!: only distribute rewards to validators that have been validating a consumer chain for some time #1929
Changes from all commits
f4b8376
0f4c2dd
a26c116
2d6e3f7
c2f7316
68d0b4f
864b3ac
7204959
3954091
d28aba5
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.
Add a blank line above the heading for better Markdown formatting.
Committable suggestion
Tools
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.
Tip
Codebase Verification
The
SetConsumerRewardsAllocation
method inx/ccv/provider/keeper/distribution.go
does not appear to handle any edge cases explicitly. It simply marshals thepool
object and stores it using thechainID
as the key. There is no error handling or validation of the input parameters.x/ccv/provider/keeper/distribution.go:236-240
Category:
Analysis chain
Ensure that the
SetConsumerRewardsAllocation
method handles edge cases appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 119
Script:
Length of output: 115
Script:
Length of output: 3381
Script:
Length of output: 912
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.
Tip
Codebase Verification
The
BeginBlockRD
function inx/ccv/provider/keeper/distribution.go
does perform a state update by callingk.AllocateTokens(ctx)
if the block height is greater than 1. However, there is no explicit exception handling within the function.x/ccv/provider/keeper/distribution.go:22-24
: The function checks the block height and callsk.AllocateTokens(ctx)
for state updates.Please ensure that
BeginBlockRD
includes proper exception handling mechanisms to manage any potential errors during execution.BeginBlockRD
inx/ccv/provider/keeper/distribution.go
.Analysis chain
Ensure that
BeginBlockRD
properly updates relevant state and handles any exceptions.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 99
Script:
Length of output: 622
Script:
Length of output: 667
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.
Tip
Codebase Verification
The calculation of
validatorsExpRewards
involves multiple operations, includingMulDecTruncate
andMulDec
. However, there is no explicit check for overflow in these calculations.validatorsExpRewards := rewardsPerConsumerDec.MulDecTruncate(math.LegacyOneDec().Sub(communityTax)).MulDec(sdk.NewDec(int64(consuNum)))
perValExpReward := validatorsExpRewards.QuoDec(sdk.NewDec(int64(valNum)))
These calculations could potentially lead to overflow issues if the values involved are large enough. It is advisable to add explicit overflow checks or handle potential overflow scenarios to ensure robustness.
Analysis chain
Check the calculation of
validatorsExpRewards
for potential overflow issues.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 241
Script:
Length of output: 70
Script:
Length of output: 341
Script:
Length of output: 1629
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 test was practically testing
AllocateTokensToConsumerValidators
so renamed it.