Skip to content

Commit e14b22b

Browse files
committed
fix westend
1 parent 42a0b9d commit e14b22b

File tree

3 files changed

+3
-103
lines changed

3 files changed

+3
-103
lines changed

polkadot/runtime/westend/src/weights/pallet_staking.rs

-82
Original file line numberDiff line numberDiff line change
@@ -714,60 +714,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
714714
.saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into()))
715715
.saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into()))
716716
}
717-
/// Storage: `VoterList::CounterForListNodes` (r:1 w:0)
718-
/// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
719-
/// Storage: `VoterList::ListBags` (r:178 w:0)
720-
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
721-
/// Storage: `VoterList::ListNodes` (r:2000 w:0)
722-
/// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`)
723-
/// Storage: `Staking::Bonded` (r:2000 w:0)
724-
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
725-
/// Storage: `Staking::Ledger` (r:2000 w:0)
726-
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
727-
/// Storage: `Staking::Nominators` (r:2000 w:0)
728-
/// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`)
729-
/// Storage: `Staking::Validators` (r:1000 w:0)
730-
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
731-
/// Storage: `Staking::MinimumActiveStake` (r:0 w:1)
732-
/// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
733-
/// The range of component `v` is `[500, 1000]`.
734-
/// The range of component `n` is `[500, 1000]`.
735-
fn get_npos_voters(v: u32, n: u32, ) -> Weight {
736-
// Proof Size summary in bytes:
737-
// Measured: `3141 + n * (907 ±0) + v * (391 ±0)`
738-
// Estimated: `456136 + n * (3566 ±0) + v * (3566 ±0)`
739-
// Minimum execution time: 42_790_195_000 picoseconds.
740-
Weight::from_parts(42_954_437_000, 0)
741-
.saturating_add(Weight::from_parts(0, 456136))
742-
// Standard Error: 478_107
743-
.saturating_add(Weight::from_parts(6_744_044, 0).saturating_mul(v.into()))
744-
// Standard Error: 478_107
745-
.saturating_add(Weight::from_parts(4_837_739, 0).saturating_mul(n.into()))
746-
.saturating_add(T::DbWeight::get().reads(179))
747-
.saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into())))
748-
.saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into())))
749-
.saturating_add(T::DbWeight::get().writes(1))
750-
.saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into()))
751-
.saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into()))
752-
}
753-
/// Storage: `Staking::CounterForValidators` (r:1 w:0)
754-
/// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
755-
/// Storage: `Staking::Validators` (r:1001 w:0)
756-
/// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
757-
/// The range of component `v` is `[500, 1000]`.
758-
fn get_npos_targets(v: u32, ) -> Weight {
759-
// Proof Size summary in bytes:
760-
// Measured: `979 + v * (50 ±0)`
761-
// Estimated: `3510 + v * (2520 ±0)`
762-
// Minimum execution time: 2_851_801_000 picoseconds.
763-
Weight::from_parts(4_477_533, 0)
764-
.saturating_add(Weight::from_parts(0, 3510))
765-
// Standard Error: 8_644
766-
.saturating_add(Weight::from_parts(5_811_682, 0).saturating_mul(v.into()))
767-
.saturating_add(T::DbWeight::get().reads(2))
768-
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into())))
769-
.saturating_add(Weight::from_parts(0, 2520).saturating_mul(v.into()))
770-
}
771717
/// Storage: `Staking::MinCommission` (r:0 w:1)
772718
/// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
773719
/// Storage: `Staking::MinValidatorBond` (r:0 w:1)
@@ -915,34 +861,6 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
915861
.saturating_add(T::DbWeight::get().reads(6))
916862
.saturating_add(T::DbWeight::get().writes(2))
917863
}
918-
/// Storage: `Staking::ActiveEra` (r:1 w:0)
919-
/// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
920-
/// Storage: `Staking::UnappliedSlashes` (r:1 w:1)
921-
/// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: Some(3231), added: 5706, mode: `MaxEncodedLen`)
922-
/// Storage: `Staking::Bonded` (r:65 w:0)
923-
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
924-
/// Storage: `Staking::Ledger` (r:65 w:65)
925-
/// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`)
926-
/// Storage: `NominationPools::ReversePoolIdLookup` (r:65 w:0)
927-
/// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
928-
/// Storage: `DelegatedStaking::Agents` (r:65 w:65)
929-
/// Proof: `DelegatedStaking::Agents` (`max_values`: None, `max_size`: Some(120), added: 2595, mode: `MaxEncodedLen`)
930-
/// Storage: `System::Account` (r:65 w:65)
931-
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
932-
/// Storage: `Staking::VirtualStakers` (r:65 w:0)
933-
/// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
934-
/// Storage: `Balances::Holds` (r:65 w:65)
935-
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(103), added: 2578, mode: `MaxEncodedLen`)
936-
fn apply_slash() -> Weight {
937-
// Proof Size summary in bytes:
938-
// Measured: `29228`
939-
// Estimated: `232780`
940-
// Minimum execution time: 3_571_461_000 picoseconds.
941-
Weight::from_parts(3_638_696_000, 0)
942-
.saturating_add(Weight::from_parts(0, 232780))
943-
.saturating_add(T::DbWeight::get().reads(457))
944-
.saturating_add(T::DbWeight::get().writes(261))
945-
}
946864
/// Storage: `Staking::CurrentEra` (r:1 w:0)
947865
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
948866
/// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0)

