Skip to content

Add getStakeInfoForColdkeyAndNetuid and getStakeOperationThreshold views to StakingPrecompileV2#2899

Open
pawel-gebal-reef wants to merge 1 commit into
RaoFoundation:devnet-readyfrom
bittensor-church:feat/staking-precompile-stake-info-and-threshold-views
Open

Add getStakeInfoForColdkeyAndNetuid and getStakeOperationThreshold views to StakingPrecompileV2#2899
pawel-gebal-reef wants to merge 1 commit into
RaoFoundation:devnet-readyfrom
bittensor-church:feat/staking-precompile-stake-info-and-threshold-views

Conversation

@pawel-gebal-reef

@pawel-gebal-reef pawel-gebal-reef commented Jul 14, 2026

Copy link
Copy Markdown

Description

Adds two read-only view functions to the V2 staking precompile:

  • getStakeInfoForColdkeyAndNetuid(coldkey, netuid) — returns every hotkey a coldkey stakes to on a given subnet, each with its stake amount. Contracts built on top of staking currently have no way of tracking the hotkeys they stake under, especially in the case of hotkey swaps.
  • getStakeOperationThreshold() — returns the minimum stake amount the chain will accept for a stake operation. Contracts integrating with the staking precompile currently have no on-chain way to read this limit, even though operations below it revert (AmountTooLow); they are forced to hardcode the value and break silently if it changes.

Both functions are read-only and charge gas per storage read, so they can't be used to force unbounded work.

Related Issue(s)

  • N/A

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

None. Both are additive, read-only view functions — no storage, extrinsic, or existing-selector changes.

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

Additional Notes

  • The Solidity name is getStakeOperationThreshold rather than the storage item's literal name (DefaultMinStake) so integrators understand what the value does without reading pallet internals.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

@pawel-gebal-reef is attempting to deploy a commit to the RaoFoundation Team on Vercel.

A member of the Team first needs to authorize it.

@pawel-gebal-reef pawel-gebal-reef marked this pull request as ready for review July 14, 2026 08:35
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