Commit 5d4e853e authored by Cecile Tonglet's avatar Cecile Tonglet
Browse files

Update from parent 'origin/master' (no conflict)

Commit: c130ab1e
Parent branch: origin/master
Forked at: 77de8b91
parents b835d3f3 c130ab1e
This diff is collapsed.
...@@ -1205,6 +1205,7 @@ mod tests { ...@@ -1205,6 +1205,7 @@ mod tests {
BlakeTwo256, IdentityLookup, SaturatedConversion, BlakeTwo256, IdentityLookup, SaturatedConversion,
OpaqueKeys, OpaqueKeys,
}, },
testing::TestXt,
}; };
use primitives::{ use primitives::{
parachain::{ parachain::{
...@@ -1239,6 +1240,7 @@ mod tests { ...@@ -1239,6 +1240,7 @@ mod tests {
impl_outer_dispatch! { impl_outer_dispatch! {
pub enum Call for Test where origin: Origin { pub enum Call for Test where origin: Origin {
parachains::Parachains, parachains::Parachains,
staking::Staking,
} }
} }
...@@ -1304,6 +1306,7 @@ mod tests { ...@@ -1304,6 +1306,7 @@ mod tests {
type ValidatorId = u64; type ValidatorId = u64;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>; type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = session::PeriodicSessions<Period, Offset>;
type SessionManager = session::historical::NoteHistoricalRoot<Self, Staking>; type SessionManager = session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = TestSessionHandler; type SessionHandler = TestSessionHandler;
type Keys = TestSessionKeys; type Keys = TestSessionKeys;
...@@ -1375,6 +1378,7 @@ mod tests { ...@@ -1375,6 +1378,7 @@ mod tests {
pub const AttestationPeriod: BlockNumber = 100; pub const AttestationPeriod: BlockNumber = 100;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const MaxNominatorRewardedPerValidator: u32 = 64;
pub const ElectionLookahead: BlockNumber = 0;
} }
pub struct CurrencyToVoteHandler; pub struct CurrencyToVoteHandler;
...@@ -1402,6 +1406,10 @@ mod tests { ...@@ -1402,6 +1406,10 @@ mod tests {
type UnixTime = timestamp::Module<Test>; type UnixTime = timestamp::Module<Test>;
type RewardCurve = RewardCurve; type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
} }
impl attestations::Trait for Test { impl attestations::Trait for Test {
......
...@@ -653,7 +653,7 @@ mod tests { ...@@ -653,7 +653,7 @@ mod tests {
traits::{ traits::{
BlakeTwo256, IdentityLookup, Dispatchable, BlakeTwo256, IdentityLookup, Dispatchable,
AccountIdConversion, AccountIdConversion,
}, testing::{UintAuthorityId, Header}, KeyTypeId, Perbill, curve::PiecewiseLinear, }, testing::{UintAuthorityId, Header, TestXt}, KeyTypeId, Perbill, curve::PiecewiseLinear,
}; };
use primitives::{ use primitives::{
parachain::{ parachain::{
...@@ -683,6 +683,7 @@ mod tests { ...@@ -683,6 +683,7 @@ mod tests {
pub enum Call for Test where origin: Origin { pub enum Call for Test where origin: Origin {
parachains::Parachains, parachains::Parachains,
registrar::Registrar, registrar::Registrar,
staking::Staking,
} }
} }
...@@ -779,6 +780,7 @@ mod tests { ...@@ -779,6 +780,7 @@ mod tests {
type SessionManager = (); type SessionManager = ();
type Keys = UintAuthorityId; type Keys = UintAuthorityId;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>; type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = session::PeriodicSessions<Period, Offset>;
type SessionHandler = session::TestSessionHandler; type SessionHandler = session::TestSessionHandler;
type Event = (); type Event = ();
type ValidatorId = u64; type ValidatorId = u64;
...@@ -789,6 +791,7 @@ mod tests { ...@@ -789,6 +791,7 @@ mod tests {
parameter_types! { parameter_types! {
pub const MaxHeadDataSize: u32 = 100; pub const MaxHeadDataSize: u32 = 100;
pub const MaxCodeSize: u32 = 100; pub const MaxCodeSize: u32 = 100;
pub const ElectionLookahead: BlockNumber = 0;
} }
impl staking::Trait for Test { impl staking::Trait for Test {
...@@ -806,6 +809,10 @@ mod tests { ...@@ -806,6 +809,10 @@ mod tests {
type UnixTime = timestamp::Module<Test>; type UnixTime = timestamp::Module<Test>;
type RewardCurve = RewardCurve; type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Test, TestXt<Call, ()>>;
} }
impl timestamp::Trait for Test { impl timestamp::Trait for Test {
...@@ -857,6 +864,8 @@ mod tests { ...@@ -857,6 +864,8 @@ mod tests {
type Slots = slots::Module<Test>; type Slots = slots::Module<Test>;
type Registrar = Module<Test>; type Registrar = Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>; type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
type Session = session::Module<Test>;
type Staking = staking::Module<Test>;
const AUTHORITY_KEYS: [Sr25519Keyring; 8] = [ const AUTHORITY_KEYS: [Sr25519Keyring; 8] = [
Sr25519Keyring::Alice, Sr25519Keyring::Alice,
......
...@@ -250,6 +250,7 @@ impl session::Trait for Runtime { ...@@ -250,6 +250,7 @@ impl session::Trait for Runtime {
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = Staking; type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys; type Keys = SessionKeys;
...@@ -281,6 +282,8 @@ parameter_types! { ...@@ -281,6 +282,8 @@ parameter_types! {
pub const SlashDeferDuration: staking::EraIndex = 28; pub const SlashDeferDuration: staking::EraIndex = 28;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const MaxNominatorRewardedPerValidator: u32 = 64;
// quarter of the last session will be for election.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
} }
impl staking::Trait for Runtime { impl staking::Trait for Runtime {
...@@ -299,6 +302,10 @@ impl staking::Trait for Runtime { ...@@ -299,6 +302,10 @@ impl staking::Trait for Runtime {
type SessionInterface = Self; type SessionInterface = Self;
type RewardCurve = RewardCurve; type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
} }
parameter_types! { parameter_types! {
......
...@@ -7,7 +7,7 @@ build = "build.rs" ...@@ -7,7 +7,7 @@ build = "build.rs"
[dependencies] [dependencies]
bitvec = { version = "0.15.2", default-features = false, features = ["alloc"] } bitvec = { version = "0.15.2", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.2.0", default-features = false, features = ["derive"] }
log = { version = "0.3.9", optional = true } log = { version = "0.3.9", optional = true }
rustc-hex = { version = "2.0.1", default-features = false } rustc-hex = { version = "2.0.1", default-features = false }
serde = { version = "1.0.102", default-features = false } serde = { version = "1.0.102", default-features = false }
......
...@@ -258,6 +258,7 @@ impl session::Trait for Runtime { ...@@ -258,6 +258,7 @@ impl session::Trait for Runtime {
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = Staking; type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys; type Keys = SessionKeys;
...@@ -288,6 +289,8 @@ parameter_types! { ...@@ -288,6 +289,8 @@ parameter_types! {
pub const SlashDeferDuration: staking::EraIndex = 28; pub const SlashDeferDuration: staking::EraIndex = 28;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const MaxNominatorRewardedPerValidator: u32 = 64;
// quarter of the last session will be for election.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
} }
impl staking::Trait for Runtime { impl staking::Trait for Runtime {
...@@ -306,6 +309,10 @@ impl staking::Trait for Runtime { ...@@ -306,6 +309,10 @@ impl staking::Trait for Runtime {
type SessionInterface = Self; type SessionInterface = Self;
type RewardCurve = RewardCurve; type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type SubmitTransaction = TransactionSubmitter<(), Runtime, UncheckedExtrinsic>;
} }
parameter_types! { parameter_types! {
......
...@@ -236,6 +236,7 @@ impl session::Trait for Runtime { ...@@ -236,6 +236,7 @@ impl session::Trait for Runtime {
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>; type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = Staking; type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders; type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys; type Keys = SessionKeys;
...@@ -267,6 +268,7 @@ parameter_types! { ...@@ -267,6 +268,7 @@ parameter_types! {
pub const SlashDeferDuration: staking::EraIndex = 28; pub const SlashDeferDuration: staking::EraIndex = 28;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64; pub const MaxNominatorRewardedPerValidator: u32 = 64;
pub const ElectionLookahead: BlockNumber = 0;
} }
impl staking::Trait for Runtime { impl staking::Trait for Runtime {
...@@ -285,6 +287,10 @@ impl staking::Trait for Runtime { ...@@ -285,6 +287,10 @@ impl staking::Trait for Runtime {
type SessionInterface = Self; type SessionInterface = Self;
type RewardCurve = RewardCurve; type RewardCurve = RewardCurve;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
type Call = Call;
type SubmitTransaction = system::offchain::TransactionSubmitter<(), Runtime, Extrinsic>;
} }
impl grandpa::Trait for Runtime { impl grandpa::Trait for Runtime {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment