Minimal parachain framework part 1 (#113)

* dynamic inclusion threshold calculator

* collators interface

* collation helpers

* initial proposal-creation future

* create proposer when asked to propose

* remove local_availability duty

* statement table tracks includable parachain count

* beginnings of timing future

* finish proposal logic

* remove stray println

* extract shared table to separate module

* change ordering

* includability tracking

* fix doc

* initial changes to parachains module

* initialise dummy block before API calls

* give polkadot control over round proposer based on random seed

* propose only after enough candidates

* flesh out parachains module a bit more

* set_heads

* actually introduce set_heads to runtime

* update block_builder to accept parachains

* split block validity errors from real errors in evaluation

* update WASM runtimes

* polkadot-api methods for parachains additions

* delay evaluation until candidates are ready

* comments

* fix dynamic inclusion with zero initial

* test for includability tracker

* wasm validation of parachain candidates

* move primitives to primitives crate

* remove runtime-std dependency from codec

* adjust doc

* polkadot-parachain-primitives

* kill legacy polkadot-validator crate

* basic-add test chain

* test for basic_add parachain

* move to test-chains dir

* use wasm-build

* new wasm directory layout

* reorganize a bit more

* Fix for rh-minimal-parachain (#141)

* Remove extern "C"

We already encountered such behavior (bug?) in pwasm-std, I believe.

* Fix `panic_fmt` signature by adding `_col`

Wrong `panic_fmt` signature can inhibit some optimizations in LTO mode.

* Add linker flags and use wasm-gc in build script

Pass --import-memory to LLD to emit wasm binary with imported memory.

Also use wasm-gc instead of wasm-build.

* Fix effective_max.

I'm not sure why it was the way it was actually.

* Recompile wasm.

* Fix indent

* more basic_add tests

* validate parachain WASM

* produce statements on receiving statements

* tests for reactive statement production

* fix build

* add OOM lang item to runtime-io

* use dynamic_inclusion when evaluating as well

* fix update_includable_count

* remove dead code

* grumbles

* actually defer round_proposer logic

* update wasm

* address a few more grumbles

* grumbles

* update WASM checkins

* remove dependency on tokio-timer
This commit is contained in:
Robert Habermeier
2018-05-25 16:16:01 +02:00
committed by GitHub
parent 24d7d38c62
commit 27aafb0a04
63 changed files with 2825 additions and 921 deletions
+22 -6
View File
@@ -27,7 +27,7 @@ extern crate substrate_runtime_support as runtime_support;
#[macro_use]
extern crate substrate_runtime_primitives as runtime_primitives;
#[cfg(feature = "std")]
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
@@ -55,7 +55,19 @@ use runtime_io::BlakeTwo256;
use polkadot_primitives::{AccountId, Balance, BlockNumber, Hash, Index, Log, SessionKey, Signature};
use runtime_primitives::generic;
use runtime_primitives::traits::{Identity, HasPublicAux};
#[cfg(feature = "std")] pub use runtime_primitives::BuildExternalities;
#[cfg(feature = "std")]
pub use runtime_primitives::BuildExternalities;
pub use consensus::Call as ConsensusCall;
pub use timestamp::Call as TimestampCall;
pub use parachains::Call as ParachainsCall;
/// The position of the timestamp set extrinsic.
pub const TIMESTAMP_SET_POSITION: u32 = 0;
/// The position of the parachains set extrinsic.
pub const PARACHAINS_SET_POSITION: u32 = 1;
/// Concrete runtime type used to parameterize the various modules.
pub struct Concrete;
@@ -77,19 +89,18 @@ impl system::Trait for Concrete {
pub type System = system::Module<Concrete>;
impl consensus::Trait for Concrete {
type PublicAux = <Self as HasPublicAux>::PublicAux;
type PublicAux = <Concrete as HasPublicAux>::PublicAux;
type SessionKey = SessionKey;
}
/// Consensus module for this concrete runtime.
pub type Consensus = consensus::Module<Concrete>;
pub use consensus::Call as ConsensusCall;
impl timestamp::Trait for Concrete {
const SET_POSITION: u32 = TIMESTAMP_SET_POSITION;
type Value = u64;
}
/// Timestamp module for this concrete runtime.
pub type Timestamp = timestamp::Module<Concrete>;
pub use timestamp::Call as TimestampCall;
impl session::Trait for Concrete {
type ConvertAccountIdToSessionKey = Identity;
@@ -116,7 +127,11 @@ pub type Council = council::Module<Concrete>;
/// Council voting module for this concrete runtime.
pub type CouncilVoting = council::voting::Module<Concrete>;
impl parachains::Trait for Concrete {}
impl parachains::Trait for Concrete {
const SET_POSITION: u32 = PARACHAINS_SET_POSITION;
type PublicAux = <Concrete as HasPublicAux>::PublicAux;
}
pub type Parachains = parachains::Module<Concrete>;
impl_outer_dispatch! {
@@ -128,6 +143,7 @@ impl_outer_dispatch! {
Democracy = 5,
Council = 6,
CouncilVoting = 7,
Parachains = 8,
}
pub enum PrivCall {