Switch to Wasmtime for parachain execution (#2265)

* Switch to Wasmtime for parachain execution

* Fix the signature for halt's validate_block

* wasmtime feature enabled from cli

* Adds missing feature

Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Robert Habermeier
2021-01-15 12:03:22 -05:00
committed by GitHub
parent 089ba85c32
commit 8192248c52
4 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate"
[features] [features]
default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker", "polkadot-parachain" ] default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker", "polkadot-parachain" ]
wasmtime = [ "sc-cli/wasmtime" ] wasmtime = [ "sc-cli/wasmtime", "polkadot-parachain/wasmtime" ]
db = [ "service/db" ] db = [ "service/db" ]
cli = [ cli = [
"structopt", "structopt",
+1
View File
@@ -32,6 +32,7 @@ shared_memory = { version = "0.10.0", optional = true }
[features] [features]
default = ["std"] default = ["std"]
wasmtime = [ "sc-executor/wasmtime" ]
wasm-api = [] wasm-api = []
std = [ std = [
"parity-scale-codec/std", "parity-scale-codec/std",
@@ -198,6 +198,9 @@ pub fn validate_candidate_internal(
spawner: impl SpawnNamed + 'static, spawner: impl SpawnNamed + 'static,
) -> Result<ValidationResult, ValidationError> { ) -> Result<ValidationResult, ValidationError> {
let executor = sc_executor::WasmExecutor::new( let executor = sc_executor::WasmExecutor::new(
#[cfg(all(feature = "wasmtime", not(any(target_os = "android", target_os = "unknown"))))]
sc_executor::WasmExecutionMethod::Compiled,
#[cfg(any(not(feature = "wasmtime"), target_os = "android", target_os = "unknown"))]
sc_executor::WasmExecutionMethod::Interpreted, sc_executor::WasmExecutionMethod::Interpreted,
// TODO: Make sure we don't use more than 1GB: https://github.com/paritytech/polkadot/issues/699 // TODO: Make sure we don't use more than 1GB: https://github.com/paritytech/polkadot/issues/699
Some(1024), Some(1024),
@@ -50,6 +50,6 @@ pub fn oom(_: core::alloc::Layout) -> ! {
#[cfg(not(feature = "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) -> u64 {
loop {} loop {}
} }