First step for generating host externals out of the function definition in sr-io (#3567)

* Adds new wrapper traits for wasm executor

* Add new crate `substrate-wasm-interface`

Thew new crate holds types and traits for the communicating between the
wasm runtime and the host.

* Rewrite externals with new macro etc

* Fix vec initialization

* Make executor tests working

* Remove unused code + warnings

* Introduce `Pointer` and `WordSize` for working with wasm

* Fix tests and compilation

* Fix compilation

* Apply suggestions from code review

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Review feedback

* Remove unused conversions

* Make each host function its own struct

`HostFunctions` now just returns these function structs. Each function
can be executed by using one of the function structs. The inherent host
functions are now moved to the "normal" host functions.

* Remove byteorder

* Add floating point types

* Make pointer interface more safe

* Add type alias for wasm-interface Result

* More review comments
This commit is contained in:
Bastian Köcher
2019-09-10 16:07:25 +02:00
committed by GitHub
parent 86b3f2e1a7
commit 1450719acc
20 changed files with 1815 additions and 1462 deletions
+8 -1
View File
@@ -4868,7 +4868,6 @@ name = "substrate-executor"
version = "2.0.0"
dependencies = [
"assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4887,6 +4886,7 @@ dependencies = [
"substrate-serializer 2.0.0",
"substrate-state-machine 2.0.0",
"substrate-trie 2.0.0",
"substrate-wasm-interface 2.0.0",
"tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5464,6 +5464,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "substrate-wasm-builder-runner"
version = "1.0.3"
[[package]]
name = "substrate-wasm-interface"
version = "2.0.0"
dependencies = [
"wasmi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "subtle"
version = "1.0.0"