mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Migrate to the 2018 edition (#273)
This commit is contained in:
committed by
Gavin Wood
parent
c699bdc10a
commit
2c85f90e0a
@@ -18,10 +18,10 @@
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sr_io::{keccak_256, secp256k1_ecdsa_recover};
|
||||
use srml_support::{StorageValue, StorageMap};
|
||||
use srml_support::{StorageValue, StorageMap, decl_event, decl_storage, decl_module};
|
||||
use srml_support::traits::Currency;
|
||||
use system::ensure_none;
|
||||
use codec::Encode;
|
||||
use parity_codec::{Encode, Decode};
|
||||
#[cfg(feature = "std")]
|
||||
use sr_primitives::traits::Zero;
|
||||
use sr_primitives::traits::ValidateUnsigned;
|
||||
@@ -183,17 +183,19 @@ impl<T: Trait> ValidateUnsigned for Module<T> {
|
||||
mod tests {
|
||||
use secp256k1;
|
||||
use tiny_keccak::keccak256;
|
||||
use hex_literal::hex;
|
||||
use super::*;
|
||||
|
||||
use sr_io::with_externalities;
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use codec::{Decode, Encode};
|
||||
use parity_codec::{Decode, Encode};
|
||||
// The testing primitives are very useful for avoiding having to work with signatures
|
||||
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
|
||||
use sr_primitives::{
|
||||
BuildStorage, traits::{BlakeTwo256, IdentityLookup}, testing::{Digest, DigestItem, Header}
|
||||
};
|
||||
use balances;
|
||||
use srml_support::{impl_outer_origin, assert_ok, assert_err, assert_noop};
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {}
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
//! A module for manually curated GRANDPA set.
|
||||
|
||||
use {grandpa, system};
|
||||
use codec::Decode;
|
||||
use parity_codec::Decode;
|
||||
use sr_primitives::traits::{Hash as HashT, BlakeTwo256, Zero};
|
||||
use rstd::prelude::*;
|
||||
use srml_support::{decl_storage, decl_module};
|
||||
|
||||
pub trait Trait: grandpa::Trait {}
|
||||
|
||||
|
||||
@@ -20,59 +20,6 @@
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate hex_literal;
|
||||
#[cfg(test)]
|
||||
extern crate secp256k1;
|
||||
#[cfg(test)]
|
||||
extern crate tiny_keccak;
|
||||
|
||||
#[macro_use]
|
||||
extern crate bitvec;
|
||||
|
||||
extern crate parity_codec_derive;
|
||||
extern crate parity_codec as codec;
|
||||
|
||||
extern crate substrate_consensus_aura_primitives as consensus_aura;
|
||||
extern crate substrate_primitives;
|
||||
extern crate substrate_inherents as inherents;
|
||||
extern crate substrate_offchain_primitives as offchain_primitives;
|
||||
#[macro_use]
|
||||
extern crate substrate_client as client;
|
||||
|
||||
extern crate sr_std as rstd;
|
||||
extern crate sr_io;
|
||||
extern crate sr_version as version;
|
||||
#[macro_use]
|
||||
extern crate sr_primitives;
|
||||
|
||||
#[macro_use]
|
||||
extern crate srml_support;
|
||||
extern crate srml_aura as aura;
|
||||
extern crate srml_balances as balances;
|
||||
extern crate srml_consensus as consensus;
|
||||
extern crate srml_council as council;
|
||||
extern crate srml_democracy as democracy;
|
||||
extern crate srml_executive as executive;
|
||||
extern crate srml_grandpa as grandpa;
|
||||
extern crate srml_indices as indices;
|
||||
extern crate srml_session as session;
|
||||
extern crate srml_staking as staking;
|
||||
extern crate srml_sudo as sudo;
|
||||
extern crate srml_system as system;
|
||||
extern crate srml_timestamp as timestamp;
|
||||
extern crate srml_treasury as treasury;
|
||||
extern crate substrate_consensus_authorities as consensus_authorities;
|
||||
|
||||
extern crate polkadot_primitives as primitives;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate substrate_keyring as keyring;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate substrate_trie;
|
||||
|
||||
mod curated_grandpa;
|
||||
mod parachains;
|
||||
mod claims;
|
||||
@@ -87,10 +34,10 @@ use primitives::{
|
||||
};
|
||||
use client::{
|
||||
block_builder::api::{self as block_builder_api, InherentData, CheckInherentsResult},
|
||||
runtime_api as client_api,
|
||||
runtime_api as client_api, impl_runtime_apis,
|
||||
};
|
||||
use sr_primitives::{
|
||||
ApplyResult, generic, transaction_validity::TransactionValidity,
|
||||
ApplyResult, generic, transaction_validity::TransactionValidity, create_runtime_str,
|
||||
traits::{
|
||||
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, Convert, AuthorityIdFor
|
||||
}
|
||||
@@ -103,6 +50,7 @@ use council::seats as council_seats;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use version::NativeVersion;
|
||||
use substrate_primitives::OpaqueMetadata;
|
||||
use srml_support::{parameter_types, construct_runtime};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use staking::StakerStatus;
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
//! Main parachains logic. For now this is just the determination of which validators do what.
|
||||
|
||||
use rstd::prelude::*;
|
||||
use codec::{Decode, HasCompact};
|
||||
use parity_codec::{Decode, HasCompact};
|
||||
use srml_support::{decl_storage, decl_module, fail, ensure};
|
||||
|
||||
use bitvec::BigEndian;
|
||||
use bitvec::{bitvec, BigEndian};
|
||||
use sr_primitives::traits::{Hash as HashT, BlakeTwo256, Member};
|
||||
use primitives::{Hash, parachain::{Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement, AccountIdConversion}};
|
||||
use {system, session};
|
||||
@@ -216,7 +217,7 @@ fn majority_of(list_len: usize) -> usize {
|
||||
}
|
||||
|
||||
fn localized_payload(statement: Statement, parent_hash: ::primitives::Hash) -> Vec<u8> {
|
||||
use codec::Encode;
|
||||
use parity_codec::Encode;
|
||||
|
||||
let mut encoded = statement.encode();
|
||||
encoded.extend(parent_hash.as_ref());
|
||||
@@ -513,6 +514,7 @@ mod tests {
|
||||
use sr_primitives::traits::{BlakeTwo256, IdentityLookup};
|
||||
use primitives::{parachain::{CandidateReceipt, HeadData, ValidityAttestation, ValidatorIndex}, SessionKey};
|
||||
use keyring::{AuthorityKeyring, AccountKeyring};
|
||||
use srml_support::{impl_outer_origin, assert_ok};
|
||||
use {consensus, timestamp};
|
||||
|
||||
impl_outer_origin! {
|
||||
@@ -524,20 +526,20 @@ mod tests {
|
||||
impl consensus::Trait for Test {
|
||||
type InherentOfflineReport = ();
|
||||
type SessionKey = SessionKey;
|
||||
type Log = ::Log;
|
||||
type Log = crate::Log;
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
type Origin = Origin;
|
||||
type Index = ::Nonce;
|
||||
type Index = crate::Nonce;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Digest = generic::Digest<::Log>;
|
||||
type AccountId = ::AccountId;
|
||||
type Lookup = IdentityLookup<::AccountId>;
|
||||
type Header = ::Header;
|
||||
type Digest = generic::Digest<crate::Log>;
|
||||
type AccountId = crate::AccountId;
|
||||
type Lookup = IdentityLookup<crate::AccountId>;
|
||||
type Header = crate::Header;
|
||||
type Event = ();
|
||||
type Log = ::Log;
|
||||
type Log = crate::Log;
|
||||
}
|
||||
impl session::Trait for Test {
|
||||
type ConvertAccountIdToSessionKey = ();
|
||||
@@ -582,7 +584,7 @@ mod tests {
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(session::GenesisConfig::<Test>{
|
||||
session_length: 1000,
|
||||
validators: validator_keys.iter().map(|k| ::AccountId::from(*k)).collect(),
|
||||
validators: validator_keys.iter().map(|k| crate::AccountId::from(*k)).collect(),
|
||||
keys: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(GenesisConfig::<Test>{
|
||||
@@ -594,12 +596,12 @@ mod tests {
|
||||
|
||||
fn make_attestations(candidate: &mut AttestedCandidate) {
|
||||
let mut vote_implicit = false;
|
||||
let parent_hash = ::System::parent_hash();
|
||||
let parent_hash = crate::System::parent_hash();
|
||||
|
||||
let duty_roster = Parachains::calculate_duty_roster();
|
||||
let candidate_hash = candidate.candidate.hash();
|
||||
|
||||
let authorities = ::Consensus::authorities();
|
||||
let authorities = crate::Consensus::authorities();
|
||||
let extract_key = |public: SessionKey| {
|
||||
AuthorityKeyring::from_raw_public(public.0).unwrap()
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
use rstd::{result, ops::Add, convert::{TryFrom, TryInto}};
|
||||
use sr_primitives::traits::CheckedSub;
|
||||
use parity_codec::{Encode, Decode};
|
||||
|
||||
/// Total number of possible sub ranges of slots.
|
||||
pub const SLOT_RANGE_COUNT: usize = 10;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
use rstd::{prelude::*, mem::swap, convert::TryInto};
|
||||
use sr_primitives::traits::{CheckedSub, StaticLookup, Zero, One, CheckedConversion, Hash};
|
||||
use codec::Decode;
|
||||
use srml_support::{decl_module, decl_storage, decl_event, StorageValue, StorageMap,
|
||||
use parity_codec::{Encode, Decode};
|
||||
use srml_support::{decl_module, decl_storage, decl_event, StorageValue, StorageMap, ensure,
|
||||
traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get}};
|
||||
use primitives::parachain::AccountIdConversion;
|
||||
use crate::parachains::ParachainRegistrar;
|
||||
@@ -785,7 +785,7 @@ mod tests {
|
||||
traits::{BlakeTwo256, Hash, IdentityLookup, OnInitialize, OnFinalize},
|
||||
testing::{Digest, DigestItem, Header}
|
||||
};
|
||||
use srml_support::{impl_outer_origin, assert_ok};
|
||||
use srml_support::{impl_outer_origin, parameter_types, assert_ok, assert_noop};
|
||||
use balances;
|
||||
use primitives::parachain::Id as ParaId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user