FRAME: Revamp Preimage pallet to use Consideration (#1363)

Make Preimage pallet use Consideration instead of handling deposits
directly.

Other half of paritytech/substrate#13666.
Depends/based on #1361.

Script for the lazy migration that should be run manually once:
[migrate-preimage-lazy.py](https://github.com/ggwpez/substrate-scripts/blob/master/migrate-preimage-lazy.py).

## TODO

- [x] Migration code.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2023-09-17 12:19:18 +01:00
committed by GitHub
parent 11d1a3955e
commit d787269cdf
25 changed files with 789 additions and 348 deletions
@@ -22,7 +22,7 @@ use crate::NegativeImbalance;
use frame_support::traits::{
BalanceStatus::{Free, Reserved},
Currency,
ExistenceRequirement::{self, AllowDeath},
ExistenceRequirement::{self, AllowDeath, KeepAlive},
Hooks, LockIdentifier, LockableCurrency, NamedReservableCurrency, ReservableCurrency,
WithdrawReasons,
};
@@ -33,6 +33,18 @@ const ID_2: LockIdentifier = *b"2 ";
pub const CALL: &<Test as frame_system::Config>::RuntimeCall =
&RuntimeCall::Balances(crate::Call::transfer_allow_death { dest: 0, value: 0 });
#[test]
fn ed_should_work() {
ExtBuilder::default().existential_deposit(1).build_and_execute_with(|| {
assert_ok!(Balances::force_set_balance(RuntimeOrigin::root(), 1, 1000));
assert_noop!(
<Balances as Currency<_>>::transfer(&1, &10, 1000, KeepAlive),
TokenError::NotExpendable
);
assert_ok!(<Balances as Currency<_>>::transfer(&1, &10, 1000, AllowDeath));
});
}
#[test]
fn set_lock_with_amount_zero_removes_lock() {
ExtBuilder::default()