substrate/frame/election-provider-support/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ use sp_runtime::{
188188

189189
pub use bounds::DataProviderBounds;
190190
pub use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
191+
/// Re-export the solution generation macro.
192+
pub use frame_election_provider_solution_type::generate_solution_type;
191193
pub use frame_support::{traits::Get, weights::Weight, BoundedVec};
192194
/// Re-export some type as they are used in the interface.
193195
pub use sp_arithmetic::PerThing;

substrate/frame/staking/src/tests.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -9694,9 +9694,6 @@ fn manual_slashing_works() {
96949694
slash_fraction_1
96959695
));
96969696

9697-
// process offence
9698-
advance_blocks(1);
9699-
97009697
// check if balance was slashed correctly (25%)
97019698
let balance_after_first_slash = Staking::slashable_balance_of(&validator_stash);
97029699
let expected_balance_1 = initial_balance - (initial_balance / 4); // 25% slash
@@ -9730,18 +9727,7 @@ fn manual_slashing_works() {
97309727
"Balance changed after slashing with smaller fraction"
97319728
);
97329729

9733-
// with the new implementation, we should see an OffenceReported event
9734-
// but no Slashed event yet as the slash will be queued
9735-
let has_offence_reported = System::events().iter().any(|record| {
9736-
matches!(
9737-
record.event,
9738-
RuntimeEvent::Staking(Event::<Test>::Slashed { staker, .. })
9739-
if staker == validator_stash
9740-
)
9741-
});
9742-
assert!(has_offence_reported, "No OffenceReported event was emitted");
9743-
9744-
// verify no Slashed event was emitted yet (since it's queued for later processing)
9730+
// verify no Slashed event since slash fraction is lower than previous
97459731
let no_slashed_events = !System::events().iter().any(|record| {
97469732
matches!(record.event, RuntimeEvent::Staking(Event::<Test>::Slashed { .. }))
97479733
});
@@ -9761,9 +9747,6 @@ fn manual_slashing_works() {
97619747
slash_fraction_3
97629748
));
97639749

9764-
// process offence
9765-
advance_blocks(1);
9766-
97679750
// check if balance was further slashed (from 75% to 50% of original)
97689751
let balance_after_third_slash = Staking::slashable_balance_of(&validator_stash);
97699752
let expected_balance_3 = initial_balance / 2; // 50% of original
@@ -9807,9 +9790,6 @@ fn manual_slashing_works() {
98079790
Perbill::from_percent(75)
98089791
));
98099792

9810-
// process offence
9811-
advance_blocks(1);
9812-
98139793
// check balance was further reduced
98149794
let balance_after_fifth_slash = Staking::slashable_balance_of(&validator_stash);
98159795
let expected_balance_5 = initial_balance / 4; // 25% of original (75% slashed)

0 commit comments

Comments
 (0)