Skip to content

[Storehouse] 004 - Payloadless Remote ledger service - #8611

Open
zhangchiqing wants to merge 5 commits into
leo/payloadless-ledgerfrom
leo/payloadless-remote-service
Open

[Storehouse] 004 - Payloadless Remote ledger service#8611
zhangchiqing wants to merge 5 commits into
leo/payloadless-ledgerfrom
leo/payloadless-remote-service

Conversation

@zhangchiqing

@zhangchiqing zhangchiqing commented Jul 13, 2026

Copy link
Copy Markdown
Member

reopen for #8575

This PR includes a breaking change: HasState now returns a (bool, error), instead of bool. This means this version would require the ledger service to be restarted. Be careful during HCU

@coderabbitai

coderabbitai Bot commented Jul 13, 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: 67dc000e-b6c9-4687-99d6-a690da57bb02

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-remote-service

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.

@zhangchiqing
zhangchiqing changed the base branch from master to leo/payloadless-ledger July 13, 2026 16:47
@zhangchiqing
zhangchiqing marked this pull request as ready for review July 13, 2026 17:18
@zhangchiqing
zhangchiqing requested a review from a team as a code owner July 13, 2026 17:18
@zhangchiqing
zhangchiqing force-pushed the leo/payloadless-ledger branch from 939e60e to d113e4c Compare July 13, 2026 17:23
@zhangchiqing
zhangchiqing force-pushed the leo/payloadless-remote-service branch from f5eaeef to 890ed2b Compare July 13, 2026 17:23
Comment thread ledger/ledger.go
HasState(state State) bool
//
// No error returns are expected during normal operation.
HasState(state State) (bool, 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.

includes a breaking change: HasState now returns a (bool, error), instead of bool. This means this version would require the ledger service to be restarted with compatible version. Be careful during HCU

Comment thread ledger/remote/client.go Outdated
// Mode check is a configuration-correctness gate. If we
// connected to a payloadless server while expecting full,
// crash now rather than fail later on every Get call.
verifyServerMode(c.ctx, c.infoClient, c.callTimeout, ledgerpb.LedgerMode_LEDGER_MODE_FULL, c.logger)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should't ServerInfo be called before InitialState. otherwise Initial state might already error because of the incorrect ledger mode, no?

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.

I think it's ok either way, because both payloadless ledger service and full ledger service support the InitialState call with the same signature. The current approach is to ensure the service has the state and then check if the right service is started.

// [ledgerpb.LedgerMode_LEDGER_MODE_PAYLOADLESS]; passing UNSPECIFIED produces
// a server that reports UNSPECIFIED, which clients will treat as a
// misconfigured server and refuse to use.
func NewInfoService(mode ledgerpb.LedgerMode) *InfoService {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this ever called?

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.

Good catch, I didn't add this function to registration for service discovery.

Comment thread ledger/trie_encoder.go
}
interims[i] = interim
}
pInst.Interims = interims

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to check that rest is empty here?

Comment thread ledger/trie_encoder.go
bp, err := decodePayloadlessTrieBatchProof(rest)
if err != nil {
return nil, fmt.Errorf("error decoding payloadless batch proof: %w", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same: do we need to check that rest is empty?

Comment thread ledger/remote/client.go Outdated
Comment on lines +145 to +150
// A gRPC failure is surfaced to the caller rather than collapsed into a false
// return: false must mean "state genuinely absent", not "the server was
// unreachable", otherwise callers (e.g. execution state) would misreport a
// reachable state as pruned.
//
// No error returns are expected during normal operation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this both be true: "gRPC failure is surfaced" and "No error returns are expected during normal operation"

Comment thread ledger/payloadless_ledger.go Outdated
@@ -0,0 +1 @@
package ledger

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

empty file

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.

2 participants