-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Add basic consensus check to support data proxy tally #344
Conversation
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.
I think it would be nice if we can emit the 'agreed' upon public keys in the tally event. That will allow us to display it in the explorer and should help with debugging :)
09a8fbe
to
971aa7b
Compare
dc75f95
to
e8e318a
Compare
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.
The only thing I'm unsure about it whether we should emit the data-proxy pubkeys when there isn't 2/3rds with a successful execution. But this won't really matter until we do incentives so I think we should leave it like this and once we decide how the rewards are done for all the different scenarios we can adjust the event accordingly. :)
Noted. Thanks for the review! |
Explanation of Changes
Until now, consensus was determined solely based on the reveal data at a given data path (Except when None filter is applied, in which case there is no check for consensus at all). Following @Thomasvdam 's proposal, this PR adds an additional "basic consensus check," which checks for consensus on the tuple
(exit_code, pub_keys)
before filter is applied. If less than 2/3 of reveals have the same tuple, a newly added error typeErrNoBasicConsensus
is returned so that tally VM is not executed.Note that when checking for basic consensus, the specific exit code values do not matter. Whether an exit code is a success or not is checked in the function
parseReveals()
, which is run by all filter types except for None filter. If more than 1/3 of the reveals have non-zero exit codes, the errorErrCorruptReveals
is returned.For example,
results in a "no basic consensus" error, while
results in a corruption error.
Also note that in case of "no basic consensus" error, an all-zero outlier list is returned and tally VM is not executed, unlike in case of the general consensus error.
Updated filter specs here
Testing
Additional test cases were added to
TestFilter
.Related PRs and Issues
Closes: #317