Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move HeadData to primitives
  • Loading branch information
cecton committed May 29, 2020
commit 3a4a6ba3b73bda9224dc542ed53d7b7095eea849
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cumulus_network::{
DelayedBlockAnnounceValidator, JustifiedBlockAnnounceValidator, WaitToAnnounce,
};
use cumulus_primitives::{
inherents::VALIDATION_FUNCTION_PARAMS_IDENTIFIER as VFP_IDENT,
HeadData, inherents::VALIDATION_FUNCTION_PARAMS_IDENTIFIER as VFP_IDENT,
validation_function_params::ValidationFunctionParams,
};
use cumulus_runtime::ParachainBlockData;
Expand Down Expand Up @@ -56,12 +56,6 @@ use std::{fmt::Debug, marker::PhantomData, sync::Arc, time::Duration, pin::Pin};

use parking_lot::Mutex;

/// The head data of the parachain, stored in the relay chain.
#[derive(Decode, Encode, Debug)]
struct HeadData<Block: BlockT> {
header: Block::Header,
}

/// The implementation of the Cumulus `Collator`.
pub struct Collator<Block: BlockT, PF, BI> {
proposer_factory: Arc<Mutex<PF>>,
Expand Down
3 changes: 3 additions & 0 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ polkadot-statement-table = { git = "https://github.com/paritytech/polkadot", bra
polkadot-validation = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }
polkadot-network = { git = "https://github.com/paritytech/polkadot", branch = "cumulus-branch" }

# cumulus deps
cumulus-primitives = { path = "../primitives" }

# other deps
codec = { package = "parity-scale-codec", version = "1.3.0", features = [ "derive" ] }
futures = { version = "0.3.1", features = ["compat"] }
Expand Down
8 changes: 2 additions & 6 deletions network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ use polkadot_primitives::{
use polkadot_statement_table::{SignedStatement, Statement};
use polkadot_validation::check_statement;

use cumulus_primitives::HeadData;

use codec::{Decode, Encode};
use futures::{pin_mut, select, StreamExt};
use futures::channel::oneshot;
Expand All @@ -45,12 +47,6 @@ use log::{error, trace};
use std::{marker::PhantomData, sync::Arc};
use parking_lot::Mutex;

/// The head data of the parachain, stored in the relay chain.
#[derive(Decode, Encode, Debug)]
struct HeadData<Block: BlockT> {
header: Block::Header,
}

/// Validate that data is a valid justification from a relay-chain validator that the block is a
/// valid parachain-block candidate.
/// Data encoding is just `GossipMessage`, the relay-chain validator candidate statement message is
Expand Down
9 changes: 9 additions & 0 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

pub mod validation_function_params;

use codec::{Decode, Encode};
use sp_runtime::traits::{Block as BlockT};

/// Identifiers and types related to Cumulus Inherents
pub mod inherents {
use sp_inherents::InherentIdentifier;
Expand Down Expand Up @@ -64,3 +67,9 @@ pub trait UpwardMessageSender {
/// Returns an error if sending failed.
fn send_upward_message(msg: &()) -> Result<(), ()>;
}

/// The head data of the parachain, stored in the relay chain.
#[derive(Decode, Encode, Debug)]
pub struct HeadData<Block: BlockT> {
header: Block::Header,
}