Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Adds SandboxExecutionMethod enum for cli param
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7CFE committed May 11, 2021
1 parent 5c6ace9 commit 5cda36e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions client/cli/src/arg_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,14 @@ pub const DEFAULT_EXECUTION_BLOCK_CONSTRUCTION: ExecutionStrategy = ExecutionStr
pub const DEFAULT_EXECUTION_OFFCHAIN_WORKER: ExecutionStrategy = ExecutionStrategy::Native;
/// Default value for the `--execution-other` parameter.
pub const DEFAULT_EXECUTION_OTHER: ExecutionStrategy = ExecutionStrategy::Native;

arg_enum! {
/// How to execute wasm in a sandboxed environment
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SandboxExecutionMethod {
// Uses an interpreter.
Interpreted,
// Uses a compiled runtime.
Compiled,
}
}
12 changes: 11 additions & 1 deletion client/cli/src/params/import_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::arg_enums::{
ExecutionStrategy, WasmExecutionMethod, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION,
ExecutionStrategy, WasmExecutionMethod, SandboxExecutionMethod, DEFAULT_EXECUTION_BLOCK_CONSTRUCTION,
DEFAULT_EXECUTION_IMPORT_BLOCK, DEFAULT_EXECUTION_IMPORT_BLOCK_VALIDATOR,
DEFAULT_EXECUTION_OFFCHAIN_WORKER, DEFAULT_EXECUTION_OTHER, DEFAULT_EXECUTION_SYNCING,
};
Expand Down Expand Up @@ -56,6 +56,16 @@ pub struct ImportParams {
)]
pub wasm_method: WasmExecutionMethod,

/// Method for executing Wasm in a sandbox environment
#[structopt(
long = "sandbox-execution",
value_name = "METHOD",
possible_values = &SandboxExecutionMethod::variants(),
case_insensitive = true,
default_value = "Interpreted"
)]
pub sandbox_method: SandboxExecutionMethod,

/// Specify the path where local WASM runtimes are stored.
///
/// These runtimes will override on-chain runtimes when the version matches.
Expand Down

0 comments on commit 5cda36e

Please sign in to comment.