Runtime version (#256)

* Runtime version

* Updated genesis.wasm

* Minor fixes

* Fresh runtime

* Default version for pre Poc-2; Fixed authorship interface check

* Fixed authoring check
This commit is contained in:
Arkadiy Paronyan
2018-07-03 17:44:43 +02:00
committed by Gav Wood
parent e6a7c64518
commit 12268ae700
52 changed files with 503 additions and 179 deletions
@@ -22,7 +22,7 @@
use std::sync::Arc;
use polkadot_api::PolkadotApi;
use polkadot_primitives::{Hash, AccountId};
use polkadot_primitives::{Hash, AccountId, BlockId};
use polkadot_primitives::parachain::{Id as ParaId, Chain, BlockData, Extrinsic, CandidateReceipt};
use futures::prelude::*;
@@ -57,7 +57,7 @@ pub trait Collators: Clone {
pub struct CollationFetch<C: Collators, P: PolkadotApi> {
parachain: Option<ParaId>,
relay_parent_hash: Hash,
relay_parent: P::CheckedBlockId,
relay_parent: BlockId,
collators: C,
live_fetch: Option<<C::Collation as IntoFuture>::Future>,
client: Arc<P>,
@@ -65,7 +65,7 @@ pub struct CollationFetch<C: Collators, P: PolkadotApi> {
impl<C: Collators, P: PolkadotApi> CollationFetch<C, P> {
/// Create a new collation fetcher for the given chain.
pub fn new(parachain: Chain, relay_parent: P::CheckedBlockId, relay_parent_hash: Hash, collators: C, client: Arc<P>) -> Self {
pub fn new(parachain: Chain, relay_parent: BlockId, relay_parent_hash: Hash, collators: C, client: Arc<P>) -> Self {
CollationFetch {
relay_parent_hash,
relay_parent,
@@ -145,7 +145,7 @@ error_chain! {
}
/// Check whether a given collation is valid. Returns `Ok` on success, error otherwise.
pub fn validate_collation<P: PolkadotApi>(client: &P, relay_parent: &P::CheckedBlockId, collation: &Collation) -> Result<(), Error> {
pub fn validate_collation<P: PolkadotApi>(client: &P, relay_parent: &BlockId, collation: &Collation) -> Result<(), Error> {
use parachain::{self, ValidationParams};
let para_id = collation.receipt.parachain_index;
+7 -9
View File
@@ -240,7 +240,6 @@ pub struct ProposerFactory<C, N, P> {
impl<C, N, P> bft::ProposerFactory<Block> for ProposerFactory<C, N, P>
where
C: PolkadotApi + Send + Sync,
C::CheckedBlockId: Sync,
N: Network,
P: Collators,
{
@@ -254,9 +253,9 @@ impl<C, N, P> bft::ProposerFactory<Block> for ProposerFactory<C, N, P>
let parent_hash = parent_header.blake2_256().into();
let checked_id = self.client.check_id(BlockId::hash(parent_hash))?;
let duty_roster = self.client.duty_roster(&checked_id)?;
let random_seed = self.client.random_seed(&checked_id)?;
let id = BlockId::hash(parent_hash);
let duty_roster = self.client.duty_roster(&id)?;
let random_seed = self.client.random_seed(&id)?;
let (group_info, local_duty) = make_group_info(
duty_roster,
@@ -264,7 +263,7 @@ impl<C, N, P> bft::ProposerFactory<Block> for ProposerFactory<C, N, P>
sign_with.public().into(),
)?;
let active_parachains = self.client.active_parachains(&checked_id)?;
let active_parachains = self.client.active_parachains(&id)?;
let n_parachains = active_parachains.len();
let table = Arc::new(SharedTable::new(group_info, sign_with.clone(), parent_hash));
@@ -291,7 +290,7 @@ impl<C, N, P> bft::ProposerFactory<Block> for ProposerFactory<C, N, P>
local_duty,
local_key: sign_with,
parent_hash,
parent_id: checked_id,
parent_id: id,
parent_number: parent_header.number,
random_seed,
router,
@@ -315,7 +314,7 @@ pub struct Proposer<C: PolkadotApi, R, P> {
local_duty: LocalDuty,
local_key: Arc<ed25519::Pair>,
parent_hash: Hash,
parent_id: C::CheckedBlockId,
parent_id: BlockId,
parent_number: BlockNumber,
random_seed: Hash,
router: R,
@@ -326,7 +325,6 @@ pub struct Proposer<C: PolkadotApi, R, P> {
impl<C, R, P> bft::Proposer<Block> for Proposer<C, R, P>
where
C: PolkadotApi + Send + Sync,
C::CheckedBlockId: Sync,
R: TableRouter,
P: Collators,
{
@@ -621,7 +619,7 @@ impl ProposalTiming {
pub struct CreateProposal<C: PolkadotApi, R, P: Collators> {
parent_hash: Hash,
parent_number: BlockNumber,
parent_id: C::CheckedBlockId,
parent_id: BlockId,
client: Arc<C>,
transaction_pool: Arc<TransactionPool<C>>,
collation: CollationFetch<P, C>,
@@ -242,7 +242,6 @@ impl Service {
where
A: LocalPolkadotApi + Send + Sync + 'static,
C: BlockchainEvents<Block> + ChainHead<Block> + bft::BlockImport<Block> + bft::Authorities<Block> + Send + Sync + 'static,
A::CheckedBlockId: Sync,
{
let (signal, exit) = ::exit_future::signal();
let thread = thread::spawn(move || {