Merged
Conversation
Do not use saturating_sub for signed types
Feat/Minimum Commitment Space
Use last epoch hotkey alpha for fee calculation
Feat/stake transfer precompile
Stake on subnet precompile
Selective metagraph interface
There was a problem hiding this comment.
Pull Request Overview
This PR primarily updates the Subtensor pallets and related tests to use the unsigned fixed‐point type U96F32 in place of I96F32, along with several related type conversions and new features for migrations and runtime APIs. Key changes include:
- Replacing I96F32 with U96F32 (and similar adjustments for other fixed-point types) in staking, coinbase, commitments, and helper modules.
- Adding a new migration module (migrate_upgrade_revealed_commitments) and extending the runtime API with get_selective_metagraph.
- Updating EVM test contracts and configurations to align with the aforementioned changes.
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pallets/subtensor/src/staking/stake_utils.rs | Conversion updates from I96F32 to U96F32 in staking utility functions. |
| pallets/subtensor/src/staking/remove_stake.rs | Updated fixed-point types in unstake extrinsics. |
| pallets/subtensor/src/staking/move_stake.rs | Updated fixed-point type conversion in move stake logic. |
| pallets/subtensor/src/staking/helpers.rs | Adjusted helper functions to use U96F32. |
| pallets/subtensor/src/rpc_info/stake_info.rs | Fixed-point type changes in RPC stake info methods. |
| pallets/subtensor/src/migrations/*.rs | Addition of new migration module for revealed commitments upgrade. |
| pallets/subtensor/src/macros/events.rs | New events added for CRV3 weights reveal and commit-reveal settings. |
| pallets/subtensor/src/lib.rs | New storage added for TotalHotkeyAlphaLastEpoch. |
| pallets/subtensor/src/coinbase/* | Consistent conversion updates in coinbase emission and block step logic. |
| pallets/subtensor/runtime-api/src/lib.rs | Extended runtime API with selective metagraph functionality. |
| pallets/subtensor/rpc/src/lib.rs | RPC implementation updated with selective metagraph support. |
| pallets/commitments/src/mock.rs & lib.rs | Adjustments to constants and commitment reveal logic. |
| evm-tests/* | EVM test contracts and config updated to reflect type changes. |
Comments suppressed due to low confidence (3)
pallets/subtensor/src/staking/stake_utils.rs:82
- The conversion from U96F32 results (used in prior calculations) to I96F32 here may introduce precision or range issues. Consider maintaining a consistent fixed-point type for moving price values or thoroughly document why the conversion to a signed type is necessary.
let new_moving: I96F32 = I96F32::saturating_from_num(current_price.saturating_add(current_moving));
pallets/commitments/src/lib.rs:590
- [nitpick] Enforcing a maximum of 10 revealed entries by draining older items might lead to loss of potentially useful historical data. Confirm that this limit meets the application requirements or consider making the cap configurable.
if existing_reveals.len() > MAX_REVEALS {
pallets/subtensor/rpc/src/lib.rs:410
- [nitpick] Ensure the error message for the get_selective_metagraph RPC call provides enough context for debugging while not exposing sensitive internal details.
Err(e) => Err(Error::RuntimeError(format!("Unable to get selective metagraph: {:?}", e)).into()),
JohnReedV
approved these changes
Apr 1, 2025
gztensor
approved these changes
Apr 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed