Skip to content

Follow-up for dynamic tempo - removing deprecated activity cutoff#2774

Open
evgeny-s wants to merge 13 commits into
devnet-readyfrom
chore/dynamic-tempo-cleanup
Open

Follow-up for dynamic tempo - removing deprecated activity cutoff#2774
evgeny-s wants to merge 13 commits into
devnet-readyfrom
chore/dynamic-tempo-cleanup

Conversation

@evgeny-s

@evgeny-s evgeny-s commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Description

Follow-up PR for #2638:

Breaking Changes ❗❗❗

On-chain storage & metadata

  • Removed SubtensorModule::ActivityCutoff and SubtensorModule::MinActivityCutoff. Both are purged from state by the migrate_remove_activity_cutoff runtime migration.
  • Migration path: read SubtensorModule::ActivityCutoffFactorMilli instead.

Extrinsics

  • Removed admin_utils.sudo_set_activity_cutoff.
  • Replacement: subtensor.set_activity_cutoff_factor(netuid, factor_milli).

EVM precompiles — ISubnet

Selectors are preserved (deployed contracts do not revert), but semantics changed:

  • getActivityCutoff(uint16) — now returns the derived effective cutoff.
  • setActivityCutoff(uint16,uint16) — now converts the block value to the equivalent per-tempo factor at the current tempo and dispatches set_activity_cutoff_factor.
  • New contracts should use setActivityCutoffFactor(uint16,uint32) / getActivityCutoffFactor(uint16) directly.

Events & Errors — deprecated, not removed (indices preserved)

  • Event::ActivityCutoffSet and Error::ActivityCutoffTooLow are marked #[deprecated] and are no longer emitted / returned.

Related Issue(s)

  • Closes #[issue number]

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

If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.

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

Please provide any additional information or context that may be helpful for reviewers.

@evgeny-s evgeny-s added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

eco-tests changed — indexer review required

This PR modifies files under eco-tests/. and may affect downstream indexing.
cc @evgeny-s — please review manually

Changed files
  • eco-tests/src/mock.rs
  • eco-tests/src/tests_taocom_indexer.rs

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

BASELINE scrutiny: established 2012 account with repository write permission, substantial subtensor PR history, and no Gittensor allowlist/index hit; branch chore/dynamic-tempo-cleanup -> devnet-ready.

