mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
Initial: Offchain Workers (#1942)
* Refactor state-machine stuff. * Fix tests. * WiP * WiP2 * Service support for offchain workers. * Service support for offchain workers. * Testing offchain worker. * Initial version working. * Pass side effects in call. * Pass OffchainExt in context. * Submit extrinsics to the pool. * Support inherents. * Insert to inherents pool. * Inserting to the pool asynchronously. * Add test to offchain worker. * Implement convenience syntax for modules. * Dispatching offchain worker through executive. * Fix offchain test. * Remove offchain worker from timestamp. * Update Cargo.lock. * Address review comments. * Use latest patch version for futures. * Add CLI parameter for offchain worker. * Fix compilation. * Fix test. * Fix extrinsics format for tests. * Fix RPC test. * Bump spec version. * Fix executive. * Fix support macro. * Address grumbles. * Bump runtime
This commit is contained in:
@@ -53,6 +53,16 @@ impl Into<client::ExecutionStrategy> for ExecutionStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
arg_enum! {
|
||||
/// How to execute blocks
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum OffchainWorkerEnabled {
|
||||
Always,
|
||||
Never,
|
||||
WhenValidating,
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared parameters used by all `CoreParams`.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
pub struct SharedParams {
|
||||
@@ -205,6 +215,70 @@ pub struct TransactionPoolParams {
|
||||
pub pool_kbytes: usize,
|
||||
}
|
||||
|
||||
/// Execution strategies parameters.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
pub struct ExecutionStrategies {
|
||||
/// The means of execution used when calling into the runtime while syncing blocks.
|
||||
#[structopt(
|
||||
long = "syncing-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""NativeElseWasm""#
|
||||
)
|
||||
)]
|
||||
pub syncing_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while importing blocks.
|
||||
#[structopt(
|
||||
long = "importing-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""NativeElseWasm""#
|
||||
)
|
||||
)]
|
||||
pub importing_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while constructing blocks.
|
||||
#[structopt(
|
||||
long = "block-construction-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""Wasm""#
|
||||
)
|
||||
)]
|
||||
pub block_construction_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while constructing blocks.
|
||||
#[structopt(
|
||||
long = "offchain-worker-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""NativeWhenPossible""#
|
||||
)
|
||||
)]
|
||||
pub offchain_worker_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while not syncing, importing or constructing blocks.
|
||||
#[structopt(
|
||||
long = "other-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""Wasm""#
|
||||
)
|
||||
)]
|
||||
pub other_execution: ExecutionStrategy,
|
||||
}
|
||||
|
||||
/// The `run` command used to run a node.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
pub struct RunCmd {
|
||||
@@ -266,53 +340,22 @@ pub struct RunCmd {
|
||||
#[structopt(long = "telemetry-url", value_name = "URL VERBOSITY", parse(try_from_str = "parse_telemetry_endpoints"))]
|
||||
pub telemetry_endpoints: Vec<(String, u8)>,
|
||||
|
||||
/// The means of execution used when calling into the runtime while syncing blocks.
|
||||
/// Should execute offchain workers on every block. By default it's only enabled for nodes that are authoring new
|
||||
/// blocks.
|
||||
#[structopt(
|
||||
long = "syncing-execution",
|
||||
value_name = "STRATEGY",
|
||||
long = "offchain-worker",
|
||||
value_name = "ENABLED",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
possible_values = "&OffchainWorkerEnabled::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""NativeElseWasm""#
|
||||
default_value = r#""WhenValidating""#
|
||||
)
|
||||
)]
|
||||
pub syncing_execution: ExecutionStrategy,
|
||||
pub offchain_worker: OffchainWorkerEnabled,
|
||||
|
||||
/// The means of execution used when calling into the runtime while importing blocks.
|
||||
#[structopt(
|
||||
long = "importing-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""NativeElseWasm""#
|
||||
)
|
||||
)]
|
||||
pub importing_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while constructing blocks.
|
||||
#[structopt(
|
||||
long = "block-construction-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""Wasm""#
|
||||
)
|
||||
)]
|
||||
pub block_construction_execution: ExecutionStrategy,
|
||||
|
||||
/// The means of execution used when calling into the runtime while not syncing, importing or constructing blocks.
|
||||
#[structopt(
|
||||
long = "other-execution",
|
||||
value_name = "STRATEGY",
|
||||
raw(
|
||||
possible_values = "&ExecutionStrategy::variants()",
|
||||
case_insensitive = "true",
|
||||
default_value = r#""Wasm""#
|
||||
)
|
||||
)]
|
||||
pub other_execution: ExecutionStrategy,
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
pub execution_strategies: ExecutionStrategies,
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[structopt(flatten)]
|
||||
|
||||
Reference in New Issue
Block a user