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

Prevent inappropriate byes being awarded to submissions during dispute #810

Merged
merged 6 commits into from
Feb 28, 2020

Conversation

area
Copy link
Member

@area area commented Feb 14, 2020

Byes were able to be awarded too liberally in the current codebase. At the very least, byes should never have been able to be claimed if the submission window was still open (because more submissions might be made). In addition, byes should never be able to be awarded if there are any submissions from any previous rounds still not eliminated.

I took several cracks at this before settling on this solution, but I'm still not happy with it. The tricky bit is preventing the award of a bye if there are any submissions from previous rounds not eliminated yet. We can't directly track if a round is complete with a flag, because multiple rounds may silently complete if the window closes and all existing disputes have completed.

A loop through all previous rounds is the natural way of solving this, but loops are bad. I've allowed myself to be a little clever and short-circuit it a bit so that if there are a series of disputes where multiple byes should be awarded (as is the case if there are e.g. 11 submissions and none time out). In that scenario, only the previous rounds that weren't complete before are examined. While the unbounded loop should be fine with our current configuration (because the maximum number of rounds should be capped at 14, based on the block gas limit and the current timeout), I've added this extra element in in an attempt to harden the approach if the parameters change in the future.

Also fixed a bug in accommodateChallenge... with the return from mod(2) - at some point, it was a JS number and is now not? This was noted as a breaking change for v5 of bn.js but I can't figure out how (if?) we were exposed to that...

@area area force-pushed the fix/mining-dispute-byes branch 2 times, most recently from 8122958 to eb93fa1 Compare February 15, 2020 12:37
@area area added this to the Sprint 44 milestone Feb 17, 2020
@area area changed the title Prevent inappropriate byes being awarded to submissions during dsipute Prevent inappropriate byes being awarded to submissions during dispute Feb 19, 2020
@area area force-pushed the fix/mining-dispute-byes branch 2 times, most recently from 3561fa5 to 420db8f Compare February 24, 2020 11:31
@area area force-pushed the fix/mining-dispute-byes branch from 2fdd300 to b0eb14c Compare February 27, 2020 14:39
@kronosapiens kronosapiens merged commit c775a3a into develop Feb 28, 2020
@kronosapiens kronosapiens deleted the fix/mining-dispute-byes branch February 28, 2020 13:28
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