Skip to content

fix(codegen): support current Bittensor metadata - #10

Merged
itzlambda merged 2 commits into
mainfrom
fix/bittensor-metadata-compatibility
Jul 20, 2026
Merged

fix(codegen): support current Bittensor metadata#10
itzlambda merged 2 commits into
mainfrom
fix/bittensor-metadata-compatibility

Conversation

@itzlambda

@itzlambda itzlambda commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Current Finney metadata now exposes NetUid, TaoBalance, AlphaBalance, and PerU16 as wrapper types, while the public client API still uses u16 and u64. This caused generated calls and storage bindings to fail compilation.

Configure Subxt code generation to substitute those SCALE-compatible wrappers with their underlying primitives. Metadata fetching, caching, and offline fallback behavior are unchanged.

Validated against both current live Finney metadata (337,180 bytes) and bundled offline metadata.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility and consistency of generated runtime bindings.
    • Preserved SCALE-compatible primitive representations for selected numeric types, supporting more reliable client interactions.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@itzlambda, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e81a4420-523c-4bb7-868c-edc0b786c82b

📥 Commits

Reviewing files that changed from the base of the PR and between 99d7dd0 and fd07631.

📒 Files selected for processing (3)
  • lightning-tensor/src/app.rs
  • lightning-tensor/src/ui/subnets.rs
  • lightning-tensor/src/wallet_compat.rs

Walkthrough

The build script configures CodegenBuilder to substitute selected runtime types with u16 or u64 before generating metadata.rs.

Changes

Primitive code generation substitutions

Layer / File(s) Summary
Configure primitive type substitutions
bittensor-rs/build.rs
Imports parse_quote and maps NetUid and PerU16 to u16, plus TaoBalance and AlphaBalance to u64, before metadata generation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit hopping through generated code,
Swapping runtime types for a lighter load.
u16 and u64 now neatly align,
Metadata sprouts in a primitive design.
Hop, hop—bindings compile just fine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the codegen fix for current Bittensor metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bittensor-metadata-compatibility

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.

@itzlambda
itzlambda marked this pull request as ready for review July 20, 2026 10:44
@itzlambda
itzlambda merged commit 0f27fd4 into main Jul 20, 2026
6 checks passed
@itzlambda
itzlambda deleted the fix/bittensor-metadata-compatibility branch July 20, 2026 11:12
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