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 5 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 search results did not reveal any specific migration logic for the new
height
field in consumer validators. This confirms that there is no existing migration strategy to handle this new field.height
field in consumer validators requires a state migration to populate this field for existing validators.Analysis chain
The concern about migrating all consumer validator state is valid. It's important to ensure that there is a migration strategy in place to populate the new
height
field for existing validators. This might involve a script or a one-time migration function during the upgrade process.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 43
Script:
Length of output: 62506
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.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.
What happens here when a new consumer chain is added? Are all the validators ineligible? If so, is it safe for ComputeConsumerTotalVotingPower to return zero? Also, what happens with the rewads for the first warmup period?
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.
See above in the PR description:
If no validator is eligible, then rewards would go to the community pool. The same applies for the first warmup period. No validator would get rewards and the rewards would end up in the community pool.
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.
Does this mean that a validator not being eligible results in the other validators getting more rewards?
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.
Yes, this could potentially happen. For instance, consider you have 2 validators
A
andB
with powers 100 and 400 respectively, so thetotalPower
would have been 500. If both validators are eligible, thenA
would get100/500
of the tokens, whileB
would get400 / 500
of the tokens. However, if validatorB
is not eligible for rewards, this would mean thattotalPower
is only100
and henceA
gets all (i.e,.100/100
) the tokens.Added this comment:
in
AllocateTokensToConsumerValidators
.Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
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.
Maybe it's safer to log an error like "fail to get consumer validator info" and then return
false
. In this scenario, the consumer validator would just have its height reset, right?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.
Yes, that is correct, the height would reset. This implies that the validator would never get rewards but this seems better than halting the provider chain. Fixed it.
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 handling unmarshal errors without panicking to improve chain stability.
Committable suggestion
Tools
GitHub Check: CodeQL