Skip to content

Commit

Permalink
Revert "Remove sandboxing host function interface (paritytech#12852)"
Browse files Browse the repository at this point in the history
This reverts commit 5722ece.
  • Loading branch information
ukint-vs committed Feb 13, 2023
1 parent 15e218a commit a8e4a83
Show file tree
Hide file tree
Showing 29 changed files with 3,850 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ members = [
"primitives/runtime-interface/test",
"primitives/runtime-interface/test-wasm",
"primitives/runtime-interface/test-wasm-deprecated",
"primitives/sandbox",
"primitives/serializer",
"primitives/session",
"primitives/staking",
Expand Down
7 changes: 7 additions & 0 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sp-session = { version = "4.0.0-dev", default-features = false, path = "../../..
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" }
sp-version = { version = "5.0.0", default-features = false, path = "../../../primitives/version" }
sp-io = { version = "7.0.0", default-features = false, path = "../../../primitives/io" }
sp-sandbox = { version = "0.10.0-dev", default-features = false, path = "../../../primitives/sandbox" }

# frame dependencies
frame-executive = { version = "4.0.0-dev", default-features = false, path = "../../../frame/executive" }
Expand Down Expand Up @@ -120,6 +121,7 @@ substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-bu
default = ["std"]
with-tracing = ["frame-executive/with-tracing"]
std = [
"sp-sandbox/std",
"pallet-whitelist/std",
"pallet-offences-benchmarking?/std",
"pallet-election-provider-support-benchmarking?/std",
Expand Down Expand Up @@ -324,3 +326,8 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
]
# Force `sp-sandbox` to call into the host resident executor. One still need to make sure
# that `sc-executor` gets the `wasmer-sandbox` feature which happens automatically when
# specified on the command line.
# Don't use that on a production chain.
wasmer-sandbox = ["sp-sandbox/wasmer-sandbox"]
3 changes: 3 additions & 0 deletions client/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
lazy_static = "1.4.0"
lru = "0.8.1"
parking_lot = "0.12.1"
tracing = "0.1.29"
Expand All @@ -25,6 +26,7 @@ sc-executor-wasmi = { version = "0.10.0-dev", path = "wasmi" }
sc-executor-wasmtime = { version = "0.10.0-dev", path = "wasmtime" }
sp-api = { version = "4.0.0-dev", path = "../../primitives/api" }
sp-core = { version = "7.0.0", path = "../../primitives/core" }
sp-core-hashing-proc-macro = { version = "5.0.0", path = "../../primitives/core/hashing/proc-macro" }
sp-externalities = { version = "0.13.0", path = "../../primitives/externalities" }
sp-io = { version = "7.0.0", path = "../../primitives/io" }
sp-panic-handler = { version = "5.0.0", path = "../../primitives/panic-handler" }
Expand Down Expand Up @@ -60,3 +62,4 @@ default = ["std"]
# This crate does not have `no_std` support, we just require this for tests
std = []
wasm-extern-trace = []
wasmer-sandbox = ["sc-executor-common/wasmer-sandbox"]
7 changes: 7 additions & 0 deletions client/executor/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0" }
environmental = "1.1.3"
thiserror = "1.0.30"
wasm-instrument = "0.3"
wasmer = { version = "2.2", features = ["singlepass"], optional = true }
wasmi = "0.13"
sc-allocator = { version = "4.1.0-dev", path = "../../allocator" }
sp-maybe-compressed-blob = { version = "4.1.0-dev", path = "../../../primitives/maybe-compressed-blob" }
sp-sandbox = { version = "0.10.0-dev", path = "../../../primitives/sandbox" }
sp-wasm-interface = { version = "7.0.0", path = "../../../primitives/wasm-interface" }

[features]
default = []
wasmer-sandbox = [
"wasmer",
]
3 changes: 3 additions & 0 deletions client/executor/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ pub enum Error {
#[error(transparent)]
Wasmi(#[from] wasmi::Error),

#[error("Sandbox error: {0}")]
Sandbox(String),

#[error("Error calling api function: {0}")]
ApiError(Box<dyn std::error::Error + Send + Sync>),

Expand Down
1 change: 1 addition & 0 deletions client/executor/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@

pub mod error;
pub mod runtime_blob;
pub mod sandbox;
pub mod util;
pub mod wasm_runtime;
Loading

0 comments on commit a8e4a83

Please sign in to comment.