mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 22:11:06 +00:00
Migrate to the 2018 edition (#273)
This commit is contained in:
committed by
Gavin Wood
parent
c699bdc10a
commit
2c85f90e0a
@@ -42,6 +42,7 @@ use runtime_primitives::traits::{ProvideRuntimeApi, Header as HeaderT};
|
||||
use tokio::runtime::TaskExecutor;
|
||||
use tokio::runtime::current_thread::Runtime as LocalRuntime;
|
||||
use tokio::timer::Interval;
|
||||
use log::{warn, debug};
|
||||
|
||||
use super::{Network, Collators};
|
||||
|
||||
@@ -49,7 +50,7 @@ use super::{Network, Collators};
|
||||
pub(crate) fn fetch_candidates<P: BlockBody<Block>>(client: &P, block: &BlockId)
|
||||
-> ClientResult<Option<impl Iterator<Item=CandidateReceipt>>>
|
||||
{
|
||||
use codec::{Encode, Decode};
|
||||
use parity_codec::{Encode, Decode};
|
||||
use polkadot_runtime::{Call, ParachainsCall, UncheckedExtrinsic as RuntimeExtrinsic};
|
||||
|
||||
let extrinsics = client.block_body(block)?;
|
||||
@@ -106,7 +107,7 @@ pub(crate) struct ServiceHandle {
|
||||
pub(crate) fn start<C, N, P, SC>(
|
||||
client: Arc<P>,
|
||||
select_chain: SC,
|
||||
parachain_validation: Arc<::ParachainValidation<C, N, P>>,
|
||||
parachain_validation: Arc<crate::ParachainValidation<C, N, P>>,
|
||||
thread_pool: TaskExecutor,
|
||||
key: Arc<ed25519::Pair>,
|
||||
extrinsic_store: ExtrinsicStore,
|
||||
|
||||
@@ -31,6 +31,8 @@ use parachain::{wasm_executor::{self, ExternalitiesError}, MessageRef};
|
||||
use error_chain::bail;
|
||||
|
||||
use futures::prelude::*;
|
||||
use error_chain::*;
|
||||
use log::debug;
|
||||
|
||||
/// Encapsulates connections to collators and allows collation on any parachain.
|
||||
///
|
||||
@@ -113,7 +115,7 @@ impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
|
||||
.get_or_insert_with(move || c.collate(parachain, r).into_future())
|
||||
.poll();
|
||||
|
||||
try_ready!(poll)
|
||||
futures::try_ready!(poll)
|
||||
};
|
||||
|
||||
let res = validate_collation(&*self.client, &self.relay_parent, &collation, self.max_block_data_size);
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
//! Errors that can occur during the validation process.
|
||||
|
||||
use runtime_primitives::RuntimeString;
|
||||
|
||||
use primitives::ed25519::Public as AuthorityId;
|
||||
use error_chain::*;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
|
||||
use super::MAX_TRANSACTIONS_SIZE;
|
||||
|
||||
use codec::Encode;
|
||||
use parity_codec::Encode;
|
||||
use polkadot_primitives::{Block, Hash, BlockNumber};
|
||||
use polkadot_primitives::parachain::Id as ParaId;
|
||||
use error_chain::*;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
|
||||
@@ -29,42 +29,6 @@
|
||||
//!
|
||||
//! Groups themselves may be compromised by malicious authorities.
|
||||
|
||||
extern crate parking_lot;
|
||||
extern crate polkadot_availability_store as extrinsic_store;
|
||||
extern crate polkadot_statement_table as table;
|
||||
extern crate polkadot_parachain as parachain;
|
||||
extern crate polkadot_runtime;
|
||||
extern crate polkadot_primitives;
|
||||
|
||||
extern crate parity_codec as codec;
|
||||
extern crate substrate_inherents as inherents;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate srml_aura as runtime_aura;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate substrate_client as client;
|
||||
extern crate substrate_trie as trie;
|
||||
|
||||
extern crate exit_future;
|
||||
extern crate tokio;
|
||||
extern crate substrate_consensus_common as consensus;
|
||||
extern crate substrate_consensus_aura as aura;
|
||||
extern crate substrate_consensus_aura_primitives as aura_primitives;
|
||||
extern crate substrate_finality_grandpa as grandpa;
|
||||
extern crate substrate_transaction_pool as transaction_pool;
|
||||
extern crate substrate_consensus_authorities as consensus_authorities;
|
||||
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
|
||||
#[macro_use]
|
||||
extern crate futures;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate substrate_keyring;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
use std::time::{self, Duration, Instant};
|
||||
@@ -73,7 +37,7 @@ use aura::SlotDuration;
|
||||
use client::{BlockchainEvents, BlockBody};
|
||||
use client::blockchain::HeaderBackend;
|
||||
use client::block_builder::api::BlockBuilder as BlockBuilderApi;
|
||||
use codec::Encode;
|
||||
use parity_codec::Encode;
|
||||
use consensus::SelectChain;
|
||||
use extrinsic_store::Store as ExtrinsicStore;
|
||||
use parking_lot::Mutex;
|
||||
@@ -97,6 +61,8 @@ use collation::CollationFetch;
|
||||
use dynamic_inclusion::DynamicInclusion;
|
||||
use inherents::InherentData;
|
||||
use runtime_aura::timestamp::TimestampInherentData;
|
||||
use log::{info, debug, warn, trace};
|
||||
use error_chain::bail;
|
||||
|
||||
use ed25519::Public as AuthorityId;
|
||||
|
||||
@@ -313,7 +279,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
|
||||
|
||||
// compute the parent candidates, if we know of them.
|
||||
// this will allow us to circulate outgoing messages to other peers as necessary.
|
||||
let parent_candidates: Vec<_> = ::attestation_service::fetch_candidates(&*self.client, &id)
|
||||
let parent_candidates: Vec<_> = crate::attestation_service::fetch_candidates(&*self.client, &id)
|
||||
.ok()
|
||||
.and_then(|x| x)
|
||||
.map(|x| x.collect())
|
||||
@@ -514,7 +480,7 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
|
||||
live_instances: Mutex::new(HashMap::new()),
|
||||
});
|
||||
|
||||
let service_handle = ::attestation_service::start(
|
||||
let service_handle = crate::attestation_service::start(
|
||||
client,
|
||||
select_chain.clone(),
|
||||
parachain_validation.clone(),
|
||||
@@ -825,7 +791,7 @@ impl<C, TxApi> Future for CreateProposal<C, TxApi> where
|
||||
// 1. try to propose if we have enough includable candidates and other
|
||||
// delays have concluded.
|
||||
let included = self.table.includable_count();
|
||||
try_ready!(self.timing.poll(included));
|
||||
futures::try_ready!(self.timing.poll(included));
|
||||
|
||||
// 2. propose
|
||||
let proposed_candidates = self.table.proposed_set();
|
||||
|
||||
@@ -29,6 +29,7 @@ use polkadot_primitives::parachain::{Id as ParaId, Collation, Extrinsic, Candida
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use futures::prelude::*;
|
||||
use log::{warn, debug};
|
||||
|
||||
use super::{GroupInfo, TableRouter};
|
||||
use self::includable::IncludabilitySender;
|
||||
@@ -79,7 +80,7 @@ impl TableContext {
|
||||
}
|
||||
|
||||
fn sign_statement(&self, statement: table::Statement) -> table::SignedStatement {
|
||||
let signature = ::sign_table_statement(&statement, &self.key, &self.parent_hash).into();
|
||||
let signature = crate::sign_table_statement(&statement, &self.key, &self.parent_hash).into();
|
||||
|
||||
table::SignedStatement {
|
||||
statement,
|
||||
@@ -284,7 +285,7 @@ impl<Fetch: Future> ParachainWork<Fetch> {
|
||||
{
|
||||
let max_block_data_size = self.max_block_data_size;
|
||||
let validate = move |id: &_, collation: &_| {
|
||||
let res = ::collation::validate_collation(
|
||||
let res = crate::collation::validate_collation(
|
||||
&*api,
|
||||
id,
|
||||
collation,
|
||||
@@ -335,7 +336,7 @@ impl<Fetch, F, Err> Future for PrimedParachainWork<Fetch, F>
|
||||
let work = &mut self.inner.work;
|
||||
let candidate = &work.candidate_receipt;
|
||||
|
||||
let pov_block = try_ready!(work.fetch.poll());
|
||||
let pov_block = futures::try_ready!(work.fetch.poll());
|
||||
let validation_res = (self.validate)(
|
||||
&BlockId::hash(self.inner.relay_parent),
|
||||
&Collation { pov: pov_block.clone(), receipt: candidate.clone() },
|
||||
@@ -637,7 +638,7 @@ mod tests {
|
||||
|
||||
let candidate_statement = GenericStatement::Candidate(candidate);
|
||||
|
||||
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signed_statement = ::table::generic::SignedStatement {
|
||||
statement: candidate_statement,
|
||||
signature: signature.into(),
|
||||
@@ -691,7 +692,7 @@ mod tests {
|
||||
|
||||
let candidate_statement = GenericStatement::Candidate(candidate);
|
||||
|
||||
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signed_statement = ::table::generic::SignedStatement {
|
||||
statement: candidate_statement,
|
||||
signature: signature.into(),
|
||||
@@ -827,7 +828,7 @@ mod tests {
|
||||
let hash = candidate.hash();
|
||||
let candidate_statement = GenericStatement::Candidate(candidate);
|
||||
|
||||
let signature = ::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signature = crate::sign_table_statement(&candidate_statement, &validity_other_key, &parent_hash);
|
||||
let signed_statement = ::table::generic::SignedStatement {
|
||||
statement: candidate_statement,
|
||||
signature: signature.into(),
|
||||
|
||||
Reference in New Issue
Block a user