Skip to content

fix(light): correctness and robustness in client verification - #1353

Merged
lklimek merged 2 commits into
v1.6-devfrom
fix/light-client-verification
Jun 17, 2026
Merged

lklimek merged 2 commits into
v1.6-devfrom
fix/light-client-verification

Conversation

@lklimek

@lklimek lklimek commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Hardens the light client's verification path against several correctness and robustness issues.

Changes

  • Same-block proof anchoring — anchor same-block proofs at the block's own height, removing an incorrect H+1 offset in light/rpc/client.go that verified proofs against the wrong header.
  • Provider pagination — fix the provider/http page increment so result sets whose total isn't a multiple of the page size no longer cause an infinite request loop.
  • Witness-conflict handling — in the detector, keep the dissenting witness, fail the comparison, and return after sending the conflicting-evidence report, so witness conflicts are surfaced rather than silently dropped.
  • Defensive nil-checks — guard ThresholdPublicKey / quorumHash against nil before use.

🤖 Generated with Claude Code

lklimek and others added 2 commits June 17, 2026 11:57
Verify query proofs and block results against the trusted header at the
same height. AppHash and ResultsHash are committed in the header at the
block's own height (same-block execution), so anchoring verification to
the next height compared against a header that does not commit the data
being verified.

A witness that reports a header conflicting with the primary's now fails
the comparison instead of being silently dropped; the dissenting witness
is kept, since the primary may be the faulty party. The witness
comparison goroutine also returns after reporting a conflict so each
witness sends exactly one result on the channel.

Validator-set responses from providers are nil-checked for the threshold
public key and quorum hash before use, the threshold key is re-requested
on a retry after a timed-out first attempt, and the pagination loop now
advances the page index so a total that is not a multiple of the page
size terminates.

Adds table-driven tests covering same-block verification anchoring, the
witness comparison flow, and the multi-page validator-set path.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses misspell linter finding in errors.go.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@lklimek
lklimek requested a review from QuantumExplorer as a code owner June 17, 2026 10:06
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2a91f6ce-5fc7-4af5-a8d7-cc43659cc604

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 fix/light-client-verification

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.

@thepastaclaw

thepastaclaw commented Jun 17, 2026 •

Copy link
Copy Markdown

✅ Review complete (commit b3bbeff)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

PR is a well-targeted light-client robustness fix: same-block proof anchoring (resp.Height instead of resp.Height+1), validator pagination page++, threshold-pubkey retry-on-timeout, nil-guards on ThresholdPublicKey/QuorumHash, and turning witness-vs-primary header conflicts into a hard failure instead of a silent witness drop (with the missing return after the conflict channel send in detector). Tests cover each behavior change. One small nit: a newly-introduced error message formats a *int64 with %d.

💬 1 nitpick(s)

Comment thread light/provider/http/http.go Resolved
@lklimek
lklimek merged commit 1705c6b into v1.6-dev Jun 17, 2026
16 of 18 checks passed
@lklimek
lklimek deleted the fix/light-client-verification branch June 17, 2026 12:41
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