-
Notifications
You must be signed in to change notification settings - Fork 97
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
Fix EpochCommittees
returning stake tables out of order
#2514
Conversation
types/src/v0/impls/stake_table.rs
Outdated
@@ -126,10 +126,16 @@ struct Committee { | |||
/// leader but without voting rights. | |||
eligible_leaders: Vec<StakeTableEntry<PubKey>>, | |||
|
|||
/// TODO: add comment | |||
/// Stake table |
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 add a comment explaining why we need these vectors
types/src/v0/impls/stake_table.rs
Outdated
indexed_stake_table: BTreeMap<PubKey, StakeTableEntry<PubKey>>, | ||
|
||
/// TODO: comment | ||
/// DA members indexed by public key, for efficient lookup. | ||
indexed_da_members: BTreeMap<PubKey, StakeTableEntry<PubKey>>, |
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.
Nit: maybe make the value here usize
index into stake_table
and da_members
, so we only have a single source of truth for the actual contents of the stake table entry?
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.
Also consider BTreeMap
-> HashMap
so it is more clear that nothing is actually ordered by keys?
(cherry picked from commit 0f75108)
Successfully created backport PR for |
…les out of order (#2515) Fix `EpochCommittees` returning stake tables out of order (#2514) (cherry picked from commit 0f75108) Co-authored-by: ss-es <[email protected]>
This PR:
Fixes an issue where
EpochCommittees
was previously returning stake tables out of order. We now store (and prefer) the vector passed toEpochCommittees::new_stake
without modification, and only retain aBTreeMap
for lookup.This PR does not:
Key places to review: