mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Remove polkadot-validation crate (#2271)
This commit is contained in:
Generated
-28
@@ -5884,34 +5884,6 @@ dependencies = [
|
|||||||
"tracing-futures",
|
"tracing-futures",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "polkadot-validation"
|
|
||||||
version = "0.8.27"
|
|
||||||
dependencies = [
|
|
||||||
"futures 0.3.10",
|
|
||||||
"log",
|
|
||||||
"parity-scale-codec",
|
|
||||||
"polkadot-parachain",
|
|
||||||
"polkadot-primitives",
|
|
||||||
"sc-basic-authorship",
|
|
||||||
"sc-block-builder",
|
|
||||||
"sc-client-api",
|
|
||||||
"sc-finality-grandpa",
|
|
||||||
"sp-api",
|
|
||||||
"sp-blockchain",
|
|
||||||
"sp-consensus",
|
|
||||||
"sp-consensus-babe",
|
|
||||||
"sp-core",
|
|
||||||
"sp-inherents",
|
|
||||||
"sp-keyring",
|
|
||||||
"sp-runtime",
|
|
||||||
"sp-timestamp",
|
|
||||||
"sp-transaction-pool",
|
|
||||||
"sp-trie",
|
|
||||||
"substrate-prometheus-endpoint",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "polling"
|
name = "polling"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ members = [
|
|||||||
"runtime/westend",
|
"runtime/westend",
|
||||||
"runtime/test-runtime",
|
"runtime/test-runtime",
|
||||||
"statement-table",
|
"statement-table",
|
||||||
"validation",
|
|
||||||
"xcm",
|
"xcm",
|
||||||
"xcm/xcm-builder",
|
"xcm/xcm-builder",
|
||||||
"xcm/xcm-executor",
|
"xcm/xcm-executor",
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "polkadot-validation"
|
|
||||||
version = "0.8.27"
|
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
polkadot-primitives = { path = "../primitives" }
|
|
||||||
parachain = { package = "polkadot-parachain", path = "../parachain" }
|
|
||||||
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
consensus = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
futures = "0.3.8"
|
|
||||||
log = "0.4.13"
|
|
||||||
parity-scale-codec = { version = "1.3.6", default-features = false, features = ["derive"] }
|
|
||||||
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
txpool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
block-builder = { package = "sc-block-builder", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
thiserror = "1.0.23"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
= Polkadot Validation
|
|
||||||
|
|
||||||
placeholder
|
|
||||||
//TODO Write content :) (https://github.com/paritytech/polkadot/issues/159)
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
// Copyright 2020 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Polkadot.
|
|
||||||
|
|
||||||
// Polkadot is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Polkadot is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! The block production pipeline of Polkadot.
|
|
||||||
//!
|
|
||||||
//! The `ProposerFactory` exported by this module will be wrapped by some
|
|
||||||
//! consensus engine, and triggered when it is time to create a block.
|
|
||||||
|
|
||||||
use std::{
|
|
||||||
pin::Pin,
|
|
||||||
sync::Arc,
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
use sp_blockchain::HeaderBackend;
|
|
||||||
use block_builder::{BlockBuilderApi, BlockBuilderProvider};
|
|
||||||
use consensus::{Proposal, RecordProof};
|
|
||||||
use primitives::traits::SpawnNamed;
|
|
||||||
use polkadot_primitives::v0::{NEW_HEADS_IDENTIFIER, Block, Header, AttestedCandidate};
|
|
||||||
use runtime_primitives::traits::{DigestFor, HashFor};
|
|
||||||
use txpool_api::TransactionPool;
|
|
||||||
|
|
||||||
use futures::prelude::*;
|
|
||||||
use inherents::InherentData;
|
|
||||||
use sp_api::{ApiExt, ProvideRuntimeApi};
|
|
||||||
use prometheus_endpoint::Registry as PrometheusRegistry;
|
|
||||||
|
|
||||||
use crate::Error;
|
|
||||||
|
|
||||||
// Polkadot proposer factory.
|
|
||||||
pub struct ProposerFactory<Client, TxPool, Backend> {
|
|
||||||
factory: sc_basic_authorship::ProposerFactory<TxPool, Backend, Client>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Client, TxPool, Backend> ProposerFactory<Client, TxPool, Backend> {
|
|
||||||
/// Create a new proposer factory.
|
|
||||||
pub fn new(
|
|
||||||
spawn_handle: Box<dyn SpawnNamed>,
|
|
||||||
client: Arc<Client>,
|
|
||||||
transaction_pool: Arc<TxPool>,
|
|
||||||
prometheus: Option<&PrometheusRegistry>,
|
|
||||||
) -> Self {
|
|
||||||
let factory = sc_basic_authorship::ProposerFactory::new(
|
|
||||||
spawn_handle,
|
|
||||||
client,
|
|
||||||
transaction_pool,
|
|
||||||
prometheus,
|
|
||||||
);
|
|
||||||
ProposerFactory {
|
|
||||||
factory,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Client, TxPool, Backend> consensus::Environment<Block>
|
|
||||||
for ProposerFactory<Client, TxPool, Backend>
|
|
||||||
where
|
|
||||||
TxPool: TransactionPool<Block=Block> + 'static,
|
|
||||||
Client: BlockBuilderProvider<Backend, Block, Client> + ProvideRuntimeApi<Block> + HeaderBackend<Block> + Send + Sync + 'static,
|
|
||||||
Client::Api: BlockBuilderApi<Block>
|
|
||||||
+ ApiExt<Block, Error = sp_blockchain::Error>,
|
|
||||||
Backend: sc_client_api::Backend<
|
|
||||||
Block,
|
|
||||||
State = sp_api::StateBackendFor<Client, Block>
|
|
||||||
> + 'static,
|
|
||||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
|
||||||
sp_api::StateBackendFor<Client, Block>: sp_api::StateBackend<HashFor<Block>> + Send,
|
|
||||||
{
|
|
||||||
type CreateProposer = Pin<Box<
|
|
||||||
dyn Future<Output = Result<Self::Proposer, Self::Error>> + Send + 'static
|
|
||||||
>>;
|
|
||||||
type Proposer = Proposer<Client, TxPool, Backend>;
|
|
||||||
type Error = Error;
|
|
||||||
|
|
||||||
fn init(
|
|
||||||
&mut self,
|
|
||||||
parent_header: &Header,
|
|
||||||
) -> Self::CreateProposer {
|
|
||||||
let proposer = self.factory.init(parent_header)
|
|
||||||
.into_inner()
|
|
||||||
.map_err(Into::into)
|
|
||||||
.map(|proposer| Proposer { proposer });
|
|
||||||
|
|
||||||
Box::pin(future::ready(proposer))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The Polkadot proposer logic.
|
|
||||||
pub struct Proposer<Client, TxPool: TransactionPool<Block=Block>, Backend> {
|
|
||||||
proposer: sc_basic_authorship::Proposer<Backend, Block, Client, TxPool>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<Client, TxPool, Backend> consensus::Proposer<Block> for Proposer<Client, TxPool, Backend> where
|
|
||||||
TxPool: TransactionPool<Block=Block> + 'static,
|
|
||||||
Client: BlockBuilderProvider<Backend, Block, Client> + ProvideRuntimeApi<Block> + HeaderBackend<Block> + Send + Sync + 'static,
|
|
||||||
Client::Api: BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
|
||||||
Backend: sc_client_api::Backend<Block, State = sp_api::StateBackendFor<Client, Block>> + 'static,
|
|
||||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
|
||||||
sp_api::StateBackendFor<Client, Block>: sp_api::StateBackend<HashFor<Block>> + Send,
|
|
||||||
{
|
|
||||||
type Error = Error;
|
|
||||||
type Transaction = sp_api::TransactionFor<Client, Block>;
|
|
||||||
type Proposal = Pin<
|
|
||||||
Box<
|
|
||||||
dyn Future<Output = Result<
|
|
||||||
Proposal<Block, sp_api::TransactionFor<Client, Block>>,
|
|
||||||
Self::Error,
|
|
||||||
>>
|
|
||||||
+ Send
|
|
||||||
>
|
|
||||||
>;
|
|
||||||
|
|
||||||
fn propose(
|
|
||||||
self,
|
|
||||||
inherent_data: InherentData,
|
|
||||||
inherent_digests: DigestFor<Block>,
|
|
||||||
max_duration: Duration,
|
|
||||||
record_proof: RecordProof,
|
|
||||||
) -> Self::Proposal {
|
|
||||||
async move {
|
|
||||||
let mut inherent_data = inherent_data;
|
|
||||||
inherent_data.put_data(NEW_HEADS_IDENTIFIER, &Vec::<AttestedCandidate>::new())
|
|
||||||
.map_err(Error::InherentError)?;
|
|
||||||
|
|
||||||
self.proposer.propose(
|
|
||||||
inherent_data,
|
|
||||||
inherent_digests.clone(),
|
|
||||||
max_duration,
|
|
||||||
record_proof
|
|
||||||
).await.map_err(Into::into)
|
|
||||||
}.boxed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Polkadot.
|
|
||||||
|
|
||||||
// Polkadot is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Polkadot is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! Errors that can occur during the validation process.
|
|
||||||
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
/// Error type for validation
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum Error {
|
|
||||||
/// Client error
|
|
||||||
#[error(transparent)]
|
|
||||||
Client(#[from] sp_blockchain::Error),
|
|
||||||
/// Consensus error
|
|
||||||
#[error(transparent)]
|
|
||||||
Consensus(#[from] consensus::error::Error),
|
|
||||||
/// Unexpected error checking inherents
|
|
||||||
#[error("Unexpected error while checking inherents: {0}")]
|
|
||||||
InherentError(inherents::Error),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
impl std::convert::From<inherents::Error> for Error {
|
|
||||||
fn from(inner: inherents::Error) -> Self {
|
|
||||||
Self::InherentError(inner)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
|
||||||
// This file is part of Polkadot.
|
|
||||||
|
|
||||||
// Polkadot is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
|
|
||||||
// Polkadot is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! Propagation and agreement of candidates.
|
|
||||||
//!
|
|
||||||
//! Authorities are split into groups by parachain, and each authority might come
|
|
||||||
//! up its own candidate for their parachain. Within groups, authorities pass around
|
|
||||||
//! their candidates and produce statements of validity.
|
|
||||||
//!
|
|
||||||
//! Any candidate that receives majority approval by the authorities in a group
|
|
||||||
//! may be subject to inclusion, unless any authorities flag that candidate as invalid.
|
|
||||||
//!
|
|
||||||
//! Wrongly flagging as invalid should be strongly disincentivized, so that in the
|
|
||||||
//! equilibrium state it is not expected to happen. Likewise with the submission
|
|
||||||
//! of invalid blocks.
|
|
||||||
//!
|
|
||||||
//! Groups themselves may be compromised by malicious authorities.
|
|
||||||
|
|
||||||
pub use self::block_production::ProposerFactory;
|
|
||||||
pub use self::error::Error;
|
|
||||||
pub use parachain::wasm_executor::run_worker as run_validation_worker;
|
|
||||||
|
|
||||||
mod error;
|
|
||||||
|
|
||||||
pub mod block_production;
|
|
||||||
Reference in New Issue
Block a user