Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Companion for 12109 (#5929)
Browse files Browse the repository at this point in the history
* Update following `pallet-vesting` configurable `WithdrawReasons`

* Update lib.rs

* Update lib.rs

* Update lib.rs

* update lockfile for {"substrate"}

* fix warning

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
  • Loading branch information
Lezek123 and shawntabrizi committed Oct 9, 2022
1 parent 1c786b3 commit fb0dd8e
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 186 deletions.
357 changes: 179 additions & 178 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ mod tests {
assert_err, assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
ord_parameter_types, parameter_types,
traits::{ExistenceRequirement, GenesisBuild},
traits::{ExistenceRequirement, GenesisBuild, WithdrawReasons},
};
use pallet_balances;
use sp_runtime::{
Expand Down Expand Up @@ -790,6 +790,8 @@ mod tests {

parameter_types! {
pub const MinVestedTransfer: u64 = 1;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Test {
Expand All @@ -798,6 +800,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
9 changes: 7 additions & 2 deletions runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,10 @@ mod tests {
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
use crate::purchase;
use frame_support::{
assert_noop, assert_ok, dispatch::DispatchError::BadOrigin, ord_parameter_types,
parameter_types, traits::Currency,
assert_noop, assert_ok,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
traits::{Currency, WithdrawReasons},
};
use pallet_balances::Error as BalancesError;
use sp_runtime::{
Expand Down Expand Up @@ -550,6 +552,8 @@ mod tests {

parameter_types! {
pub const MinVestedTransfer: u64 = 1;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Test {
Expand All @@ -558,6 +562,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem,
LockIdentifier, PrivilegeCmp,
LockIdentifier, PrivilegeCmp, WithdrawReasons,
},
weights::ConstantMultiplier,
PalletId, RuntimeDebug,
Expand Down Expand Up @@ -931,6 +931,8 @@ impl pallet_society::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -939,6 +941,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
PrivilegeCmp,
PrivilegeCmp, WithdrawReasons,
},
weights::ConstantMultiplier,
PalletId, RuntimeDebug,
Expand Down Expand Up @@ -992,6 +992,8 @@ impl claims::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 1 * DOLLARS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -1000,6 +1002,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
PrivilegeCmp,
PrivilegeCmp, WithdrawReasons,
},
weights::ConstantMultiplier,
PalletId, RuntimeDebug,
Expand Down Expand Up @@ -857,6 +857,8 @@ impl pallet_society::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -865,6 +867,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, KeyOwnerProofSystem},
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
};
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_session::historical as session_historical;
Expand Down Expand Up @@ -455,6 +455,8 @@ impl claims::Config for Runtime {

parameter_types! {
pub storage MinVestedTransfer: Balance = 100 * DOLLARS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -463,6 +465,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, InstanceFilter, KeyOwnerProofSystem},
traits::{ConstU32, InstanceFilter, KeyOwnerProofSystem, WithdrawReasons},
weights::ConstantMultiplier,
PalletId,
};
Expand Down Expand Up @@ -712,6 +712,8 @@ impl pallet_recovery::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -720,6 +722,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand Down

0 comments on commit fb0dd8e

Please sign in to comment.