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

Generate storage info for Pallet Staking #9864

Closed
wants to merge 82 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
9cb610c
Updating broken website link
Sep 20, 2021
5fba3bb
Updating rust example to FRAME 2.0 syntax
Sep 20, 2021
6d46910
Start of the implementation of adding storage_info
Sep 20, 2021
04d55f3
Continuing adding storage_info to pallet staking
Sep 21, 2021
a55274a
Implementing `MaxEncodedLen` on `PerThing`
Sep 21, 2021
578284f
Adding `force_push` to `WeakBoundedVec`
Sep 21, 2021
6a2a06e
Continue adding storage_info to staking pallet
Sep 22, 2021
97c4c9f
Implementing `PartialOrd` on `WeakBoundedVec`
Sep 22, 2021
d6ebf74
Implementing `Ord` for `WeakBoundedVec`
Sep 22, 2021
7c60ac5
Implementing `force_insert` on `WeakBoundedVec`
Sep 22, 2021
1fc848f
Implementing `truncate` on `WeakBoundedVec`
Sep 22, 2021
06830eb
Moved const `MAX_NOMINATIONS` to be a type
Sep 23, 2021
df969c6
Add `drain` to `BoundedVec` and `WeakBoundedVec`
Sep 23, 2021
8b4392a
Implementing `sort_by` on `WeakBoundedVec`
Sep 24, 2021
fc54a66
Implement `entry` on `BoundedBTreeMap`
Sep 24, 2021
8e358e5
Implement `last_mut` on `BoundedVec`
Sep 24, 2021
6f10ad3
Implement `pop` on `BoundedVec`
Sep 24, 2021
d415c3b
Implement `iter_mut` on `BoundedVec`
Sep 25, 2021
4563cab
Adding `storage_info` to pallet `staking`
Sep 25, 2021
7d6c9b6
Radical change: moving `MaxValidatorsCount` from
Sep 25, 2021
f0201b9
Merge branch 'master' of https://github.com/paritytech/substrate into…
Sep 25, 2021
243e038
Cleanups
Sep 25, 2021
e16f995
Fixing tests and some refactoring
Sep 25, 2021
5604e90
Fixed test cases
Sep 25, 2021
7473eca
Fixing docs
Sep 25, 2021
55d9d93
Fixing other pallets' tests
Sep 25, 2021
37d5d35
Fixing README
Sep 25, 2021
2dce1f1
Fixing test benchmarks
Sep 25, 2021
68fc710
fixing benchmark tests
Sep 25, 2021
abe2d61
Changing naming from `Nb` to `Count` nomenclature
Sep 26, 2021
a8f9dcc
Stop globally importing `ConstU32` and annotate
Sep 26, 2021
f8b5e80
No need for a full description, only scope is
Sep 26, 2021
87613b8
Only scope is needed in message
Sep 26, 2021
1230145
Better documentation punctuation
Sep 26, 2021
b83cda7
Removing few `[pallet::constant]`
Sep 26, 2021
a097ab6
Making MAX_UNLOCKING_CHUNKS become a runtime
Sep 26, 2021
b8e8559
Adding punctuation to documentation.
Sep 26, 2021
98526da
Fixing tests after changes to `MaxUnlockingChunks`
Sep 26, 2021
cc6729b
Test fixes
Sep 26, 2021
0c8fa9f
Test fixes
Sep 26, 2021
a024de5
Adding `MaxIndividualExposures` replacing
Sep 26, 2021
de68fd2
Fixing tests after adding `MaxIndividualExposures`
Sep 26, 2021
d3d61da
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Sep 26, 2021
531f43a
Removing trailing whitespace
Sep 26, 2021
a9eef28
Merge branch 'staking-storage-info' of https://github.com/georgesdib/…
Sep 26, 2021
84d2b13
Fixing tests post merge
Sep 26, 2021
a2f7055
fmt
Sep 26, 2021
5705c25
Renaming `MaxNominatorRewardedPerValidator` to
Sep 27, 2021
38b4554
Merge branch 'master' of https://github.com/paritytech/substrate into…
Oct 2, 2021
2577c7d
Implementing `OrdNoBound` derive trait
Oct 2, 2021
0e6455a
Adding tests for `OrdNoBound`
Oct 2, 2021
a629627
Fixing tests, I must be running a different
Oct 2, 2021
c51b29c
* Increasing `MaxIndividualExposures`
Oct 12, 2021
f35b5d2
Merge branch 'master' into staking-storage-info
Oct 12, 2021
545a98a
Make `OffendingValidators` a `BoundedVec`
Oct 12, 2021
e8aff29
Fixing fmt
Oct 12, 2021
a53cfc9
fmt
Oct 12, 2021
9105c63
fmt
Oct 12, 2021
570f7cb
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Oct 13, 2021
9cd2bd6
Fixing tests
Oct 13, 2021
d70e2e6
Merge branch 'staking-storage-info' of https://github.com/georgesdib/…
Oct 13, 2021
fe2ee23
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Oct 28, 2021
6ccb25c
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Oct 30, 2021
522d3bd
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Oct 30, 2021
2daef3c
Merge branch 'master' into staking-storage-info
georgesdib Nov 11, 2021
fe493f0
Add `max-encoded-len` to `sp-primitives`
Nov 11, 2021
e21ca66
Merge branch 'paritytech:master' into staking-storage-info
georgesdib Nov 13, 2021
0cdd216
Adding version to `remote-externalities`
Nov 13, 2021
3cd8b1d
Merge branch 'staking-storage-info' of https://github.com/georgesdib/…
Nov 13, 2021
956c888
Adding version to `frame-support`
Nov 13, 2021
370254a
Merge branch 'master' of upstream
Nov 14, 2021
6aa99e7
Fixes after changes to `StakingLedger` tests
Nov 19, 2021
4373245
Merge upstream into staking-storage-info
Nov 19, 2021
235defd
Fixing some tests
Nov 19, 2021
1fb3ee6
Merge remote branch
Dec 31, 2021
aeef7bc
Merge pull request #35 from paritytech/master
georgesdib Dec 31, 2021
2820306
Fixing doc issues, `last_mut` and `iter_mut`
Dec 31, 2021
0171201
Fixing tests
Dec 31, 2021
4fb8fed
Merge branch 'staking-storage-info' of https://github.com/georgesdib/…
Dec 31, 2021
0093dc6
Cleanups
Dec 31, 2021
49e8eb8
Adding missing `pub`
Dec 31, 2021
1f458da
removing unneeded import
Dec 31, 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
2 changes: 1 addition & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ criterion = { version = "0.3.5", features = [ "async_tokio" ] }
tokio = { version = "1.15", features = ["macros", "time"] }
jsonrpsee-ws-client = "0.4.1"
wait-timeout = "0.2"
remote-externalities = { path = "../../../utils/frame/remote-externalities" }
remote-externalities = { version = "0.10.0-dev", path = "../../../utils/frame/remote-externalities" }
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }

