diff --git a/Cargo.toml b/Cargo.toml index 52bb82f006..278b946928 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ exclude = [ "/res/*", "/tests/*", "/fuzz/*", "/benches/*" ] [dependencies] validation = { package = "wasmi-validation", version = "0.3", path = "validation", default-features = false } -parity-wasm = { version = "0.41.0", default-features = false } +parity-wasm = { version = "0.42.0", default-features = false } memory_units = "0.3.0" libm = { version = "0.2.1", optional = true } num-rational = { version = "0.2.2", default-features = false } diff --git a/src/prepare/mod.rs b/src/prepare/mod.rs index eb85a0f8e5..c6d4b54b8b 100644 --- a/src/prepare/mod.rs +++ b/src/prepare/mod.rs @@ -154,7 +154,7 @@ pub fn deny_floating_point(module: &Module) -> Result<(), Error> { if func .params() .iter() - .chain(func.return_type().as_ref()) + .chain(func.results()) .any(|&typ| typ == ValueType::F32 || typ == ValueType::F64) { return Err(Error("Use of floating point types denied".to_string())); diff --git a/src/types.rs b/src/types.rs index 12a8d5986b..2e26bcde07 100644 --- a/src/types.rs +++ b/src/types.rs @@ -65,7 +65,10 @@ impl Signature { .cloned() .map(ValueType::from_elements) .collect(), - return_type: func_type.return_type().map(ValueType::from_elements), + return_type: func_type + .results() + .first() + .map(|vty| ValueType::from_elements(*vty)), } } } diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 5ae3bb5ea7..fe2ade546e 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasmi-validation" -version = "0.3.0" +version = "0.3.1" authors = ["Parity Technologies "] edition = "2018" license = "MIT/Apache-2.0" @@ -8,7 +8,7 @@ repository = "https://github.com/paritytech/wasmi" description = "Wasm code validator" [dependencies] -parity-wasm = { version = "0.41.0", default-features = false } +parity-wasm = { version = "0.42.0", default-features = false } [dev-dependencies] assert_matches = "1.1" diff --git a/validation/src/context.rs b/validation/src/context.rs index 619e5c7945..792bb3bbb4 100644 --- a/validation/src/context.rs +++ b/validation/src/context.rs @@ -63,8 +63,9 @@ impl ModuleContext { let params = ty.params(); let return_ty = ty - .return_type() - .map(BlockType::Value) + .results() + .first() + .map(|vty| BlockType::Value(*vty)) .unwrap_or(BlockType::NoResult); Ok((params, return_ty)) } diff --git a/validation/src/tests.rs b/validation/src/tests.rs index 480225d926..526d8873e7 100644 --- a/validation/src/tests.rs +++ b/validation/src/tests.rs @@ -201,7 +201,7 @@ fn funcs() { let m = module() .function() .signature() - .return_type() + .result() .i32() .build() .body() @@ -213,7 +213,7 @@ fn funcs() { .build() .function() .signature() - .return_type() + .result() .i32() .build() .body()