From c4ea3a6f41749cfc8351533f1146610980b4faea Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 30 May 2017 15:06:46 +0400 Subject: [PATCH 1/6] Update README.md --- README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ae8afb7..67f7136 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,25 @@ -# wasm-tools +# wasm-utils -Boilerplate code to test Parity WASM tools and compile rust/c/c++ code to wasm-contracts +Collection of WASM utilities used in Parity and WASM contract devepment -## How to compile contract +## Symbols optimizer (wasm-opt) ``` -git clone https://github.com/NikVolf/wasm-tools -cd wasm-tools/runner -./build.sh -./start.sh +cargo run --release --bin wasm-opt -- ``` -and then open `http://localhost:8000`, specify input stream in `Input` input, press `Execute call` to run a contract `call` function, see storage update (if contract produced any) as well as `Result` stream (again, if contract produced any). +This will optimize WASM symbols tree to leave only those elements that are used by contract `call` function entry. -see `/samples` directory for sample contracts that are compiled this way +## Gas counter (wasm-gas) -## Prerequisites +For development puposes, raw WASM contract can be injected with gas counters (the same way as it done by Parity runtime when running contracts) -- Emscripiten for C/C++ (see [this page](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html), `emcc` should be in the `PATH`) -- Rust with `wasm32-unknown-emscripten` target (see [this instruction](https://hackernoon.com/compiling-rust-to-webassembly-guide-411066a69fde) to setup) +``` +cargo run --release --bin wasm-gas -- Date: Tue, 30 May 2017 15:08:19 +0400 Subject: [PATCH 2/6] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 67f7136..b62f92f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Collection of WASM utilities used in Parity and WASM contract devepment ## Symbols optimizer (wasm-opt) ``` -cargo run --release --bin wasm-opt -- +cargo run --release --bin wasm-opt -- ``` This will optimize WASM symbols tree to leave only those elements that are used by contract `call` function entry. @@ -15,11 +15,17 @@ This will optimize WASM symbols tree to leave only those elements that are used For development puposes, raw WASM contract can be injected with gas counters (the same way as it done by Parity runtime when running contracts) ``` -cargo run --release --bin wasm-gas -- ``` ## Allocators substiution (wasm-ext) Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduce. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes it with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results. +``` +cargo run --release --bin wasm-ext -- +``` + +## API + All executables use corresponding api methods in the root crate and can be combined in other build tools. From 46778833e989d9e644fca3bf30ec8e542c5ccb48 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 30 May 2017 15:08:42 +0400 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b62f92f..af74e98 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,4 @@ cargo run --release --bin wasm-ext -- ## API -All executables use corresponding api methods in the root crate and can be combined in other build tools. +All executables use corresponding api methods of the root crate and can be combined in other build tools. From 221c7bbc390411f83ff4efc5eb55ace46882a98f Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 30 May 2017 15:11:04 +0400 Subject: [PATCH 4/6] typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af74e98..27c943a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ cargo run --release --bin wasm-gas -- ## Allocators substiution (wasm-ext) -Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduce. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes it with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results. +Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduced. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes it with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results. ``` cargo run --release --bin wasm-ext -- From bbfeb8f924e13d27ec309c2c3cdeb8484b3814cc Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 30 May 2017 15:15:11 +0400 Subject: [PATCH 5/6] more typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27c943a..702d9b9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ cargo run --release --bin wasm-gas -- ## Allocators substiution (wasm-ext) -Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduced. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes it with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results. +Parity WASM runtime provides simple memory allocators, if contract requires. When relied on this allocators, WASM binary size can be greatly reduced. This utility scans for `_malloc`, `_free` invokes inside the WASM binary and substitutes them with invokes of the imported `_malloc`, `_free`. Should be run before `wasm-opt` for better results. ``` cargo run --release --bin wasm-ext -- From 87ad7d9fbe46eaf83bfa4e20da31a9214617e340 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 31 May 2017 15:10:20 +0400 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 702d9b9..f9aeee2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Collection of WASM utilities used in Parity and WASM contract devepment cargo run --release --bin wasm-opt -- ``` -This will optimize WASM symbols tree to leave only those elements that are used by contract `call` function entry. +This will optimize WASM symbols tree to leave only those elements that are used by contract `_call` function entry. ## Gas counter (wasm-gas)