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

substrate #9202 companion: Multiple vesting schedules #3407

Merged
23 commits merged into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
885bc80
substrate #9202 companion: Multiple vesting schedules
emostov Jul 5, 2021
28582bc
Update weights inline with substrate updates
emostov Jul 5, 2021
e878dae
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Jul 5, 2021
c29c285
Use 28 vesting schedules
emostov Jul 6, 2021
064b708
Add MaxSchedulesParam everywhere
emostov Jul 6, 2021
93554b3
Fix var name errors
emostov Jul 6, 2021
5a0716e
rever accidental changes to test-runtime
emostov Jul 6, 2021
398d65d
try merge origin master
emostov Jul 6, 2021
de9ed26
Revert "try merge origin master"
emostov Jul 6, 2021
81b0999
Merge branch 'master' into zeke-companion-multi-vest
emostov Jul 6, 2021
f9c8457
update to pass integrity test
emostov Jul 7, 2021
ed5d8a9
Make integrity tests work
emostov Jul 8, 2021
d6cdb92
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Jul 14, 2021
5dc2b53
Revert const to storage MinVestedTransfer
emostov Jul 18, 2021
0d32657
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Jul 20, 2021
f08d467
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Jul 22, 2021
8d25615
Use MAX_VESTING_SCHEDULES const
emostov Jul 22, 2021
681f4a8
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Jul 23, 2021
140d88a
Try merge origin master
emostov Aug 9, 2021
827e8ab
Merge remote-tracking branch 'origin' into zeke-companion-multi-vest
emostov Aug 19, 2021
91ba773
Update Cargo.lock to make it compile
emostov Aug 19, 2021
eaaa42d
Merge remote-tracking branch 'origin/master' into zeke-companion-mult…
Aug 24, 2021
cecc4c1
update Substrate
Aug 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,8 @@ mod tests {
}

