mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 21:31:02 +00:00
Make ED of zero (kind of) work (#13655)
* Minimum of 1 for ED * Avoid need for ED to be minimum one * Docs * Ban ED of zero unless feature enabled * use integrity_test * Docs * Cleanup * Update frame/balances/Cargo.toml Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/balances/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/balances/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ensure dodgy code is disabled by default * zero_ed -> insecure_zero_ed --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -23,7 +23,8 @@ use frame_support::traits::{
|
||||
BalanceStatus::{Free, Reserved},
|
||||
Currency,
|
||||
ExistenceRequirement::{self, AllowDeath},
|
||||
LockIdentifier, LockableCurrency, NamedReservableCurrency, ReservableCurrency, WithdrawReasons,
|
||||
Hooks, LockIdentifier, LockableCurrency, NamedReservableCurrency, ReservableCurrency,
|
||||
WithdrawReasons,
|
||||
};
|
||||
|
||||
const ID_1: LockIdentifier = *b"1 ";
|
||||
@@ -974,7 +975,7 @@ fn slash_reserved_on_non_existant_works() {
|
||||
fn operations_on_dead_account_should_not_change_state() {
|
||||
// These functions all use `mutate_account` which may introduce a storage change when
|
||||
// the account never existed to begin with, and shouldn't exist in the end.
|
||||
ExtBuilder::default().existential_deposit(0).build_and_execute_with(|| {
|
||||
ExtBuilder::default().existential_deposit(1).build_and_execute_with(|| {
|
||||
assert!(!frame_system::Account::<Test>::contains_key(&1337));
|
||||
|
||||
// Unreserve
|
||||
@@ -993,6 +994,16 @@ fn operations_on_dead_account_should_not_change_state() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic = "The existential deposit must be greater than zero!"]
|
||||
fn zero_ed_is_prohibited() {
|
||||
// These functions all use `mutate_account` which may introduce a storage change when
|
||||
// the account never existed to begin with, and shouldn't exist in the end.
|
||||
ExtBuilder::default().existential_deposit(0).build_and_execute_with(|| {
|
||||
Balances::integrity_test();
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn named_reserve_should_work() {
|
||||
ExtBuilder::default().build_and_execute_with(|| {
|
||||
|
||||
@@ -87,7 +87,7 @@ parameter_types! {
|
||||
frame_system::limits::BlockWeights::simple_max(
|
||||
frame_support::weights::Weight::from_parts(1024, u64::MAX),
|
||||
);
|
||||
pub static ExistentialDeposit: u64 = 0;
|
||||
pub static ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
|
||||
Reference in New Issue
Block a user