[build-dependencies]
Expand Down
26 changes: 16 additions & 10 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU128, ConstU16, ConstU32, Currency, EnsureOneOf, EqualPrivilegeOnly, Everything,
Imbalance, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced,
U128CurrencyToVote,
ConstU128, ConstU16, ConstU32, ConstU64, Currency, EnsureOneOf, EqualPrivilegeOnly,
Everything, Imbalance, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing,
OnUnbalanced, U128CurrencyToVote,
},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
Expand Down Expand Up @@ -503,7 +503,7 @@ impl pallet_session::Config for Runtime {
}

impl pallet_session::historical::Config for Runtime {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentification = pallet_staking::Exposure<AccountId, Balance, MaxIndividualExposures>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}

Expand All @@ -523,8 +523,8 @@ parameter_types! {
pub const BondingDuration: pallet_staking::EraIndex = 24 * 28;
pub const SlashDeferDuration: pallet_staking::EraIndex = 24 * 7; // 1/4 the bonding duration.
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxIndividualExposures: u32 = 10_000;
pub OffchainRepeat: BlockNumber = 5;
}

Expand All @@ -541,7 +541,6 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
}

impl pallet_staking::Config for Runtime {
const MAX_NOMINATIONS: u32 = MAX_NOMINATIONS;
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = U128CurrencyToVote;
Expand All @@ -560,14 +559,23 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type MaxRewardableIndividualExposures = ConstU32<256>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
// Alternatively, use pallet_staking::UseNominatorsMap<Runtime> to just use the nominators map.
// Note that the aforementioned does not scale to a very large number of nominators.
type SortedListProvider = BagsList;
type WeightInfo = pallet_staking::weights::SubstrateWeight<Runtime>;
type MaxIndividualExposures = MaxIndividualExposures;
type MaxNominations = ConstU32<MAX_NOMINATIONS>;
type MaxUnappliedSlashes = ConstU32<1_000>;
type MaxInvulnerablesCount = ConstU32<10>;
type MaxHistoryDepth = ConstU32<10_000>;
type MaxReportersCount = ConstU32<1_000>;
type MaxPriorSlashingSpans = ConstU32<1_000>;
type MaxValidatorsCount = ConstU32<4_000>;
type MaxUnlockingChunks = ConstU32<32>;
type BenchmarkingConfig = StakingBenchmarkingConfig;
}

