Skip to content

fix(rpc): support cometbft v1 validator updates - #70

Merged
traviolus merged 1 commit into
mainfrom
fix/cometbft-v1-val-updates
Sep 3, 2026
Merged

fix(rpc): support cometbft v1 validator updates#70
traviolus merged 1 commit into
mainfrom
fix/cometbft-v1-val-updates

Conversation

@traviolus

@traviolus traviolus commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with CometBFT v1 block results by correctly decoding flattened validator public keys.
    • Preserved support for legacy nested validator keys and block results without validator updates.
    • Added validation for unsupported public-key formats to prevent incorrect decoding.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: d5a0589d-ccbe-406c-8e13-c58f905fa608

📥 Commits

Reviewing files that changed from the base of the PR and between 490fe1c and 4049694.

📒 Files selected for processing (2)
  • src/lib/rpcClient.spec.ts
  • src/lib/rpcClient.ts

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The RPC client now normalizes CometBFT v1 flattened validator public keys before CosmJS decoding. It also accepts nullable validator updates. Tests cover flattened keys, legacy nested keys, bigint voting power, and null updates.

Changes

Validator update decoding

Layer / File(s) Summary
Normalize validator update keys
src/lib/rpcClient.ts
The RPC client models nullable validator updates and supports legacy nested and CometBFT v1 flattened public-key fields. Flattened keys are converted before CosmJS decoding, and unknown key types raise an error.
Validate supported update formats
src/lib/rpcClient.spec.ts
Tests cover flattened Ed25519 keys, legacy nested keys, bigint voting power, and null validator updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 40496

The change adds CometBFT v1 validator-key normalization and nullable-update handling with regression coverage; no merge-blocking risk is established.

Sequence Diagram(s)

sequenceDiagram
  participant CometBFT
  participant RPCClient
  participant CosmJS
  CometBFT->>RPCClient: Return block results with validator_updates
  RPCClient->>RPCClient: Normalize flattened public-key fields
  RPCClient->>CosmJS: Decode normalized validator updates
  CosmJS-->>RPCClient: Return decoded public keys and voting power
Loading

Poem

I am a rabbit with keys in my paws
Flattened or nested, they follow the laws
Big integers hop through the night
Null updates leave the path light
CosmJS decodes them just right

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding RPC support for CometBFT v1 validator updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cometbft-v1-val-updates

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

@traviolus
traviolus requested a review from songwongtp September 3, 2026 13:15
@traviolus
traviolus merged commit 218b0a7 into main Sep 3, 2026
4 of 5 checks passed
@traviolus
traviolus deleted the fix/cometbft-v1-val-updates branch September 3, 2026 13:16
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