-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sudo call to set duration for schedule call #745
Changes from 7 commits
6b621e6
092a373
9be558e
8d9bb2d
9424806
8ea7255
039bb08
b4c1712
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -681,7 +681,7 @@ mod dispatches { | |
new_coldkey: T::AccountId, | ||
) -> DispatchResultWithPostInfo { | ||
// Ensure it's called with root privileges (scheduler has root privileges) | ||
ensure_root(origin.clone())?; | ||
ensure_root(origin)?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nevermind , the check is the method |
||
log::info!("swap_coldkey: {:?} -> {:?}", old_coldkey, new_coldkey); | ||
|
||
Self::do_swap_coldkey(&old_coldkey, &new_coldkey) | ||
|
@@ -930,8 +930,13 @@ mod dispatches { | |
#[pallet::weight((Weight::from_parts(119_000_000, 0) | ||
.saturating_add(T::DbWeight::get().reads(6)) | ||
.saturating_add(T::DbWeight::get().writes(31)), DispatchClass::Operational, Pays::No))] | ||
pub fn dissolve_network(origin: OriginFor<T>, netuid: u16) -> DispatchResult { | ||
Self::user_remove_network(origin, netuid) | ||
pub fn dissolve_network( | ||
origin: OriginFor<T>, | ||
coldkey: T::AccountId, | ||
netuid: u16, | ||
) -> DispatchResult { | ||
ensure_root(origin)?; | ||
Self::user_remove_network(coldkey, netuid) | ||
} | ||
|
||
/// Set a single child for a given hotkey on a specified network. | ||
|
@@ -1100,7 +1105,10 @@ mod dispatches { | |
let duration: BlockNumberFor<T> = DissolveNetworkScheduleDuration::<T>::get(); | ||
let when: BlockNumberFor<T> = current_block.saturating_add(duration); | ||
|
||
let call = Call::<T>::dissolve_network { netuid }; | ||
let call = Call::<T>::dissolve_network { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
coldkey: who.clone(), | ||
netuid, | ||
}; | ||
|
||
let bound_call = T::Preimages::bound(LocalCallOf::<T>::from(call.clone())) | ||
.map_err(|_| Error::<T>::FailedToSchedule)?; | ||
|
@@ -1109,7 +1117,7 @@ mod dispatches { | |
DispatchTime::At(when), | ||
None, | ||
63, | ||
frame_system::RawOrigin::Signed(who.clone()).into(), | ||
frame_system::RawOrigin::Root.into(), | ||
bound_call, | ||
) | ||
.map_err(|_| Error::<T>::FailedToSchedule)?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix it.