-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Epoch Sync] Strengthen the storage access guarantees of block merkle…
… proof. (#12308) This serves as the foundation for solving #12255 For Epoch Sync, we need to be able to generate block merkle proofs despite not having older blocks. Luckily, after much [banging my head against the wall](https://github.com/user-attachments/assets/74954ab8-a80e-409a-85d1-0a48655274d3) on the merkle tree proof algorithm mostly without much luck, I eventually found a way to modify the algorithm (without changing the result it generates) to guarantee that proving block X against block Y will never access anything older than X or newer than Y (the latter is not important and also already true, but we may as well say it neatly like this). Added a test to assert that this guarantee is met for all pairs 0 <= X < Y < 100. The rigorous proof of this guarantee is left as an exercise to the reader (good luck :) ). Update: actually I rewrote the whole algorithm. Not only is there less code, but also it is now O(log N) lookups as opposed to O(log^2 N) looks before.
- Loading branch information
1 parent
54f53c8
commit 244422d
Showing
2 changed files
with
190 additions
and
150 deletions.
There are no files selected for viewing
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
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