Skip to content

[Storehouse] 002 - Payloadless forest#8573

Open
zhangchiqing wants to merge 7 commits into
leo/payloadless-testsfrom
leo/payloadless-forest
Open

[Storehouse] 002 - Payloadless forest#8573
zhangchiqing wants to merge 7 commits into
leo/payloadless-testsfrom
leo/payloadless-forest

Conversation

@zhangchiqing

@zhangchiqing zhangchiqing commented Jun 8, 2026

Copy link
Copy Markdown
Member

This PR adds Payloadless forest.

Strategy: same copy-then-modify pattern as Spec 001 (mtrie/forest.go → payloadless/forest.go).
See spec

zhangchiqing and others added 6 commits May 29, 2026 15:50
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>
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2ff988d3-e2f9-4902-b84c-6ad04773e848

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch leo/payloadless-forest

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests are to verify payloadless implementation with the existing full trie implementation.

}

// look up for non existing paths
exists, err := f.HasPaths(r)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same implementation as ledger/complete/mtrie/trieCache.go, except the tries is a slice of payloadless trie

@zhangchiqing zhangchiqing marked this pull request as ready for review June 8, 2026 16:25
@zhangchiqing zhangchiqing requested a review from a team as a code owner June 8, 2026 16:25
@zhangchiqing zhangchiqing changed the title [Storehouse Payloadless forest [Storehouse] Payloadless forest Jun 8, 2026
@zhangchiqing zhangchiqing changed the title [Storehouse] Payloadless forest [Storehouse] Spec 002 - Payloadless forest Jun 8, 2026
@zhangchiqing zhangchiqing changed the title [Storehouse] Spec 002 - Payloadless forest [Storehouse] 002 - Payloadless forest Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant