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

feat: smt verification #6115

Merged

Conversation

hansieodendaal
Copy link
Contributor

Description

Fix an issue where the SMT should not be verified for each block height while horizon sync is in progress, but only at the end.

Motivation and Context

The SMT can only be verified after all outputs have been downloaded, due to the way we optimize fetching
outputs from the sync peer. As an example:

  1. Initial sync:
    • We request outputs from height 0 to 100 (the tranche)
    • The sync peer only returns outputs per block that would still be unspent at height 100 and all
      inputs per block. All outputs that were created and spent within the tranche are never returned.
    • For example, an output is created in block 50 and spent in block 70. It would be included in the SMT
      for headers from height 50 to 69, but due to the optimization, the sync peer would never know about it.
  2. Consecutive sync:
    • We request outputs from height 101 to 200 (the tranche)
    • The sync peer only returns outputs per block that would still be unspent at height 200, as well as all
      inputs per block, but in this case, only those inputs that are not an output of the current tranche of
      outputs. Similarly, all outputs created and spent within the tranche are never returned.
    • For example, an output is created in block 110 and spent in block 180. It would be included in the SMT
      for headers from height 110 to 179, but due to the optimization, the sync peer would never know about it.
  3. In both cases it would be impossible to verify the SMT per block, as we would not be able to update the
    SMT with the outputs that were created and spent within the tranche.

How Has This Been Tested?

System-level horizon sync test using a previous archival node that was converted to a pruned node.

What process can a PR reviewer use to test or verify this change?

Code review

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

@hansieodendaal hansieodendaal requested a review from a team as a code owner February 1, 2024 05:46
Copy link

github-actions bot commented Feb 1, 2024

Test Results (CI)

1 268 tests   1 268 ✅  11m 32s ⏱️
   39 suites      0 💤
    1 files        0 ❌

Results for commit e044133.

♻️ This comment has been updated with latest results.

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Feb 1, 2024
Copy link

github-actions bot commented Feb 1, 2024

Test Results (Integration tests)

 2 files  + 2  11 suites  +11   14m 2s ⏱️ + 14m 2s
29 tests +29  28 ✅ +28  0 💤 ±0  1 ❌ +1 
31 runs  +31  29 ✅ +29  0 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit e044133. ± Comparison against base commit b6b80f6.

♻️ This comment has been updated with latest results.

@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label Feb 1, 2024
@SWvheerden SWvheerden merged commit 78a9348 into tari-project:development Feb 1, 2024
12 of 14 checks passed
@hansieodendaal hansieodendaal deleted the ho_horizon_sync_smt branch February 1, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants