-
Notifications
You must be signed in to change notification settings - Fork 316
Repatriate residual stake and locks on lease termination #2709
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
base: devnet-ready
Are you sure you want to change the base?
Changes from all commits
55a24f0
c375dfd
9a53fb6
ddba12d
1a2c1ce
ee4bdfe
05003f4
4068519
8fa9a01
1d62923
690d898
2d31243
f7283f1
ed72c17
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 |
|---|---|---|
|
|
@@ -620,6 +620,11 @@ pub mod pallet { | |
| ensure!(crowdloan.raised == crowdloan.cap, Error::<T>::CapNotRaised); | ||
| ensure!(!crowdloan.finalized, Error::<T>::AlreadyFinalized); | ||
|
|
||
| // Mark finalized *before* dispatching the creator-controlled call so re-entrant | ||
| // withdraw/refund/dissolve are rejected mid-dispatch. Reverts if the dispatch fails. | ||
| crowdloan.finalized = true; | ||
| Crowdloans::<T>::insert(crowdloan_id, &crowdloan); | ||
|
Comment on lines
+623
to
+626
Contributor
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. [HIGH] Failed finalize can persist finalized state and trap funds This writes
Comment on lines
+623
to
+626
Contributor
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. [HIGH] Failed finalize can persist finalized state and trap funds
|
||
|
|
||
| match (&crowdloan.call, &crowdloan.target_address) { | ||
| (Some(call), None) => { | ||
| // Set the current crowdloan id so the dispatched call | ||
|
|
@@ -659,9 +664,6 @@ pub mod pallet { | |
| } | ||
| } | ||
|
|
||
| crowdloan.finalized = true; | ||
| Crowdloans::<T>::insert(crowdloan_id, &crowdloan); | ||
|
|
||
| Self::deposit_event(Event::<T>::Finalized { crowdloan_id }); | ||
|
|
||
| Ok(()) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1950,7 +1950,10 @@ mod dispatches { | |
| /// * `hotkey` (T::AccountId): | ||
| /// - The hotkey of the beneficiary to mark as subnet owner hotkey. | ||
| #[pallet::call_index(111)] | ||
| #[pallet::weight(<T as crate::pallet::Config>::WeightInfo::terminate_lease(T::MaxContributors::get()))] | ||
| #[pallet::weight( | ||
| <T as crate::pallet::Config>::WeightInfo::terminate_lease(T::MaxContributors::get()) | ||
| .saturating_add(<T as crate::pallet::Config>::WeightInfo::swap_hotkey()) | ||
| )] | ||
|
Comment on lines
+1953
to
+1956
Contributor
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. [HIGH] Lease termination weight does not cover the new worst-case work The dispatch weight is still just generated |
||
| pub fn terminate_lease( | ||
| origin: OriginFor<T>, | ||
| lease_id: LeaseId, | ||
|
|
@@ -2575,7 +2578,7 @@ mod dispatches { | |
| netuid: NetUid, | ||
| ) -> DispatchResult { | ||
| let coldkey = ensure_signed(origin)?; | ||
| Self::do_move_lock(&coldkey, &destination_hotkey, netuid) | ||
| Self::do_move_lock(&coldkey, &destination_hotkey, netuid, false) | ||
| } | ||
|
|
||
| /// Sets or clears the caller's perpetual lock flag for a subnet. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.