Fixes for pallets (#4595)

* Move rebond to the end

* Fix identity module

* Fix order of things in tresury

* Fixes

* Fix.

* Fix test

* Fix test
This commit is contained in:
Gavin Wood
2020-01-10 19:23:20 +01:00
committed by GitHub
parent 7b17deda24
commit 8bde366d32
3 changed files with 96 additions and 97 deletions
+20 -20
View File
@@ -985,26 +985,6 @@ decl_module! {
}
}
/// Rebond a portion of the stash scheduled to be unlocked.
///
/// # <weight>
/// - Time complexity: O(1). Bounded by `MAX_UNLOCKING_CHUNKS`.
/// - Storage changes: Can't increase storage, only decrease it.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(500_000)]
fn rebond(origin, #[compact] value: BalanceOf<T>) {
let controller = ensure_signed(origin)?;
let ledger = Self::ledger(&controller).ok_or(Error::<T>::NotController)?;
ensure!(
ledger.unlocking.len() > 0,
Error::<T>::NoUnlockChunk,
);
let ledger = ledger.rebond(value);
Self::update_ledger(&controller, &ledger);
}
/// Remove any unlocked chunks from the `unlocking` queue from our management.
///
/// This essentially frees up that balance to be used by the stash account to do
@@ -1256,6 +1236,26 @@ decl_module! {
<Self as Store>::UnappliedSlashes::insert(&era, &unapplied);
}
/// Rebond a portion of the stash scheduled to be unlocked.
///
/// # <weight>
/// - Time complexity: O(1). Bounded by `MAX_UNLOCKING_CHUNKS`.
/// - Storage changes: Can't increase storage, only decrease it.
/// # </weight>
#[weight = SimpleDispatchInfo::FixedNormal(500_000)]
fn rebond(origin, #[compact] value: BalanceOf<T>) {
let controller = ensure_signed(origin)?;
let ledger = Self::ledger(&controller).ok_or(Error::<T>::NotController)?;
ensure!(
ledger.unlocking.len() > 0,
Error::<T>::NoUnlockChunk,
);
let ledger = ledger.rebond(value);
Self::update_ledger(&controller, &ledger);
}
}
}