-
Notifications
You must be signed in to change notification settings - Fork 24
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
Update node weight #272
Update node weight #272
Conversation
services/node_stake_update.proto
Outdated
/** | ||
* The consensus weight of this node in the network. This is computed based on the stake of this node | ||
* at midnight UTC of the current day. If the stake of this node is less than minStake, then the | ||
* weight is 0. Sum of all weights of nodes in the network should be less than 500. |
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 might tweak this to give a little more context,
The network normalizes the weights of nodes above minStake so that the total sum of
weight is approximately 500. Specifically, the weight of a node A with stake > minStake
is computed using integer arithmetic as,
A_weight = Math.max((# of whole hbars staked by A) * 500 / (total # of whole hbars staked), 1)
so that every node above minStake has weight at least 1; but any node that has staked
at least 1 out of every 250 whole hbars staked will have weight >= 2.
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.
Thanks @tinker-michaelj . Updated
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.
One suggestion on comment, otherwise LGTM!
@@ -112,7 +112,7 @@ message NodeStake { | |||
int64 reward_rate = 4; | |||
|
|||
/** | |||
* Consensus weight of this node for the new staking period. | |||
* Total stake (rewarded and not rewarded) of this node at the beginning of the new staking 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.
it's true only when min_stake <= stake_rewarded + stake_not_rewarded <= max_stake I believe. i.e. if the sum is less than min_stake, stake is 0; if the sum is more than max_stake, stake = max_stake
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.
Yeah just discussed with Nick and the same field can be used as the consensus weight
.
|
Fixes #271
Related to hashgraph/hedera-services#6204
Adds Consensus Weight to NodeStake to update mirror nodes with the staking info updated midnight UTC