mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 11:51:01 +00:00
Update wasmtime (#5822)
* update wasmtime * update tests * Update client/executor/wasmtime/src/host.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * wip * use master-candidate * update with patches * update versions Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Generated
+78
-66
@@ -300,6 +300,12 @@ version = "0.11.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
|
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bincode"
|
name = "bincode"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@@ -721,18 +727,18 @@ checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-bforest"
|
name = "cranelift-bforest"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "45a9c21f8042b9857bda93f6c1910b9f9f24100187a3d3d52f214a34e3dc5818"
|
checksum = "d4425bb6c3f3d2f581c650f1a1fdd3196a975490149cf59bea9d34c3bea79eda"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen"
|
name = "cranelift-codegen"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7853f77a6e4a33c67a69c40f5e1bb982bd2dc5c4a22e17e67b65bbccf9b33b2e"
|
checksum = "d166b289fd30062ee6de86284750fc3fe5d037c6b864b3326ce153239b0626e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.4",
|
"byteorder 1.3.4",
|
||||||
"cranelift-bforest",
|
"cranelift-bforest",
|
||||||
@@ -741,6 +747,7 @@ dependencies = [
|
|||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
"gimli",
|
"gimli",
|
||||||
"log",
|
"log",
|
||||||
|
"regalloc",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec 1.3.0",
|
"smallvec 1.3.0",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
@@ -749,9 +756,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-meta"
|
name = "cranelift-codegen-meta"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "084cd6d5fb0d1da28acd72c199471bfb09acc703ec8f3bf07b1699584272a3b9"
|
checksum = "02c9fb2306a36d41c5facd4bf3400bc6c157185c43a96eaaa503471c34c5144b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen-shared",
|
"cranelift-codegen-shared",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
@@ -759,24 +766,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-codegen-shared"
|
name = "cranelift-codegen-shared"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "701b599783305a58c25027a4d73f2d6b599b2d8ef3f26677275f480b4d51e05d"
|
checksum = "44e0cfe9b1f97d9f836bca551618106c7d53b93b579029ecd38e73daa7eb689e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-entity"
|
name = "cranelift-entity"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b88e792b28e1ebbc0187b72ba5ba880dad083abe9231a99d19604d10c9e73f38"
|
checksum = "926a73c432e5ba9c891171ff50b75e7d992cd76cd271f0a0a0ba199138077472"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-frontend"
|
name = "cranelift-frontend"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "518344698fa6c976d853319218415fdfb4f1bc6b42d0b2e2df652e55dff1f778"
|
checksum = "e45f82e3446dd1ebb8c2c2f6a6b0e6cd6cd52965c7e5f7b1b35e9a9ace31ccde"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"log",
|
"log",
|
||||||
@@ -786,9 +793,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-native"
|
name = "cranelift-native"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32daf082da21c0c05d93394ff4842c2ab7c4991b1f3186a1d952f8ac660edd0b"
|
checksum = "488b5d481bb0996a143e55a9d1739ef425efa20d4a5e5e98c859a8573c9ead9a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"raw-cpuid",
|
"raw-cpuid",
|
||||||
@@ -797,9 +804,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-wasm"
|
name = "cranelift-wasm"
|
||||||
version = "0.59.0"
|
version = "0.63.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2aa816f554a3ef739a5d17ca3081a1f8983f04c944ea8ff60fb8d9dd8cd2d7b"
|
checksum = "00aa8dde71fd9fdb1958e7b0ef8f524c1560e2c6165e4ea54bc302b40551c161"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
@@ -1277,11 +1284,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "faerie"
|
name = "faerie"
|
||||||
version = "0.14.0"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "74b9ed6159e4a6212c61d9c6a86bee01876b192a64accecf58d5b5ae3b667b52"
|
checksum = "dfef65b0e94693295c5d2fe2506f0ee6f43465342d4b5331659936aee8b16084"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"goblin",
|
"goblin",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"log",
|
"log",
|
||||||
@@ -2724,7 +2730,7 @@ version = "0.18.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f7f3f79f060864db0317cc47641b7d35276dee52a0ffa91553fbd0c153863a3"
|
checksum = "3f7f3f79f060864db0317cc47641b7d35276dee52a0ffa91553fbd0c153863a3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.11.0",
|
||||||
"byteorder 1.3.4",
|
"byteorder 1.3.4",
|
||||||
"bytes 0.5.4",
|
"bytes 0.5.4",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -3876,16 +3882,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.17.0"
|
version = "0.18.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea44a4fd660ab0f38434934ca0212e90fbeaaee54126ef20a3451c30c95bafae"
|
checksum = "e5666bbb90bc4d1e5bdcb26c0afda1822d25928341e9384ab187a9b37ab69e36"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flate2",
|
"flate2",
|
||||||
"goblin",
|
|
||||||
"parity-wasm 0.41.0",
|
|
||||||
"scroll",
|
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"uuid",
|
"wasmparser",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5602,6 +5605,17 @@ dependencies = [
|
|||||||
"syn 1.0.17",
|
"syn 1.0.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regalloc"
|
||||||
|
version = "0.0.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b27b256b41986ac5141b37b8bbba85d314fbf546c182eb255af6720e07e4f804"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"rustc-hash",
|
||||||
|
"smallvec 1.3.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.3.7"
|
version = "1.3.7"
|
||||||
@@ -5706,7 +5720,7 @@ version = "0.7.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
|
checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.11.0",
|
||||||
"blake2b_simd",
|
"blake2b_simd",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
@@ -5745,7 +5759,7 @@ version = "0.17.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1"
|
checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.11.0",
|
||||||
"log",
|
"log",
|
||||||
"ring",
|
"ring",
|
||||||
"sct",
|
"sct",
|
||||||
@@ -7176,7 +7190,7 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b"
|
checksum = "1c9dab3f95c9ebdf3a88268c19af668f637a3c5039c2c56ff2d40b1b2d64a25b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64 0.11.0",
|
||||||
"bytes 0.5.4",
|
"bytes 0.5.4",
|
||||||
"flate2",
|
"flate2",
|
||||||
"futures 0.3.4",
|
"futures 0.3.4",
|
||||||
@@ -8231,9 +8245,9 @@ version = "1.0.5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasmtime"
|
name = "substrate-wasmtime"
|
||||||
version = "0.13.0-threadsafe.1"
|
version = "0.16.0-threadsafe.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e512629525ecfe43bffe1f3d9e6bb0f08bf01155288ef27fcaae4ea086e4a9d"
|
checksum = "3b8f9558e3fe7018b9aeac2aba318664dd7b15e307de11b09f58240695688a96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
@@ -8243,20 +8257,20 @@ dependencies = [
|
|||||||
"region",
|
"region",
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
"substrate-wasmtime-jit",
|
"substrate-wasmtime-jit",
|
||||||
|
"substrate-wasmtime-profiling",
|
||||||
"substrate-wasmtime-runtime",
|
"substrate-wasmtime-runtime",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"wasmparser",
|
"wasmparser",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
"wasmtime-profiling",
|
|
||||||
"wat",
|
"wat",
|
||||||
"winapi 0.3.8",
|
"winapi 0.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasmtime-jit"
|
name = "substrate-wasmtime-jit"
|
||||||
version = "0.13.0-threadsafe.1"
|
version = "0.16.0-threadsafe.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a20de5564886d2bcffdd351c9cd114ceb50758aa58eac3cedb14faabf7f93b91"
|
checksum = "f6b681b90a8d48b9535e4287c02e5aef6c72228ff45cbb60b4d195a762cc0770"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@@ -8265,23 +8279,44 @@ dependencies = [
|
|||||||
"cranelift-frontend",
|
"cranelift-frontend",
|
||||||
"cranelift-native",
|
"cranelift-native",
|
||||||
"cranelift-wasm",
|
"cranelift-wasm",
|
||||||
|
"gimli",
|
||||||
|
"log",
|
||||||
"more-asserts",
|
"more-asserts",
|
||||||
"region",
|
"region",
|
||||||
|
"substrate-wasmtime-profiling",
|
||||||
"substrate-wasmtime-runtime",
|
"substrate-wasmtime-runtime",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmparser",
|
"wasmparser",
|
||||||
"wasmtime-debug",
|
"wasmtime-debug",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
"wasmtime-profiling",
|
|
||||||
"winapi 0.3.8",
|
"winapi 0.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasmtime-runtime"
|
name = "substrate-wasmtime-profiling"
|
||||||
version = "0.13.0-threadsafe.1"
|
version = "0.16.0-threadsafe.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d08846f04293a7fc27eeb30f06262ca2e1b4ee20f5192cec1f3ce201e08ceb8"
|
checksum = "b7cb99b24e771de6c20b380fdf2d26ffc2c20701892c540830beb83af98bb3b7"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"cfg-if",
|
||||||
|
"gimli",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"object",
|
||||||
|
"scroll",
|
||||||
|
"serde",
|
||||||
|
"substrate-wasmtime-runtime",
|
||||||
|
"target-lexicon",
|
||||||
|
"wasmtime-environ",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "substrate-wasmtime-runtime"
|
||||||
|
version = "0.16.0-threadsafe.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aaccd27cc466bd2904aa14f984f642083037bf5b47e251ccaf1009aed0a2a185"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -8294,7 +8329,6 @@ dependencies = [
|
|||||||
"region",
|
"region",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"wasmtime-environ",
|
"wasmtime-environ",
|
||||||
"wasmtime-profiling",
|
|
||||||
"winapi 0.3.8",
|
"winapi 0.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -9051,12 +9085,6 @@ dependencies = [
|
|||||||
"percent-encoding 2.1.0",
|
"percent-encoding 2.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "uuid"
|
|
||||||
version = "0.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@@ -9302,9 +9330,9 @@ checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmtime-debug"
|
name = "wasmtime-debug"
|
||||||
version = "0.12.0"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d3d007436043bf55ec252d2f4dc1d35834157b5e2f148da839ca502e611cfe1"
|
checksum = "d39ba645aee700b29ff0093028b4123556dd142a74973f04ed6225eedb40e77d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"faerie",
|
"faerie",
|
||||||
@@ -9318,12 +9346,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmtime-environ"
|
name = "wasmtime-environ"
|
||||||
version = "0.12.0"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "80f3dea0e60c076dd0da27fa10c821323903c9554c617ed32eaab8e7a7e36c89"
|
checksum = "ed54fd9d64dfeeee7c285fd126174a6b5e6d4efc7e5a1566fdb635e60ff6a74e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64",
|
"base64 0.12.0",
|
||||||
"bincode",
|
"bincode",
|
||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
@@ -9345,22 +9373,6 @@ dependencies = [
|
|||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasmtime-profiling"
|
|
||||||
version = "0.12.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "984d29c8add3381e60d649f4e3e2a501da900fc2d2586e139502eec32fe0ebc8"
|
|
||||||
dependencies = [
|
|
||||||
"gimli",
|
|
||||||
"goblin",
|
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
|
||||||
"object",
|
|
||||||
"scroll",
|
|
||||||
"serde",
|
|
||||||
"target-lexicon",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wast"
|
name = "wast"
|
||||||
version = "14.0.0"
|
version = "14.0.0"
|
||||||
|
|||||||
@@ -92,9 +92,8 @@ fn call_not_existing_function(wasm_method: WasmExecutionMethod) {
|
|||||||
"\"Trap: Trap { kind: Host(Other(\\\"Function `missing_external` is only a stub. Calling a stub is not allowed.\\\")) }\""
|
"\"Trap: Trap { kind: Host(Other(\\\"Function `missing_external` is only a stub. Calling a stub is not allowed.\\\")) }\""
|
||||||
),
|
),
|
||||||
#[cfg(feature = "wasmtime")]
|
#[cfg(feature = "wasmtime")]
|
||||||
WasmExecutionMethod::Compiled => assert_eq!(
|
WasmExecutionMethod::Compiled => assert!(
|
||||||
&format!("{:?}", e),
|
format!("{:?}", e).contains("Wasm execution trapped: call to a missing function env:missing_external")
|
||||||
"\"Wasm execution trapped: call to a missing function env:missing_external\""
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,9 +120,8 @@ fn call_yet_another_not_existing_function(wasm_method: WasmExecutionMethod) {
|
|||||||
"\"Trap: Trap { kind: Host(Other(\\\"Function `yet_another_missing_external` is only a stub. Calling a stub is not allowed.\\\")) }\""
|
"\"Trap: Trap { kind: Host(Other(\\\"Function `yet_another_missing_external` is only a stub. Calling a stub is not allowed.\\\")) }\""
|
||||||
),
|
),
|
||||||
#[cfg(feature = "wasmtime")]
|
#[cfg(feature = "wasmtime")]
|
||||||
WasmExecutionMethod::Compiled => assert_eq!(
|
WasmExecutionMethod::Compiled => assert!(
|
||||||
&format!("{:?}", e),
|
format!("{:?}", e).contains("Wasm execution trapped: call to a missing function env:yet_another_missing_external")
|
||||||
"\"Wasm execution trapped: call to a missing function env:yet_another_missing_external\""
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ sp-wasm-interface = { version = "2.0.0-dev", path = "../../../primitives/wasm-in
|
|||||||
sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" }
|
sp-runtime-interface = { version = "2.0.0-dev", path = "../../../primitives/runtime-interface" }
|
||||||
sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" }
|
sp-core = { version = "2.0.0-dev", path = "../../../primitives/core" }
|
||||||
sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" }
|
sp-allocator = { version = "2.0.0-dev", path = "../../../primitives/allocator" }
|
||||||
wasmtime = { package = "substrate-wasmtime", version = "0.13.0-threadsafe.1" }
|
wasmtime = { package = "substrate-wasmtime", version = "0.16.0-threadsafe.1" }
|
||||||
wasmtime_runtime = { package = "substrate-wasmtime-runtime", version = "0.13.0-threadsafe.1" }
|
wasmtime-runtime = { package = "substrate-wasmtime-runtime", version = "0.16.0-threadsafe.1" }
|
||||||
wasmtime-environ = "0.12.0"
|
wasmtime-environ = "0.16"
|
||||||
cranelift-wasm = "0.59.0"
|
cranelift-wasm = "0.63"
|
||||||
cranelift-codegen = "0.59.0"
|
cranelift-codegen = "0.63"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.3.0"
|
assert_matches = "1.3.0"
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ impl<'a> SandboxCapabilities for HostContext<'a> {
|
|||||||
return Err("Supervisor function returned unexpected result!".into());
|
return Err("Supervisor function returned unexpected result!".into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => Err(err.message().to_string().into()),
|
Err(err) => Err(err.to_string().into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,8 @@ use crate::state_holder;
|
|||||||
use sc_executor_common::error::WasmError;
|
use sc_executor_common::error::WasmError;
|
||||||
use sp_wasm_interface::{Function, Value, ValueType};
|
use sp_wasm_interface::{Function, Value, ValueType};
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::rc::Rc;
|
|
||||||
use wasmtime::{
|
use wasmtime::{
|
||||||
Callable, Extern, ExternType, Func, FuncType, ImportType, Limits, Memory, MemoryType, Module,
|
Extern, ExternType, Func, FuncType, ImportType, Limits, Memory, MemoryType, Module,
|
||||||
Trap, Val,
|
Trap, Val,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,11 +52,11 @@ pub fn resolve_imports(
|
|||||||
let resolved = match import_ty.name() {
|
let resolved = match import_ty.name() {
|
||||||
"memory" => {
|
"memory" => {
|
||||||
memory_import_index = Some(externs.len());
|
memory_import_index = Some(externs.len());
|
||||||
resolve_memory_import(module, import_ty, heap_pages)?
|
resolve_memory_import(module, &import_ty, heap_pages)?
|
||||||
}
|
}
|
||||||
_ => resolve_func_import(
|
_ => resolve_func_import(
|
||||||
module,
|
module,
|
||||||
import_ty,
|
&import_ty,
|
||||||
host_functions,
|
host_functions,
|
||||||
allow_missing_func_imports,
|
allow_missing_func_imports,
|
||||||
)?,
|
)?,
|
||||||
@@ -131,7 +130,7 @@ fn resolve_func_import(
|
|||||||
{
|
{
|
||||||
Some(host_func) => host_func,
|
Some(host_func) => host_func,
|
||||||
None if allow_missing_func_imports => {
|
None if allow_missing_func_imports => {
|
||||||
return Ok(MissingHostFuncHandler::new(import_ty).into_extern(module, func_ty));
|
return Ok(MissingHostFuncHandler::new(import_ty).into_extern(module, &func_ty));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
return Err(WasmError::Other(format!(
|
return Err(WasmError::Other(format!(
|
||||||
@@ -163,6 +162,58 @@ struct HostFuncHandler {
|
|||||||
host_func: &'static dyn Function,
|
host_func: &'static dyn Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn call_static(
|
||||||
|
static_func: &'static dyn Function,
|
||||||
|
wasmtime_params: &[Val],
|
||||||
|
wasmtime_results: &mut [Val],
|
||||||
|
) -> Result<(), wasmtime::Trap> {
|
||||||
|
let unwind_result = state_holder::with_context(|host_ctx| {
|
||||||
|
let mut host_ctx = host_ctx.expect(
|
||||||
|
"host functions can be called only from wasm instance;
|
||||||
|
wasm instance is always called initializing context;
|
||||||
|
therefore host_ctx cannot be None;
|
||||||
|
qed
|
||||||
|
",
|
||||||
|
);
|
||||||
|
// `into_value` panics if it encounters a value that doesn't fit into the values
|
||||||
|
// available in substrate.
|
||||||
|
//
|
||||||
|
// This, however, cannot happen since the signature of this function is created from
|
||||||
|
// a `dyn Function` signature of which cannot have a non substrate value by definition.
|
||||||
|
let mut params = wasmtime_params.iter().cloned().map(into_value);
|
||||||
|
|
||||||
|
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||||
|
static_func.execute(&mut host_ctx, &mut params)
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
|
||||||
|
let execution_result = match unwind_result {
|
||||||
|
Ok(execution_result) => execution_result,
|
||||||
|
Err(err) => return Err(Trap::new(stringify_panic_payload(err))),
|
||||||
|
};
|
||||||
|
|
||||||
|
match execution_result {
|
||||||
|
Ok(Some(ret_val)) => {
|
||||||
|
debug_assert!(
|
||||||
|
wasmtime_results.len() == 1,
|
||||||
|
"wasmtime function signature, therefore the number of results, should always \
|
||||||
|
correspond to the number of results returned by the host function",
|
||||||
|
);
|
||||||
|
wasmtime_results[0] = into_wasmtime_val(ret_val);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
debug_assert!(
|
||||||
|
wasmtime_results.len() == 0,
|
||||||
|
"wasmtime function signature, therefore the number of results, should always \
|
||||||
|
correspond to the number of results returned by the host function",
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Err(msg) => Err(Trap::new(msg)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl HostFuncHandler {
|
impl HostFuncHandler {
|
||||||
fn new(host_func: &'static dyn Function) -> Self {
|
fn new(host_func: &'static dyn Function) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -171,66 +222,17 @@ impl HostFuncHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn into_extern(self, module: &Module) -> Extern {
|
fn into_extern(self, module: &Module) -> Extern {
|
||||||
|
let host_func = self.host_func;
|
||||||
let func_ty = wasmtime_func_sig(self.host_func);
|
let func_ty = wasmtime_func_sig(self.host_func);
|
||||||
let func = Func::new(module.store(), func_ty, Rc::new(self));
|
let func = Func::new(module.store(), func_ty,
|
||||||
|
move |_, params, result| {
|
||||||
|
call_static(host_func, params, result)
|
||||||
|
}
|
||||||
|
);
|
||||||
Extern::Func(func)
|
Extern::Func(func)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Callable for HostFuncHandler {
|
|
||||||
fn call(
|
|
||||||
&self,
|
|
||||||
wasmtime_params: &[Val],
|
|
||||||
wasmtime_results: &mut [Val],
|
|
||||||
) -> Result<(), wasmtime::Trap> {
|
|
||||||
let unwind_result = state_holder::with_context(|host_ctx| {
|
|
||||||
let mut host_ctx = host_ctx.expect(
|
|
||||||
"host functions can be called only from wasm instance;
|
|
||||||
wasm instance is always called initializing context;
|
|
||||||
therefore host_ctx cannot be None;
|
|
||||||
qed
|
|
||||||
",
|
|
||||||
);
|
|
||||||
// `into_value` panics if it encounters a value that doesn't fit into the values
|
|
||||||
// available in substrate.
|
|
||||||
//
|
|
||||||
// This, however, cannot happen since the signature of this function is created from
|
|
||||||
// a `dyn Function` signature of which cannot have a non substrate value by definition.
|
|
||||||
let mut params = wasmtime_params.iter().cloned().map(into_value);
|
|
||||||
|
|
||||||
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
|
||||||
self.host_func.execute(&mut host_ctx, &mut params)
|
|
||||||
}))
|
|
||||||
});
|
|
||||||
|
|
||||||
let execution_result = match unwind_result {
|
|
||||||
Ok(execution_result) => execution_result,
|
|
||||||
Err(err) => return Err(Trap::new(stringify_panic_payload(err))),
|
|
||||||
};
|
|
||||||
|
|
||||||
match execution_result {
|
|
||||||
Ok(Some(ret_val)) => {
|
|
||||||
debug_assert!(
|
|
||||||
wasmtime_results.len() == 1,
|
|
||||||
"wasmtime function signature, therefore the number of results, should always \
|
|
||||||
correspond to the number of results returned by the host function",
|
|
||||||
);
|
|
||||||
wasmtime_results[0] = into_wasmtime_val(ret_val);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
Ok(None) => {
|
|
||||||
debug_assert!(
|
|
||||||
wasmtime_results.len() == 0,
|
|
||||||
"wasmtime function signature, therefore the number of results, should always \
|
|
||||||
correspond to the number of results returned by the host function",
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
Err(msg) => Err(Trap::new(msg)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A `Callable` handler for missing functions.
|
/// A `Callable` handler for missing functions.
|
||||||
struct MissingHostFuncHandler {
|
struct MissingHostFuncHandler {
|
||||||
module: String,
|
module: String,
|
||||||
@@ -245,25 +247,18 @@ impl MissingHostFuncHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_extern(self, module: &Module, func_ty: &FuncType) -> Extern {
|
fn into_extern(self, wasmtime_module: &Module, func_ty: &FuncType) -> Extern {
|
||||||
let func = Func::new(module.store(), func_ty.clone(), Rc::new(self));
|
let Self { module, name } = self;
|
||||||
|
let func = Func::new(wasmtime_module.store(), func_ty.clone(),
|
||||||
|
move |_, _, _| Err(Trap::new(format!(
|
||||||
|
"call to a missing function {}:{}",
|
||||||
|
module, name
|
||||||
|
)))
|
||||||
|
);
|
||||||
Extern::Func(func)
|
Extern::Func(func)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Callable for MissingHostFuncHandler {
|
|
||||||
fn call(
|
|
||||||
&self,
|
|
||||||
_wasmtime_params: &[Val],
|
|
||||||
_wasmtime_results: &mut [Val],
|
|
||||||
) -> Result<(), wasmtime::Trap> {
|
|
||||||
Err(Trap::new(format!(
|
|
||||||
"call to a missing function {}:{}",
|
|
||||||
self.module, self.name
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn wasmtime_func_sig(func: &dyn Function) -> wasmtime::FuncType {
|
fn wasmtime_func_sig(func: &dyn Function) -> wasmtime::FuncType {
|
||||||
let params = func
|
let params = func
|
||||||
.signature()
|
.signature()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use sc_executor_common::{
|
|||||||
util::{WasmModuleInfo, DataSegmentsSnapshot},
|
util::{WasmModuleInfo, DataSegmentsSnapshot},
|
||||||
};
|
};
|
||||||
use sp_wasm_interface::{Pointer, WordSize, Value};
|
use sp_wasm_interface::{Pointer, WordSize, Value};
|
||||||
use wasmtime::{Store, Instance, Module, Memory, Table, Val};
|
use wasmtime::{Store, Instance, Module, Memory, Table, Val, Func, Extern, Global};
|
||||||
|
|
||||||
mod globals_snapshot;
|
mod globals_snapshot;
|
||||||
|
|
||||||
@@ -88,6 +88,35 @@ pub struct InstanceWrapper {
|
|||||||
_not_send_nor_sync: marker::PhantomData<*const ()>,
|
_not_send_nor_sync: marker::PhantomData<*const ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn extern_memory(extern_: &Extern) -> Option<&Memory> {
|
||||||
|
match extern_ {
|
||||||
|
Extern::Memory(mem) => Some(mem),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn extern_global(extern_: &Extern) -> Option<&Global> {
|
||||||
|
match extern_ {
|
||||||
|
Extern::Global(glob) => Some(glob),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extern_table(extern_: &Extern) -> Option<&Table> {
|
||||||
|
match extern_ {
|
||||||
|
Extern::Table(table) => Some(table),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extern_func(extern_: &Extern) -> Option<&Func> {
|
||||||
|
match extern_ {
|
||||||
|
Extern::Func(func) => Some(func),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl InstanceWrapper {
|
impl InstanceWrapper {
|
||||||
/// Create a new instance wrapper from the given wasm module.
|
/// Create a new instance wrapper from the given wasm module.
|
||||||
pub fn new(module_wrapper: &ModuleWrapper, imports: &Imports, heap_pages: u32) -> Result<Self> {
|
pub fn new(module_wrapper: &ModuleWrapper, imports: &Imports, heap_pages: u32) -> Result<Self> {
|
||||||
@@ -96,8 +125,7 @@ impl InstanceWrapper {
|
|||||||
|
|
||||||
let memory = match imports.memory_import_index {
|
let memory = match imports.memory_import_index {
|
||||||
Some(memory_idx) => {
|
Some(memory_idx) => {
|
||||||
imports.externs[memory_idx]
|
extern_memory(&imports.externs[memory_idx])
|
||||||
.memory()
|
|
||||||
.expect("only memory can be at the `memory_idx`; qed")
|
.expect("only memory can be at the `memory_idx`; qed")
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
@@ -130,8 +158,7 @@ impl InstanceWrapper {
|
|||||||
.instance
|
.instance
|
||||||
.get_export(name)
|
.get_export(name)
|
||||||
.ok_or_else(|| Error::from(format!("Exported method {} is not found", name)))?;
|
.ok_or_else(|| Error::from(format!("Exported method {} is not found", name)))?;
|
||||||
let entrypoint = export
|
let entrypoint = extern_func(&export)
|
||||||
.func()
|
|
||||||
.ok_or_else(|| Error::from(format!("Export {} is not a function", name)))?;
|
.ok_or_else(|| Error::from(format!("Export {} is not a function", name)))?;
|
||||||
match (entrypoint.ty().params(), entrypoint.ty().results()) {
|
match (entrypoint.ty().params(), entrypoint.ty().results()) {
|
||||||
(&[wasmtime::ValType::I32, wasmtime::ValType::I32], &[wasmtime::ValType::I64]) => {}
|
(&[wasmtime::ValType::I32, wasmtime::ValType::I32], &[wasmtime::ValType::I64]) => {}
|
||||||
@@ -164,8 +191,7 @@ impl InstanceWrapper {
|
|||||||
.get_export("__heap_base")
|
.get_export("__heap_base")
|
||||||
.ok_or_else(|| Error::from("__heap_base is not found"))?;
|
.ok_or_else(|| Error::from("__heap_base is not found"))?;
|
||||||
|
|
||||||
let heap_base_global = heap_base_export
|
let heap_base_global = extern_global(&heap_base_export)
|
||||||
.global()
|
|
||||||
.ok_or_else(|| Error::from("__heap_base is not a global"))?;
|
.ok_or_else(|| Error::from("__heap_base is not a global"))?;
|
||||||
|
|
||||||
let heap_base = heap_base_global
|
let heap_base = heap_base_global
|
||||||
@@ -183,7 +209,7 @@ impl InstanceWrapper {
|
|||||||
None => return Ok(None),
|
None => return Ok(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
let global = global.global().ok_or_else(|| format!("`{}` is not a global", name))?;
|
let global = extern_global(&global).ok_or_else(|| format!("`{}` is not a global", name))?;
|
||||||
|
|
||||||
match global.get() {
|
match global.get() {
|
||||||
Val::I32(val) => Ok(Some(Value::I32(val))),
|
Val::I32(val) => Ok(Some(Value::I32(val))),
|
||||||
@@ -201,8 +227,7 @@ fn get_linear_memory(instance: &Instance) -> Result<Memory> {
|
|||||||
.get_export("memory")
|
.get_export("memory")
|
||||||
.ok_or_else(|| Error::from("memory is not exported under `memory` name"))?;
|
.ok_or_else(|| Error::from("memory is not exported under `memory` name"))?;
|
||||||
|
|
||||||
let memory = memory_export
|
let memory = extern_memory(&memory_export)
|
||||||
.memory()
|
|
||||||
.ok_or_else(|| Error::from("the `memory` export should have memory type"))?
|
.ok_or_else(|| Error::from("the `memory` export should have memory type"))?
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
@@ -213,7 +238,8 @@ fn get_linear_memory(instance: &Instance) -> Result<Memory> {
|
|||||||
fn get_table(instance: &Instance) -> Option<Table> {
|
fn get_table(instance: &Instance) -> Option<Table> {
|
||||||
instance
|
instance
|
||||||
.get_export("__indirect_function_table")
|
.get_export("__indirect_function_table")
|
||||||
.and_then(|export| export.table())
|
.as_ref()
|
||||||
|
.and_then(extern_table)
|
||||||
.cloned()
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ use sc_executor_common::{
|
|||||||
use sp_wasm_interface::Value;
|
use sp_wasm_interface::Value;
|
||||||
use cranelift_codegen::ir;
|
use cranelift_codegen::ir;
|
||||||
use cranelift_wasm::GlobalIndex;
|
use cranelift_wasm::GlobalIndex;
|
||||||
|
use wasmtime_runtime::{ExportGlobal, Export};
|
||||||
|
|
||||||
/// A snapshot of a global variables values. This snapshot can be used later for restoring the
|
/// A snapshot of a global variables values. This snapshot can be used later for restoring the
|
||||||
/// values to the preserved state.
|
/// values to the preserved state.
|
||||||
@@ -43,11 +44,9 @@ impl GlobalsSnapshot {
|
|||||||
|
|
||||||
for global_idx in instance_wrapper.imported_globals_count..instance_wrapper.globals_count {
|
for global_idx in instance_wrapper.imported_globals_count..instance_wrapper.globals_count {
|
||||||
let (def, global) = match handle.lookup_by_declaration(
|
let (def, global) = match handle.lookup_by_declaration(
|
||||||
&wasmtime_environ::Export::Global(GlobalIndex::from_u32(global_idx)),
|
&wasmtime_environ::EntityIndex::Global(GlobalIndex::from_u32(global_idx)),
|
||||||
) {
|
) {
|
||||||
wasmtime_runtime::Export::Global {
|
Export::Global(ExportGlobal { definition, global, .. }) => (definition, global),
|
||||||
definition, global, ..
|
|
||||||
} => (definition, global),
|
|
||||||
_ => unreachable!("only globals can be returned for a global request"),
|
_ => unreachable!("only globals can be returned for a global request"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ fn perform_call(
|
|||||||
Err(trap) => {
|
Err(trap) => {
|
||||||
return Err(Error::from(format!(
|
return Err(Error::from(format!(
|
||||||
"Wasm execution trapped: {}",
|
"Wasm execution trapped: {}",
|
||||||
trap.message()
|
trap
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user