Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make it work
  • Loading branch information
bkchr committed Jan 20, 2020
commit ab41ef4c042070e07b8d1c68abb7b90eb1118849
12 changes: 12 additions & 0 deletions client/cli/src/execution_strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ arg_enum! {
}
}

impl ExecutionStrategy {
/// Returns the variant as `'&static str`.
pub fn as_str(&self) -> &'static str {
match self {
Self::Native => "Native",
Self::Wasm => "Wasm",
Self::Both => "Both",
Self::NativeElseWasm => "NativeElseWasm",
}
}
}

/// Default value for the `--execution-syncing` parameter.
pub const DEFAULT_EXECUTION_SYNCING: ExecutionStrategy = ExecutionStrategy::NativeElseWasm;
/// Default value for the `--execution-import-block` parameter.
Expand Down
10 changes: 5 additions & 5 deletions client/cli/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub struct ExecutionStrategies {
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
default_value = "DEFAULT_EXECUTION_SYNCING"
default_value = DEFAULT_EXECUTION_SYNCING.as_str(),
)]
pub execution_syncing: ExecutionStrategy,

Expand All @@ -332,7 +332,7 @@ pub struct ExecutionStrategies {
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
default_value = "DEFAULT_EXECUTION_IMPORT_BLOCK"
default_value = DEFAULT_EXECUTION_IMPORT_BLOCK.as_str(),
)]
pub execution_import_block: ExecutionStrategy,

Expand All @@ -342,7 +342,7 @@ pub struct ExecutionStrategies {
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
default_value = "DEFAULT_EXECUTION_BLOCK_CONSTRUCTION"
default_value = DEFAULT_EXECUTION_BLOCK_CONSTRUCTION.as_str(),
)]
pub execution_block_construction: ExecutionStrategy,

Expand All @@ -352,7 +352,7 @@ pub struct ExecutionStrategies {
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
default_value = "DEFAULT_EXECUTION_OFFCHAIN_WORKER"
default_value = DEFAULT_EXECUTION_OFFCHAIN_WORKER.as_str(),
)]
pub execution_offchain_worker: ExecutionStrategy,

Expand All @@ -362,7 +362,7 @@ pub struct ExecutionStrategies {
value_name = "STRATEGY",
possible_values = &ExecutionStrategy::variants(),
case_insensitive = true,
default_value = "DEFAULT_EXECUTION_OTHER"
default_value = DEFAULT_EXECUTION_OTHER.as_str(),
)]
pub execution_other: ExecutionStrategy,

Expand Down