Skip to content

Get Hyperparams v3#2699

Merged
JohnReedV merged 14 commits into
devnet-readyfrom
feat/thewhaleking/hyperparams-v4
May 29, 2026
Merged

Get Hyperparams v3#2699
JohnReedV merged 14 commits into
devnet-readyfrom
feat/thewhaleking/hyperparams-v4

Conversation

@thewhaleking
Copy link
Copy Markdown
Contributor

@thewhaleking thewhaleking commented May 27, 2026

Description

Adds a new runtime API: get_hyperparams_v3, which returns a Vec allowing us to much more easily add new hyperparams here for fetching.

This is mainly due to a frustration in BTCLI, where everyone wants new hyperparams, but these would require separate calls for each, which seems excessive, and defeats the purpose of the hyperparams runtime API in the first place.

Related Issue(s)

In my mind

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

N/A

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run ./scripts/fix_rust.sh to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Please include any relevant screenshots or GIFs that demonstrate the changes made.

Additional Notes

V3 removes deprecated hyperparams:

  • adjustment_alpha
  • adjustment_interval
  • difficulty
  • min_difficulty
  • max_difficulty
  • rho

and adds new ones:

  • burn_half_life
  • burn_increase_mult
  • owner_cut_enabled
  • owner_cut_auto_lock_enabled

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

LOW scrutiny: established 2018 account with repo write permission, substantial contribution history, matching PR author/committer, and no trusted Gittensor allowlist hit; branch feat/thewhaleking/hyperparams-v4 -> devnet-ready.

