Skip to content

Commit

Permalink
Change wabt to wat (paritytech#7050)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepyakin authored and thadouk committed Sep 10, 2020
1 parent cbf0bda commit 7d9cf7f
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 67 deletions.
54 changes: 8 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sp-application-crypto = { version = "2.0.0-rc6", path = "../../../primitives/app
sp-runtime = { version = "2.0.0-rc6", path = "../../../primitives/runtime" }
sp-externalities = { version = "0.8.0-rc6", path = "../../../primitives/externalities" }
substrate-test-client = { version = "2.0.0-rc6", path = "../../../test-utils/client" }
wabt = "0.9.1"
wat = "1.0"

[features]
wasmtime = [
Expand Down
4 changes: 2 additions & 2 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use node_runtime::{
constants::currency::*,
};
use node_primitives::{Balance, Hash};
use wabt;
use wat;
use node_testing::keyring::*;

pub mod common;
Expand Down Expand Up @@ -580,7 +580,7 @@ const CODE_TRANSFER: &str = r#"

#[test]
fn deploying_wasm_contract_should_work() {
let transfer_code = wabt::wat2wasm(CODE_TRANSFER).unwrap();
let transfer_code = wat::parse_str(CODE_TRANSFER).unwrap();
let transfer_ch = <Runtime as frame_system::Trait>::Hashing::hash(&transfer_code);

let addr = <Runtime as pallet_contracts::Trait>::DetermineContractAddress::contract_address_for(
Expand Down
2 changes: 1 addition & 1 deletion bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ substrate-test-client = { version = "2.0.0-rc6", path = "../../../test-utils/cli
pallet-timestamp = { version = "2.0.0-rc6", path = "../../../frame/timestamp" }
pallet-transaction-payment = { version = "2.0.0-rc6", path = "../../../frame/transaction-payment" }
pallet-treasury = { version = "2.0.0-rc6", path = "../../../frame/treasury" }
wabt = "0.9.1"
wat = "1.0"
sp-api = { version = "2.0.0-rc6", path = "../../../primitives/api" }
sp-finality-tracker = { version = "2.0.0-rc6", default-features = false, path = "../../../primitives/finality-tracker" }
sp-timestamp = { version = "2.0.0-rc6", default-features = false, path = "../../../primitives/timestamp" }
Expand Down
2 changes: 1 addition & 1 deletion client/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ libsecp256k1 = "0.3.4"

[dev-dependencies]
assert_matches = "1.3.0"
wabt = "0.9.1"
wat = "1.0"
hex-literal = "0.3.1"
sc-runtime-test = { version = "2.0.0-rc6", path = "runtime-test" }
substrate-test-runtime = { version = "2.0.0-rc6", path = "../../test-utils/runtime" }
Expand Down
19 changes: 9 additions & 10 deletions client/executor/src/integration_tests/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ use crate::WasmExecutionMethod;

use codec::Encode;
use test_case::test_case;
use wabt;

#[test_case(WasmExecutionMethod::Interpreted)]
#[cfg_attr(feature = "wasmtime", test_case(WasmExecutionMethod::Compiled))]
fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "assert" (func $assert (param i32)))
(import "env" "inc_counter" (func $inc_counter (param i32) (result i32)))
Expand Down Expand Up @@ -67,7 +66,7 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "assert" (func $assert (param i32)))
(func (export "call")
Expand All @@ -94,7 +93,7 @@ fn start_called(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "assert" (func $assert (param i32)))
(import "env" "inc_counter" (func $inc_counter (param i32) (result i32)))
Expand Down Expand Up @@ -138,7 +137,7 @@ fn invoke_args(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "assert" (func $assert (param i32)))
Expand Down Expand Up @@ -178,7 +177,7 @@ fn return_val(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(func (export "call") (param $x i32) (result i32)
(i32.add
Expand Down Expand Up @@ -206,7 +205,7 @@ fn unlinkable_module(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "non-existent" (func))
Expand Down Expand Up @@ -252,7 +251,7 @@ fn start_fn_ok(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(func (export "call")
)
Expand Down Expand Up @@ -281,7 +280,7 @@ fn start_fn_traps(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(func (export "call")
)
Expand Down Expand Up @@ -311,7 +310,7 @@ fn get_global_val_works(wasm_method: WasmExecutionMethod) {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(global (export "test_global") i64 (i64.const 500))
)
Expand Down
2 changes: 1 addition & 1 deletion primitives/sandbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sp-wasm-interface = { version = "2.0.0-rc6", default-features = false, path = ".
codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false }

[dev-dependencies]
wabt = "0.9.1"
wat = "1.0"
assert_matches = "1.3.0"

[features]
Expand Down
9 changes: 4 additions & 5 deletions primitives/sandbox/with_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ impl<T> Instance<T> {

#[cfg(test)]
mod tests {
use wabt;
use crate::{Error, Value, ReturnValue, HostError, EnvironmentDefinitionBuilder, Instance};
use assert_matches::assert_matches;

Expand Down Expand Up @@ -351,7 +350,7 @@ mod tests {

#[test]
fn invoke_args() {
let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "assert" (func $assert (param i32)))
Expand Down Expand Up @@ -386,7 +385,7 @@ mod tests {

#[test]
fn return_value() {
let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(func (export "call") (param $x i32) (result i32)
(i32.add
Expand All @@ -408,7 +407,7 @@ mod tests {

#[test]
fn signatures_dont_matter() {
let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
(import "env" "polymorphic_id" (func $id_i32 (param i32) (result i32)))
(import "env" "polymorphic_id" (func $id_i64 (param i64) (result i64)))
Expand Down Expand Up @@ -450,7 +449,7 @@ mod tests {
let mut env_builder = EnvironmentDefinitionBuilder::new();
env_builder.add_host_func("env", "returns_i32", env_returns_i32);

let code = wabt::wat2wasm(r#"
let code = wat::parse_str(r#"
(module
;; It's actually returns i32, but imported as if it returned i64
(import "env" "returns_i32" (func $returns_i32 (result i64)))
Expand Down

0 comments on commit 7d9cf7f

Please sign in to comment.