-
Notifications
You must be signed in to change notification settings - Fork 2.6k
client/beefy: add some bounds on enqueued votes #12562
client/beefy: add some bounds on enqueued votes #12562
Conversation
to_process_for() rework
fix error when trying to insert votes
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.
Thank you for contributing! I left some feedback below:
@dharjeezy do you need help with getting this over the finish line? |
Apologies. I have been busy with personal stuffs. Will pick this up for this week. @acatangiu |
657ed78
to
06d7a23
Compare
…es' into dharjeezy/bounds-on-enqueued-votes # Conflicts: # client/beefy/src/lib.rs # client/beefy/src/worker.rs
…dharjeezy/bounds-on-enqueued-votes � Conflicts: � client/beefy/src/worker.rs
convert BTreeMap to a BoundedBTreeMap
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.
Looks good!
bot rebase |
Rebased |
bot rebase |
Rebased |
if self.pending_votes.len() < MAX_BUFFERED_VOTE_ROUNDS { | ||
let votes_vec = self.pending_votes.entry(block_num).or_default(); | ||
if votes_vec.try_push(vote).is_err() { | ||
warn!(target: "beefy", "🥩 Buffer vote dropped for round: {:?}", block_num) |
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.
Just random thought: value in pending_votes
map may store duplicated votes, right? So in theory malicious validator may try to send MAX_BUFFERED_VOTES_PER_ROUND
duplicate votes to all other validators, blocking round from concluding. If that's true, then it is something that must be tracked during equivocation impl.
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's correct - added explicit comment for this to #12692
/tip small |
@acatangiu You are not allowed to request a tip. Only shawntabrizi, gavofyork, rphmeier, athei, andresilva, arkpar, bkchr, eskimor, drahnr, dvdplm, robbepop, cmichi, tomaka, pepyakin, tomusdrw, kianenigma, jacogr, rossbulat are allowed. |
Thanks for the tip @acatangiu |
Can you help here? @shawntabrizi @bkchr |
Introduce bounds on the justifications and votes queues, so they do not grow forever if voter cannot make progress and consume from them. When bounds are hit, new votes or justifications get dropped. * use a BTreeMap and check for bounds * cargo fmt * use usize Co-authored-by: Adrian Catangiu <adrian@parity.io>
Introduce bounds on the justifications and votes queues, so they do not grow forever if voter cannot make progress and consume from them. When bounds are hit, new votes or justifications get dropped. * use a BTreeMap and check for bounds * cargo fmt * use usize Co-authored-by: Adrian Catangiu <adrian@parity.io>
Introduces
BoundedBTreeMap
forpending_votes
andpending_justifications
closes #12484
Polkadot address: 12ZNas89oEagaxLVNbpqmvfMxdrGrqN7gJKSpwthTUPZsrku