Skip to content
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

Handle equivocations correctly #5

Merged
merged 11 commits into from
Aug 28, 2018
Merged

Handle equivocations correctly #5

merged 11 commits into from
Aug 28, 2018

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Aug 27, 2018

Closes #4

This introduces a bitfield module, which is used to lazily attach bitfields for equivocating (double-voting) validators as soon as we have an equivocating validator. The bitfields are uninitialized in the general case and are fast. The node-weight addition logic has been altered to avoid double-counting any equivocated votes.

The second, and probably most error-prone thing this does is to alter the logic for determining if a round is completable. The completable check sometimes needs to determine if any descendents of a block could possibly get 2/3+ vote-weight, and this PR alters the logic there to account for possible equivocations on blocks (i.e. not discounting any vote-weight which has already been spent).

Copy link
Contributor

@gnunicorn gnunicorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor Todo you've already marked yourself. Aside from that, it makes things a tad more complex to understand but looks good!

src/bitfield.rs Outdated
let word_off = bit_idx / 64;
let bit_off = bit_idx % 64;

// TODO: if this isn't `Some`, something has gone really wrong.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please log this with warning or higher. I don't think it can happen at the moment, but IMHO stuff in here should scream loudly if it assumptions are not met.

@rphmeier rphmeier merged commit 8c3a1ba into master Aug 28, 2018
@andresilva andresilva deleted the rh-handle-equivocations branch June 13, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants