mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 18:47:56 +00:00
82f3c3e2e8
Moved from https://github.com/paritytech/substrate/pull/14788 ---- Fixes https://github.com/paritytech/polkadot-sdk/issues/232 This PR introduces outer-macro approach for `construct_runtime` as discussed in the linked issue. It looks like the following: ```rust #[frame_support::runtime] mod runtime { #[runtime::runtime] #[runtime::derive( RuntimeCall, RuntimeEvent, RuntimeError, RuntimeOrigin, RuntimeFreezeReason, RuntimeHoldReason, RuntimeSlashReason, RuntimeLockId, RuntimeTask, )] pub struct Runtime; #[runtime::pallet_index(0)] pub type System = frame_system; #[runtime::pallet_index(1)] pub type Timestamp = pallet_timestamp; #[runtime::pallet_index(2)] pub type Aura = pallet_aura; #[runtime::pallet_index(3)] pub type Grandpa = pallet_grandpa; #[runtime::pallet_index(4)] pub type Balances = pallet_balances; #[runtime::pallet_index(5)] pub type TransactionPayment = pallet_transaction_payment; #[runtime::pallet_index(6)] pub type Sudo = pallet_sudo; // Include the custom logic from the pallet-template in the runtime. #[runtime::pallet_index(7)] pub type TemplateModule = pallet_template; } ``` ## Features - `#[runtime::runtime]` attached to a struct defines the main runtime - `#[runtime::derive]` attached to this struct defines the types generated by runtime - `#[runtime::pallet_index]` must be attached to a pallet to define its index - `#[runtime::disable_call]` can be optionally attached to a pallet to disable its calls - `#[runtime::disable_unsigned]` can be optionally attached to a pallet to disable unsigned calls - A pallet instance can be defined as `TemplateModule: pallet_template<Instance>` - An optional attribute can be defined as `#[frame_support::runtime(legacy_ordering)]` to ensure that the order of hooks is same as the order of pallets (and not based on the pallet_index). This is to support legacy runtimes and should be avoided for new ones. ## Todo - [x] Update the latest syntax in kitchensink and tests - [x] Update UI tests - [x] Docs ## Extension - Abstract away the Executive similar to https://github.com/paritytech/substrate/pull/14742 - Optionally avoid the need to specify all runtime types (TBD) --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Nikhil Gupta <>
82 lines
2.9 KiB
TOML
82 lines
2.9 KiB
TOML
[package]
|
|
name = "frame-support-test"
|
|
version = "3.0.0"
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
license = "Apache-2.0"
|
|
publish = false
|
|
homepage = "https://substrate.io"
|
|
repository.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
targets = ["x86_64-unknown-linux-gnu"]
|
|
|
|
[dependencies]
|
|
static_assertions = "1.1.0"
|
|
serde = { features = ["derive"], workspace = true }
|
|
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
|
|
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
|
|
frame-metadata = { version = "16.0.0", default-features = false, features = ["current"] }
|
|
sp-api = { path = "../../../primitives/api", default-features = false }
|
|
sp-arithmetic = { path = "../../../primitives/arithmetic", default-features = false }
|
|
sp-io = { path = "../../../primitives/io", default-features = false }
|
|
sp-state-machine = { path = "../../../primitives/state-machine", optional = true }
|
|
frame-support = { path = "..", default-features = false, features = ["experimental"] }
|
|
frame-benchmarking = { path = "../../benchmarking", default-features = false }
|
|
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
|
|
sp-core = { path = "../../../primitives/core", default-features = false }
|
|
sp-std = { path = "../../../primitives/std", default-features = false }
|
|
sp-version = { path = "../../../primitives/version", default-features = false }
|
|
sp-metadata-ir = { path = "../../../primitives/metadata-ir", default-features = false }
|
|
trybuild = { version = "1.0.88", features = ["diff"] }
|
|
pretty_assertions = "1.3.0"
|
|
rustversion = "1.0.6"
|
|
frame-system = { path = "../../system", default-features = false }
|
|
frame-executive = { path = "../../executive", default-features = false }
|
|
# The "std" feature for this pallet is never activated on purpose, in order to test construct_runtime error message
|
|
test-pallet = { package = "frame-support-test-pallet", path = "pallet", default-features = false }
|
|
|
|
[features]
|
|
default = ["std"]
|
|
std = [
|
|
"codec/std",
|
|
"frame-benchmarking/std",
|
|
"frame-executive/std",
|
|
"frame-metadata/std",
|
|
"frame-support/std",
|
|
"frame-system/std",
|
|
"scale-info/std",
|
|
"serde/std",
|
|
"sp-api/std",
|
|
"sp-arithmetic/std",
|
|
"sp-core/std",
|
|
"sp-io/std",
|
|
"sp-metadata-ir/std",
|
|
"sp-runtime/std",
|
|
"sp-state-machine/std",
|
|
"sp-std/std",
|
|
"sp-version/std",
|
|
"test-pallet/std",
|
|
]
|
|
experimental = [
|
|
"frame-support/experimental",
|
|
"frame-system/experimental",
|
|
]
|
|
try-runtime = [
|
|
"frame-executive/try-runtime",
|
|
"frame-support/try-runtime",
|
|
"frame-system/try-runtime",
|
|
"sp-runtime/try-runtime",
|
|
]
|
|
# WARNING:
|
|
# Only CI runs with this feature enabled. This feature is for testing stuff related to the FRAME macros
|
|
# in conjunction with rust features.
|
|
frame-feature-testing = []
|
|
frame-feature-testing-2 = []
|
|
# Disable ui tests
|
|
disable-ui-tests = []
|
|
no-metadata-docs = ["frame-support/no-metadata-docs"]
|