Static review found no protected .github/ai-review/* or .github/copilot-instructions.md changes, no dependency or build-script changes, and no suspicious runtime execution path. The migration sequence reads legacy ActivityCutoff through a local alias before the new cleanup migration removes the old storage, and the deprecated EVM setter now dispatches to the bounded owner/root-checked set_activity_cutoff_factor path. spec_version is bumped from 423 to 424.

Findings

No findings.

Conclusion

No malicious intent or security vulnerability was identified in the reviewed diff. The previous Skeptic verdict had no finding markers, and the current changes remain consistent with a dynamic-tempo cleanup and backward-compatible precompile behavior.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor: LIKELY by heuristic; no allowlist/index hit, but author has write permission and substantial recent Subtensor PR activity.

The Auditor proposed a replacement PR description, but the current body is non-trivial; not overwriting. Maintainers: ask the Auditor to regenerate if you want it.

Static review covered the legacy ActivityCutoff / MinActivityCutoff removal, the raw storage alias retained for migrate_dynamic_tempo, migration ordering that converts legacy cutoff values before clearing old storage, admin-utils removal, runtime proxy filter update, precompile ABI compatibility, and focused migration tests for wiping legacy storage.

The previous blocker is addressed: deprecated setActivityCutoff(uint16,uint16) now converts the legacy absolute block value to ActivityCutoffFactorMilli and dispatches through the bounded owner/root-checked set_activity_cutoff_factor path instead of returning success as a no-op.

spec_version is bumped from 423 to 424. git diff --check passed. No auto-fixes were applied. I attempted the targeted precompile test, but this runner cannot populate rustup/Cargo caches because $HOME is read-only, so runtime confirmation was not available here.

Duplicate-work check found overlapping files with other open PRs, but no competing PR appears to implement this ActivityCutoff cleanup.

Findings

No findings.

Prior-comment reconciliation

  • ef3a69cc: addressedsetActivityCutoff(uint16,uint16) now converts legacy block cutoffs to a per-tempo factor and dispatches set_activity_cutoff_factor, so it no longer reports success without changing state.

Conclusion

Approving because the prior behavioral blocker is fixed and the cleanup preserves the dynamic-tempo migration path before deleting legacy storage. Remaining risk is limited to test execution being unavailable in this runner; CI should run the targeted precompile and migration tests.


📜 Previous run (superseded)
Sev File Finding Status
HIGH precompiles/src/subnet.rs:487 Deprecated precompile setter succeeds without changing state ✅ Addressed
setActivityCutoff(uint16,uint16) now converts legacy block cutoffs to a per-tempo factor and dispatches set_activity_cutoff_factor, so it no longer reports success without changing state.

@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: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@evgeny-s evgeny-s changed the title Follow-up for dynamic tempo - removing deprecated activity cutoff [DO NOT MERGE] Follow-up for dynamic tempo - removing deprecated activity cutoff Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

# Conflicts:
#	pallets/admin-utils/src/weights.rs
@evgeny-s evgeny-s changed the base branch from feat/configure-max-epochs-per-block to devnet-ready June 24, 2026 11:08

@github-actions github-actions Bot left a comment

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.

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

fn sudo_set_difficulty() -> Weight;
fn sudo_set_adjustment_interval() -> Weight;
fn sudo_set_target_registrations_per_interval() -> Weight;
fn sudo_set_activity_cutoff() -> Weight;

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.

[HIGH] Remove the stale generated weight implementations too

Deleting this trait item leaves two generated sudo_set_activity_cutoff() implementations in this same file, around pallets/admin-utils/src/weights.rs:367 and pallets/admin-utils/src/weights.rs:1333. Those methods are no longer members of WeightInfo, and Rust trait impls cannot define extra associated methods, so pallet-admin-utils will not compile after this cleanup. Regenerate pallets/admin-utils/src/weights.rs or manually remove both stale method blocks along with this trait item.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions github-actions Bot left a comment

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.

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

Comment thread pallets/admin-utils/src/weights.rs Outdated
fn sudo_trim_to_max_allowed_uids() -> Weight;
fn sudo_set_min_non_immune_uids() -> Weight;
fn sudo_set_max_epochs_per_block() -> Weight;
fn sudo_set_activity_cutoff() -> Weight;

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.

[LOW] Remove the stale generated activity-cutoff weight stub

sudo_set_activity_cutoff was removed from pallets/admin-utils/src/lib.rs and its benchmark was deleted, but the generated WeightInfo trait still exposes the method and both generated impls still define it against the removed SubtensorModule::ActivityCutoff / MinActivityCutoff storage. This no longer appears to be the compile-breaking mismatch from the prior run because the trait and impls are internally consistent, but it leaves dead generated weight code for an extrinsic this PR removes. Regenerate pallets/admin-utils/src/weights.rs or delete the stale trait item and the two sudo_set_activity_cutoff impl blocks.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

# Conflicts:
#	contract-tests/src/contracts/subnet.ts
#	contract-tests/src/subtensor.ts
#	contract-tests/test/staking.precompile.reward.test.ts

@github-actions github-actions Bot left a comment

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.

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

Comment thread pallets/admin-utils/src/weights.rs Outdated
fn sudo_trim_to_max_allowed_uids() -> Weight;
fn sudo_set_min_non_immune_uids() -> Weight;
fn sudo_set_max_epochs_per_block() -> Weight;
fn sudo_set_activity_cutoff() -> Weight;

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.

[LOW] Remove the stale generated activity-cutoff weight stub

sudo_set_activity_cutoff was removed from pallets/admin-utils/src/lib.rs, but this generated weight method is still re-added to the trait and the file still carries both impl bodies for the removed call. This is dead generated code over storage that the PR deletes; regenerate pallet_admin_utils weights or remove the trait method and both impl methods so the weights file matches the pallet surface.

@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: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@evgeny-s evgeny-s changed the title [DO NOT MERGE] Follow-up for dynamic tempo - removing deprecated activity cutoff Follow-up for dynamic tempo - removing deprecated activity cutoff Jun 29, 2026
@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: 👍

l0r1s
l0r1s previously approved these changes Jun 30, 2026
Comment thread precompiles/src/solidity/subnet.sol
Comment thread pallets/subtensor/src/lib.rs
Comment thread chain-extensions/src/mock.rs
@@ -1,23 +1,4 @@
[
{

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.

For backward-compatibility, we should keep the getActivityCutoff in precompiles, otherwise the existing contracts will start failing. They may respond with 0 or something hardcoded.

int16 steepness
) external payable;

function getActivityCutoff(uint16 netuid) external view returns (uint16);

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.

For backward-compatibility, we should keep the getActivityCutoff in precompiles, otherwise the existing contracts will start failing. They may respond with 0 or something hardcoded.

@evgeny-s evgeny-s added the breaking-change This PR introduces a noteworthy breaking change label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!

@github-actions github-actions Bot left a comment

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.

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

Comment thread precompiles/src/subnet.rs
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change This PR introduces a noteworthy breaking change 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.

3 participants