Skip to content

add sudo call to set duration for schedule call#745

Merged
unconst merged 8 commits intodevnet-readyfrom
junius-add-sudo-call-for-schedule
Aug 23, 2024
Merged

add sudo call to set duration for schedule call#745
unconst merged 8 commits intodevnet-readyfrom
junius-add-sudo-call-for-schedule

Conversation

@open-junius
Copy link
Contributor

Description

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 cargo fmt and cargo clippy 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 requested a review from unconst as a code owner August 20, 2024 11:44
sam0x17
sam0x17 previously approved these changes Aug 20, 2024
@open-junius open-junius requested a review from a team August 20, 2024 17:53
sam0x17
sam0x17 previously approved these changes Aug 20, 2024
sam0x17
sam0x17 previously approved these changes Aug 21, 2024
///
pub fn user_remove_network(origin: T::RuntimeOrigin, netuid: u16) -> dispatch::DispatchResult {
pub fn user_remove_network(coldkey: T::AccountId, netuid: u16) -> dispatch::DispatchResult {
// --- 1. Ensure the function caller is a signed user.
Copy link
Collaborator

Choose a reason for hiding this comment

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

fix comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix it.

let when: BlockNumberFor<T> = current_block.saturating_add(duration);

let call = Call::<T>::dissolve_network { netuid };
let call = Call::<T>::dissolve_network {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to check that the user owns the network they are trying to dissolve here ? From the looks of it , anyone can dissolve a network , so I think we should just check if the user is the owner of the network

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The owner could be updated after the call scheduled. You can check my test case. We could let the dissolve_network extrinsic to check when it is executed.

) -> DispatchResultWithPostInfo {
// Ensure it's called with root privileges (scheduler has root privileges)
ensure_root(origin.clone())?;
ensure_root(origin)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nevermind , the check is the method

@unconst unconst merged commit e2a60a1 into devnet-ready Aug 23, 2024
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.

4 participants