diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 26c8288a4c..dd3addf64d 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -78,7 +78,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 194, - impl_version: 194, + impl_version: 195, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/paint/balances/src/lib.rs b/substrate/paint/balances/src/lib.rs index 9240ea7e89..bdbed61ec2 100644 --- a/substrate/paint/balances/src/lib.rs +++ b/substrate/paint/balances/src/lib.rs @@ -372,6 +372,14 @@ decl_storage! { config(balances): Vec<(T::AccountId, T::Balance)>; config(vesting): Vec<(T::AccountId, T::BlockNumber, T::BlockNumber, T::Balance)>; // ^^ begin, length, amount liquid at genesis + build(|config: &GenesisConfig| { + for (_, balance) in &config.balances { + assert!( + *balance >= >::ExistentialDeposit::get(), + "the balance of any account should always be more than existential deposit.", + ) + } + }); } } diff --git a/substrate/paint/balances/src/mock.rs b/substrate/paint/balances/src/mock.rs index 600d0e6fb7..cd42fed673 100644 --- a/substrate/paint/balances/src/mock.rs +++ b/substrate/paint/balances/src/mock.rs @@ -32,7 +32,7 @@ impl_outer_origin!{ } thread_local! { - static EXISTENTIAL_DEPOSIT: RefCell = RefCell::new(0); + pub(crate) static EXISTENTIAL_DEPOSIT: RefCell = RefCell::new(0); static TRANSFER_FEE: RefCell = RefCell::new(0); static CREATION_FEE: RefCell = RefCell::new(0); } diff --git a/substrate/paint/balances/src/tests.rs b/substrate/paint/balances/src/tests.rs index 8afec6f697..61e5a82f08 100644 --- a/substrate/paint/balances/src/tests.rs +++ b/substrate/paint/balances/src/tests.rs @@ -760,3 +760,14 @@ fn transfer_keep_alive_works() { assert_eq!(Balances::total_balance(&2), 0); }); } + +#[test] +#[should_panic="the balance of any account should always be more than existential deposit."] +fn cannot_set_genesis_value_below_ed() { + mock::EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = 11); + let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + let _ = GenesisConfig:: { + balances: vec![(1, 10)], + vesting: vec![], + }.assimilate_storage(&mut t).unwrap(); +} diff --git a/substrate/paint/executive/src/lib.rs b/substrate/paint/executive/src/lib.rs index 2f0a418ab0..95c04c5355 100644 --- a/substrate/paint/executive/src/lib.rs +++ b/substrate/paint/executive/src/lib.rs @@ -709,7 +709,7 @@ mod tests { #[test] fn block_hooks_weight_is_stored() { - new_test_ext(0).execute_with(|| { + new_test_ext(1).execute_with(|| { Executive::initialize_block(&Header::new_from_number(1)); // NOTE: might need updates over time if system and balance introduce new weights. For