Simplify log proofs generation
pav-kv opened this issue · comments
The proofs generation code needs a refreshment. It is old, bulky, and has references to C++ implementation that is obsolete. For example, the merkle/log_proofs.go file can be reduced by >200 LoC if it uses helpers from the compact ranges package.
Algorithmic components of Merkle trees are scattered across the codebase. For instance, it is clear that Rehash
parameter is meant to be consumed by the rehasher type. This type should probably migrate to merkle
folder and come in pair with log_proofs.go
.
Plan:
- Refactor tests (e.g. merkle/log_proofs_test.go).
- Increase coverage to >100% to prevent regressions.
- Convert to using compact ranges in backwards-compatible way [prototype PR].
- Move purely algorithmic components to
merkle
.
The bigger goal is that merkle
package is reuse-friendly.
Not sure what input you're looking for? It sounds like an improvement worth having. Al might have a view on whether to do it now or later.
This is just an FYI, to explain the bigger picture. I will be sending some PRs to you soon.
Re now/later, in my mind reusability of merkle
package fits into the current goals as we'll be using it internally for some experiments.
OK if it helps current work that is an argument for doing it now.
👍 Sounds great!