Skip to content

[Storehouse] 003 - Payloadless ledger#8574

Open
zhangchiqing wants to merge 5 commits into
leo/payloadless-forestfrom
leo/payloadless-ledger
Open

[Storehouse] 003 - Payloadless ledger#8574
zhangchiqing wants to merge 5 commits into
leo/payloadless-forestfrom
leo/payloadless-ledger

Conversation

@zhangchiqing

@zhangchiqing zhangchiqing commented Jun 8, 2026

Copy link
Copy Markdown
Member

Create Payloadless ledger that mirrors complete.Ledger from ledger/complete/ledger.go

See Spec

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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: 2d367efb-1d09-4148-9e26-0b5ae207ede8

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-ledger

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.

Comment thread ledger/complete/ledger.go
pathFinderVersion uint8
}

var _ ledger.Ledger = (*Ledger)(nil)

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.

Added an interface check here, but I didn't define ledger.PayloadlessLedger interface for payloadless ledger struct yet, will add in future PR.

// register at the given state. The returned slice is in the same order as
// `query.Keys()`.
//
// HasPaths replaces the full ledger's ValueSizes for payloadless mode, since

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.

HasPaths replaces full ledger's ValueSizes method

//
// GetSingleLeafHash replaces the full ledger's GetSingleValue for payloadless
// mode, since payload values are not retained.
func (l *PayloadlessLedger) GetSingleLeafHash(query *ledger.QuerySingleValue) (*hash.Hash, error) {

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.

GetSingleLeafHash replaces the full ledger's GetSingleValue

//
// GetLeafHashes replaces the full ledger's Get for payloadless mode, since
// payload values are not retained.
func (l *PayloadlessLedger) GetLeafHashes(query *ledger.Query) ([]*hash.Hash, error) {

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.

GetLeafHashes replaces the full ledger's Get

return nil, fmt.Errorf("could not get proofs: %w", err)
}

return batchProof, nil

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 ledger's Prove returns ledger.Proof which is a []byte slice, which is encoded trie.

However, we return a structured data *ledger.PayloadlessTrieBatchProof for now instead of []byte, because the caller will need to assemble with the payload value, and also read the leaf hash to verify the payload value. In the future, it can be optimized to []byte to reduce some decoding work.

@zhangchiqing zhangchiqing marked this pull request as ready for review June 8, 2026 18:36
@zhangchiqing zhangchiqing requested a review from a team as a code owner June 8, 2026 18:36
@zhangchiqing zhangchiqing changed the title [Storehouse] Spec 003 - Payloadless ledger [Storehouse] 003 - Payloadless ledger 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