-
Notifications
You must be signed in to change notification settings - Fork 214
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 V2 Malfeasance proofs in V2 ATX handler #6133
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d672779
to
88a0601
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6133 +/- ##
=========================================
- Coverage 81.7% 81.5% -0.3%
=========================================
Files 312 315 +3
Lines 34613 34802 +189
=========================================
+ Hits 28297 28368 +71
- Misses 4479 4594 +115
- Partials 1837 1840 +3 ☔ View full report in Codecov by Sentry. |
Superseded by #6307 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This adds the first two malfeasance proofs for ATXv2: double publish and double marry.
Description
Double Publish
TODO: Update to instead check if 2 ATXs in the same epoch contain a PoST by the same identity.
If an identity publishes two ATXs with the same publish epoch they become malfeasant. This proof verifies that a given ATX was created by the same identity and targets the same epoch. It works basically the same as the previous double publish proof, except that merkle trees are used instead of a signature where the payloads first 4 bytes are the publish epoch.
Double Marry
If an identity is part of more than one marriage it is considered malfeasant. This Proof shows that two ATXs containing marriage certificates contain certificates signed by the same identity.
To simplify this proof the main identity (the one that signs the ATX) has to include a marriage certificate marrying themselves, otherwise we would need additional proofs: i.e. 2 ATXs signed by the same identity containing marriage certificates and one for the case where one ATX containing marriage certificates is signed by identity A and another ATX signed by B contains a marriage certificate of A.
Creating and verifying proofs
Both types of proofs have a
New...Proof
function that creates them. This function does some basic checks to prevent creating an invalid malfeasance proof if two ATXs that do not show malfeasant behaviour are passed as arguments.The wire types for the malfeasance proofs have a
Valid
method that can be called to check if the malfeasance proof is valid. It returns anerror
that is notnil
when the proof is invalid and explains why it is invalid.Publishing Proofs
The ATX handler has been updated to first store the (syntactically valid) ATX before checking if the ATX is contextually invalid and creating a malfeasance proof for it. If a malfeasance proof is created it is immediately published.
The malfeasance publisher will take care that the internal state of the node (tortoise, etc.) is informed about the detected malicious identity and only gossip the proof if we are already synced.
Test Plan
For both malfeasance proofs multiple tests have been added to verify they are working correctly.
TODO