Expand All @@ -584,7 +592,6 @@ parameter_types! {
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(1u32, 10_000);

// miner configs
pub const MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64;
pub MinerMaxWeight: Weight = RuntimeBlockWeights::get()
.get(DispatchClass::Normal)
.max_extrinsic.expect("Normal extrinsics have a weight limit configured; qed")
Expand Down Expand Up @@ -657,7 +664,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type OffchainRepeat = OffchainRepeat;
type MinerMaxWeight = MinerMaxWeight;
type MinerMaxLength = MinerMaxLength;
type MinerTxPriority = MultiPhaseUnsignedPriority;
type MinerTxPriority = ConstU64<{ TransactionPriority::max_value() / 2 - 1u64 }>;
type SignedMaxSubmissions = ConstU32<10>;
type SignedRewardBase = SignedRewardBase;
type SignedDepositBase = SignedDepositBase;
Expand Down Expand Up @@ -969,7 +976,6 @@ impl pallet_sudo::Config for Runtime {
parameter_types! {
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
/// We prioritize im-online heartbeats over election solution submission.
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
pub const MaxAuthorities: u32 = 100;
pub const MaxKeys: u32 = 10_000;
pub const MaxPeerInHeartbeats: u32 = 10_000;
Expand Down
15 changes: 12 additions & 3 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl pallet_session::Config for Test {
}

impl pallet_session::historical::Config for Test {
type FullIdentification = pallet_staking::Exposure<u64, u128>;
type FullIdentification = pallet_staking::Exposure<u64, u128, MaxIndividualExposures>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}

Expand Down Expand Up @@ -172,6 +172,7 @@ parameter_types! {
pub const SlashDeferDuration: EraIndex = 0;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(16);
pub const MaxIndividualExposures: u32 = 64;
}

impl onchain::Config for Test {
Expand All @@ -180,7 +181,6 @@ impl onchain::Config for Test {
}

impl pallet_staking::Config for Test {
const MAX_NOMINATIONS: u32 = 16;
type RewardRemainder = ();
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type Event = Event;
Expand All @@ -194,7 +194,16 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type UnixTime = pallet_timestamp::Pallet<Test>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxRewardableIndividualExposures = ConstU32<64>;
type MaxIndividualExposures = MaxIndividualExposures;
type MaxNominations = ConstU32<16>;
type MaxUnappliedSlashes = ConstU32<1_000>;
type MaxInvulnerablesCount = ConstU32<10>;
type MaxHistoryDepth = ConstU32<10_000>;
type MaxReportersCount = ConstU32<1_000>;
type MaxPriorSlashingSpans = ConstU32<1_000>;
type MaxValidatorsCount = ConstU32<4_000>;
type MaxUnlockingChunks = ConstU32<32>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
Expand Down
8 changes: 4 additions & 4 deletions frame/babe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ fn report_equivocation_current_session_works() {

assert_eq!(
Staking::eras_stakers(1, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}

Expand Down Expand Up @@ -456,7 +456,7 @@ fn report_equivocation_current_session_works() {
assert_eq!(Staking::slashable_balance_of(&offending_validator_id), 0);
assert_eq!(
Staking::eras_stakers(2, offending_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
pallet_staking::Exposure { total: 0, own: 0, others: Default::default() },
);

// check that the balances of all other validators are left intact.
Expand All @@ -469,7 +469,7 @@ fn report_equivocation_current_session_works() {
assert_eq!(Staking::slashable_balance_of(validator), 10_000);
assert_eq!(
Staking::eras_stakers(2, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}
})
Expand Down Expand Up @@ -528,7 +528,7 @@ fn report_equivocation_old_session_works() {
assert_eq!(Staking::slashable_balance_of(&offending_validator_id), 0);
assert_eq!(
Staking::eras_stakers(3, offending_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
pallet_staking::Exposure { total: 0, own: 0, others: Default::default() },
);
})
}
Expand Down
7 changes: 4 additions & 3 deletions frame/election-provider-multi-phase/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn set_up_data_provider<T: Config>(v: u32, t: u32) {
info,
"setting up with voters = {} [degree = {}], targets = {}",
v,
T::DataProvider::MAXIMUM_VOTES_PER_VOTER,
<T::DataProvider as ElectionDataProvider>::MaximumVotesPerVoter::get(),
t
);

Expand All @@ -165,8 +165,9 @@ fn set_up_data_provider<T: Config>(v: u32, t: u32) {
})
.collect::<Vec<_>>();
// we should always have enough voters to fill.
assert!(targets.len() > T::DataProvider::MAXIMUM_VOTES_PER_VOTER as usize);
targets.truncate(T::DataProvider::MAXIMUM_VOTES_PER_VOTER as usize);
let max_votes = <T::DataProvider as ElectionDataProvider>::MaximumVotesPerVoter::get() as usize;
assert!(targets.len() > max_votes);
targets.truncate(max_votes);

// fill voters.
(0..v).for_each(|i| {
Expand Down
2 changes: 1 addition & 1 deletion frame/election-provider-multi-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ pub mod pallet {
// NOTE that this pallet does not really need to enforce this in runtime. The
// solution cannot represent any voters more than `LIMIT` anyhow.
assert_eq!(
<T::DataProvider as ElectionDataProvider>::MAXIMUM_VOTES_PER_VOTER,
<T::DataProvider as ElectionDataProvider>::MaximumVotesPerVoter::get(),
<SolutionOf<T> as NposSolution>::LIMIT as u32,
);
}
Expand Down
3 changes: 2 additions & 1 deletion frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,11 @@ pub type Extrinsic = sp_runtime::testing::TestXt<Call, ()>;
pub struct ExtBuilder {}

pub struct StakingMock;

impl ElectionDataProvider for StakingMock {
type AccountId = AccountId;
type BlockNumber = u64;
const MAXIMUM_VOTES_PER_VOTER: u32 = <TestNposSolution as NposSolution>::LIMIT as u32;
type MaximumVotesPerVoter = ConstU32<{ <TestNposSolution as NposSolution>::LIMIT as u32 }>;
fn targets(maybe_max_len: Option<usize>) -> data_provider::Result<Vec<AccountId>> {
let targets = Targets::get();

Expand Down
6 changes: 3 additions & 3 deletions frame/election-provider-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
//! impl<T: Config> ElectionDataProvider for Pallet<T> {
//! type AccountId = AccountId;
//! type BlockNumber = BlockNumber;
//! const MAXIMUM_VOTES_PER_VOTER: u32 = 1;
//! type MaximumVotesPerVoter = frame_support::pallet_prelude::ConstU32<1>;
//!
//! fn desired_targets() -> data_provider::Result<u32> {
//! Ok(1)
Expand Down Expand Up @@ -191,7 +191,7 @@ pub trait ElectionDataProvider {
type BlockNumber;

/// Maximum number of votes per voter that this data provider is providing.
const MAXIMUM_VOTES_PER_VOTER: u32;
type MaximumVotesPerVoter: Get<u32>;

/// All possible targets for the election, i.e. the candidates.
///
Expand Down Expand Up @@ -266,8 +266,8 @@ pub struct TestDataProvider<X>(sp_std::marker::PhantomData<X>);
impl<AccountId, BlockNumber> ElectionDataProvider for TestDataProvider<(AccountId, BlockNumber)> {
type AccountId = AccountId;
type BlockNumber = BlockNumber;
type MaximumVotesPerVoter = frame_support::pallet_prelude::ConstU32<0>;

const MAXIMUM_VOTES_PER_VOTER: u32 = 0;
fn targets(_maybe_max_len: Option<usize>) -> data_provider::Result<Vec<AccountId>> {
Ok(Default::default())
}
Expand Down
4 changes: 3 additions & 1 deletion frame/election-provider-support/src/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ mod tests {
use crate::data_provider;

pub struct DataProvider;

impl ElectionDataProvider for DataProvider {
type AccountId = AccountId;
type BlockNumber = BlockNumber;
const MAXIMUM_VOTES_PER_VOTER: u32 = 2;
type MaximumVotesPerVoter = frame_support::pallet_prelude::ConstU32<2>;

fn voters(
_: Option<usize>,
) -> data_provider::Result<Vec<(AccountId, VoteWeight, Vec<AccountId>)>> {
Expand Down
17 changes: 12 additions & 5 deletions frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl pallet_session::Config for Test {
}

impl pallet_session::historical::Config for Test {
type FullIdentification = pallet_staking::Exposure<u64, u128>;
type FullIdentification = pallet_staking::Exposure<u64, u128, MaxIndividualExposures>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}

Expand Down Expand Up @@ -176,9 +176,8 @@ parameter_types! {
pub const SlashDeferDuration: EraIndex = 0;
pub const AttestationPeriod: u64 = 100;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const ElectionLookahead: u64 = 0;
pub const StakingUnsignedPriority: u64 = u64::MAX / 2;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxIndividualExposures: u32 = 64;
}

impl onchain::Config for Test {
Expand All @@ -187,7 +186,6 @@ impl onchain::Config for Test {
}

impl pallet_staking::Config for Test {
const MAX_NOMINATIONS: u32 = 16;
type RewardRemainder = ();
type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote;
type Event = Event;
Expand All @@ -201,7 +199,16 @@ impl pallet_staking::Config for Test {
type SessionInterface = Self;
type UnixTime = pallet_timestamp::Pallet<Test>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type MaxRewardableIndividualExposures = ConstU32<64>;
type MaxIndividualExposures = MaxIndividualExposures;
type MaxNominations = ConstU32<16>;
type MaxUnappliedSlashes = ConstU32<1_000>;
type MaxInvulnerablesCount = ConstU32<10>;
type MaxHistoryDepth = ConstU32<10_000>;
type MaxReportersCount = ConstU32<1_000>;
type MaxPriorSlashingSpans = ConstU32<1_000>;
type MaxValidatorsCount = ConstU32<4_000>;
type MaxUnlockingChunks = ConstU32<32>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
Expand Down
12 changes: 6 additions & 6 deletions frame/grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ fn report_equivocation_current_set_works() {

assert_eq!(
Staking::eras_stakers(1, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}

Expand Down Expand Up @@ -373,7 +373,7 @@ fn report_equivocation_current_set_works() {
assert_eq!(Staking::slashable_balance_of(&equivocation_validator_id), 0);
assert_eq!(
Staking::eras_stakers(2, equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
pallet_staking::Exposure { total: 0, own: 0, others: Default::default() },
);

// check that the balances of all other validators are left intact.
Expand All @@ -387,7 +387,7 @@ fn report_equivocation_current_set_works() {

assert_eq!(
Staking::eras_stakers(2, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}
});
Expand Down Expand Up @@ -419,7 +419,7 @@ fn report_equivocation_old_set_works() {

assert_eq!(
Staking::eras_stakers(2, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}

Expand Down Expand Up @@ -452,7 +452,7 @@ fn report_equivocation_old_set_works() {

assert_eq!(
Staking::eras_stakers(3, equivocation_validator_id),
pallet_staking::Exposure { total: 0, own: 0, others: vec![] },
pallet_staking::Exposure { total: 0, own: 0, others: Default::default() },
);

// check that the balances of all other validators are left intact.
Expand All @@ -466,7 +466,7 @@ fn report_equivocation_old_set_works() {

assert_eq!(
Staking::eras_stakers(3, validator),
pallet_staking::Exposure { total: 10_000, own: 10_000, others: vec![] },
pallet_staking::Exposure { total: 10_000, own: 10_000, others: Default::default() },
);
}
});
Expand Down
Loading