mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 12:01:12 +00:00
staking: Proportional ledger slashing (#10982)
* staking: Proportional ledger slashing * Some comment cleanup * Update frame/staking/src/pallet/mod.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Fix benchmarks * FMT * Try fill in all staking configs * round of feedback and imp from kian * demonstrate per_thing usage * Update some tests * FMT * Test that era offset works correctly * Update mocks * Remove unnescary docs * Remove unlock_era * Update frame/staking/src/lib.rs * Adjust tests to account for only remove when < ED * Remove stale TODOs * Remove dupe test Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
@@ -75,8 +75,22 @@ pub mod pallet {
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config + SendTransactionTypes<Call<Self>> {
|
||||
/// The staking balance.
|
||||
type Currency: LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>;
|
||||
|
||||
type Currency: LockableCurrency<
|
||||
Self::AccountId,
|
||||
Moment = Self::BlockNumber,
|
||||
Balance = Self::CurrencyBalance,
|
||||
>;
|
||||
/// Just the `Currency::Balance` type; we have this item to allow us to constrain it to
|
||||
/// `From<u64>`.
|
||||
type CurrencyBalance: sp_runtime::traits::AtLeast32BitUnsigned
|
||||
+ codec::FullCodec
|
||||
+ Copy
|
||||
+ MaybeSerializeDeserialize
|
||||
+ sp_std::fmt::Debug
|
||||
+ Default
|
||||
+ From<u64>
|
||||
+ TypeInfo
|
||||
+ MaxEncodedLen;
|
||||
/// Time used for computing era duration.
|
||||
///
|
||||
/// It is guaranteed to start being called from the first `on_finalize`. Thus value at
|
||||
@@ -177,6 +191,10 @@ pub mod pallet {
|
||||
#[pallet::constant]
|
||||
type MaxUnlockingChunks: Get<u32>;
|
||||
|
||||
/// A hook called when any staker is slashed. Mostly likely this can be a no-op unless
|
||||
/// other pallets exist that are affected by slashing per-staker.
|
||||
type OnStakerSlash: sp_staking::OnStakerSlash<Self::AccountId, BalanceOf<Self>>;
|
||||
|
||||
/// Some parameters of the benchmarking.
|
||||
type BenchmarkingConfig: BenchmarkingConfig;
|
||||
|
||||
@@ -239,8 +257,7 @@ pub mod pallet {
|
||||
/// Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn ledger)]
|
||||
pub type Ledger<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, T::AccountId, StakingLedger<T::AccountId, BalanceOf<T>>>;
|
||||
pub type Ledger<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, StakingLedger<T>>;
|
||||
|
||||
/// Where the reward payment should be made. Keyed by stash.
|
||||
#[pallet::storage]
|
||||
|
||||
Reference in New Issue
Block a user