Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
- Loading branch information