Switch to wasm-builder 1.0.7 (#441)

* Switch to `wasm-builder` 1.0.7
This commit is contained in:
Bastian Köcher
2019-09-23 12:38:38 +02:00
committed by thiolliere
parent 0b0a42b717
commit 21cb1e9f45
8 changed files with 19 additions and 24 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ trie-db = "0.15"
serde_json = "1.0" serde_json = "1.0"
[build-dependencies] [build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2" } wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.3" }
[features] [features]
default = ["std"] default = ["std"]
+1 -1
View File
@@ -17,5 +17,5 @@
use wasm_builder_runner::{build_current_project, WasmBuilderSource}; use wasm_builder_runner::{build_current_project, WasmBuilderSource};
fn main() { fn main() {
build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.5")); build_current_project("wasm_binary.rs", WasmBuilderSource::Crates("1.0.7"));
} }
+3 -9
View File
@@ -7,23 +7,17 @@ edition = "2018"
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
parachain = { package = "polkadot-parachain", path = "../../parachain/", default-features = false } parachain = { package = "polkadot-parachain", path = "../../parachain/", default-features = false, features = [ "wasm-api" ] }
codec = { package = "parity-scale-codec", version = "~1.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "~1.0.0", default-features = false, features = ["derive"] }
tiny-keccak = "1.5.0" tiny-keccak = "1.5.0"
dlmalloc = { version = "0.1.3", features = ["global"], optional = true } dlmalloc = { version = "0.1.3", features = [ "global" ] }
# We need to make sure the global allocator is disabled until we have support of full substrate externalities # We need to make sure the global allocator is disabled until we have support of full substrate externalities
rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false } rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false, features = [ "no_global_allocator" ] }
[build-dependencies] [build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2" } wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2" }
[features] [features]
default = [ "std" ] default = [ "std" ]
no_std = [
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
"rstd/no_global_allocator",
"parachain/wasm-api",
"dlmalloc",
]
std = [] std = []
+3 -1
View File
@@ -16,10 +16,12 @@
use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource}; use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};
use std::env;
fn main() { fn main() {
build_current_project_with_rustflags( build_current_project_with_rustflags(
"wasm_binary.rs", "wasm_binary.rs",
WasmBuilderSource::Crates("1.0.5"), WasmBuilderSource::Crates("1.0.7"),
"-C link-arg=--import-memory", "-C link-arg=--import-memory",
); );
} }
+5 -5
View File
@@ -18,14 +18,14 @@
#![no_std] #![no_std]
#![cfg_attr(feature = "no_std", feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))] #![cfg_attr(not(feature = "std"), feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))]
use codec::{Encode, Decode}; use codec::{Encode, Decode};
#[cfg(feature = "no_std")] #[cfg(not(feature = "std"))]
mod wasm_validation; mod wasm_validation;
#[cfg(feature = "no_std")] #[cfg(not(feature = "std"))]
#[global_allocator] #[global_allocator]
static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc; static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
@@ -46,7 +46,7 @@ pub struct HeadData {
impl HeadData { impl HeadData {
pub fn hash(&self) -> [u8; 32] { pub fn hash(&self) -> [u8; 32] {
::tiny_keccak::keccak256(&self.encode()) tiny_keccak::keccak256(&self.encode())
} }
} }
@@ -60,7 +60,7 @@ pub struct BlockData {
} }
pub fn hash_state(state: u64) -> [u8; 32] { pub fn hash_state(state: u64) -> [u8; 32] {
::tiny_keccak::keccak256(state.encode().as_slice()) tiny_keccak::keccak256(state.encode().as_slice())
} }
#[derive(Default, Encode, Decode)] #[derive(Default, Encode, Decode)]
+1 -2
View File
@@ -9,9 +9,8 @@ build = "build.rs"
[dependencies] [dependencies]
[build-dependencies] [build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2" } wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.3" }
[features] [features]
default = [ "std" ] default = [ "std" ]
no_std = []
std = [] std = []
+1 -1
View File
@@ -19,7 +19,7 @@ use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSourc
fn main() { fn main() {
build_current_project_with_rustflags( build_current_project_with_rustflags(
"wasm_binary.rs", "wasm_binary.rs",
WasmBuilderSource::Crates("1.0.5"), WasmBuilderSource::Crates("1.0.7"),
"-C link-arg=--import-memory", "-C link-arg=--import-memory",
); );
} }
+4 -4
View File
@@ -17,13 +17,13 @@
//! Basic parachain that executes forever. //! Basic parachain that executes forever.
#![no_std] #![no_std]
#![cfg_attr(feature = "no_std", feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))] #![cfg_attr(not(feature = "std"), feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))]
// Make the WASM binary available. // Make the WASM binary available.
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "no_std")] #[cfg(not(feature = "std"))]
#[panic_handler] #[panic_handler]
#[no_mangle] #[no_mangle]
pub fn panic(_info: &core::panic::PanicInfo) -> ! { pub fn panic(_info: &core::panic::PanicInfo) -> ! {
@@ -32,7 +32,7 @@ pub fn panic(_info: &core::panic::PanicInfo) -> ! {
} }
} }
#[cfg(feature = "no_std")] #[cfg(not(feature = "std"))]
#[alloc_error_handler] #[alloc_error_handler]
#[no_mangle] #[no_mangle]
pub fn oom(_: core::alloc::Layout) -> ! { pub fn oom(_: core::alloc::Layout) -> ! {
@@ -41,7 +41,7 @@ pub fn oom(_: core::alloc::Layout) -> ! {
} }
} }
#[cfg(feature = "no_std")] #[cfg(not(feature = "std"))]
#[no_mangle] #[no_mangle]
pub extern fn validate_block(params: *const u8, len: usize) -> usize { pub extern fn validate_block(params: *const u8, len: usize) -> usize {
loop {} loop {}