mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 11:21:08 +00:00
Move all example pallets under examples folder. (#10215)
* Put all examples under one folder Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * Updated Cargo.toml Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * updated for ci script Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * update Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * Added notes that example pallets are not meant to be used in production. Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com> * updated Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>
This commit is contained in:
@@ -41,7 +41,7 @@ variables: &default-vars
|
|||||||
CI_IMAGE: "paritytech/ci-linux:production"
|
CI_IMAGE: "paritytech/ci-linux:production"
|
||||||
# FIXME set to release
|
# FIXME set to release
|
||||||
CARGO_UNLEASH_INSTALL_PARAMS: "--version 1.0.0-alpha.12"
|
CARGO_UNLEASH_INSTALL_PARAMS: "--version 1.0.0-alpha.12"
|
||||||
CARGO_UNLEASH_PKG_DEF: "--skip node node-* pallet-template pallet-example pallet-example-* subkey chain-spec-builder"
|
CARGO_UNLEASH_PKG_DEF: "--skip node node-* pallet-template pallet-example-* subkey chain-spec-builder"
|
||||||
VAULT_SERVER_URL: "https://vault.parity-mgmt-vault.parity.io"
|
VAULT_SERVER_URL: "https://vault.parity-mgmt-vault.parity.io"
|
||||||
VAULT_AUTH_PATH: "gitlab-parity-io-jwt"
|
VAULT_AUTH_PATH: "gitlab-parity-io-jwt"
|
||||||
VAULT_AUTH_ROLE: "cicd_gitlab_parity_${CI_PROJECT_NAME}"
|
VAULT_AUTH_ROLE: "cicd_gitlab_parity_${CI_PROJECT_NAME}"
|
||||||
@@ -482,9 +482,9 @@ test-frame-examples-compile-to-wasm:
|
|||||||
RUSTFLAGS: "-Cdebug-assertions=y"
|
RUSTFLAGS: "-Cdebug-assertions=y"
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
script:
|
script:
|
||||||
- cd frame/example-offchain-worker/
|
- cd frame/examples/offchain-worker/
|
||||||
- cargo +nightly build --target=wasm32-unknown-unknown --no-default-features
|
- cargo +nightly build --target=wasm32-unknown-unknown --no-default-features
|
||||||
- cd ../example
|
- cd ../basic
|
||||||
- cargo +nightly build --target=wasm32-unknown-unknown --no-default-features
|
- cargo +nightly build --target=wasm32-unknown-unknown --no-default-features
|
||||||
- sccache -s
|
- sccache -s
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -5515,7 +5515,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pallet-example"
|
name = "pallet-example-basic"
|
||||||
version = "4.0.0-dev"
|
version = "4.0.0-dev"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking",
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ members = [
|
|||||||
"frame/elections",
|
"frame/elections",
|
||||||
"frame/election-provider-multi-phase",
|
"frame/election-provider-multi-phase",
|
||||||
"frame/election-provider-support",
|
"frame/election-provider-support",
|
||||||
"frame/example",
|
"frame/examples/basic",
|
||||||
"frame/example-offchain-worker",
|
"frame/examples/offchain-worker",
|
||||||
"frame/example-parallel",
|
"frame/examples/parallel",
|
||||||
"frame/executive",
|
"frame/executive",
|
||||||
"frame/gilt",
|
"frame/gilt",
|
||||||
"frame/grandpa",
|
"frame/grandpa",
|
||||||
|
|||||||
@@ -1217,7 +1217,7 @@ macro_rules! impl_benchmark_test {
|
|||||||
|
|
||||||
/// This creates a test suite which runs the module's benchmarks.
|
/// This creates a test suite which runs the module's benchmarks.
|
||||||
///
|
///
|
||||||
/// When called in `pallet_example` as
|
/// When called in `pallet_example_basic` as
|
||||||
///
|
///
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
|
/// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||||
@@ -1243,7 +1243,7 @@ macro_rules! impl_benchmark_test {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// When called inside the `benchmarks` macro of the `pallet_example` as
|
/// When called inside the `benchmarks` macro of the `pallet_example_basic` as
|
||||||
///
|
///
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// benchmarks! {
|
/// benchmarks! {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pallet-example"
|
name = "pallet-example-basic"
|
||||||
version = "4.0.0-dev"
|
version = "4.0.0-dev"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -14,18 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
|
||||||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
|
|
||||||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
|
|
||||||
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../balances" }
|
|
||||||
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../primitives/runtime" }
|
|
||||||
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../primitives/std" }
|
|
||||||
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../primitives/io" }
|
|
||||||
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../benchmarking", optional = true }
|
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
|
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
|
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../benchmarking", optional = true }
|
||||||
|
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
|
||||||
|
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
|
||||||
|
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../balances" }
|
||||||
|
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/io" }
|
||||||
|
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/runtime" }
|
||||||
|
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/std" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sp-core = { version = "4.0.0-dev", path = "../../primitives/core", default-features = false }
|
sp-core = { version = "4.0.0-dev", path = "../../../primitives/core", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
<!-- markdown-link-check-disable -->
|
<!-- markdown-link-check-disable -->
|
||||||
# Example Pallet
|
# Basic Example Pallet
|
||||||
|
|
||||||
<!-- Original author of paragraph: @gavofyork -->
|
<!-- Original author of paragraph: @gavofyork -->
|
||||||
The Example: A simple example of a FRAME pallet demonstrating
|
The Example: A simple example of a FRAME pallet demonstrating
|
||||||
concepts, APIs and structures common to most FRAME runtimes.
|
concepts, APIs and structures common to most FRAME runtimes.
|
||||||
|
|
||||||
Run `cargo doc --package pallet-example --open` to view this pallet's documentation.
|
Run `cargo doc --package pallet-example-basic --open` to view this pallet's documentation.
|
||||||
|
|
||||||
|
**This pallet serves as an example and is not meant to be used in production.**
|
||||||
|
|
||||||
### Documentation Guidelines:
|
### Documentation Guidelines:
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ Run `cargo doc --package pallet-example --open` to view this pallet's documentat
|
|||||||
|
|
||||||
### Documentation Template:<br>
|
### Documentation Template:<br>
|
||||||
|
|
||||||
Copy and paste this template from frame/example/src/lib.rs into file
|
Copy and paste this template from frame/examples/basic/src/lib.rs into file
|
||||||
`frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pallet and complete it.
|
`frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pallet and complete it.
|
||||||
<details><p><pre>
|
<details><p><pre>
|
||||||
// Add heading with custom pallet name
|
// Add heading with custom pallet name
|
||||||
@@ -46,9 +48,9 @@ Copy and paste this template from frame/example/src/lib.rs into file
|
|||||||
// Include the following links that shows what trait needs to be implemented to use the pallet
|
// Include the following links that shows what trait needs to be implemented to use the pallet
|
||||||
// and the supported dispatchables that are documented in the Call enum.
|
// and the supported dispatchables that are documented in the Call enum.
|
||||||
|
|
||||||
- \[`<INSERT_CUSTOM_PALLET_NAME>::Config`](https://docs.rs/pallet-example/latest/pallet_example/trait.Config.html)
|
- \[`<INSERT_CUSTOM_PALLET_NAME>::Config`](https://docs.rs/pallet-example-basic/latest/pallet_example_basic/trait.Config.html)
|
||||||
- \[`Call`](https://docs.rs/pallet-example/latest/pallet_example/enum.Call.html)
|
- \[`Call`](https://docs.rs/pallet-example-basic/latest/pallet_example_basic/enum.Call.html)
|
||||||
- \[`Module`](https://docs.rs/pallet-example/latest/pallet_example/struct.Module.html)
|
- \[`Module`](https://docs.rs/pallet-example-basic/latest/pallet_example_basic/struct.Module.html)
|
||||||
|
|
||||||
\## Overview
|
\## Overview
|
||||||
|
|
||||||
+3
-3
@@ -15,7 +15,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! Benchmarking for pallet-example.
|
//! Benchmarking for pallet-example-basic.
|
||||||
|
|
||||||
#![cfg(feature = "runtime-benchmarks")]
|
#![cfg(feature = "runtime-benchmarks")]
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ use crate::*;
|
|||||||
use frame_benchmarking::{benchmarks, whitelisted_caller};
|
use frame_benchmarking::{benchmarks, whitelisted_caller};
|
||||||
use frame_system::RawOrigin;
|
use frame_system::RawOrigin;
|
||||||
|
|
||||||
// To actually run this benchmark on pallet-example, we need to put this pallet into the
|
// To actually run this benchmark on pallet-example-basic, we need to put this pallet into the
|
||||||
// runtime and compile it with `runtime-benchmarks` feature. The detail procedures are
|
// runtime and compile it with `runtime-benchmarks` feature. The detail procedures are
|
||||||
// documented at:
|
// documented at:
|
||||||
// https://docs.substrate.io/v3/runtime/benchmarking#how-to-benchmark
|
// https://docs.substrate.io/v3/runtime/benchmarking#how-to-benchmark
|
||||||
@@ -67,7 +67,7 @@ benchmarks! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This line generates test cases for benchmarking, and could be run by:
|
// This line generates test cases for benchmarking, and could be run by:
|
||||||
// `cargo test -p pallet-example --all-features`, you will see one line per case:
|
// `cargo test -p pallet-example-basic --all-features`, you will see one line per case:
|
||||||
// `test benchmarking::bench_sort_vector ... ok`
|
// `test benchmarking::bench_sort_vector ... ok`
|
||||||
// `test benchmarking::bench_accumulate_dummy ... ok`
|
// `test benchmarking::bench_accumulate_dummy ... ok`
|
||||||
// `test benchmarking::bench_set_dummy_benchmark ... ok` in the result.
|
// `test benchmarking::bench_set_dummy_benchmark ... ok` in the result.
|
||||||
@@ -16,13 +16,15 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! <!-- markdown-link-check-disable -->
|
//! <!-- markdown-link-check-disable -->
|
||||||
//! # Example Pallet
|
//! # Basic Example Pallet
|
||||||
//!
|
//!
|
||||||
//! <!-- Original author of paragraph: @gavofyork -->
|
//! <!-- Original author of paragraph: @gavofyork -->
|
||||||
//! The Example: A simple example of a FRAME pallet demonstrating
|
//! The Example: A simple example of a FRAME pallet demonstrating
|
||||||
//! concepts, APIs and structures common to most FRAME runtimes.
|
//! concepts, APIs and structures common to most FRAME runtimes.
|
||||||
//!
|
//!
|
||||||
//! Run `cargo doc --package pallet-example --open` to view this pallet's documentation.
|
//! Run `cargo doc --package pallet-example-basic --open` to view this pallet's documentation.
|
||||||
|
//!
|
||||||
|
//! **This pallet serves as an example and is not meant to be used in production.**
|
||||||
//!
|
//!
|
||||||
//! ### Documentation Guidelines:
|
//! ### Documentation Guidelines:
|
||||||
//!
|
//!
|
||||||
@@ -59,7 +61,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ### Documentation Template:<br>
|
//! ### Documentation Template:<br>
|
||||||
//!
|
//!
|
||||||
//! Copy and paste this template from frame/example/src/lib.rs into file
|
//! Copy and paste this template from frame/examples/basic/src/lib.rs into file
|
||||||
//! `frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pallet and complete it.
|
//! `frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pallet and complete it.
|
||||||
//! <details><p><pre>
|
//! <details><p><pre>
|
||||||
//! // Add heading with custom pallet name
|
//! // Add heading with custom pallet name
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! Tests for pallet-example.
|
//! Tests for pallet-example-basic.
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
@@ -32,7 +32,7 @@ use sp_runtime::{
|
|||||||
BuildStorage,
|
BuildStorage,
|
||||||
};
|
};
|
||||||
// Reexport crate as its pallet name for construct_runtime.
|
// Reexport crate as its pallet name for construct_runtime.
|
||||||
use crate as pallet_example;
|
use crate as pallet_example_basic;
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
@@ -46,7 +46,7 @@ frame_support::construct_runtime!(
|
|||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
Example: pallet_example::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Example: pallet_example_basic::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
|||||||
// We use default for brevity, but you can configure as desired if needed.
|
// We use default for brevity, but you can configure as desired if needed.
|
||||||
system: Default::default(),
|
system: Default::default(),
|
||||||
balances: Default::default(),
|
balances: Default::default(),
|
||||||
example: pallet_example::GenesisConfig {
|
example: pallet_example_basic::GenesisConfig {
|
||||||
dummy: 42,
|
dummy: 42,
|
||||||
// we configure the map with (key, value) pairs.
|
// we configure the map with (key, value) pairs.
|
||||||
bar: vec![(1, 2), (2, 3)],
|
bar: vec![(1, 2), (2, 3)],
|
||||||
@@ -163,7 +163,7 @@ fn set_dummy_works() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn signed_ext_watch_dummy_works() {
|
fn signed_ext_watch_dummy_works() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
let call = pallet_example::Call::set_dummy { new_value: 10 }.into();
|
let call = pallet_example_basic::Call::set_dummy { new_value: 10 }.into();
|
||||||
let info = DispatchInfo::default();
|
let info = DispatchInfo::default();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -192,14 +192,14 @@ fn counted_map_works() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn weights_work() {
|
fn weights_work() {
|
||||||
// must have a defined weight.
|
// must have a defined weight.
|
||||||
let default_call = pallet_example::Call::<Test>::accumulate_dummy { increase_by: 10 };
|
let default_call = pallet_example_basic::Call::<Test>::accumulate_dummy { increase_by: 10 };
|
||||||
let info1 = default_call.get_dispatch_info();
|
let info1 = default_call.get_dispatch_info();
|
||||||
// aka. `let info = <Call<Test> as GetDispatchInfo>::get_dispatch_info(&default_call);`
|
// aka. `let info = <Call<Test> as GetDispatchInfo>::get_dispatch_info(&default_call);`
|
||||||
assert!(info1.weight > 0);
|
assert!(info1.weight > 0);
|
||||||
|
|
||||||
// `set_dummy` is simpler than `accumulate_dummy`, and the weight
|
// `set_dummy` is simpler than `accumulate_dummy`, and the weight
|
||||||
// should be less.
|
// should be less.
|
||||||
let custom_call = pallet_example::Call::<Test>::set_dummy { new_value: 20 };
|
let custom_call = pallet_example_basic::Call::<Test>::set_dummy { new_value: 20 };
|
||||||
let info2 = custom_call.get_dispatch_info();
|
let info2 = custom_call.get_dispatch_info();
|
||||||
assert!(info1.weight > info2.weight);
|
assert!(info1.weight > info2.weight);
|
||||||
}
|
}
|
||||||
+4
-4
@@ -15,7 +15,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! Autogenerated weights for pallet_example
|
//! Autogenerated weights for pallet_example_basic
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||||
//! DATE: 2021-03-15, STEPS: `[100, ]`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2021-03-15, STEPS: `[100, ]`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
// --wasm-execution
|
// --wasm-execution
|
||||||
// compiled
|
// compiled
|
||||||
// --pallet
|
// --pallet
|
||||||
// pallet_example
|
// pallet_example_basic
|
||||||
// --extrinsic
|
// --extrinsic
|
||||||
// *
|
// *
|
||||||
// --steps
|
// --steps
|
||||||
@@ -52,14 +52,14 @@
|
|||||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||||
use sp_std::marker::PhantomData;
|
use sp_std::marker::PhantomData;
|
||||||
|
|
||||||
/// Weight functions needed for pallet_example.
|
/// Weight functions needed for pallet_example_basic.
|
||||||
pub trait WeightInfo {
|
pub trait WeightInfo {
|
||||||
fn set_dummy_benchmark(b: u32, ) -> Weight;
|
fn set_dummy_benchmark(b: u32, ) -> Weight;
|
||||||
fn accumulate_dummy(b: u32, ) -> Weight;
|
fn accumulate_dummy(b: u32, ) -> Weight;
|
||||||
fn sort_vector(x: u32, ) -> Weight;
|
fn sort_vector(x: u32, ) -> Weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Weights for pallet_example using the Substrate node and recommended hardware.
|
/// Weights for pallet_example_basic using the Substrate node and recommended hardware.
|
||||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||||
fn set_dummy_benchmark(b: u32, ) -> Weight {
|
fn set_dummy_benchmark(b: u32, ) -> Weight {
|
||||||
+9
-8
@@ -14,16 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
|
||||||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
|
|
||||||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
|
|
||||||
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../primitives/core" }
|
|
||||||
sp-keystore = { version = "0.10.0-dev", path = "../../primitives/keystore", optional = true }
|
|
||||||
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../primitives/io" }
|
|
||||||
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../primitives/runtime" }
|
|
||||||
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../primitives/std" }
|
|
||||||
lite-json = { version = "0.1", default-features = false }
|
lite-json = { version = "0.1", default-features = false }
|
||||||
log = { version = "0.4.14", default-features = false }
|
log = { version = "0.4.14", default-features = false }
|
||||||
|
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
|
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
|
||||||
|
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
|
||||||
|
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/core" }
|
||||||
|
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/io" }
|
||||||
|
sp-keystore = { version = "0.10.0-dev", path = "../../../primitives/keystore", optional = true }
|
||||||
|
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/runtime" }
|
||||||
|
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/std" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
<!-- markdown-link-check-disable -->
|
<!-- markdown-link-check-disable -->
|
||||||
# Offchain Worker Example Module
|
# Offchain Worker Example Pallet
|
||||||
|
|
||||||
The Offchain Worker Example: A simple pallet demonstrating
|
The Offchain Worker Example: A simple pallet demonstrating
|
||||||
concepts, APIs and structures common to most offchain workers.
|
concepts, APIs and structures common to most offchain workers.
|
||||||
@@ -11,6 +11,8 @@ documentation.
|
|||||||
- [`Call`](./enum.Call.html)
|
- [`Call`](./enum.Call.html)
|
||||||
- [`Module`](./struct.Module.html)
|
- [`Module`](./struct.Module.html)
|
||||||
|
|
||||||
|
**This pallet serves as an example showcasing Substrate off-chain worker and is not meant to be
|
||||||
|
used in production.**
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
+3
@@ -28,6 +28,8 @@
|
|||||||
//! - [`Call`]
|
//! - [`Call`]
|
||||||
//! - [`Pallet`]
|
//! - [`Pallet`]
|
||||||
//!
|
//!
|
||||||
|
//! **This pallet serves as an example showcasing Substrate off-chain worker and is not meant to
|
||||||
|
//! be used in production.**
|
||||||
//!
|
//!
|
||||||
//! ## Overview
|
//! ## Overview
|
||||||
//!
|
//!
|
||||||
@@ -40,6 +42,7 @@
|
|||||||
//! Additional logic in OCW is put in place to prevent spamming the network with both signed
|
//! Additional logic in OCW is put in place to prevent spamming the network with both signed
|
||||||
//! and unsigned transactions, and custom `UnsignedValidator` makes sure that there is only
|
//! and unsigned transactions, and custom `UnsignedValidator` makes sure that there is only
|
||||||
//! one unsigned transaction floating in the network.
|
//! one unsigned transaction floating in the network.
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
+8
-7
@@ -14,13 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
|
||||||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
|
|
||||||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
|
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
|
||||||
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../primitives/core" }
|
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
|
||||||
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../primitives/io" }
|
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/core" }
|
||||||
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../primitives/runtime" }
|
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/io" }
|
||||||
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../primitives/std" }
|
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/runtime" }
|
||||||
sp-tasks = { version = "4.0.0-dev", default-features = false, path = "../../primitives/tasks" }
|
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/std" }
|
||||||
|
sp-tasks = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/tasks" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<!-- markdown-link-check-disable -->
|
||||||
|
# Parallel Tasks Example Pallet
|
||||||
|
|
||||||
|
This example pallet demonstrates parallelizing validation of the enlisted participants (see
|
||||||
|
`enlist_participants` dispatch).
|
||||||
|
|
||||||
|
**This pallet serves as an example and is not meant to be used in production.**
|
||||||
+4
-2
@@ -15,10 +15,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//! Parallel tasks example
|
//! # Parallel Tasks Example Pallet
|
||||||
//!
|
//!
|
||||||
//! This example pallet parallelizes validation of the enlisted participants
|
//! This example pallet demonstrates parallelizing validation of the enlisted participants
|
||||||
//! (see `enlist_participants` dispatch).
|
//! (see `enlist_participants` dispatch).
|
||||||
|
//!
|
||||||
|
//! **This pallet serves as an example and is not meant to be used in production.**
|
||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
Reference in New Issue
Block a user