Master backports (#571)

* Update to latest Substrate master (#570)

* Bump substrate/version (#557)

* Bump version and Substrate (#560)

* Bump version and Substrate

* Bump version and Substrate

* Bump versions

* bump substrate to release specific v0.6.15

* Update lock

* Prepare Polkadot update for Substrate runtime interface 2.0 (#563)

* Prepare Polkadot update for Substrate runtime interface 2.0

* bump substrate to release specific v0.6.15

* Switch to `polkadot-master`

* Version bump

* Master backports

* Bump runtime

* Fix tests

* Fix tests

* Another fix.
This commit is contained in:
Gavin Wood
2019-11-12 02:10:02 +01:00
committed by GitHub
parent 40f1d22cd8
commit cc0e775810
33 changed files with 971 additions and 371 deletions
+3 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "polkadot-validation"
version = "0.6.10"
version = "0.6.16"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
@@ -25,6 +25,8 @@ consensus = { package = "substrate-consensus-common", git = "https://github.com/
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sr-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
block-builder = { package = "substrate-block-builder", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
trie = { package = "substrate-trie", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
runtime_primitives = { package = "sr-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
bitvec = { version = "0.14.0", default-features = false, features = ["alloc"] }
@@ -26,7 +26,7 @@
use std::{thread, time::{Duration, Instant}, sync::Arc};
use client::{error::Result as ClientResult, BlockchainEvents, BlockBody};
use client::block_builder::api::BlockBuilder;
use block_builder::BlockBuilderApi;
use client::blockchain::HeaderBackend;
use consensus::SelectChain;
use availability_store::Store as AvailabilityStore;
@@ -38,6 +38,7 @@ use polkadot_primitives::parachain::{CandidateReceipt, ParachainHost};
use runtime_primitives::traits::{ProvideRuntimeApi};
use babe_primitives::BabeApi;
use keystore::KeyStorePtr;
use sr_api::ApiExt;
use tokio::{timer::Interval, runtime::current_thread::Runtime as LocalRuntime};
use log::{warn, debug};
@@ -123,7 +124,10 @@ pub(crate) fn start<C, N, P, SC>(
<C::Collation as IntoFuture>::Future: Send + 'static,
P: BlockchainEvents<Block> + BlockBody<Block>,
P: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + BlockBuilder<Block> + BabeApi<Block>,
P::Api: ParachainHost<Block> +
BlockBuilderApi<Block> +
BabeApi<Block> +
ApiExt<Block, Error = client::error::Error>,
N: Network + Send + Sync + 'static,
N::TableRouter: Send + 'static,
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
+8 -3
View File
@@ -98,7 +98,7 @@ impl<C: Collators, P> CollationFetch<C, P> {
}
impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
where P::Api: ParachainHost<Block>,
where P::Api: ParachainHost<Block, Error = client::error::Error>,
{
type Item = (Collation, OutgoingMessages);
type Error = C::Error;
@@ -115,7 +115,12 @@ impl<C: Collators, P: ProvideRuntimeApi> Future for CollationFetch<C, P>
futures::try_ready!(poll)
};
let res = validate_collation(&*self.client, &self.relay_parent, &collation, self.max_block_data_size);
let res = validate_collation(
&*self.client,
&self.relay_parent,
&collation,
self.max_block_data_size,
);
match res {
Ok(e) => {
@@ -388,7 +393,7 @@ pub fn validate_collation<P>(
max_block_data_size: Option<u64>,
) -> Result<OutgoingMessages, Error> where
P: ProvideRuntimeApi,
P::Api: ParachainHost<Block>,
P::Api: ParachainHost<Block, Error = client::error::Error>,
{
use parachain::{IncomingMessage, ValidationParams};
+1 -2
View File
@@ -16,7 +16,6 @@
//! Errors that can occur during the validation process.
use runtime_primitives::RuntimeString;
use polkadot_primitives::parachain::ValidatorId;
/// Error type for validation
@@ -38,7 +37,7 @@ pub enum Error {
NotValidator(ValidatorId),
/// Unexpected error checking inherents
#[display(fmt = "Unexpected error while checking inherents: {}", _0)]
InherentError(RuntimeString),
InherentError(inherents::Error),
/// Proposer destroyed before finishing proposing or evaluating
#[display(fmt = "Proposer destroyed before finishing proposing or evaluating")]
PrematureDestruction,
+24 -10
View File
@@ -34,7 +34,7 @@ use std::{collections::{HashMap, HashSet}, pin::Pin, sync::Arc, time::{self, Dur
use babe_primitives::BabeApi;
use client::{BlockchainEvents, BlockBody};
use client::blockchain::HeaderBackend;
use client::block_builder::api::BlockBuilder as BlockBuilderApi;
use block_builder::BlockBuilderApi;
use client::error as client_error;
use codec::Encode;
use consensus::SelectChain;
@@ -60,6 +60,7 @@ use inherents::InherentData;
use runtime_babe::timestamp::TimestampInherentData;
use log::{info, debug, warn, trace, error};
use keystore::KeyStorePtr;
use sr_api::ApiExt;
type TaskExecutor = Arc<dyn futures::future::Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync>;
@@ -249,7 +250,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
C: Collators + Send + 'static,
N: Network,
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + BlockBuilderApi<Block>,
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
<C::Collation as IntoFuture>::Future: Send + 'static,
N::TableRouter: Send + 'static,
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
@@ -433,7 +434,10 @@ impl<C, N, P, SC, TxApi> ProposerFactory<C, N, P, SC, TxApi> where
<C::Collation as IntoFuture>::Future: Send + 'static,
P: BlockchainEvents<Block> + BlockBody<Block>,
P: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + BabeApi<Block>,
P::Api: ParachainHost<Block> +
BlockBuilderApi<Block> +
BabeApi<Block> +
ApiExt<Block, Error = client_error::Error>,
N: Network + Send + Sync + 'static,
N::TableRouter: Send + 'static,
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
@@ -489,7 +493,10 @@ impl<C, N, P, SC, TxApi> consensus::Environment<Block> for ProposerFactory<C, N,
N: Network,
TxApi: PoolChainApi<Block=Block>,
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + BabeApi<Block>,
P::Api: ParachainHost<Block> +
BlockBuilderApi<Block> +
BabeApi<Block> +
ApiExt<Block, Error = client_error::Error>,
<C::Collation as IntoFuture>::Future: Send + 'static,
N::TableRouter: Send + 'static,
<N::BuildTableRouter as IntoFuture>::Future: Send + 'static,
@@ -545,7 +552,7 @@ pub struct Proposer<C: Send + Sync, TxApi: PoolChainApi> where
impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where
TxApi: PoolChainApi<Block=Block>,
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block>,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
{
type Error = Error;
type Create = Either<CreateProposal<C, TxApi>, future::Ready<Result<Block, Error>>>;
@@ -688,10 +695,10 @@ pub struct CreateProposal<C: Send + Sync, TxApi: PoolChainApi> {
impl<C, TxApi> CreateProposal<C, TxApi> where
TxApi: PoolChainApi<Block=Block>,
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block>,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
{
fn propose_with(&mut self, candidates: Vec<AttestedCandidate>) -> Result<Block, Error> {
use client::block_builder::BlockBuilder;
use block_builder::BlockBuilder;
use runtime_primitives::traits::{Hash as HashT, BlakeTwo256};
const MAX_TRANSACTIONS: usize = 40;
@@ -699,11 +706,18 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
let mut inherent_data = self.inherent_data
.take()
.expect("CreateProposal is not polled after finishing; qed");
inherent_data.put_data(polkadot_runtime::NEW_HEADS_IDENTIFIER, &candidates).map_err(Error::InherentError)?;
inherent_data.put_data(polkadot_runtime::NEW_HEADS_IDENTIFIER, &candidates)
.map_err(Error::InherentError)?;
let runtime_api = self.client.runtime_api();
let mut block_builder = BlockBuilder::at_block(&self.parent_id, &*self.client, false, self.inherent_digests.clone())?;
let mut block_builder = BlockBuilder::new(
&*self.client,
self.client.expect_block_hash_from_id(&self.parent_id)?,
self.client.expect_block_number_from_id(&self.parent_id)?,
false,
self.inherent_digests.clone(),
)?;
{
let inherents = runtime_api.inherent_extrinsics(&self.parent_id, inherent_data)?;
@@ -773,7 +787,7 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
impl<C, TxApi> futures03::Future for CreateProposal<C, TxApi> where
TxApi: PoolChainApi<Block=Block>,
C: ProvideRuntimeApi + HeaderBackend<Block> + Send + Sync,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block>,
C::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = client_error::Error>,
{
type Output = Result<Block, Error>;
+1 -1
View File
@@ -276,7 +276,7 @@ impl<Fetch: Future> ParachainWork<Fetch> {
>
where
P: Send + Sync + 'static,
P::Api: ParachainHost<Block>,
P::Api: ParachainHost<Block, Error = client::error::Error>,
{
let max_block_data_size = self.max_block_data_size;
let validate = move |id: &_, collation: &_| {