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

[Merged by Bors] - Add invalid post malfeasance #6308

Closed
wants to merge 36 commits into from

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Aug 29, 2024

Motivation

Closes #6141. This PR adds the Malfeasance proof needed to show that an identity produced an invalid post. Supports both solo and merged ATXs.

Description

This PR adds some additional methods to the ATX wire types to deduplicate code that is needed to create and validate malfeasance proofs. This also reduces the code needed for the ProofDoubleMarry and ProofInvalidPost proofs significantly. I will also re-base #6339 and #6310 to use the new helpers in the wire package and reduce code duplication.

The interface for ATXProof.Proof has been updated to use a MalfeasanceValidator instead of a *signing.EdVerifier, since more than just signatures are validated with some malfeasance proofs. The new interface is defined in the wire package and the current implementation is part of the activation.Validator type but will be moved to the malfeasance handler and/or publisher in #6307 (which will get rid of the open TODO there).

IMPORTANT: ID calculation for ATXv2 changed - when we merge this we cannot just update atxmerge testnets without causing problems. This change was necessary because some leaves in the ATXID tree were not Hash32 which still lets one calculate the root of the tree, but causes problems when trying to validate a merkle proof against it.

atxTreeHash now uses the blake3.Hash pool that we have, before it initialized a new hasher on every call which was expensive and is not needed if an existing instance can be reused from the pool, this more than tripled execution time of the tests in the activation/wire package on my machine.

Test Plan

Several unit tests were added to test the functionality of the invalid post proof.

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

@fasmat fasmat self-assigned this Aug 29, 2024
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch from 3e94b7e to 39883a2 Compare August 29, 2024 19:46
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 83.35901% with 108 lines in your changes missing coverage. Please review.

Project coverage is 79.8%. Comparing base (aeb943c) to head (3425c11).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
activation/wire/wire_v2.go 85.7% 34 Missing and 10 partials ⚠️
activation/wire/malfeasance_shared.go 72.5% 15 Missing and 7 partials ⚠️
activation/wire/malfeasance_invalid_post.go 91.3% 10 Missing and 5 partials ⚠️
activation/handler_v2.go 62.1% 9 Missing and 5 partials ⚠️
activation/validation.go 11.1% 7 Missing and 1 partial ⚠️
checkpoint/util.go 0.0% 2 Missing ⚠️
signing/signer.go 0.0% 2 Missing ⚠️
activation/certifier.go 0.0% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #6308     +/-   ##
=========================================
- Coverage     79.8%   79.8%   -0.1%     
=========================================
  Files          341     343      +2     
  Lines        44205   44505    +300     
=========================================
+ Hits         35317   35527    +210     
- Misses        6895    6976     +81     
- Partials      1993    2002      +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch from efe056f to 28a5fb1 Compare September 9, 2024 08:23
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch 3 times, most recently from 99f15b6 to e84b2f5 Compare September 27, 2024 14:04
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch 2 times, most recently from 47e2b58 to 65dd8b6 Compare October 9, 2024 08:13
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch 2 times, most recently from 76edcc7 to b64cf35 Compare October 15, 2024 18:52
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch 2 times, most recently from 541673b to 86f4785 Compare October 26, 2024 12:09
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch 9 times, most recently from 170e466 to fa19a2a Compare November 4, 2024 13:36
@fasmat fasmat marked this pull request as ready for review November 4, 2024 14:32
@fasmat fasmat force-pushed the add-invalid-post-malfeasance branch from 6349b9b to cb7ccaa Compare November 6, 2024 11:45
@fasmat
Copy link
Member Author

fasmat commented Nov 6, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Nov 6, 2024
## Motivation

Closes #6141. This PR adds the Malfeasance proof needed to show that an identity produced an invalid post. Supports both solo and merged ATXs.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Nov 6, 2024

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Nov 6, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Nov 6, 2024
## Motivation

Closes #6141. This PR adds the Malfeasance proof needed to show that an identity produced an invalid post. Supports both solo and merged ATXs.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Nov 6, 2024

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Nov 6, 2024

TestPartition_30_70 failed because 4 pods were re-deployed shortly before the end of the test

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Nov 6, 2024
## Motivation

Closes #6141. This PR adds the Malfeasance proof needed to show that an identity produced an invalid post. Supports both solo and merged ATXs.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Nov 6, 2024

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Nov 6, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Nov 6, 2024
## Motivation

Closes #6141. This PR adds the Malfeasance proof needed to show that an identity produced an invalid post. Supports both solo and merged ATXs.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Nov 6, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title Add invalid post malfeasance [Merged by Bors] - Add invalid post malfeasance Nov 6, 2024
@spacemesh-bors spacemesh-bors bot closed this Nov 6, 2024
@spacemesh-bors spacemesh-bors bot deleted the add-invalid-post-malfeasance branch November 6, 2024 22:24
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.

Malfeasance V2: Invalid Post
2 participants