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
+1 -2
View File
@@ -5,8 +5,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
substrate-runtime-std = { path = "../runtime-std", default_features = false }
[features]
default = ["std"]
std = ["substrate-runtime-std/std"]
std = []
+1 -1
View File
@@ -16,7 +16,7 @@
//! Trait
use rstd::iter::Extend;
use core::iter::Extend;
use super::slicable::Slicable;
/// Trait to allow itself to be serialised into a value which can be extended
+2 -2
View File
@@ -17,8 +17,8 @@
//! Serialiser and prepender.
use slicable::Slicable;
use rstd::iter::Extend;
use rstd::vec::Vec;
use core::iter::Extend;
use alloc::vec::Vec;
/// Trait to allow itselg to be serialised and prepended by a given slice.
pub trait KeyedVec {
+13 -4
View File
@@ -14,14 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! Implements the serialization and deserialization codec for polkadot runtime
//! values.
//! Implements a serialization and deserialization codec for simple marshalling.
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg_attr(not(feature = "std"), macro_use)]
extern crate substrate_runtime_std as rstd;
#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;
#[cfg(feature = "std")]
pub mod alloc {
pub use std::boxed;
pub use std::vec;
}
mod slicable;
mod joiner;
+6 -5
View File
@@ -16,8 +16,9 @@
//! Serialisation.
use rstd::prelude::*;
use rstd::{mem, slice};
use alloc::vec::Vec;
use alloc::boxed::Box;
use core::{mem, slice};
use super::joiner::Joiner;
/// Trait that allows reading of data into a slice.
@@ -38,7 +39,7 @@ pub trait Input {
impl<'a> Input for &'a [u8] {
fn read(&mut self, into: &mut [u8]) -> usize {
let len = ::rstd::cmp::min(into.len(), self.len());
let len = ::core::cmp::min(into.len(), self.len());
into[..len].copy_from_slice(&self[..len]);
*self = &self[len..];
len
@@ -155,7 +156,7 @@ impl<T: Slicable> Slicable for Vec<T> {
}
fn encode(&self) -> Vec<u8> {
use rstd::iter::Extend;
use core::iter::Extend;
let len = self.len();
assert!(len <= u32::max_value() as usize, "Attempted to serialize vec with too many elements.");
@@ -241,7 +242,7 @@ macro_rules! tuple_impl {
#[allow(non_snake_case)]
mod inner_tuple_impl {
use rstd::vec::Vec;
use alloc::vec::Vec;
use super::{Input, Slicable};
tuple_impl!(A, B, C, D, E, F, G, H, I, J, K,);