Skip to content

Conversation

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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()),

@sam0x17 sam0x17 merged commit e81603e into devnet Apr 1, 2025
56 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants