mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
Rewards and slashing, early-exit of bad sessions (#234)
* Recompile runtime. * Introduce and enforce block time * Introduce early session ending. * Report most of staking module * rewards, proper early exit and slashing * Fix build & session logic, introduce tests * Fixed staking tests. * Initial test for reward * Fix test * Tests for slashing * Update/fix preset configs * Fix some tests. * Fix some staking tests * Minor fix * minor cleanups * Fix build * Rename timestamp::Value -> Moment * Require final block of session to be timely
This commit is contained in:
@@ -33,7 +33,7 @@ use rstd::marker::PhantomData;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use {runtime_io, runtime_primitives};
|
||||
|
||||
pub trait Trait: system::Trait<Hash = primitives::Hash> + session::Trait {
|
||||
pub trait Trait: session::Trait<Hash = primitives::Hash> {
|
||||
/// The position of the set_heads call in the block.
|
||||
const SET_POSITION: u32;
|
||||
|
||||
@@ -232,7 +232,7 @@ mod tests {
|
||||
use runtime_primitives::BuildStorage;
|
||||
use runtime_primitives::traits::{HasPublicAux, Identity, BlakeTwo256};
|
||||
use runtime_primitives::testing::{Digest, Header};
|
||||
use consensus;
|
||||
use {consensus, timestamp};
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
@@ -254,6 +254,11 @@ mod tests {
|
||||
}
|
||||
impl session::Trait for Test {
|
||||
type ConvertAccountIdToSessionKey = Identity;
|
||||
type OnSessionChange = ();
|
||||
}
|
||||
impl timestamp::Trait for Test {
|
||||
const TIMESTAMP_SET_POSITION: u32 = 0;
|
||||
type Moment = u64;
|
||||
}
|
||||
impl Trait for Test {
|
||||
const SET_POSITION: u32 = 0;
|
||||
@@ -272,6 +277,7 @@ mod tests {
|
||||
t.extend(session::GenesisConfig::<Test>{
|
||||
session_length: 1000,
|
||||
validators: vec![1, 2, 3, 4, 5, 6, 7, 8],
|
||||
broken_percent_late: 100,
|
||||
}.build_storage());
|
||||
t.extend(GenesisConfig::<Test>{
|
||||
parachains: parachains,
|
||||
|
||||
Reference in New Issue
Block a user