Commit 1a2bf251 authored by thiolliere's avatar thiolliere Committed by asynchronous rob
Browse files

update substrate (#442)

parent 6659d9a1
Pipeline #52375 passed with stages
in 16 minutes and 5 seconds
This diff is collapsed.
......@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.17", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -43,6 +43,7 @@ offences = { package = "srml-offences", git = "https://github.com/paritytech/sub
session = { package = "srml-session", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
staking = { package = "srml-staking", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
srml-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sudo = { package = "srml-sudo", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
system = { package = "srml-system", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
timestamp = { package = "srml-timestamp", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
......
......@@ -39,11 +39,11 @@ use client::{
runtime_api as client_api, impl_runtime_apis,
};
use sr_primitives::{
ApplyResult, generic,
ApplyResult, generic, Permill, Perbill, impl_opaque_keys, create_runtime_str, key_types,
transaction_validity::{TransactionValidity, InvalidTransaction, TransactionValidityError},
impl_opaque_keys, weights::{Weight, DispatchInfo}, create_runtime_str, key_types, traits::{
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, SignedExtension,
},
weights::{Weight, DispatchInfo},
traits::{BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, SignedExtension},
curve::PiecewiseLinear,
};
use version::RuntimeVersion;
use grandpa::{AuthorityId as GrandpaId, fg_primitives::{self, ScheduledChange}};
......@@ -67,7 +67,6 @@ pub use timestamp::Call as TimestampCall;
pub use balances::Call as BalancesCall;
pub use attestations::{Call as AttestationsCall, MORE_ATTESTATIONS_IDENTIFIER};
pub use parachains::{Call as ParachainsCall, NEW_HEADS_IDENTIFIER};
pub use sr_primitives::{Permill, Perbill};
pub use srml_support::StorageValue;
/// Implementations of some helper traits passed into runtime modules as associated types.
......@@ -264,6 +263,10 @@ impl_opaque_keys! {
// TODO: Introduce some structure to tie these together to make it a bit less of a footgun. This
// should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl session::Trait for Runtime {
type OnSessionEnding = Staking;
type SessionHandler = SessionHandlers;
......@@ -273,6 +276,7 @@ impl session::Trait for Runtime {
type SelectInitialValidators = Staking;
type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
}
impl session::historical::Trait for Runtime {
......@@ -280,11 +284,23 @@ impl session::historical::Trait for Runtime {
type FullIdentificationOf = staking::ExposureOf<Self>;
}
srml_staking_reward_curve::build! {
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
min_inflation: 0_025_000,
max_inflation: 0_100_000,
ideal_stake: 0_500_000,
falloff: 0_050_000,
max_piece_count: 40,
test_precision: 0_005_000,
);
}
parameter_types! {
// Six sessions in an era (24 hours).
pub const SessionsPerEra: SessionIndex = 6;
// 28 eras for unbonding (28 days).
pub const BondingDuration: staking::EraIndex = 28;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
}
impl staking::Trait for Runtime {
......@@ -298,6 +314,7 @@ impl staking::Trait for Runtime {
type BondingDuration = BondingDuration;
type SessionInterface = Self;
type Time = Timestamp;
type RewardCurve = RewardCurve;
}
parameter_types! {
......@@ -347,6 +364,7 @@ parameter_types! {
pub const CandidacyBond: Balance = 10 * DOLLARS;
pub const VotingBond: Balance = 1 * DOLLARS;
pub const VotingFee: Balance = 2 * DOLLARS;
pub const MinimumVotingLock: Balance = 1 * DOLLARS;
pub const PresentSlashPerVoter: Balance = 1 * CENTS;
pub const CarryCount: u32 = 6;
// one additional vote should go by before an inactive voter can be reaped.
......@@ -366,6 +384,7 @@ impl elections::Trait for Runtime {
type CandidacyBond = CandidacyBond;
type VotingBond = VotingBond;
type VotingFee = VotingFee;
type MinimumVotingLock = MinimumVotingLock;
type PresentSlashPerVoter = PresentSlashPerVoter;
type CarryCount = CarryCount;
type InactiveGracePeriod = InactiveGracePeriod;
......@@ -424,7 +443,6 @@ impl im_online::Trait for Runtime {
type Call = Call;
type SubmitTransaction = SubmitTransaction;
type ReportUnresponsiveness = ();
type CurrentElectedSet = staking::CurrentElectedStashAccounts<Runtime>;
}
impl grandpa::Trait for Runtime {
......
......@@ -890,6 +890,7 @@ mod tests {
Perbill,
traits::{BlakeTwo256, IdentityLookup, ConvertInto},
testing::{UintAuthorityId, Header},
curve::PiecewiseLinear,
};
use primitives::{
parachain::{CandidateReceipt, HeadData, ValidityAttestation, ValidatorId},
......@@ -944,6 +945,7 @@ mod tests {
parameter_types! {
pub const Period: BlockNumber = 1;
pub const Offset: BlockNumber = 0;
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl session::Trait for Test {
......@@ -955,6 +957,7 @@ mod tests {
type SelectInitialValidators = staking::Module<Self>;
type ValidatorId = u64;
type ValidatorIdOf = staking::StashOf<Self>;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
}
impl session::historical::Trait for Test {
......@@ -1005,10 +1008,22 @@ mod tests {
type WeightToFee = ConvertInto;
}
srml_staking_reward_curve::build! {
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
min_inflation: 0_025_000,
max_inflation: 0_100_000,
ideal_stake: 0_500_000,
falloff: 0_050_000,
max_piece_count: 40,
test_precision: 0_005_000,
);
}
parameter_types! {
pub const SessionsPerEra: sr_staking_primitives::SessionIndex = 6;
pub const BondingDuration: staking::EraIndex = 28;
pub const AttestationPeriod: BlockNumber = 100;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
}
impl staking::Trait for Test {
......@@ -1022,6 +1037,7 @@ mod tests {
type BondingDuration = BondingDuration;
type SessionInterface = Self;
type Time = timestamp::Module<Test>;
type RewardCurve = RewardCurve;
}
impl attestations::Trait for Test {
......
......@@ -20,11 +20,12 @@ use primitives::{Pair, Public, crypto::UncheckedInto};
use polkadot_primitives::{AccountId, parachain::ValidatorId};
use polkadot_runtime::{
GenesisConfig, CouncilConfig, ElectionsConfig, DemocracyConfig, SystemConfig,
SessionConfig, StakingConfig, BalancesConfig, Perbill, SessionKeys, TechnicalCommitteeConfig,
SessionConfig, StakingConfig, BalancesConfig, SessionKeys, TechnicalCommitteeConfig,
SudoConfig, IndicesConfig, StakerStatus, WASM_BINARY,
ClaimsConfig, ParachainsConfig
};
use polkadot_runtime::constants::{currency::DOTS, time::*};
use sr_primitives::Perbill;
use telemetry::TelemetryEndpoints;
use hex_literal::hex;
use babe_primitives::AuthorityId as BabeId;
......
......@@ -332,9 +332,8 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
.with_transaction_pool(|config, client|
Ok(TransactionPool::new(config, transaction_pool::ChainApi::new(client)))
)?
.with_import_queue_and_fprb(|_config, client, backend, _select_chain, transaction_pool| {
let fetch_checker = backend.blockchain().fetcher()
.upgrade()
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, transaction_pool| {
let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
let block_import = grandpa::light_block_import::<_, _, _, RuntimeApi, _>(
......
......@@ -16,8 +16,6 @@
use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};
use std::env;
fn main() {
build_current_project_with_rustflags(
"wasm_binary.rs",
......
......@@ -6,8 +6,8 @@ edition = "2018"
[dependencies]
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.17", features = ["compat"] }
futures-timer = "0.2.1"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
futures-timer = "0.4.0"
parking_lot = "0.9.0"
tokio = "0.1.7"
derive_more = "0.14.0"
......
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