-
Notifications
You must be signed in to change notification settings - Fork 5
fix: update rewarder implementation #105
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
Conversation
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
|
|
||
| event ActiveStateChange(bool active, address account); | ||
| event SubnetUpdated(SubnetID subnet, uint256 checkpointPeriod); | ||
| event SubnetUpdated(SubnetID subnet); |
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.
Stop storing checkpointPeriod, we will fetch the number of blocks in a checkpoint on the fly
| /// @dev Ensures the checkpoint height is a multiple of the checkpoint period | ||
| function validateCheckpointHeight(uint64 claimedCheckpointHeight) internal view returns (bool) { | ||
| return claimedCheckpointHeight > 0 && claimedCheckpointHeight % checkpointPeriod == 0; | ||
| /// @notice Gets the number of blocks in a checkpoint from the subnet actor |
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.
Calls the subnetActorGetter to fetch the number of blocks in the checkpoint.
| } | ||
|
|
||
| /// @notice A bottom-up checkpoint type. | ||
| struct BottomUpCheckpoint { |
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.
Addition data types copied over from IPC contracts to call subnetGetterActor
This pull request updates
ValidatorRewardercontract and related scripts and tests. The changes focus on improving the accuracy of reward calculations.In the earlier implementation we mistakenly assumed that every bottom-up checkpoint will always be 600 blocks (checkpoint period). This assumption is wrong. Bottom up checkpoints in IPC can be shorter than the checkpoint period. Sometimes when the max number of messages are added the checkpoint is sent immediately.
These changes reads the actual number of blocks in the checkpoint and use that number for reward calculation. For instance, if any checkpoint contains only 300 blocks then the rewards claimed by the validator should be: 100 * validator's share.
closes: #100