-
Notifications
You must be signed in to change notification settings - Fork 955
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
Misc PoS tasks #2178
Misc PoS tasks #2178
Conversation
1b8d247
to
d5d730f
Compare
d5d730f
to
ee857d5
Compare
dingus
14a5cb8
to
02f5935
Compare
* brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_stake`
* brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_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.
Minor nits.
@@ -327,7 +322,7 @@ where | |||
current_epoch, | |||
epoch, | |||
)?; | |||
store_total_consensus_stake(storage, epoch)?; | |||
// compute_and_store_total_consensus_stake(storage, epoch)?; |
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.
Why is this now commented?
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 was a redundant operation. We already call this function in init_chain
and in finalize_block
upon a new epoch, both times before calling copy_validator_sets
. It is only necessary to call the function at the beginning of a new epoch and compute the total consensus stake for that current epoch only.
@@ -308,7 +302,8 @@ where | |||
Ok(()) | |||
} | |||
|
|||
/// new init genesis | |||
/// Copies the validator sets into all epochs up through the pipeline epoch at | |||
/// genesis. Also computes the total |
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.
Sentence fragment
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.
Thx, will fix up.
@@ -716,6 +721,8 @@ pub fn is_validator<S>( | |||
where | |||
S: StorageRead, | |||
{ | |||
// TODO: should this check be made different? I suppose it does work but |
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 do you mean?
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.
Technically this works because all validators need to have a max_commission_rate_change
set in storage, but it just seems odd from a readability perspective. May change this in a small PR before the next release
.total_stake | ||
.checked_mul(2.into()) | ||
.expect("Amount overflow while computing minimum required votes") | ||
+ (3u64 - 1u64)) |
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.
Couldn't it technically overflow 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.
Yeah, you are right, this should have an extra checked_add
* origin/brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_stake`
* origin/brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_stake`
* origin/brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_stake`
* origin/brent/misc-pos-tasks: changelog: add #2178 fix and test `is_delegator` checked arithmetic remove unnecessary computation of total consensus stake clean up TODOs, docstrings, logging remove unused queries fn fix FutureEpoch offsets of some data panic on slashing error rename to `compute_and_store_total_consensus_stake`
Describe your changes
Closes #17, closes #1270. Some other things addressed in this PR:
store_total_consensus_stake
tocompute_and_store_total_consensus_stake
is_delegator
issueIndicate on which release or other PRs this topic is based on
v0.26.0
Checklist before merging to
draft