mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Update to latest Substrate (7688cbc) (#329)
* Initial fixes * Clean up Timestamp * Patch futures * Typo * Fix compilation of tests * Fix parachains tests * Update runtime/src/parachains.rs Co-Authored-By: thiolliere <gui.thiolliere@gmail.com> * Update runtime/src/parachains.rs Co-Authored-By: Gavin Wood <github@gavwood.com>
This commit is contained in:
committed by
Gavin Wood
parent
1ded51d77b
commit
2c66adfb0a
@@ -211,6 +211,9 @@ mod tests {
|
||||
// configuration traits of modules we want to use.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -221,6 +224,7 @@ mod tests {
|
||||
type Lookup = IdentityLookup<u64>;
|
||||
type Header = Header;
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
+39
-22
@@ -42,9 +42,7 @@ use sr_primitives::{
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
use grandpa::{AuthorityId as GrandpaId, fg_primitives::{self, ScheduledChange}};
|
||||
use council::motions as council_motions;
|
||||
#[cfg(feature = "std")]
|
||||
use council::seats as council_seats;
|
||||
use elections::VoteIndex;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use version::NativeVersion;
|
||||
use substrate_primitives::OpaqueMetadata;
|
||||
@@ -60,7 +58,6 @@ pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use parachains::{Call as ParachainsCall, INHERENT_IDENTIFIER as PARACHAIN_INHERENT_IDENTIFIER};
|
||||
pub use sr_primitives::{Permill, Perbill};
|
||||
pub use timestamp::BlockPeriod;
|
||||
pub use srml_support::StorageValue;
|
||||
|
||||
// Make the WASM binary available.
|
||||
@@ -91,11 +88,15 @@ const BUCKS: Balance = DOTS / 100;
|
||||
const CENTS: Balance = BUCKS / 100;
|
||||
const MILLICENTS: Balance = CENTS / 1_000;
|
||||
|
||||
const SECS_PER_BLOCK: BlockNumber = 10;
|
||||
const SECS_PER_BLOCK: BlockNumber = 6;
|
||||
const MINUTES: BlockNumber = 60 / SECS_PER_BLOCK;
|
||||
const HOURS: BlockNumber = MINUTES * 60;
|
||||
const DAYS: BlockNumber = HOURS * 24;
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
}
|
||||
|
||||
impl system::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
type Index = Nonce;
|
||||
@@ -106,6 +107,7 @@ impl system::Trait for Runtime {
|
||||
type Lookup = Indices;
|
||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
}
|
||||
|
||||
impl aura::Trait for Runtime {
|
||||
@@ -162,9 +164,14 @@ impl balances::Trait for Runtime {
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SECS_PER_BLOCK / 2;
|
||||
}
|
||||
|
||||
impl timestamp::Trait for Runtime {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -264,14 +271,22 @@ impl democracy::Trait for Runtime {
|
||||
type VotingPeriod = VotingPeriod;
|
||||
type EmergencyVotingPeriod = EmergencyVotingPeriod;
|
||||
type MinimumDeposit = MinimumDeposit;
|
||||
type ExternalOrigin = council_motions::EnsureProportionAtLeast<_1, _2, AccountId>;
|
||||
type ExternalMajorityOrigin = council_motions::EnsureProportionAtLeast<_2, _3, AccountId>;
|
||||
type EmergencyOrigin = council_motions::EnsureProportionAtLeast<_1, _1, AccountId>;
|
||||
type CancellationOrigin = council_motions::EnsureProportionAtLeast<_2, _3, AccountId>;
|
||||
type VetoOrigin = council_motions::EnsureMember<AccountId>;
|
||||
type ExternalOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilInstance>;
|
||||
type ExternalMajorityOrigin = collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilInstance>;
|
||||
type ExternalPushOrigin = collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalInstance>;
|
||||
type EmergencyOrigin = collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilInstance>;
|
||||
type CancellationOrigin = collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilInstance>;
|
||||
type VetoOrigin = collective::EnsureMember<AccountId, CouncilInstance>;
|
||||
type CooloffPeriod = CooloffPeriod;
|
||||
}
|
||||
|
||||
type CouncilInstance = collective::Instance1;
|
||||
impl collective::Trait<CouncilInstance> for Runtime {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CandidacyBond: Balance = 10 * BUCKS;
|
||||
pub const VotingBond: Balance = 1 * BUCKS;
|
||||
@@ -279,29 +294,31 @@ parameter_types! {
|
||||
pub const PresentSlashPerVoter: Balance = 1 * CENTS;
|
||||
pub const CarryCount: u32 = 6;
|
||||
// one additional vote should go by before an inactive voter can be reaped.
|
||||
pub const InactiveGracePeriod: council::VoteIndex = 1;
|
||||
pub const CouncilVotingPeriod: BlockNumber = 2 * DAYS;
|
||||
pub const InactiveGracePeriod: VoteIndex = 1;
|
||||
pub const ElectionsVotingPeriod: BlockNumber = 2 * DAYS;
|
||||
pub const DecayRatio: u32 = 0;
|
||||
}
|
||||
|
||||
impl council::Trait for Runtime {
|
||||
impl elections::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type BadPresentation = ();
|
||||
type BadReaper = ();
|
||||
type BadVoterIndex = ();
|
||||
type LoserCandidate = ();
|
||||
type OnMembersChanged = CouncilMotions;
|
||||
type ChangeMembers = Council;
|
||||
type CandidacyBond = CandidacyBond;
|
||||
type VotingBond = VotingBond;
|
||||
type VotingFee = VotingFee;
|
||||
type PresentSlashPerVoter = PresentSlashPerVoter;
|
||||
type CarryCount = CarryCount;
|
||||
type InactiveGracePeriod = InactiveGracePeriod;
|
||||
type CouncilVotingPeriod = CouncilVotingPeriod;
|
||||
type VotingPeriod = ElectionsVotingPeriod;
|
||||
type DecayRatio = DecayRatio;
|
||||
}
|
||||
|
||||
impl council::motions::Trait for Runtime {
|
||||
type TechnicalInstance = collective::Instance2;
|
||||
impl collective::Trait<TechnicalInstance> for Runtime {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
@@ -316,8 +333,8 @@ parameter_types! {
|
||||
|
||||
impl treasury::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type ApproveOrigin = council_motions::EnsureMembers<_4, AccountId>;
|
||||
type RejectOrigin = council_motions::EnsureMembers<_2, AccountId>;
|
||||
type ApproveOrigin = collective::EnsureMembers<_4, AccountId, CouncilInstance>;
|
||||
type RejectOrigin = collective::EnsureMembers<_2, AccountId, CouncilInstance>;
|
||||
type Event = Event;
|
||||
type MintedForSpending = ();
|
||||
type ProposalRejection = ();
|
||||
@@ -376,16 +393,16 @@ construct_runtime!(
|
||||
{
|
||||
System: system::{Module, Call, Storage, Config, Event},
|
||||
Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Inherent},
|
||||
Authorship: authorship::{Module, Call, Storage},
|
||||
Indices: indices,
|
||||
Balances: balances,
|
||||
Staking: staking::{default, OfflineWorker},
|
||||
Session: session::{Module, Call, Storage, Event, Config<T>},
|
||||
Democracy: democracy::{Module, Call, Storage, Config, Event<T>},
|
||||
Council: council::{Module, Call, Storage, Event<T>},
|
||||
CouncilMotions: council_motions::{Module, Call, Storage, Event<T>, Origin<T>},
|
||||
CouncilSeats: council_seats::{Config<T>},
|
||||
Council: collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
TechnicalCommittee: collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
|
||||
Elections: elections::{Module, Call, Storage, Event<T>, Config<T>},
|
||||
FinalityTracker: finality_tracker::{Module, Call, Inherent},
|
||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||
CuratedGrandpa: curated_grandpa::{Module, Call, Config<T>, Storage},
|
||||
|
||||
@@ -818,11 +818,12 @@ mod tests {
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use substrate_trie::NodeCodec;
|
||||
use sr_primitives::{
|
||||
traits::{BlakeTwo256, IdentityLookup}, testing::UintAuthorityId,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
testing::{UintAuthorityId, Header},
|
||||
};
|
||||
use primitives::{
|
||||
parachain::{CandidateReceipt, HeadData, ValidityAttestation, ValidatorIndex}, SessionKey,
|
||||
BlockNumber, AuraId
|
||||
BlockNumber, AuraId,
|
||||
};
|
||||
use keyring::{AuthorityKeyring, AccountKeyring};
|
||||
use srml_support::{
|
||||
@@ -844,16 +845,20 @@ mod tests {
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = crate::Nonce;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = crate::AccountId;
|
||||
type Lookup = IdentityLookup<crate::AccountId>;
|
||||
type Header = crate::Header;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<u64>;
|
||||
type Header = Header;
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -868,18 +873,22 @@ mod tests {
|
||||
type SessionHandler = ();
|
||||
type Event = ();
|
||||
type SelectInitialValidators = staking::Module<Self>;
|
||||
type ValidatorId = crate::AccountId;
|
||||
type ValidatorId = u64;
|
||||
type ValidatorIdOf = staking::StashOf<Self>;
|
||||
}
|
||||
|
||||
impl session::historical::Trait for Test {
|
||||
type FullIdentification = staking::Exposure<crate::AccountId, Balance>;
|
||||
type FullIdentification = staking::Exposure<u64, Balance>;
|
||||
type FullIdentificationOf = staking::ExposureOf<Self>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = 3;
|
||||
}
|
||||
impl timestamp::Trait for Test {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
}
|
||||
|
||||
impl aura::Trait for Test {
|
||||
@@ -960,7 +969,7 @@ mod tests {
|
||||
];
|
||||
|
||||
t.extend(session::GenesisConfig::<Test>{
|
||||
keys: vec![],
|
||||
keys: vec![(1, UintAuthorityId(1))],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(GenesisConfig::<Test>{
|
||||
parachains,
|
||||
|
||||
@@ -801,6 +801,9 @@ mod tests {
|
||||
// configuration traits of modules we want to use.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -811,6 +814,7 @@ mod tests {
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
Reference in New Issue
Block a user