[Storehouse] 002 - Payloadless forest#8573
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- switch package to payloadless and drop import of mtrie/trie - Forest now stores leaf hashes per register, not payloads - replace ValueSizes with HasPaths (returns existence, not byte sizes) - replace Read/ReadSingleValue with ReadLeafHashes/ReadSingleLeafHash - Update/NewTrie extract value bytes from u.Payloads and discard keys - Proofs returns *ledger.PayloadlessTrieBatchProof - drop RegSize metrics and payload-size accounting Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- switch package to payloadless and drop external imports of mtrie/{trie,node}, ptrie, prf
- read assertions now compare HashLeaf(path, value) against returned *hash.Hash
- ReadSingleValue tests become ReadSingleLeafHash
- ValueSizes tests become HasPaths (existence-only flags)
- drop tests that depend on full-payload proof verification or partial-trie reconstruction:
TestNonExistingInvalidProof, TestRandomUpdateReadProofValueSizes, TestProofGenerationInclusion
- randomMTrie uses NewNode and NewMTrie from the payloadless package
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
these tests are to verify payloadless implementation with the existing full trie implementation.
| } | ||
|
|
||
| // look up for non existing paths | ||
| exists, err := f.HasPaths(r) |
There was a problem hiding this comment.
The full trie forest uses ValueSize() method to look up for non existing paths, but since payloadless forest does not store value size anymore, instead, a HasPaths() method is added to be used here.
|
|
||
| // TestForestEquivalence_HasPathsVsValueSizes verifies that for every path, | ||
| // payloadless.HasPaths reports true iff the full forest's ValueSizes is > 0. | ||
| func TestForestEquivalence_HasPathsVsValueSizes(t *testing.T) { |
There was a problem hiding this comment.
verify HasPaths is equivalent to ValueSize in checking the path exists.
| // Under the hood it uses a circular buffer | ||
| // of mtrie pointers and a map of rootHash to cache index for fast lookup | ||
| type TrieCache struct { | ||
| tries []*MTrie |
There was a problem hiding this comment.
same implementation as ledger/complete/mtrie/trieCache.go, except the tries is a slice of payloadless trie
This PR adds Payloadless forest.
Strategy: same copy-then-modify pattern as Spec 001 (mtrie/forest.go → payloadless/forest.go).
See spec