Static review covered the six-file diff adding a read-only get_subnet_hyperparams_v3 runtime API surface and focused tests. The PR does not modify .github/ai-review/* or .github/copilot-instructions.md, adds no dependencies or build scripts, targets the expected devnet-ready branch, and introduces no storage mutation, extrinsic/origin path, user-controlled loop in block execution, runtime panic source, or backdoor pattern that I found.

Findings

No findings.

Conclusion

No malicious behavior or security vulnerability found in the static diff.


🔍 AI Review — Auditor (domain review)

VERDICT: 👎

Gittensor UNKNOWN; author has write permission and substantial prior GitHub/subtensor history, so calibrated as an established contributor.

Spec version is bumped to 412. I did not run build/test commands because the remaining issue is visible statically: the V3 runtime API exists, but the node custom RPC surface still only exposes the legacy and V2 hyperparams methods. The overlapping PRs touch broad runtime/pallet files but do not appear to duplicate this hyperparams API change.

Findings

Sev File Finding
MEDIUM pallets/subtensor/rpc/src/lib.rs:322 Expose get_subnet_hyperparams_v3 through custom RPC inline

Prior-comment reconciliation

  • 3995efd4: not addressed — The runtime API implementation was added, but the custom RPC trait/server still exposes only the legacy and V2 hyperparams methods.

Conclusion

The V3 getter and tests are directionally sound, but the PR still does not expose the BTCLI-facing custom RPC method it describes. Add the custom RPC trait method and server implementation before merging.


📜 Previous run (superseded)
Sev File Finding Status
MEDIUM pallets/subtensor/rpc/src/lib.rs:62 Expose the V3 hyperparams API through custom RPC ➡️ Carried forward to current findings
The runtime API implementation was added, but the custom RPC trait/server still exposes only the legacy and V2 hyperparams methods.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/rpc_info/subnet_info.rs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/rpc_info/subnet_info.rs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@thewhaleking thewhaleking marked this pull request as ready for review May 27, 2026 18:11
@thewhaleking thewhaleking requested a review from a team May 27, 2026 18:11
@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@thewhaleking thewhaleking changed the title Hyperparams v3 Get Hyperparams v3 May 27, 2026
open-junius
open-junius previously approved these changes May 28, 2026
Copy link
Copy Markdown
Contributor

@open-junius open-junius left a comment

Choose a reason for hiding this comment

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

Need update runtime version manually

@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@thewhaleking thewhaleking requested review from a team and open-junius May 28, 2026 11:38
@thewhaleking
Copy link
Copy Markdown
Contributor Author

Need update runtime version manually

Done. Thanks!

@open-junius open-junius added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label May 28, 2026
open-junius
open-junius previously approved these changes May 28, 2026
@open-junius open-junius requested review from evgeny-s, l0r1s and sam0x17 May 28, 2026 12:41
@open-junius open-junius requested review from JohnReedV and gztensor May 28, 2026 12:41
Copy link
Copy Markdown
Collaborator

@l0r1s l0r1s left a comment

Choose a reason for hiding this comment

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

Great, way better than having to add a new field struct everytime.

Comment thread pallets/subtensor/rpc/src/lib.rs Outdated
Comment thread pallets/subtensor/runtime-api/src/lib.rs
Comment thread pallets/subtensor/src/rpc_info/subnet_info.rs Outdated
Comment thread pallets/subtensor/src/rpc_info/subnet_info.rs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@thewhaleking
Copy link
Copy Markdown
Contributor Author

Conclusion

The V3 runtime getter and tests are directionally sound, but the advertised BTCLI-facing hyperparams fetch is not exposed through the node's custom RPC surface. Add the V3 RPC trait method and server implementation before merging.

I'm a bit confused by this, as this works fine:

from async_substrate_interface.sync_substrate import SubstrateInterface


with SubstrateInterface("ws://127.0.0.1:9945", chain_name="Bittensor") as substrate:
    call = substrate.runtime_call(
      "SubnetInfoRuntimeApi",
      "get_subnet_hyperparams_v3",
      [1]
    )
print(call)  # [{'name': 'rho', 'value': {'U16': 10}}, {'name': 'kappa', 'value': {'U16': 32767}}, {'name': 'immunity_period', 'value': {'U16': 4096}}, {'name': 'min_allowed_weights', 'value': {'U16': 0}}, {'name': 'max_weights_limit', 'value': {'U16': 65535}}, {'name': 'tempo', 'value': {'U16': 100}}, {'name': 'min_difficulty', 'value': {'U64': 10000000}}, {'name': 'max_difficulty', 'value': {'U64': 4611686018427387903}}, {'name': 'weights_version', 'value': {'U64': 0}}, {'name': 'weights_rate_limit', 'value': {'U64': 100}}, {'name': 'adjustment_interval', 'value': {'U16': 100}}, {'name': 'activity_cutoff', 'value': {'U16': 5000}}, {'name': 'registration_allowed', 'value': {'Bool': True}}, {'name': 'target_regs_per_interval', 'value': {'U16': 2}}, {'name': 'min_burn', 'value': {'TaoBalance': 500000}}, {'name': 'max_burn', 'value': {'TaoBalance': 100000000000}}, {'name': 'bonds_moving_avg', 'value': {'U64': 900000}}, {'name': 'max_regs_per_block', 'value': {'U16': 1}}, {'name': 'serving_rate_limit', 'value': {'U64': 50}}, {'name': 'max_validators', 'value': {'U16': 64}}, {'name': 'adjustment_alpha', 'value': {'U64': 0}}, {'name': 'difficulty', 'value': {'U64': 10000000}}, {'name': 'commit_reveal_period', 'value': {'U64': 1}}, {'name': 'commit_reveal_weights_enabled', 'value': {'Bool': True}}, {'name': 'alpha_high', 'value': {'U16': 58982}}, {'name': 'alpha_low', 'value': {'U16': 45875}}, {'name': 'liquid_alpha_enabled', 'value': {'Bool': False}}, {'name': 'alpha_sigmoid_steepness', 'value': {'I32F32': {'bits': 4294967296000}}}, {'name': 'yuma_version', 'value': {'U16': 2}}, {'name': 'subnet_is_active', 'value': {'Bool': False}}, {'name': 'transfers_enabled', 'value': {'Bool': True}}, {'name': 'bonds_reset_enabled', 'value': {'Bool': False}}, {'name': 'user_liquidity_enabled', 'value': {'Bool': False}}]

@thewhaleking thewhaleking requested review from l0r1s and open-junius May 28, 2026 16:11
Copy link
Copy Markdown
Contributor

@JohnReedV JohnReedV left a comment

Choose a reason for hiding this comment

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

This is great but a few params are deprecated and should not be brought to v3.

These include:

  • adjustment_alpha
  • adjustment_interval
  • difficulty
  • min_difficulty
  • max_difficulty
  • rho

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

}
}

#[allow(deprecated)]
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.

[MEDIUM] Expose get_subnet_hyperparams_v3 through custom RPC

The PR description says this is meant to make BTCLI hyperparam fetching easier, but the jsonrpsee custom RPC trait still exposes only subnetInfo_getSubnetHyperparams and subnetInfo_getSubnetHyperparamsV2. The new runtime API is implemented, but node RPC clients using this established surface still have no subnetInfo_getSubnetHyperparamsV3 method to call. Add a trait method, e.g. subnetInfo_getSubnetHyperparamsV3, plus a server implementation that delegates to api.get_subnet_hyperparams_v3(at, netuid) and SCALE-encodes the result like V1/V2.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're wrong. I was specifically advised not to do that.

@github-actions
Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@l0r1s
Copy link
Copy Markdown
Collaborator

l0r1s commented May 29, 2026

Conclusion

The V3 runtime getter and tests are directionally sound, but the advertised BTCLI-facing hyperparams fetch is not exposed through the node's custom RPC surface. Add the V3 RPC trait method and server implementation before merging.

I'm a bit confused by this, as this works fine:

from async_substrate_interface.sync_substrate import SubstrateInterface


with SubstrateInterface("ws://127.0.0.1:9945", chain_name="Bittensor") as substrate:
    call = substrate.runtime_call(
      "SubnetInfoRuntimeApi",
      "get_subnet_hyperparams_v3",
      [1]
    )
print(call)  # [{'name': 'rho', 'value': {'U16': 10}}, {'name': 'kappa', 'value': {'U16': 32767}}, {'name': 'immunity_period', 'value': {'U16': 4096}}, {'name': 'min_allowed_weights', 'value': {'U16': 0}}, {'name': 'max_weights_limit', 'value': {'U16': 65535}}, {'name': 'tempo', 'value': {'U16': 100}}, {'name': 'min_difficulty', 'value': {'U64': 10000000}}, {'name': 'max_difficulty', 'value': {'U64': 4611686018427387903}}, {'name': 'weights_version', 'value': {'U64': 0}}, {'name': 'weights_rate_limit', 'value': {'U64': 100}}, {'name': 'adjustment_interval', 'value': {'U16': 100}}, {'name': 'activity_cutoff', 'value': {'U16': 5000}}, {'name': 'registration_allowed', 'value': {'Bool': True}}, {'name': 'target_regs_per_interval', 'value': {'U16': 2}}, {'name': 'min_burn', 'value': {'TaoBalance': 500000}}, {'name': 'max_burn', 'value': {'TaoBalance': 100000000000}}, {'name': 'bonds_moving_avg', 'value': {'U64': 900000}}, {'name': 'max_regs_per_block', 'value': {'U16': 1}}, {'name': 'serving_rate_limit', 'value': {'U64': 50}}, {'name': 'max_validators', 'value': {'U16': 64}}, {'name': 'adjustment_alpha', 'value': {'U64': 0}}, {'name': 'difficulty', 'value': {'U64': 10000000}}, {'name': 'commit_reveal_period', 'value': {'U64': 1}}, {'name': 'commit_reveal_weights_enabled', 'value': {'Bool': True}}, {'name': 'alpha_high', 'value': {'U16': 58982}}, {'name': 'alpha_low', 'value': {'U16': 45875}}, {'name': 'liquid_alpha_enabled', 'value': {'Bool': False}}, {'name': 'alpha_sigmoid_steepness', 'value': {'I32F32': {'bits': 4294967296000}}}, {'name': 'yuma_version', 'value': {'U16': 2}}, {'name': 'subnet_is_active', 'value': {'Bool': False}}, {'name': 'transfers_enabled', 'value': {'Bool': True}}, {'name': 'bonds_reset_enabled', 'value': {'Bool': False}}, {'name': 'user_liquidity_enabled', 'value': {'Bool': False}}]

Yes you can safely ignore, the AI reviewer is missing a bit of substrate knowledge. Using the runtime_call is the correct way.

@JohnReedV JohnReedV merged commit 8ba1aa5 into devnet-ready May 29, 2026
210 of 212 checks passed
@thewhaleking thewhaleking deleted the feat/thewhaleking/hyperparams-v4 branch May 29, 2026 17:17
@sam0x17 sam0x17 mentioned this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants