mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Rename polkadot-consensus -> polkadot-validation (#151)
* Initial rename of consensus -> validation * Rename crate imports * network: rename consensus to validation * network: rename consensus in comments and logs * Grumbles * Rename tests consensus -> validation
This commit is contained in:
committed by
Robert Habermeier
parent
62cf571336
commit
7a619ea222
@@ -4,6 +4,7 @@
|
||||
.wasm-binaries
|
||||
polkadot/runtime/wasm/target/
|
||||
**/._*
|
||||
.idea
|
||||
.vscode
|
||||
polkadot.*
|
||||
.DS_Store
|
||||
|
||||
Generated
+31
-31
@@ -2204,35 +2204,6 @@ dependencies = [
|
||||
"tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-consensus"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"polkadot-availability-store 0.1.0",
|
||||
"polkadot-parachain 0.1.0",
|
||||
"polkadot-primitives 0.1.0",
|
||||
"polkadot-runtime 0.1.0",
|
||||
"polkadot-statement-table 0.1.0",
|
||||
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"srml-aura 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-consensus-aura 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-consensus-common 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-finality-grandpa 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-inherents 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-transaction-pool 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate)",
|
||||
"tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-erasure-coding"
|
||||
version = "0.1.0"
|
||||
@@ -2264,8 +2235,8 @@ dependencies = [
|
||||
"parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"polkadot-availability-store 0.1.0",
|
||||
"polkadot-consensus 0.1.0",
|
||||
"polkadot-primitives 0.1.0",
|
||||
"polkadot-validation 0.1.0",
|
||||
"slice-group-by 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
@@ -2361,11 +2332,11 @@ dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"polkadot-availability-store 0.1.0",
|
||||
"polkadot-consensus 0.1.0",
|
||||
"polkadot-executor 0.1.0",
|
||||
"polkadot-network 0.1.0",
|
||||
"polkadot-primitives 0.1.0",
|
||||
"polkadot-runtime 0.1.0",
|
||||
"polkadot-validation 0.1.0",
|
||||
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-io 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
@@ -2390,6 +2361,35 @@ dependencies = [
|
||||
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polkadot-validation"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"polkadot-availability-store 0.1.0",
|
||||
"polkadot-parachain 0.1.0",
|
||||
"polkadot-primitives 0.1.0",
|
||||
"polkadot-runtime 0.1.0",
|
||||
"polkadot-statement-table 0.1.0",
|
||||
"sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"srml-aura 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-consensus-aura 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-consensus-common 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-finality-grandpa 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-inherents 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-transaction-pool 0.1.0 (git+https://github.com/paritytech/substrate)",
|
||||
"substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate)",
|
||||
"tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pretty_assertions"
|
||||
version = "0.5.1"
|
||||
|
||||
+1
-1
@@ -22,7 +22,6 @@ members = [
|
||||
"availability-store",
|
||||
"cli",
|
||||
"collator",
|
||||
"consensus",
|
||||
"erasure-coding",
|
||||
"executor",
|
||||
"network",
|
||||
@@ -31,6 +30,7 @@ members = [
|
||||
"service",
|
||||
"statement-table",
|
||||
"service",
|
||||
"validation",
|
||||
|
||||
"test-parachains/adder",
|
||||
"test-parachains/adder/collator",
|
||||
|
||||
@@ -8,7 +8,7 @@ description = "Polkadot-specific networking protocol"
|
||||
arrayvec = "0.4"
|
||||
parking_lot = "0.7.1"
|
||||
polkadot-availability-store = { path = "../availability-store" }
|
||||
polkadot-consensus = { path = "../consensus" }
|
||||
polkadot-validation = { path = "../validation" }
|
||||
polkadot-primitives = { path = "../primitives" }
|
||||
parity-codec = "3.0"
|
||||
parity-codec-derive = "3.0"
|
||||
|
||||
+19
-19
@@ -24,7 +24,7 @@ extern crate substrate_network;
|
||||
extern crate substrate_primitives;
|
||||
extern crate sr_primitives;
|
||||
|
||||
extern crate polkadot_consensus;
|
||||
extern crate polkadot_validation;
|
||||
extern crate polkadot_availability_store as av_store;
|
||||
extern crate polkadot_primitives;
|
||||
|
||||
@@ -49,7 +49,7 @@ extern crate substrate_keyring;
|
||||
mod collator_pool;
|
||||
mod local_collations;
|
||||
mod router;
|
||||
pub mod consensus;
|
||||
pub mod validation;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use futures::sync::oneshot;
|
||||
@@ -59,7 +59,7 @@ use substrate_network::{NodeIndex, RequestId, Context, Severity};
|
||||
use substrate_network::{message, generic_message};
|
||||
use substrate_network::specialization::NetworkSpecialization as Specialization;
|
||||
use substrate_network::StatusMessage as GenericFullStatus;
|
||||
use self::consensus::{LiveConsensusInstances, RecentSessionKeys, InsertedRecentKey};
|
||||
use self::validation::{LiveValidationSessions, RecentSessionKeys, InsertedRecentKey};
|
||||
use self::collator_pool::{CollatorPool, Role, Action};
|
||||
use self::local_collations::LocalCollations;
|
||||
|
||||
@@ -85,7 +85,7 @@ pub struct Status {
|
||||
|
||||
struct BlockDataRequest {
|
||||
attempted_peers: HashSet<SessionKey>,
|
||||
consensus_parent: Hash,
|
||||
validation_session_parent: Hash,
|
||||
candidate_hash: Hash,
|
||||
block_data_hash: Hash,
|
||||
sender: oneshot::Sender<BlockData>,
|
||||
@@ -168,7 +168,7 @@ pub struct PolkadotProtocol {
|
||||
collators: CollatorPool,
|
||||
validators: HashMap<SessionKey, NodeIndex>,
|
||||
local_collations: LocalCollations<Collation>,
|
||||
live_consensus: LiveConsensusInstances,
|
||||
live_validation_sessions: LiveValidationSessions,
|
||||
in_flight: HashMap<(RequestId, NodeIndex), BlockDataRequest>,
|
||||
pending: Vec<BlockDataRequest>,
|
||||
extrinsic_store: Option<::av_store::Store>,
|
||||
@@ -184,7 +184,7 @@ impl PolkadotProtocol {
|
||||
collating_for,
|
||||
validators: HashMap::new(),
|
||||
local_collations: LocalCollations::new(),
|
||||
live_consensus: LiveConsensusInstances::new(),
|
||||
live_validation_sessions: LiveValidationSessions::new(),
|
||||
in_flight: HashMap::new(),
|
||||
pending: Vec::new(),
|
||||
extrinsic_store: None,
|
||||
@@ -198,7 +198,7 @@ impl PolkadotProtocol {
|
||||
|
||||
self.pending.push(BlockDataRequest {
|
||||
attempted_peers: Default::default(),
|
||||
consensus_parent: relay_parent,
|
||||
validation_session_parent: relay_parent,
|
||||
candidate_hash: candidate.hash(),
|
||||
block_data_hash: candidate.block_data_hash,
|
||||
sender: tx,
|
||||
@@ -208,14 +208,14 @@ impl PolkadotProtocol {
|
||||
rx
|
||||
}
|
||||
|
||||
/// Note new consensus session.
|
||||
fn new_consensus(
|
||||
/// Note new validation session.
|
||||
fn new_validation_session(
|
||||
&mut self,
|
||||
ctx: &mut Context<Block>,
|
||||
parent_hash: Hash,
|
||||
consensus: consensus::CurrentConsensus,
|
||||
session: validation::ValidationSession,
|
||||
) {
|
||||
if let Some(new_local) = self.live_consensus.new_consensus(parent_hash, consensus) {
|
||||
if let Some(new_local) = self.live_validation_sessions.new_validation_session(parent_hash, session) {
|
||||
for (id, peer_data) in self.peers.iter_mut()
|
||||
.filter(|&(_, ref info)| info.should_send_key())
|
||||
{
|
||||
@@ -228,8 +228,8 @@ impl PolkadotProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
fn remove_consensus(&mut self, parent_hash: &Hash) {
|
||||
self.live_consensus.remove(parent_hash);
|
||||
fn remove_validation_session(&mut self, parent_hash: &Hash) {
|
||||
self.live_validation_sessions.remove(parent_hash);
|
||||
}
|
||||
|
||||
fn dispatch_pending_requests(&mut self, ctx: &mut Context<Block>) {
|
||||
@@ -239,10 +239,10 @@ impl PolkadotProtocol {
|
||||
let in_flight = &mut self.in_flight;
|
||||
|
||||
for mut pending in ::std::mem::replace(&mut self.pending, Vec::new()) {
|
||||
let parent = pending.consensus_parent;
|
||||
let parent = pending.validation_session_parent;
|
||||
let c_hash = pending.candidate_hash;
|
||||
|
||||
let still_pending = self.live_consensus.with_block_data(&parent, &c_hash, |x| match x {
|
||||
let still_pending = self.live_validation_sessions.with_block_data(&parent, &c_hash, |x| match x {
|
||||
Ok(data @ &_) => {
|
||||
// answer locally.
|
||||
let _ = pending.sender.send(data.clone());
|
||||
@@ -272,7 +272,7 @@ impl PolkadotProtocol {
|
||||
Some(pending)
|
||||
}
|
||||
}
|
||||
Err(None) => None, // no such known consensus session. prune out.
|
||||
Err(None) => None, // no such known validation session. prune out.
|
||||
});
|
||||
|
||||
if let Some(pending) = still_pending {
|
||||
@@ -288,7 +288,7 @@ impl PolkadotProtocol {
|
||||
match msg {
|
||||
Message::SessionKey(key) => self.on_session_key(ctx, who, key),
|
||||
Message::RequestBlockData(req_id, relay_parent, candidate_hash) => {
|
||||
let block_data = self.live_consensus
|
||||
let block_data = self.live_validation_sessions
|
||||
.with_block_data(
|
||||
&relay_parent,
|
||||
&candidate_hash,
|
||||
@@ -440,7 +440,7 @@ impl Specialization<Block> for PolkadotProtocol {
|
||||
|
||||
// send session keys.
|
||||
if peer_info.should_send_key() {
|
||||
for local_session_key in self.live_consensus.recent_keys() {
|
||||
for local_session_key in self.live_validation_sessions.recent_keys() {
|
||||
peer_info.collator_state.send_key(*local_session_key, |msg| send_polkadot_message(
|
||||
ctx,
|
||||
who,
|
||||
@@ -481,7 +481,7 @@ impl Specialization<Block> for PolkadotProtocol {
|
||||
let (sender, _) = oneshot::channel();
|
||||
pending.push(::std::mem::replace(val, BlockDataRequest {
|
||||
attempted_peers: Default::default(),
|
||||
consensus_parent: Default::default(),
|
||||
validation_session_parent: Default::default(),
|
||||
candidate_hash: Default::default(),
|
||||
block_data_hash: Default::default(),
|
||||
sender,
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
//! During the consensus process, validators exchange statements on validity and availability
|
||||
//! of parachain candidates.
|
||||
//! The `Router` in this file hooks into the underlying network to fulfill
|
||||
//! the `TableRouter` trait from `polkadot-consensus`, which is expected to call into a shared statement table
|
||||
//! the `TableRouter` trait from `polkadot-validation`, which is expected to call into a shared statement table
|
||||
//! and dispatch evaluation work as necessary when new statements come in.
|
||||
|
||||
use sr_primitives::traits::{ProvideRuntimeApi, BlakeTwo256, Hash as HashT};
|
||||
use polkadot_consensus::{
|
||||
use polkadot_validation::{
|
||||
SharedTable, TableRouter, SignedStatement, GenericStatement, ParachainWork, Incoming,
|
||||
Validated, Outgoing,
|
||||
};
|
||||
@@ -41,7 +41,7 @@ use std::collections::{hash_map::{Entry, HashMap}, HashSet};
|
||||
use std::{io, mem};
|
||||
use std::sync::Arc;
|
||||
|
||||
use consensus::{NetworkService, Knowledge, Executor};
|
||||
use validation::{NetworkService, Knowledge, Executor};
|
||||
|
||||
type IngressPair = (ParaId, Vec<Message>);
|
||||
type IngressPairRef<'a> = (ParaId, &'a [Message]);
|
||||
@@ -380,7 +380,7 @@ impl<P: ProvideRuntimeApi + Send, E, N, T> TableRouter for Router<P, E, N, T> wh
|
||||
impl<P, E, N: NetworkService, T> Drop for Router<P, E, N, T> {
|
||||
fn drop(&mut self) {
|
||||
let parent_hash = self.parent_hash.clone();
|
||||
self.network.with_spec(move |spec, _| spec.remove_consensus(&parent_hash));
|
||||
self.network.with_spec(move |spec, _| spec.remove_validation_session(&parent_hash));
|
||||
self.network.drop_gossip(self.attestation_topic);
|
||||
|
||||
{
|
||||
@@ -481,7 +481,7 @@ impl<S> Future for ComputeIngress<S> where S: Stream<Item=IngressPair> {
|
||||
Entry::Occupied(occupied) => {
|
||||
let canon_root = occupied.get().clone();
|
||||
let messages = messages.iter().map(|m| &m.0[..]);
|
||||
if ::polkadot_consensus::message_queue_root(messages) != canon_root {
|
||||
if ::polkadot_validation::message_queue_root(messages) != canon_root {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ mod tests {
|
||||
let roots: HashMap<_, _> = actual_messages.iter()
|
||||
.map(|&(para_id, ref messages)| (
|
||||
para_id,
|
||||
::polkadot_consensus::message_queue_root(messages.iter().map(|m| &m.0)),
|
||||
::polkadot_validation::message_queue_root(messages.iter().map(|m| &m.0)),
|
||||
))
|
||||
.collect();
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Tests for polkadot and consensus network.
|
||||
//! Tests for polkadot and validation network.
|
||||
|
||||
use super::{PolkadotProtocol, Status, Message, FullStatus};
|
||||
use consensus::{CurrentConsensus, Knowledge};
|
||||
use validation::{ValidationSession, Knowledge};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use polkadot_consensus::GenericStatement;
|
||||
use polkadot_validation::GenericStatement;
|
||||
use polkadot_primitives::{Block, SessionKey};
|
||||
use polkadot_primitives::parachain::{CandidateReceipt, HeadData, BlockData};
|
||||
use substrate_primitives::H512;
|
||||
@@ -34,7 +34,7 @@ use substrate_network::{
|
||||
use std::sync::Arc;
|
||||
use futures::Future;
|
||||
|
||||
mod consensus;
|
||||
mod validation;
|
||||
|
||||
#[derive(Default)]
|
||||
struct TestContext {
|
||||
@@ -87,9 +87,9 @@ fn make_status(status: &Status, roles: Roles) -> FullStatus {
|
||||
}
|
||||
}
|
||||
|
||||
fn make_consensus(local_key: SessionKey) -> (CurrentConsensus, Arc<Mutex<Knowledge>>) {
|
||||
fn make_validation_session(local_key: SessionKey) -> (ValidationSession, Arc<Mutex<Knowledge>>) {
|
||||
let knowledge = Arc::new(Mutex::new(Knowledge::new()));
|
||||
let c = CurrentConsensus::new(knowledge.clone(), local_key);
|
||||
let c = ValidationSession::new(knowledge.clone(), local_key);
|
||||
|
||||
(c, knowledge)
|
||||
}
|
||||
@@ -119,8 +119,8 @@ fn sends_session_key() {
|
||||
|
||||
{
|
||||
let mut ctx = TestContext::default();
|
||||
let (consensus, _knowledge) = make_consensus(local_key);
|
||||
protocol.new_consensus(&mut ctx, parent_hash, consensus);
|
||||
let (session, _knowledge) = make_validation_session(local_key);
|
||||
protocol.new_validation_session(&mut ctx, parent_hash, session);
|
||||
assert!(ctx.has_message(peer_a, Message::SessionKey(local_key)));
|
||||
}
|
||||
|
||||
@@ -159,8 +159,8 @@ fn fetches_from_those_with_knowledge() {
|
||||
|
||||
let status = Status { collating_for: None };
|
||||
|
||||
let (consensus, knowledge) = make_consensus(local_key);
|
||||
protocol.new_consensus(&mut TestContext::default(), parent_hash, consensus);
|
||||
let (session, knowledge) = make_validation_session(local_key);
|
||||
protocol.new_validation_session(&mut TestContext::default(), parent_hash, session);
|
||||
|
||||
knowledge.lock().note_statement(a_key, &GenericStatement::Valid(candidate_hash));
|
||||
let recv = protocol.fetch_block_data(&mut TestContext::default(), &candidate_receipt, parent_hash);
|
||||
@@ -289,13 +289,13 @@ fn many_session_keys() {
|
||||
let local_key_a = [3; 32].into();
|
||||
let local_key_b = [4; 32].into();
|
||||
|
||||
let (consensus_a, _knowledge_a) = make_consensus(local_key_a);
|
||||
let (consensus_b, _knowledge_b) = make_consensus(local_key_b);
|
||||
let (session_a, _knowledge_a) = make_validation_session(local_key_a);
|
||||
let (session_b, _knowledge_b) = make_validation_session(local_key_b);
|
||||
|
||||
protocol.new_consensus(&mut TestContext::default(), parent_a, consensus_a);
|
||||
protocol.new_consensus(&mut TestContext::default(), parent_b, consensus_b);
|
||||
protocol.new_validation_session(&mut TestContext::default(), parent_a, session_a);
|
||||
protocol.new_validation_session(&mut TestContext::default(), parent_b, session_b);
|
||||
|
||||
assert_eq!(protocol.live_consensus.recent_keys(), &[local_key_a, local_key_b]);
|
||||
assert_eq!(protocol.live_validation_sessions.recent_keys(), &[local_key_a, local_key_b]);
|
||||
|
||||
let peer_a = 1;
|
||||
|
||||
@@ -312,7 +312,7 @@ fn many_session_keys() {
|
||||
|
||||
let peer_b = 2;
|
||||
|
||||
protocol.remove_consensus(&parent_a);
|
||||
protocol.remove_validation_session(&parent_a);
|
||||
|
||||
{
|
||||
let mut ctx = TestContext::default();
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Tests and helpers for consensus networking.
|
||||
//! Tests and helpers for validation networking.
|
||||
|
||||
use consensus::NetworkService;
|
||||
use validation::NetworkService;
|
||||
use substrate_network::{consensus_gossip::ConsensusMessage, Context as NetContext};
|
||||
use substrate_primitives::{Ed25519AuthorityId, NativeOrEncoded};
|
||||
use substrate_keyring::Keyring;
|
||||
use {PolkadotProtocol};
|
||||
|
||||
use polkadot_consensus::{SharedTable, MessagesFrom, Network, TableRouter};
|
||||
use polkadot_validation::{SharedTable, MessagesFrom, Network, TableRouter};
|
||||
use polkadot_primitives::{AccountId, Block, Hash, Header, BlockId};
|
||||
use polkadot_primitives::parachain::{Id as ParaId, Chain, DutyRoster, ParachainHost, OutgoingMessage};
|
||||
use parking_lot::Mutex;
|
||||
@@ -298,7 +298,7 @@ impl ParachainHost<Block> for RuntimeApi {
|
||||
}
|
||||
}
|
||||
|
||||
type TestConsensusNetwork = ::consensus::ConsensusNetwork<
|
||||
type TestValidationNetwork = ::validation::ValidationNetwork<
|
||||
TestApi,
|
||||
NeverExit,
|
||||
TestNetwork,
|
||||
@@ -308,7 +308,7 @@ type TestConsensusNetwork = ::consensus::ConsensusNetwork<
|
||||
struct Built {
|
||||
gossip: GossipRouter,
|
||||
api_handle: Arc<Mutex<ApiData>>,
|
||||
networks: Vec<TestConsensusNetwork>,
|
||||
networks: Vec<TestValidationNetwork>,
|
||||
}
|
||||
|
||||
fn build_network(n: usize, executor: TaskExecutor) -> Built {
|
||||
@@ -322,7 +322,7 @@ fn build_network(n: usize, executor: TaskExecutor) -> Built {
|
||||
gossip: gossip_handle.clone(),
|
||||
});
|
||||
|
||||
TestConsensusNetwork::new(
|
||||
TestValidationNetwork::new(
|
||||
net,
|
||||
NeverExit,
|
||||
runtime_api.clone(),
|
||||
@@ -356,7 +356,7 @@ impl IngressBuilder {
|
||||
let mut map = HashMap::new();
|
||||
for ((source, target), messages) in self.egress {
|
||||
map.entry(target).or_insert_with(Vec::new)
|
||||
.push((source, polkadot_consensus::message_queue_root(&messages)));
|
||||
.push((source, polkadot_validation::message_queue_root(&messages)));
|
||||
}
|
||||
|
||||
for roots in map.values_mut() {
|
||||
@@ -372,7 +372,7 @@ fn make_table(data: &ApiData, local_key: &Keyring, parent_hash: Hash) -> Arc<Sha
|
||||
|
||||
let store = Store::new_in_memory();
|
||||
let authorities: Vec<_> = data.validators.iter().map(|v| v.to_fixed_bytes().into()).collect();
|
||||
let (group_info, _) = ::polkadot_consensus::make_group_info(
|
||||
let (group_info, _) = ::polkadot_validation::make_group_info(
|
||||
DutyRoster { validator_duty: data.duties.clone() },
|
||||
&authorities,
|
||||
local_key.to_raw_public().into()
|
||||
@@ -14,14 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The "consensus" networking code built on top of the base network service.
|
||||
//! The "validation session" networking code built on top of the base network service.
|
||||
//!
|
||||
//! This fulfills the `polkadot_consensus::Network` trait, providing a hook to be called
|
||||
//! each time consensus begins on a new chain head.
|
||||
//! This fulfills the `polkadot_validation::Network` trait, providing a hook to be called
|
||||
//! each time a validation session begins on a new chain head.
|
||||
|
||||
use sr_primitives::traits::ProvideRuntimeApi;
|
||||
use substrate_network::{consensus_gossip::ConsensusMessage, Context as NetContext};
|
||||
use polkadot_consensus::{Network as ParachainNetwork, SharedTable, Collators, Statement, GenericStatement};
|
||||
use polkadot_validation::{Network as ParachainNetwork, SharedTable, Collators, Statement, GenericStatement};
|
||||
use polkadot_primitives::{AccountId, Block, Hash, SessionKey};
|
||||
use polkadot_primitives::parachain::{Id as ParaId, Collation, Extrinsic, ParachainHost, BlockData};
|
||||
use codec::Decode;
|
||||
@@ -53,7 +53,7 @@ impl<T> Executor for WrappedExecutor<T>
|
||||
{
|
||||
fn spawn<F: Future<Item=(),Error=()> + Send + 'static>(&self, f: F) {
|
||||
if let Err(e) = self.0.execute(Box::new(f)) {
|
||||
warn!(target: "consensus", "could not spawn consensus task: {:?}", e);
|
||||
warn!(target: "validation", "could not spawn consensus task: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,11 +128,11 @@ impl<P, E, N, T> MessageProcessTask<P, E, N, T> where
|
||||
T: Clone + Executor + Send + 'static,
|
||||
{
|
||||
fn process_message(&self, msg: ConsensusMessage) -> Option<Async<()>> {
|
||||
use polkadot_consensus::SignedStatement;
|
||||
use polkadot_validation::SignedStatement;
|
||||
|
||||
debug!(target: "consensus", "Processing consensus statement for live consensus");
|
||||
debug!(target: "validation", "Processing validation statement for live session");
|
||||
if let Some(statement) = SignedStatement::decode(&mut msg.as_slice()) {
|
||||
if ::polkadot_consensus::check_statement(
|
||||
if ::polkadot_validation::check_statement(
|
||||
&statement.statement,
|
||||
&statement.signature,
|
||||
statement.sender,
|
||||
@@ -171,23 +171,23 @@ impl<P, E, N, T> Future for MessageProcessTask<P, E, N, T> where
|
||||
}
|
||||
|
||||
/// Wrapper around the network service
|
||||
pub struct ConsensusNetwork<P, E, N, T> {
|
||||
pub struct ValidationNetwork<P, E, N, T> {
|
||||
network: Arc<N>,
|
||||
api: Arc<P>,
|
||||
executor: T,
|
||||
exit: E,
|
||||
}
|
||||
|
||||
impl<P, E, N, T> ConsensusNetwork<P, E, N, T> {
|
||||
/// Create a new consensus networking object.
|
||||
impl<P, E, N, T> ValidationNetwork<P, E, N, T> {
|
||||
/// Create a new validation session networking object.
|
||||
pub fn new(network: Arc<N>, exit: E, api: Arc<P>, executor: T) -> Self {
|
||||
ConsensusNetwork { network, exit, api, executor }
|
||||
ValidationNetwork { network, exit, api, executor }
|
||||
}
|
||||
}
|
||||
|
||||
impl<P, E: Clone, N, T: Clone> Clone for ConsensusNetwork<P, E, N, T> {
|
||||
impl<P, E: Clone, N, T: Clone> Clone for ValidationNetwork<P, E, N, T> {
|
||||
fn clone(&self) -> Self {
|
||||
ConsensusNetwork {
|
||||
ValidationNetwork {
|
||||
network: self.network.clone(),
|
||||
exit: self.exit.clone(),
|
||||
api: self.api.clone(),
|
||||
@@ -197,7 +197,7 @@ impl<P, E: Clone, N, T: Clone> Clone for ConsensusNetwork<P, E, N, T> {
|
||||
}
|
||||
|
||||
/// A long-lived network which can create parachain statement routing processes on demand.
|
||||
impl<P, E, N, T> ParachainNetwork for ConsensusNetwork<P, E, N, T> where
|
||||
impl<P, E, N, T> ParachainNetwork for ValidationNetwork<P, E, N, T> where
|
||||
P: ProvideRuntimeApi + Send + Sync + 'static,
|
||||
P::Api: ParachainHost<Block>,
|
||||
E: Clone + Future<Item=(),Error=()> + Send + 'static,
|
||||
@@ -209,7 +209,7 @@ impl<P, E, N, T> ParachainNetwork for ConsensusNetwork<P, E, N, T> where
|
||||
fn communication_for(
|
||||
&self,
|
||||
table: Arc<SharedTable>,
|
||||
outgoing: polkadot_consensus::Outgoing,
|
||||
outgoing: polkadot_validation::Outgoing,
|
||||
) -> Self::TableRouter {
|
||||
let parent_hash = table.consensus_parent_hash().clone();
|
||||
|
||||
@@ -238,7 +238,7 @@ impl<P, E, N, T> ParachainNetwork for ConsensusNetwork<P, E, N, T> where
|
||||
let inner_stream = self.network.gossip_messages_for(attestation_topic);
|
||||
self.network
|
||||
.with_spec(move |spec, ctx| {
|
||||
spec.new_consensus(ctx, parent_hash, CurrentConsensus {
|
||||
spec.new_validation_session(ctx, parent_hash, ValidationSession {
|
||||
knowledge,
|
||||
local_session_key,
|
||||
});
|
||||
@@ -284,7 +284,7 @@ impl Future for AwaitingCollation {
|
||||
}
|
||||
}
|
||||
|
||||
impl<P, E: Clone, N, T: Clone> Collators for ConsensusNetwork<P, E, N, T> where
|
||||
impl<P, E: Clone, N, T: Clone> Collators for ValidationNetwork<P, E, N, T> where
|
||||
P: ProvideRuntimeApi + Send + Sync + 'static,
|
||||
P::Api: ParachainHost<Block>,
|
||||
N: NetworkService,
|
||||
@@ -359,16 +359,16 @@ impl Knowledge {
|
||||
}
|
||||
}
|
||||
|
||||
/// A current consensus instance.
|
||||
pub(crate) struct CurrentConsensus {
|
||||
/// A current validation session instance.
|
||||
pub(crate) struct ValidationSession {
|
||||
knowledge: Arc<Mutex<Knowledge>>,
|
||||
local_session_key: SessionKey,
|
||||
}
|
||||
|
||||
impl CurrentConsensus {
|
||||
impl ValidationSession {
|
||||
#[cfg(test)]
|
||||
pub(crate) fn new(knowledge: Arc<Mutex<Knowledge>>, local_session_key: SessionKey) -> Self {
|
||||
CurrentConsensus {
|
||||
ValidationSession {
|
||||
knowledge,
|
||||
local_session_key
|
||||
}
|
||||
@@ -434,50 +434,50 @@ impl RecentSessionKeys {
|
||||
}
|
||||
}
|
||||
|
||||
/// Manages requests and session keys for live consensus instances.
|
||||
pub(crate) struct LiveConsensusInstances {
|
||||
/// Manages requests and keys for live validation session instances.
|
||||
pub(crate) struct LiveValidationSessions {
|
||||
// recent local session keys.
|
||||
recent: RecentSessionKeys,
|
||||
// live consensus instances, on `parent_hash`.
|
||||
live_instances: HashMap<Hash, CurrentConsensus>,
|
||||
// live validation session instances, on `parent_hash`.
|
||||
live_instances: HashMap<Hash, ValidationSession>,
|
||||
}
|
||||
|
||||
impl LiveConsensusInstances {
|
||||
/// Create a new `LiveConsensusInstances`
|
||||
impl LiveValidationSessions {
|
||||
/// Create a new `LiveValidationSessions`
|
||||
pub(crate) fn new() -> Self {
|
||||
LiveConsensusInstances {
|
||||
LiveValidationSessions {
|
||||
recent: Default::default(),
|
||||
live_instances: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Note new consensus session. If the used session key is new,
|
||||
/// Note new validation session. If the used session key is new,
|
||||
/// it returns it to be broadcasted to peers.
|
||||
pub(crate) fn new_consensus(
|
||||
pub(crate) fn new_validation_session(
|
||||
&mut self,
|
||||
parent_hash: Hash,
|
||||
consensus: CurrentConsensus,
|
||||
session: ValidationSession,
|
||||
) -> Option<SessionKey> {
|
||||
let inserted_key = self.recent.insert(consensus.local_session_key);
|
||||
let inserted_key = self.recent.insert(session.local_session_key);
|
||||
let maybe_new = if let InsertedRecentKey::New(_) = inserted_key {
|
||||
Some(consensus.local_session_key)
|
||||
Some(session.local_session_key)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.live_instances.insert(parent_hash, consensus);
|
||||
self.live_instances.insert(parent_hash, session);
|
||||
|
||||
maybe_new
|
||||
}
|
||||
|
||||
/// Remove consensus session.
|
||||
/// Remove validation session.
|
||||
pub(crate) fn remove(&mut self, parent_hash: &Hash) {
|
||||
if let Some(consensus) = self.live_instances.remove(parent_hash) {
|
||||
if let Some(validation_session) = self.live_instances.remove(parent_hash) {
|
||||
let key_still_used = self.live_instances.values()
|
||||
.any(|c| c.local_session_key == consensus.local_session_key);
|
||||
.any(|c| c.local_session_key == validation_session.local_session_key);
|
||||
|
||||
if !key_still_used {
|
||||
self.recent.remove(&consensus.local_session_key)
|
||||
self.recent.remove(&validation_session.local_session_key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ impl LiveConsensusInstances {
|
||||
self.recent.as_slice()
|
||||
}
|
||||
|
||||
/// Call a closure with block data from consensus session at parent hash.
|
||||
/// Call a closure with block data from validation session at parent hash.
|
||||
///
|
||||
/// This calls the closure with `Some(data)` where the session and data are live,
|
||||
/// `Err(Some(keys))` when the session is live but the data unknown, with a list of keys
|
||||
@@ -12,7 +12,7 @@ slog = "^2"
|
||||
tokio = "0.1.7"
|
||||
hex-literal = "0.1"
|
||||
polkadot-availability-store = { path = "../availability-store" }
|
||||
polkadot-consensus = { path = "../consensus" }
|
||||
polkadot-validation = { path = "../validation" }
|
||||
polkadot-primitives = { path = "../primitives" }
|
||||
polkadot-runtime = { path = "../runtime" }
|
||||
polkadot-executor = { path = "../executor" }
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
//! Polkadot service. Specialized wrapper over substrate service.
|
||||
|
||||
extern crate polkadot_availability_store as av_store;
|
||||
extern crate polkadot_consensus as consensus;
|
||||
extern crate polkadot_validation as consensus;
|
||||
extern crate polkadot_primitives;
|
||||
extern crate polkadot_runtime;
|
||||
extern crate polkadot_executor;
|
||||
@@ -169,7 +169,7 @@ construct_service_factory! {
|
||||
FullComponents::<Factory>::new(config, executor)
|
||||
} },
|
||||
AuthoritySetup = { |mut service: Self::FullService, executor: TaskExecutor, key: Option<Arc<ed25519::Pair>>| {
|
||||
use polkadot_network::consensus::ConsensusNetwork;
|
||||
use polkadot_network::validation::ValidationNetwork;
|
||||
|
||||
let (block_import, link_half) = service.config.custom.grandpa_import_setup.take()
|
||||
.expect("Link Half and Block Import are present for Full Services or setup failed before. qed");
|
||||
@@ -211,8 +211,8 @@ construct_service_factory! {
|
||||
|
||||
let client = service.client();
|
||||
|
||||
// collator connections and consensus network both fulfilled by this
|
||||
let consensus_network = ConsensusNetwork::new(
|
||||
// collator connections and validation network both fulfilled by this
|
||||
let validation_network = ValidationNetwork::new(
|
||||
service.network(),
|
||||
service.on_exit(),
|
||||
service.client(),
|
||||
@@ -220,8 +220,8 @@ construct_service_factory! {
|
||||
);
|
||||
let proposer_factory = ::consensus::ProposerFactory::new(
|
||||
client.clone(),
|
||||
consensus_network.clone(),
|
||||
consensus_network,
|
||||
validation_network.clone(),
|
||||
validation_network,
|
||||
service.transaction_pool(),
|
||||
executor.clone(),
|
||||
key.clone(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "polkadot-consensus"
|
||||
name = "polkadot-validation"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
= Polkadot Consensus
|
||||
= Polkadot Validation
|
||||
|
||||
placeholder
|
||||
//TODO Write content :)
|
||||
+6
-6
@@ -88,7 +88,7 @@ fn prune_unneeded_availability<P>(client: Arc<P>, extrinsic_store: ExtrinsicStor
|
||||
};
|
||||
|
||||
if let Err(e) = extrinsic_store.candidates_finalized(parent_hash, candidate_hashes) {
|
||||
warn!(target: "consensus", "Failed to prune unneeded available data: {:?}", e);
|
||||
warn!(target: "validation", "Failed to prune unneeded available data: {:?}", e);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -104,7 +104,7 @@ pub(crate) struct ServiceHandle {
|
||||
/// Create and start a new instance of the attestation service.
|
||||
pub(crate) fn start<C, N, P>(
|
||||
client: Arc<P>,
|
||||
parachain_consensus: Arc<::ParachainConsensus<C, N, P>>,
|
||||
parachain_validation: Arc<::ParachainValidation<C, N, P>>,
|
||||
thread_pool: TaskExecutor,
|
||||
key: Arc<ed25519::Pair>,
|
||||
extrinsic_store: ExtrinsicStore,
|
||||
@@ -127,7 +127,7 @@ pub(crate) fn start<C, N, P>(
|
||||
let mut runtime = LocalRuntime::new().expect("Could not create local runtime");
|
||||
let notifications = {
|
||||
let client = client.clone();
|
||||
let consensus = parachain_consensus.clone();
|
||||
let validation = parachain_validation.clone();
|
||||
let key = key.clone();
|
||||
|
||||
client.import_notification_stream()
|
||||
@@ -139,7 +139,7 @@ pub(crate) fn start<C, N, P>(
|
||||
.authorities(&BlockId::hash(parent_hash))
|
||||
.map_err(Into::into)
|
||||
.and_then(|authorities| {
|
||||
consensus.get_or_instantiate(
|
||||
validation.get_or_instantiate(
|
||||
parent_hash,
|
||||
notification.header.parent_hash().clone(),
|
||||
&authorities,
|
||||
@@ -148,7 +148,7 @@ pub(crate) fn start<C, N, P>(
|
||||
});
|
||||
|
||||
if let Err(e) = res {
|
||||
warn!("Unable to start parachain consensus on top of {:?}: {}",
|
||||
warn!("Unable to start parachain validation on top of {:?}: {}",
|
||||
parent_hash, e);
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ pub(crate) fn start<C, N, P>(
|
||||
interval
|
||||
.for_each(move |_| match client.leaves() {
|
||||
Ok(leaves) => {
|
||||
parachain_consensus.retain(|h| leaves.contains(h));
|
||||
parachain_validation.retain(|h| leaves.contains(h));
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -14,7 +14,7 @@
|
||||
// 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 consensus process.
|
||||
//! Errors that can occur during the validation process.
|
||||
|
||||
use primitives::Ed25519AuthorityId as AuthorityId;
|
||||
use runtime_primitives::RuntimeString;
|
||||
@@ -258,7 +258,7 @@ pub fn make_group_info(
|
||||
}
|
||||
|
||||
/// Constructs parachain-agreement instances.
|
||||
struct ParachainConsensus<C, N, P> {
|
||||
struct ParachainValidation<C, N, P> {
|
||||
/// The client instance.
|
||||
client: Arc<P>,
|
||||
/// The backing network handle.
|
||||
@@ -274,7 +274,7 @@ struct ParachainConsensus<C, N, P> {
|
||||
live_instances: Mutex<HashMap<Hash, Arc<AttestationTracker>>>,
|
||||
}
|
||||
|
||||
impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
impl<C, N, P> ParachainValidation<C, N, P> where
|
||||
C: Collators + Send + 'static,
|
||||
N: Network,
|
||||
P: ProvideRuntimeApi + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
||||
@@ -316,11 +316,11 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
|
||||
let outgoing: Vec<_> = {
|
||||
// extract all extrinsic data that we have and propagate to peers.
|
||||
live_instances.get(&grandparent_hash).map(|parent_consensus| {
|
||||
live_instances.get(&grandparent_hash).map(|parent_validation| {
|
||||
parent_candidates.iter().filter_map(|c| {
|
||||
let para_id = c.parachain_index;
|
||||
let hash = c.hash();
|
||||
parent_consensus.table.extrinsic_data(&hash).map(|ex| MessagesFrom {
|
||||
parent_validation.table.extrinsic_data(&hash).map(|ex| MessagesFrom {
|
||||
from: para_id,
|
||||
messages: ex,
|
||||
})
|
||||
@@ -341,7 +341,7 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
|
||||
let active_parachains = self.client.runtime_api().active_parachains(&id)?;
|
||||
|
||||
debug!(target: "consensus", "Active parachains: {:?}", active_parachains);
|
||||
debug!(target: "validation", "Active parachains: {:?}", active_parachains);
|
||||
|
||||
let table = Arc::new(SharedTable::new(group_info, sign_with.clone(), parent_hash, self.extrinsic_store.clone()));
|
||||
let router = self.network.communication_for(
|
||||
@@ -369,7 +369,7 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
Ok(tracker)
|
||||
}
|
||||
|
||||
/// Retain consensus sessions matching predicate.
|
||||
/// Retain validation sessions matching predicate.
|
||||
fn retain<F: FnMut(&Hash) -> bool>(&self, mut pred: F) {
|
||||
self.live_instances.lock().retain(|k, _| pred(k))
|
||||
}
|
||||
@@ -422,7 +422,7 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
router.local_candidate(collation.receipt, collation.block_data, extrinsic)
|
||||
}
|
||||
Err(e) => warn!(
|
||||
target: "consensus",
|
||||
target: "validation",
|
||||
"Failed to make collation data available: {:?}",
|
||||
e,
|
||||
),
|
||||
@@ -431,7 +431,7 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(target: "consensus", "Failed to collate candidate: {}", e);
|
||||
warn!(target: "validation", "Failed to collate candidate: {}", e);
|
||||
Ok(())
|
||||
}
|
||||
});
|
||||
@@ -444,7 +444,7 @@ impl<C, N, P> ParachainConsensus<C, N, P> where
|
||||
}
|
||||
}
|
||||
|
||||
/// Parachain consensus for a single block.
|
||||
/// Parachain validation for a single block.
|
||||
struct AttestationTracker {
|
||||
_drop_signal: Option<exit_future::Signal>,
|
||||
table: Arc<SharedTable>,
|
||||
@@ -453,7 +453,7 @@ struct AttestationTracker {
|
||||
|
||||
/// Polkadot proposer factory.
|
||||
pub struct ProposerFactory<C, N, P, TxApi: PoolChainApi> {
|
||||
parachain_consensus: Arc<ParachainConsensus<C, N, P>>,
|
||||
parachain_validation: Arc<ParachainValidation<C, N, P>>,
|
||||
transaction_pool: Arc<Pool<TxApi>>,
|
||||
key: Arc<ed25519::Pair>,
|
||||
_service_handle: ServiceHandle,
|
||||
@@ -482,7 +482,7 @@ impl<C, N, P, TxApi> ProposerFactory<C, N, P, TxApi> where
|
||||
extrinsic_store: ExtrinsicStore,
|
||||
aura_slot_duration: SlotDuration,
|
||||
) -> Self {
|
||||
let parachain_consensus = Arc::new(ParachainConsensus {
|
||||
let parachain_validation = Arc::new(ParachainValidation {
|
||||
client: client.clone(),
|
||||
network,
|
||||
collators,
|
||||
@@ -493,14 +493,14 @@ impl<C, N, P, TxApi> ProposerFactory<C, N, P, TxApi> where
|
||||
|
||||
let service_handle = ::attestation_service::start(
|
||||
client,
|
||||
parachain_consensus.clone(),
|
||||
parachain_validation.clone(),
|
||||
thread_pool,
|
||||
key.clone(),
|
||||
extrinsic_store,
|
||||
);
|
||||
|
||||
ProposerFactory {
|
||||
parachain_consensus,
|
||||
parachain_validation,
|
||||
transaction_pool,
|
||||
key,
|
||||
_service_handle: service_handle,
|
||||
@@ -530,7 +530,7 @@ impl<C, N, P, TxApi> consensus::Environment<Block> for ProposerFactory<C, N, P,
|
||||
let parent_hash = parent_header.hash();
|
||||
let parent_id = BlockId::hash(parent_hash);
|
||||
let sign_with = self.key.clone();
|
||||
let tracker = self.parachain_consensus.get_or_instantiate(
|
||||
let tracker = self.parachain_validation.get_or_instantiate(
|
||||
parent_hash,
|
||||
parent_header.parent_hash().clone(),
|
||||
authorities,
|
||||
@@ -538,7 +538,7 @@ impl<C, N, P, TxApi> consensus::Environment<Block> for ProposerFactory<C, N, P,
|
||||
)?;
|
||||
|
||||
Ok(Proposer {
|
||||
client: self.parachain_consensus.client.clone(),
|
||||
client: self.parachain_validation.client.clone(),
|
||||
tracker,
|
||||
parent_hash,
|
||||
parent_id,
|
||||
@@ -725,7 +725,7 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
|
||||
|
||||
for ready in self.transaction_pool.ready() {
|
||||
if Instant::now() > self.deadline {
|
||||
debug!("Consensus deadline reached when pushing block transactions, proceeding with proposing.");
|
||||
debug!("Validation deadline reached when pushing block transactions, proceeding with proposing.");
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-3
@@ -157,7 +157,7 @@ impl SharedTableInner {
|
||||
digest,
|
||||
);
|
||||
|
||||
warn!(target: "consensus", "{}", message);
|
||||
warn!(target: "validation", "{}", message);
|
||||
self.validated.insert(digest.clone(), ValidationWork::Error(message));
|
||||
None
|
||||
}
|
||||
@@ -276,7 +276,7 @@ impl<Fetch: Future> ParachainWork<Fetch> {
|
||||
match res {
|
||||
Ok(e) => Ok(e),
|
||||
Err(e) => {
|
||||
debug!(target: "consensus", "Encountered bad collation: {}", e);
|
||||
debug!(target: "validation", "Encountered bad collation: {}", e);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ impl<Fetch, F, Err> Future for PrimedParachainWork<Fetch, F>
|
||||
|
||||
let candidate_hash = candidate.hash();
|
||||
|
||||
debug!(target: "consensus", "Making validity statement about candidate {}: is_good? {:?}",
|
||||
debug!(target: "validation", "Making validity statement about candidate {}: is_good? {:?}",
|
||||
candidate_hash, validation_res.is_ok());
|
||||
|
||||
let (validity_statement, result) = match validation_res {
|
||||
Reference in New Issue
Block a user