fix most issues with compiling on WASM

This commit is contained in:
Robert Habermeier
2018-02-06 12:02:03 +01:00
parent b58df7892f
commit 5a675e9c64
18 changed files with 220 additions and 357 deletions
+12 -13
View File
@@ -400,8 +400,9 @@ dependencies = [
[[package]]
name = "fixed-hash"
version = "0.1.2"
source = "git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature#18e2f90688b0d90b5f79761865e394595ce55079"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -409,11 +410,9 @@ dependencies = [
[[package]]
name = "fixed-hash"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
version = "0.1.3"
source = "git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm#853bb53158497914f1837f5186e31e5b29f77cee"
dependencies = [
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1055,17 +1054,15 @@ dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fixed-hash 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)",
"fixed-hash 0.1.3 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
"polkadot-runtime-codec 0.1.0",
"polkadot-serializer 0.1.0",
"pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uint 0.1.1 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)",
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
]
[[package]]
@@ -1105,8 +1102,10 @@ dependencies = [
"polkadot-state-machine 0.1.0",
"pwasm-alloc 0.1.0",
"pwasm-libc 0.1.0",
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1629,8 +1628,8 @@ dependencies = [
[[package]]
name = "uint"
version = "0.1.1"
source = "git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature#18e2f90688b0d90b5f79761865e394595ce55079"
version = "0.1.2"
source = "git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm#853bb53158497914f1837f5186e31e5b29f77cee"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1822,8 +1821,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ethcrypto 0.1.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
"checksum ethereum-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaa5b8ceafcce0bc3a68ef116ca5702958cc97d70a6eb008aeddb569b092b3"
"checksum ethkey 0.3.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
"checksum fixed-hash 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)" = "<none>"
"checksum fixed-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4b54d107faeb66084eca7c506aa50b6b7cb9eb9a1f1f633ae2ca3af55620c191"
"checksum fixed-hash 0.1.3 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)" = "<none>"
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
@@ -1942,7 +1941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "475352206e7a290c5fccc27624a163e8d0d115f7bb60ca18a64fc9ce056d7435"
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
"checksum uint 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91ed1e25ded4e37e0967b1f12d5f910b32f979768d4f48e2f6ca7b6e7130b44e"
"checksum uint 0.1.1 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)" = "<none>"
"checksum uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)" = "<none>"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
+17 -9
View File
@@ -5,16 +5,14 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
crunchy = "0.1"
fixed-hash = { git = "https://github.com/rphmeier/primitives.git", branch = "uint-asm-with-feature" }
fixed-hash = { git = "https://github.com/rphmeier/primitives.git", branch = "compile-for-wasm", default_features = false }
rustc-hex = { git = "https://github.com/rphmeier/rustc-hex.git", version = "2.0", default_features = false }
serde = { version = "1.0", default_features = false }
serde_derive = "1.0"
uint = { git = "https://github.com/rphmeier/primitives.git", branch = "uint-asm-with-feature" }
ring = "0.12"
untrusted = "0.5"
twox-hash = "1.1.0"
byteorder = "1.1"
blake2-rfc = "0.2.18"
serde_derive = { version = "1.0", optional = true }
uint = { git = "https://github.com/rphmeier/primitives.git", branch = "compile-for-wasm" }
twox-hash = { version = "1.1.0", optional = true }
byteorder = { version = "1.1", default_features = false }
blake2-rfc = { version = "0.2.18", optional = true }
polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1", default_features = false }
[dev-dependencies]
@@ -23,4 +21,14 @@ pretty_assertions = "0.4"
[features]
default = ["std"]
std = ["uint/std", "fixed-hash/std", "polkadot-runtime-codec/std", "serde/std", "rustc-hex/std"]
std = [
"uint/std",
"fixed-hash/std",
"polkadot-runtime-codec/std",
"serde/std",
"rustc-hex/std",
"twox-hash",
"blake2-rfc",
"serde_derive",
"byteorder/std"
]
+18 -11
View File
@@ -16,7 +16,9 @@
//! Block and header type definitions.
use bytes::{self, Vec};
#[cfg(feature = "std")]
use bytes;
use bytes::Vec;
use codec::Slicable;
use hash::H256;
use parachain;
@@ -32,8 +34,9 @@ pub type HeaderHash = H256;
pub type TransactionHash = H256;
/// Execution log (event)
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Log(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Log(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
impl Slicable for Log {
fn from_slice(value: &mut &[u8]) -> Option<Self> {
@@ -48,7 +51,8 @@ impl Slicable for Log {
impl ::codec::NonTrivialSlicable for Log { }
/// The digest of a block, useful for light-clients.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Digest {
/// All logs that have happened in the block.
pub logs: Vec<Log>,
@@ -65,7 +69,8 @@ impl Slicable for Digest {
}
/// A Polkadot relay chain block.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Block {
/// The block header.
pub header: Header,
@@ -98,9 +103,10 @@ impl Slicable for Block {
/// A relay chain block header.
///
/// https://github.com/w3f/polkadot-spec/blob/master/spec.md#header
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Header {
/// Block parent's hash.
pub parent_hash: HeaderHash,
@@ -146,9 +152,10 @@ impl Slicable for Header {
///
/// Included candidates should be sorted by parachain ID, and without duplicate
/// IDs.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Body {
/// Parachain proposal blocks.
pub candidates: Vec<parachain::Candidate>,
+18 -1
View File
@@ -63,6 +63,7 @@ pub fn serialize_uint<S>(bytes: &[u8], serializer: S) -> Result<S::Ok, S::Error>
#[derive(Debug, PartialEq, Eq)]
pub enum ExpectedLen {
/// Any length in bytes.
#[cfg_attr(not(feature = "std"), allow(unused))]
Any,
/// Exact length in bytes.
Exact(usize),
@@ -81,6 +82,7 @@ impl fmt::Display for ExpectedLen {
}
/// Deserialize into vector of bytes.
#[cfg(feature = "std")]
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error> where
D: Deserializer<'de>,
{
@@ -125,9 +127,24 @@ pub fn deserialize_check_len<'de, D>(deserializer: D, len: ExpectedLen) -> Resul
_ => ::rustc_hex::FromHex::from_hex(&v[2..])
};
bytes.map_err(|e| E::custom(&format!("invalid hex value: {:?}", e)))
#[cfg(feature = "std")]
fn format_err(e: ::rustc_hex::FromHexError) -> String {
format!("invalid hex value: {:?}", e);
}
#[cfg(not(feature = "std"))]
fn format_err(e: ::rustc_hex::FromHexError) -> String {
match e {
::rustc_hex::InvalidHexLength => format!("invalid hex value: invalid length"),
::rustc_hex::InvalidHexCharacter(c, p) =>
format!("invalid hex value: invalid character {} at position {}", c, p),
}
}
bytes.map_err(|e| E::custom(format_err(e)))
}
#[cfg(feature = "std")]
fn visit_string<E: de::Error>(self, v: String) -> Result<Self::Value, E> {
self.visit_str(&v)
}
+15 -9
View File
@@ -16,20 +16,26 @@
//! Contract execution data.
use bytes::{self, Vec};
#[cfg(feature = "std")]
use bytes;
use bytes::Vec;
/// Contract call data.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CallData(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct CallData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Contract output data.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct OutData(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct OutData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Contract storage key.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct StorageKey(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct StorageKey(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Contract storage entry data.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct StorageData(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct StorageData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
-236
View File
@@ -1,236 +0,0 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Simple Ed25519 API.
use bytes::Vec;
use untrusted;
use ring::{rand, signature};
use rustc_hex::FromHex;
/// Verify a message without type checking the parameters' types for the right size.
pub fn verify(sig: &[u8], message: &[u8], public: &[u8]) -> bool {
let public_key = untrusted::Input::from(public);
let msg = untrusted::Input::from(message);
let sig = untrusted::Input::from(sig);
match signature::verify(&signature::ED25519, public_key, msg, sig) {
Ok(_) => true,
_ => false,
}
}
/// A public key.
#[derive(PartialEq, Clone, Debug)]
pub struct Public ([u8; 32]);
/// A key pair.
pub struct Pair(signature::Ed25519KeyPair);
/// A signature.
#[derive(Clone)]
pub struct Signature ([u8; 64]);
impl Signature {
/// A new signature from the given 64-byte `data`.
pub fn from(data: [u8; 64]) -> Self {
Signature(data)
}
/// A new signature from the given slice that should be 64 bytes long.
pub fn from_slice(data: &[u8]) -> Self {
let mut r = [0u8; 64];
r.copy_from_slice(data);
Signature(r)
}
}
impl AsRef<[u8; 64]> for Signature {
fn as_ref(&self) -> &[u8; 64] {
&self.0
}
}
impl AsRef<[u8]> for Signature {
fn as_ref(&self) -> &[u8] {
&self.0[..]
}
}
impl Public {
/// A new instance from the given 32-byte `data`.
pub fn from(data: [u8; 32]) -> Self {
Public(data)
}
/// A new instance from the given slice that should be 32 bytes long.
pub fn from_slice(data: &[u8]) -> Self {
let mut r = [0u8; 32];
r.copy_from_slice(data);
Public(r)
}
}
impl AsRef<[u8; 32]> for Public {
fn as_ref(&self) -> &[u8; 32] {
&self.0
}
}
impl AsRef<[u8]> for Public {
fn as_ref(&self) -> &[u8] {
&self.0[..]
}
}
impl Pair {
/// Generate new secure (random) key pair.
pub fn new() -> Pair {
let rng = rand::SystemRandom::new();
let pkcs8_bytes = signature::Ed25519KeyPair::generate_pkcs8(&rng).unwrap();
Pair(signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes)).unwrap())
}
/// Make a new key pair from a seed phrase.
pub fn from_seed(seed: &[u8; 32]) -> Pair {
Pair(signature::Ed25519KeyPair::from_seed_unchecked(untrusted::Input::from(&seed[..])).unwrap())
}
/// Make a new key pair from the raw secret.
pub fn from_secret(secret: &[u8; 32]) -> Pair {
let mut pkcs8_bytes: Vec<u8> = FromHex::from_hex("302e020100300506032b657004220420").unwrap();
pkcs8_bytes.extend_from_slice(&secret[..]);
Pair(signature::Ed25519KeyPair::from_pkcs8_maybe_unchecked(untrusted::Input::from(&pkcs8_bytes)).unwrap())
}
/// Make a new key pair from the raw secret and public key (it will check to make sure
/// they correspond to each other).
pub fn from_both(secret_public: &[u8; 64]) -> Option<Pair> {
let mut pkcs8_bytes: Vec<u8> = FromHex::from_hex("3053020101300506032b657004220420").unwrap();
pkcs8_bytes.extend_from_slice(&secret_public[0..32]);
pkcs8_bytes.extend_from_slice(&[0xa1u8, 0x23, 0x03, 0x21, 0x00]);
pkcs8_bytes.extend_from_slice(&secret_public[32..64]);
signature::Ed25519KeyPair::from_pkcs8_maybe_unchecked(untrusted::Input::from(&pkcs8_bytes)).ok().map(Pair)
}
/// Sign a message.
pub fn sign(&self, message: &[u8]) -> Signature {
let mut r = [0u8; 64];
r.copy_from_slice(self.0.sign(message).as_ref());
Signature(r)
}
/// Get the public key.
pub fn public(&self) -> Public {
let mut r = [0u8; 32];
let pk = self.0.public_key_bytes();
r.copy_from_slice(pk);
Public(r)
}
}
impl Signature {
/// Verify a message.
pub fn verify(&self, message: &[u8], public: &Public) -> bool {
let peer_public_key = untrusted::Input::from(&public.0[..]);
let msg = untrusted::Input::from(message);
let sig = untrusted::Input::from(&self.0[..]);
match signature::verify(&signature::ED25519, peer_public_key, msg, sig) {
Ok(_) => true,
_ => false,
}
}
}
impl From<&'static str> for Public {
fn from(hex: &'static str) -> Self {
let mut r = [0u8; 32];
r.copy_from_slice(&FromHex::from_hex::<Vec<_>>(hex).unwrap()[0..32]);
Public(r)
}
}
impl From<&'static str> for Pair {
fn from(hex: &'static str) -> Self {
let data = FromHex::from_hex::<Vec<_>>(hex).expect("Key pair given is static so hex should be good.");
match data.len() {
32 => {
let mut r = [0u8; 32];
r.copy_from_slice(&data[0..32]);
Pair::from_secret(&r)
}
64 => {
let mut r = [0u8; 64];
r.copy_from_slice(&data[0..64]);
Pair::from_both(&r).expect("Key pair given is static so should be good.")
}
_ => {
panic!("Key pair given is static so should be correct length.");
}
}
}
}
impl From<&'static str> for Signature {
fn from(hex: &'static str) -> Self {
let mut r = [0u8; 64];
r.copy_from_slice(&FromHex::from_hex::<Vec<_>>(hex).unwrap()[0..64]);
Signature(r)
}
}
impl PartialEq for Signature {
fn eq(&self, other: &Signature) -> bool {
self.0.iter().eq(other.0.iter())
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_vector_should_work() {
let pair: Pair = "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60".into();
let public = pair.public();
assert_eq!(public, "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a".into());
let message = b"";
let signature: Signature = "e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b".into();
assert!(&pair.sign(&message[..]) == &signature);
assert!(signature.verify(&message[..], &public));
}
#[test]
fn generated_pair_should_work() {
let pair = Pair::new();
let public = pair.public();
let message = b"Something important";
let signature = pair.sign(&message[..]);
assert!(signature.verify(&message[..], &public));
}
#[test]
fn seeded_pair_should_work() {
let pair = Pair::from_seed(b"12345678901234567890123456789012");
let public = pair.public();
assert_eq!(public, "2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee".into());
let message = b"Something important";
let signature = pair.sign(&message[..]);
assert!(signature.verify(&message[..], &public));
}
#[test]
fn can_sign_transaction() {
let pair = Pair::from_seed(b"12345678901234567890123456789012");
let public = pair.public();
assert_eq!(public, "2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee".into());
let message: Vec<u8> = FromHex::from_hex("2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee000000000000000002d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a4500000000000000").unwrap();
let signature = pair.sign(&message[..]);
assert!(signature.verify(&message[..], &public));
}
}
+22 -11
View File
@@ -19,20 +19,22 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#![cfg_attr(not(feature = "std"), feature(alloc, lang_items))]
extern crate rustc_hex;
extern crate serde;
extern crate ring;
extern crate untrusted;
extern crate twox_hash;
extern crate byteorder;
#[cfg(feature = "std")]
extern crate twox_hash;
#[cfg(feature = "std")]
extern crate blake2_rfc;
#[macro_use]
extern crate crunchy;
#[macro_use]
extern crate fixed_hash;
#[cfg(feature = "std")]
#[macro_use]
extern crate serde_derive;
#[macro_use]
@@ -61,12 +63,21 @@ macro_rules! try_opt {
}
}
#[lang = "panic_fmt"]
#[no_mangle]
pub extern fn panic_fmt(_fmt: ::core::fmt::Arguments, _file: &'static str, _line: u32, _col: u32) {
unsafe {
ext_print_utf8(_file.as_ptr() as *const u8, _file.len() as u32);
ext_print_num(_line as u64);
ext_print_num(_col as u64);
::core::intrinsics::abort()
}
}
mod bytes;
pub mod block;
pub mod contract;
pub mod ed25519;
pub mod hash;
pub mod hashing;
pub mod hexdisplay;
pub mod parachain;
pub mod proposal;
@@ -75,8 +86,13 @@ pub mod transaction;
pub mod uint;
pub mod validator;
#[cfg(feature = "std")]
pub mod hashing;
pub use self::hash::{H160, H256};
pub use self::uint::{U256, U512};
#[cfg(feature = "std")]
pub use hashing::{blake2_256, twox_128, twox_256};
/// Virtual account ID that represents the idea of a dispatch/statement being signed by everybody
@@ -111,8 +127,3 @@ pub type Balance = u64;
/// A timestamp.
pub type Timestamp = u64;
/// A hash function.
pub fn hash(data: &[u8]) -> hash::H256 {
blake2_256(data).into()
}
+33 -21
View File
@@ -16,10 +16,13 @@
//! Parachain data types.
use bytes::{self, Vec};
#[cfg(feature = "std")]
use bytes;
use bytes::Vec;
/// Unique identifier of a parachain.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Id(u64);
impl From<Id> for u64 {
@@ -43,9 +46,10 @@ impl ::codec::Slicable for Id {
/// Candidate parachain block.
///
/// https://github.com/w3f/polkadot-spec/blob/master/spec.md#candidate-para-chain-block
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Candidate {
/// The ID of the parachain this is a proposal for.
pub parachain_index: Id,
@@ -60,9 +64,10 @@ pub struct Candidate {
}
/// Candidate receipt type.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct CandidateReceipt {
/// The ID of the parachain this is a candidate for.
pub parachain_index: Id,
@@ -79,37 +84,44 @@ pub struct CandidateReceipt {
}
/// Parachain ingress queue message.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Message(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Message(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Consolidated ingress queue data.
///
/// This is just an ordered vector of other parachains' egress queues,
/// obtained according to the routing rules.
#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[derive(Debug, Default, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct ConsolidatedIngress(pub Vec<(Id, Vec<Message>)>);
/// Parachain block data.
///
/// contains everything required to validate para-block, may contain block and witness data
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct BlockData(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct BlockData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Parachain header raw bytes wrapper type.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Header(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Header(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Parachain head data included in the chain.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct HeadData(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Parachain validation code.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ValidationCode(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Activitiy bit field
#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
pub struct Activity(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Activity(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
impl ::codec::Slicable for Activity {
fn from_slice(value: &mut &[u8]) -> Option<Self> {
+7 -4
View File
@@ -19,10 +19,12 @@
//! This describes a combination of a function ID and data that can be used to call into
//! an internal function.
use bytes::Vec;
use block::Number as BlockNumber;
use codec::Slicable;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[repr(u8)]
enum InternalFunctionId {
/// Set the system's code.
@@ -60,8 +62,8 @@ impl InternalFunctionId {
}
/// Internal functions that can be dispatched to.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[repr(u8)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum InternalFunction {
/// Set the system's code.
SystemSetCode(Vec<u8>),
@@ -78,7 +80,8 @@ pub enum InternalFunction {
}
/// An internal function.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Proposal {
/// The privileged function to call.
pub function: InternalFunction,
+5 -3
View File
@@ -17,10 +17,12 @@
//! Polkadot runtime functions.
//! This describes a function that can be called from an external transaction.
use bytes::Vec;
use codec::Slicable;
/// Public functions that can be dispatched to.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[repr(u8)]
enum FunctionId {
/// Staking subsystem: begin staking.
@@ -56,8 +58,8 @@ impl FunctionId {
}
/// Functions on the runtime.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[repr(u8)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum Function {
/// Staking subsystem: begin staking.
StakingStake,
+4 -2
View File
@@ -27,7 +27,8 @@ use std::fmt;
use alloc::fmt;
/// A vetted and verified transaction from the external world.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Transaction {
/// Who signed it (note this is not a signature).
pub signed: ::AccountId,
@@ -62,7 +63,8 @@ impl Slicable for Transaction {
}
/// A transactions right from the external world. Unchecked.
#[derive(Eq, Clone, Serialize, Deserialize)]
#[derive(Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct UncheckedTransaction {
/// The actual transaction information.
pub transaction: Transaction,
+16 -10
View File
@@ -16,25 +16,31 @@
//! Validator primitives.
use bytes::{self, Vec};
#[cfg(feature = "std")]
use bytes;
use bytes::Vec;
use parachain;
/// Parachain outgoing message.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct EgressPost(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct EgressPost(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Balance upload.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BalanceUpload(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct BalanceUpload(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// Balance download.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BalanceDownload(#[serde(with="bytes")] pub Vec<u8>);
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct BalanceDownload(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
/// The result of parachain validation.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct ValidationResult {
/// New head data that should be included in the relay chain state.
pub head_data: parachain::HeadData,
+11 -1
View File
@@ -15,9 +15,19 @@ polkadot-state-machine = { path = "../state-machine", version = "0.1", optional
polkadot-primitives = { path = "../primitives", version = "0.1", default_features = false }
polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1", default_features = false }
triehash = { version = "0.1", optional = true }
ring = { version = "0.12", optional = true }
untrusted = { version = "0.5", optional = true }
[features]
default = ["std"]
std = ["environmental", "polkadot-state-machine", "triehash", "polkadot-primitives/std", "polkadot-runtime-codec/std"]
std = [
"environmental",
"polkadot-state-machine",
"triehash",
"polkadot-primitives/std",
"polkadot-runtime-codec/std",
"ring",
"untrusted"
]
nightly = []
strict = []
+13 -4
View File
@@ -20,8 +20,8 @@ extern crate environmental;
extern crate polkadot_state_machine;
extern crate polkadot_primitives as primitives;
extern crate triehash;
use primitives::ed25519;
extern crate ring;
extern crate untrusted;
pub use std::vec;
pub use std::rc;
@@ -93,7 +93,16 @@ pub fn enumerated_trie_root(serialised_values: &[&[u8]]) -> [u8; 32] {
/// Verify a ed25519 signature.
pub fn ed25519_verify(sig: &[u8; 64], msg: &[u8], pubkey: &[u8; 32]) -> bool {
ed25519::verify(&sig[..], msg, &pubkey[..])
use ring::signature;
let public_key = untrusted::Input::from(pubkey);
let msg = untrusted::Input::from(msg);
let sig = untrusted::Input::from(sig);
match signature::verify(&signature::ED25519, public_key, msg, sig) {
Ok(_) => true,
_ => false,
}
}
/// Execute the given closure with global function available whose functionality routes into the
@@ -136,7 +145,7 @@ macro_rules! impl_stubs {
}
#[cfg(test)]
mod tests {
mod std_tests {
use super::*;
macro_rules! map {
+1 -1
View File
@@ -6,7 +6,7 @@ extern crate pwasm_libc;
#[cfg(feature = "nightly")]
extern crate pwasm_alloc;
extern crate polkadot_primitives as primitives;;
extern crate polkadot_primitives as primitives;
pub use alloc::vec;
pub use alloc::boxed;
+1 -1
View File
@@ -4,5 +4,5 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
serde = "1.0"
serde = { version = "1.0", default_features = false }
serde_json = "1.0"
+26 -19
View File
@@ -123,7 +123,7 @@ dependencies = [
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"plain_hasher 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -150,10 +150,9 @@ dependencies = [
[[package]]
name = "fixed-hash"
version = "0.1.2"
source = "git+https://github.com/paritytech/primitives.git#30f15bb3387faf40f519dd56a5768cb3d3fe3638"
version = "0.1.3"
source = "git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm#853bb53158497914f1837f5186e31e5b29f77cee"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -335,7 +334,7 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -353,7 +352,7 @@ dependencies = [
"keccak-hash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"memorydb 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -373,15 +372,13 @@ dependencies = [
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fixed-hash 0.1.2 (git+https://github.com/paritytech/primitives.git)",
"fixed-hash 0.1.3 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
"polkadot-runtime-codec 0.1.0",
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uint 0.1.0 (git+https://github.com/paritytech/primitives.git)",
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)",
]
[[package]]
@@ -394,11 +391,14 @@ version = "0.1.0"
dependencies = [
"environmental 0.1.0",
"polkadot-primitives 0.1.0",
"polkadot-runtime-codec 0.1.0",
"polkadot-state-machine 0.1.0",
"pwasm-alloc 0.1.0",
"pwasm-libc 0.1.0",
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -446,11 +446,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.20"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -480,7 +481,7 @@ dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -557,6 +558,11 @@ name = "rustc-hex"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-hex"
version = "2.0.0"
source = "git+https://github.com/rphmeier/rustc-hex.git#ee2ec40b9062ac7769ccb9dc891d6dc2cc9009d7"
[[package]]
name = "rustc_version"
version = "0.2.1"
@@ -684,13 +690,13 @@ name = "twox-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "uint"
version = "0.1.0"
source = "git+https://github.com/paritytech/primitives.git#30f15bb3387faf40f519dd56a5768cb3d3fe3638"
version = "0.1.2"
source = "git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm#853bb53158497914f1837f5186e31e5b29f77cee"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -774,7 +780,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ethcore-bigint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcb5af77e74a8f70e9c3337e069c37bc82178ef1b459c02091f73c4ad5281eb5"
"checksum ethcore-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3977c772cd6c5c22e1c7cfa208e4c3b746bd6c3a6c8eeec0999a6b2103015ad5"
"checksum ethcore-logger 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fd5813e49546030be7d134e775088d56b8ff4ab60617b90e93d4f0513da4c5b"
"checksum fixed-hash 0.1.2 (git+https://github.com/paritytech/primitives.git)" = "<none>"
"checksum fixed-hash 0.1.3 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)" = "<none>"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
@@ -803,7 +809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum proc-macro-hack 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ba8d4f9257b85eb6cdf13f055cea3190520aab1409ca2ab43493ea4820c25f0"
"checksum proc-macro-hack-impl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5cb6f960ad471404618e9817c0e5d10b1ae74cfdf01fab89ea0641fe7fb2892"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "512870020642bb8c221bf68baa1b2573da814f6ccfe5c9699b1c303047abe9b1"
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
"checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8"
"checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53"
@@ -814,6 +820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c"
"checksum rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "babe6fce20c0ca9b1582998734c4569082d0ad08e43772a1c6c40aef4f106ef9"
"checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e"
"checksum rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)" = "<none>"
"checksum rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9743a7670d88d5d52950408ecdb7c71d8986251ab604d4689dd2ca25c9bca69"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
@@ -831,7 +838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum tiny-keccak 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e9241752647ca572f12c9b520a5d360d9099360c527770647e694001646a1d0"
"checksum triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9291c7f0fae44858b5e087dd462afb382354120003778f1695b44aab98c7abd7"
"checksum twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "475352206e7a290c5fccc27624a163e8d0d115f7bb60ca18a64fc9ce056d7435"
"checksum uint 0.1.0 (git+https://github.com/paritytech/primitives.git)" = "<none>"
"checksum uint 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=compile-for-wasm)" = "<none>"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
"checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
cargo +nightly build --target=wasm32-unknown-unknown --release
xargo +nightly build --target=wasm32-unknown-unknown --release
dirs=`find * -maxdepth 0 -type d | grep -v pwasm- | grep -v std`
for i in $dirs
do