Skip to content

remove subnet owner check#2631

Merged
open-junius merged 12 commits into
devnet-readyfrom
remove-subnet-owner-check
May 7, 2026
Merged

remove subnet owner check#2631
open-junius merged 12 commits into
devnet-readyfrom
remove-subnet-owner-check

Conversation

@open-junius
Copy link
Copy Markdown
Contributor

Description

Remove the subnet owner check for do_add_stake_burn

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.

@open-junius open-junius self-assigned this May 4, 2026
Comment thread pallets/subtensor/src/macros/dispatches.rs Outdated
Comment thread pallets/subtensor/src/staking/recycle_alpha.rs Outdated
Comment thread pallets/subtensor/src/staking/recycle_alpha.rs Outdated
Self::do_burn_alpha(origin, hotkey.clone(), alpha, netuid)?;

Self::set_rate_limited_last_block(&RateLimitKey::AddStakeBurn(netuid), current_block);
transactional::with_transaction(|| {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we need with_transaction here, because FRAME should automatically wrap the extrinsic call with the transaction.

Copy link
Copy Markdown
Collaborator

@l0r1s l0r1s May 4, 2026

Choose a reason for hiding this comment

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

Correct. Every extrinsic is already inside a storage layer so no need for that, failure propagated through ? will rollback the state. All below extrinsic can be simplified too.

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.

Will also update these extrinsics

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Guys, I see that we call this function do_add_stake_recycle outside the extrinsic call - in the chain extension and since we return Converging, it won't revert the state. We should call Diverging with flag Revert.
It means that we might still need the transaction wrapper.
@open-junius , could you confirm it with the TS e2e test (not Rust, since it won't catch it).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can't change the error processing; otherwise, it will change the ABI. So we need to confirm the regression via the test and probably revert the transactional layer here.
cc @l0r1s

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.

Thanks! just got your point, I will test it in TS e2e. do_add_stake_recycle is defined out of extrinsic, but It will be called in an extrinsic in pallet_contract extrinsic. Anyway, I will verify it.

Comment thread pallets/subtensor/src/lib.rs Outdated
// "Add stake and burn" rate limit
#[codec(index = 6)]
AddStakeBurn(NetUid),
AddStakeBurn(NetUid, AccountId),
Copy link
Copy Markdown
Collaborator

@l0r1s l0r1s May 4, 2026

Choose a reason for hiding this comment

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

I think it will require a migration of the LastRateLimitedBlock storage item given this is used as the storage key.

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.

It makes sense, will add a migration function.

@open-junius open-junius added skip-cargo-audit This PR fails cargo audit but needs to be merged anyway apply-benchmark-patch labels May 5, 2026
JohnReedV
JohnReedV previously approved these changes May 5, 2026
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.

LGTM. Only need to fix conflicts with devnet-ready.

Comment thread pallets/subtensor/src/tests/recycle_alpha.rs Outdated
l0r1s
l0r1s previously approved these changes May 5, 2026
@open-junius open-junius dismissed stale reviews from l0r1s and JohnReedV via 0b2014f May 5, 2026 23:40
@open-junius open-junius requested review from JohnReedV and l0r1s May 6, 2026 13:08
@l0r1s
Copy link
Copy Markdown
Collaborator

l0r1s commented May 6, 2026

Some Bittensor E2E tests are failing following the change. Maybe @basfroman or @ibraheem-abe can have a look at this? Thanks!

@open-junius
Copy link
Copy Markdown
Contributor Author

open-junius commented May 6, 2026

Some Bittensor E2E tests are failing following the change. Maybe @basfroman or @ibraheem-abe can have a look at this? Thanks!

I can see failed E2E without any code change #2637. There is a new one, sorry, let me check it.

The PR remove the subnet owner only check and rate limit restriction https://github.com/opentensor/subtensor/pull/2631/changes#diff-623d1d1d2b9b4882cf7ac464c376245f5efb9a20805d5324e8d384d7afa1d97cL128. Not sure why the E2E is failed. Please @basfroman @ibraheem-abe take a look.

@thewhaleking
Copy link
Copy Markdown
Contributor

thewhaleking commented May 6, 2026

Please ping me if/when this lands so I can update the btcli test. Looks like the failure is due to the rate limit no longer applying.

@open-junius open-junius merged commit adb7ae9 into devnet-ready May 7, 2026
558 of 564 checks passed
@open-junius
Copy link
Copy Markdown
Contributor Author

@thewhaleking It is merged, please update the btcli test.

@thewhaleking
Copy link
Copy Markdown
Contributor

@thewhaleking It is merged, please update the btcli test.

Thanks. Updated test in latent-to/btcli#958

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.

5 participants