parameter_types! {
pub const MinVestedTransfer: u64 = 0;
pub const MinVestedTransfer: u64 = 1;
pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Test {
Expand All @@ -734,6 +735,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type MaxVestingSchedules = MaxVestingSchedules;
}

parameter_types!{
Expand Down
4 changes: 3 additions & 1 deletion runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ mod tests {
}

parameter_types! {
pub const MinVestedTransfer: u64 = 0;
pub const MinVestedTransfer: u64 = 1;
pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Test {
Expand All @@ -508,6 +509,7 @@ mod tests {
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type MaxVestingSchedules = MaxVestingSchedules;
}

parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ impl pallet_society::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
emostov marked this conversation as resolved.
Show resolved Hide resolved
pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -957,6 +958,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type MaxVestingSchedules = MaxVestingSchedules;
}

parameter_types! {
Expand Down
77 changes: 51 additions & 26 deletions runtime/kusama/src/weights/pallet_vesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,71 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_vesting.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_vesting::WeightInfo for WeightInfo<T> {
fn vest_locked(l: u32, ) -> Weight {
(42_136_000 as Weight)
// Standard Error: 16_000
.saturating_add((235_000 as Weight).saturating_mul(l as Weight))
fn vest_locked(l: u32, s: u32, ) -> Weight {
(93_789_000 as Weight)
// Standard Error: 70_000
.saturating_add((41_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 182_000
.saturating_add((211_000 as Weight).saturating_mul(s as Weight))

.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_unlocked(l: u32, ) -> Weight {
(45_276_000 as Weight)
// Standard Error: 10_000
.saturating_add((189_000 as Weight).saturating_mul(l as Weight))
fn vest_unlocked(_l: u32, s: u32, ) -> Weight {
(90_737_000 as Weight)
// Standard Error: 0
.saturating_add((263_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_other_locked(l: u32, ) -> Weight {
(42_030_000 as Weight)
// Standard Error: 18_000
.saturating_add((243_000 as Weight).saturating_mul(l as Weight))
fn vest_other_locked(l: u32, s: u32, ) -> Weight {
(85_211_000 as Weight)
// Standard Error: 17_000
.saturating_add((153_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((289_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vest_other_unlocked(l: u32, ) -> Weight {
(45_211_000 as Weight)
// Standard Error: 10_000
.saturating_add((191_000 as Weight).saturating_mul(l as Weight))
fn vest_other_unlocked(l: u32, s: u32, ) -> Weight {
(90_368_000 as Weight)
// Standard Error: 17_000
.saturating_add((31_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((132_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vested_transfer(l: u32, ) -> Weight {
(100_375_000 as Weight)
// Standard Error: 13_000
.saturating_add((136_000 as Weight).saturating_mul(l as Weight))
fn vested_transfer(l: u32, _s: u32, ) -> Weight {
(167_500_000 as Weight)
// Standard Error: 194_000
.saturating_add((255_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn force_vested_transfer(l: u32, ) -> Weight {
(100_907_000 as Weight)
// Standard Error: 12_000
.saturating_add((101_000 as Weight).saturating_mul(l as Weight))
fn force_vested_transfer(l: u32, _s: u32, ) -> Weight {
(174_000_000 as Weight)
// Standard Error: 70_000
.saturating_add((143_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(101_778_000 as Weight)
// Standard Error: 17_000
.saturating_add((194_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 48_000
.saturating_add((361_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(104_111_000 as Weight)
// Standard Error: 88_000
.saturating_add((276_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 240_000
.saturating_add((194_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
}
2 changes: 2 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ impl claims::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 1 * DOLLARS;
pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -839,6 +840,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type MaxVestingSchedules = MaxVestingSchedules;
}

impl pallet_utility::Config for Runtime {
Expand Down
75 changes: 50 additions & 25 deletions runtime/polkadot/src/weights/pallet_vesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,71 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_vesting.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_vesting::WeightInfo for WeightInfo<T> {
fn vest_locked(l: u32, ) -> Weight {
(41_282_000 as Weight)
// Standard Error: 14_000
.saturating_add((225_000 as Weight).saturating_mul(l as Weight))
fn vest_locked(l: u32, s: u32, ) -> Weight {
(93_789_000 as Weight)
// Standard Error: 70_000
.saturating_add((41_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 182_000
.saturating_add((211_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_unlocked(l: u32, ) -> Weight {
(44_048_000 as Weight)
// Standard Error: 10_000
.saturating_add((192_000 as Weight).saturating_mul(l as Weight))
fn vest_unlocked(_l: u32, s: u32, ) -> Weight {
(90_737_000 as Weight)
// Standard Error: 0
.saturating_add((263_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_other_locked(l: u32, ) -> Weight {
(40_722_000 as Weight)
fn vest_other_locked(l: u32, s: u32, ) -> Weight {
(85_211_000 as Weight)
// Standard Error: 17_000
.saturating_add((242_000 as Weight).saturating_mul(l as Weight))
.saturating_add((153_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((289_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vest_other_unlocked(l: u32, ) -> Weight {
(43_752_000 as Weight)
// Standard Error: 14_000
.saturating_add((215_000 as Weight).saturating_mul(l as Weight))
fn vest_other_unlocked(l: u32, s: u32, ) -> Weight {
(90_368_000 as Weight)
// Standard Error: 17_000
.saturating_add((31_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((132_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vested_transfer(l: u32, ) -> Weight {
(97_642_000 as Weight)
// Standard Error: 13_000
.saturating_add((133_000 as Weight).saturating_mul(l as Weight))
fn vested_transfer(l: u32, _s: u32, ) -> Weight {
(167_500_000 as Weight)
// Standard Error: 194_000
.saturating_add((255_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn force_vested_transfer(l: u32, ) -> Weight {
(97_119_000 as Weight)
// Standard Error: 13_000
.saturating_add((124_000 as Weight).saturating_mul(l as Weight))
fn force_vested_transfer(l: u32, _s: u32, ) -> Weight {
(174_000_000 as Weight)
// Standard Error: 70_000
.saturating_add((143_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(101_778_000 as Weight)
// Standard Error: 17_000
.saturating_add((194_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 48_000
.saturating_add((361_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(104_111_000 as Weight)
// Standard Error: 88_000
.saturating_add((276_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 240_000
.saturating_add((194_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
}

4 changes: 3 additions & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ impl claims::Config for Runtime {
}

parameter_types! {
pub storage MinVestedTransfer: Balance = 100 * DOLLARS;
pub const MinVestedTransfer: Balance = 100 * DOLLARS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change being made?

sounds like instead you should be placing something within a externalities environment instead of doing this

pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -442,6 +443,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type MaxVestingSchedules = MaxVestingSchedules;
}

impl pallet_sudo::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ impl pallet_recovery::Config for Runtime {

parameter_types! {
pub const MinVestedTransfer: Balance = 100 * CENTS;
pub const MaxVestingSchedules: u32 = 28;
}

impl pallet_vesting::Config for Runtime {
Expand All @@ -640,6 +641,7 @@ impl pallet_vesting::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
type MaxVestingSchedules = MaxVestingSchedules;
}

impl pallet_sudo::Config for Runtime {
Expand Down
76 changes: 50 additions & 26 deletions runtime/westend/src/weights/pallet_vesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,70 @@ use sp_std::marker::PhantomData;
/// Weight functions for pallet_vesting.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_vesting::WeightInfo for WeightInfo<T> {
fn vest_locked(l: u32, ) -> Weight {
(42_241_000 as Weight)
// Standard Error: 13_000
.saturating_add((220_000 as Weight).saturating_mul(l as Weight))
fn vest_locked(l: u32, s: u32, ) -> Weight {
(93_789_000 as Weight)
// Standard Error: 70_000
.saturating_add((41_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 182_000
.saturating_add((211_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_unlocked(l: u32, ) -> Weight {
(45_263_000 as Weight)
// Standard Error: 10_000
.saturating_add((188_000 as Weight).saturating_mul(l as Weight))
fn vest_unlocked(_l: u32, s: u32, ) -> Weight {
(90_737_000 as Weight)
// Standard Error: 0
.saturating_add((263_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn vest_other_locked(l: u32, ) -> Weight {
(41_538_000 as Weight)
fn vest_other_locked(l: u32, s: u32, ) -> Weight {
(85_211_000 as Weight)
// Standard Error: 17_000
.saturating_add((239_000 as Weight).saturating_mul(l as Weight))
.saturating_add((153_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((289_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vest_other_unlocked(l: u32, ) -> Weight {
(44_715_000 as Weight)
// Standard Error: 13_000
.saturating_add((207_000 as Weight).saturating_mul(l as Weight))
fn vest_other_unlocked(l: u32, s: u32, ) -> Weight {
(90_368_000 as Weight)
// Standard Error: 17_000
.saturating_add((31_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 45_000
.saturating_add((132_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn vested_transfer(l: u32, ) -> Weight {
(100_413_000 as Weight)
// Standard Error: 13_000
.saturating_add((103_000 as Weight).saturating_mul(l as Weight))
fn vested_transfer(l: u32, _s: u32, ) -> Weight {
(167_500_000 as Weight)
// Standard Error: 194_000
.saturating_add((255_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn force_vested_transfer(l: u32, ) -> Weight {
(99_525_000 as Weight)
// Standard Error: 13_000
.saturating_add((108_000 as Weight).saturating_mul(l as Weight))
fn force_vested_transfer(l: u32, _s: u32, ) -> Weight {
(174_000_000 as Weight)
// Standard Error: 70_000
.saturating_add((143_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
}
fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(101_778_000 as Weight)
// Standard Error: 17_000
.saturating_add((194_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 48_000
.saturating_add((361_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight {
(104_111_000 as Weight)
// Standard Error: 88_000
.saturating_add((276_000 as Weight).saturating_mul(l as Weight))
// Standard Error: 240_000
.saturating_add((194_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
}