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

Persist information about merged ATX members across checkpoint #6074

Conversation

poszu
Copy link
Contributor

@poszu poszu commented Jun 26, 2024

Motivation

A merged ATX contains PoST proofs for multiple IDs. When using such ATX as the previous ATX, we must ensure that the identity which claims this ATX to be its previous one was a member of that ATX. To do this, we must persist a mapping (ATXID, NODEID) -> number of POST units across a checkpoint-restore.

As a benefit, it also simplifies and speeds up the code calculating the effective num units for ID as we don't need to decode the previous ATX blob anymore.

Description

I added a table posts that maps a pair of ATXID and NodeID to units. There will be a row for every identity contributing its PoST in an ATX (1 row for ATX v1 and 1-256 rows for ATX v2). This table simplifies the calculation of effective units in the ATX handler - decoding the previous ATX blob turned into a lookup in the posts table.

I didn't include a map[types.NodeID]uint32 field in the types.ActivationTx to avoid having to fill it every time an ATX is retrieved from the database. Reading PoSTs is only required in the ATX handler and the checkpoint generation.

The checkpoint generation and recovery code was updated to persist the units across checkpoint.

Test Plan

TODO

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

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 12 lines in your changes missing coverage. Please review.

Please upload report for BASE (atx-handler-v2/syntactical-validation-merged@ee1d0bc). Learn more about missing BASE report.

Current head 6cbca05 differs from pull request most recent head b7cba29

Please upload reports for the commit b7cba29 to get more accurate results.

Files Patch % Lines
sql/atxs/atxs.go 86.0% 3 Missing and 3 partials ⚠️
activation/handler_v1.go 50.0% 2 Missing and 2 partials ⚠️
activation/handler_v2.go 90.4% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                              Coverage Diff                               @@
##             atx-handler-v2/syntactical-validation-merged   #6074   +/-   ##
==============================================================================
  Coverage                                                ?   81.5%           
==============================================================================
  Files                                                   ?     299           
  Lines                                                   ?   32260           
  Branches                                                ?       0           
==============================================================================
  Hits                                                    ?   26307           
  Misses                                                  ?    4241           
  Partials                                                ?    1712           

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

@poszu
Copy link
Contributor Author

poszu commented Jun 26, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Jun 26, 2024
@spacemesh-bors
Copy link

try

Build failed:

@poszu poszu force-pushed the atxmerge/checkpoint/persists-merged-atx-members branch from af2b7b7 to b55ef60 Compare June 26, 2024 14:09
@poszu
Copy link
Contributor Author

poszu commented Jun 26, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Jun 26, 2024
@spacemesh-bors
Copy link

try

Build failed:

@poszu poszu force-pushed the atxmerge/checkpoint/persists-merged-atx-members branch from b55ef60 to 6cbca05 Compare June 26, 2024 14:41
@poszu
Copy link
Contributor Author

poszu commented Jun 27, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Jun 27, 2024
@spacemesh-bors
Copy link

try

Build failed:

@poszu poszu marked this pull request as ready for review June 28, 2024 07:52
@poszu poszu marked this pull request as draft June 28, 2024 08:11
@poszu poszu force-pushed the atxmerge/checkpoint/persists-merged-atx-members branch from 6cbca05 to b7cba29 Compare July 1, 2024 10:03
@poszu poszu marked this pull request as ready for review July 1, 2024 10:03
@poszu poszu merged commit f8445a9 into atx-handler-v2/syntactical-validation-merged Jul 1, 2024
19 of 20 checks passed
@poszu poszu deleted the atxmerge/checkpoint/persists-merged-atx-members branch July 1, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant