Skip to content

Commit 2a4ff73

Browse files
committed
fix: adding parachain compatibility section
1 parent 8a1dbb8 commit 2a4ff73

File tree

2 files changed

+185
-1
lines changed

2 files changed

+185
-1
lines changed

develop/toolkit/parachains/polkadot-omni-node.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,96 @@ By default, `polkadot-omni-node` exposes a WebSocket endpoint at `ws://localhost
9696
- [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank} — a web-based interface for exploring and interacting with Polkadot SDK-based chains
9797
- Custom scripts using compatible [libraries](/develop/toolkit/api-libraries/){target=\_blank}
9898

99-
Once connected, you can review blocks, call extrinsics, inspect storage, and interact with the runtime.
99+
Once connected, you can review blocks, call extrinsics, inspect storage, and interact with the runtime.
100+
101+
## Parachain Compatibility
102+
103+
The `polkadot-omni-node` is designed to work with most parachains out of the box, but your parachain runtime must meet certain requirements and follow specific conventions to be compatible. This section outlines what your runtime needs to implement and configure to work seamlessly with the `polkadot-omni-node`:
104+
105+
- Your runtime must implement the required runtime APIs (see below).
106+
- Your runtime must include and configure the required pallets.
107+
108+
The [`parachain-template`](https://github.com/paritytech/polkadot-sdk-parachain-template/tree/v0.0.4){target=_blank} provides a complete reference implementation that is fully compatible with the `polkadot-omni-node`. You can use it as a starting point or reference for ensuring your runtime meets all compatibility requirements.
109+
110+
### Required Runtime APIs
111+
112+
Your parachain runtime must implement the following runtime APIs for the `polkadot-omni-node` to function properly:
113+
114+
- **GetParachainInfo Runtime API**: The omni-node requires the [`GetParachainInfo`](https://paritytech.github.io/polkadot-sdk/master/cumulus_primitives_core/trait.GetParachainInfo.html){target=\_blank} runtime API to identify and configure the parachain correctly. This API provides the parachain ID to the node.
115+
116+
```rust title="runtime/src/apis.rs"
117+
impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
118+
fn parachain_id() -> cumulus_primitives_core::ParaId {
119+
// Return your parachain ID
120+
ParachainInfo::parachain_id()
121+
}
122+
}
123+
```
124+
125+
- **Aura Runtime API**: For consensus, the `polkadot-omni-node` expects the [Aura runtime API](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/runtime/apis/trait.AuraApi.html){target=\_blank} to be implemented:
126+
127+
```rust title="runtime/src/apis.rs"
128+
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
129+
fn slot_duration() -> sp_consensus_aura::SlotDuration {
130+
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
131+
}
132+
133+
fn authorities() -> Vec<AuraId> {
134+
Aura::authorities().into_inner()
135+
}
136+
}
137+
```
138+
139+
### Required Pallets
140+
141+
Your runtime must include and properly configure the following pallets:
142+
143+
- **System Pallet**: The System pallet ([`frame-system`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/prelude/frame_system/index.html){target=\_blank}) is fundamental and must be configured with appropriate types:
144+
145+
```rust title="runtime/src/lib.rs"
146+
#[frame_support::runtime]
147+
impl frame_system::Config for Runtime {
148+
type Block = Block;
149+
type BlockNumber = BlockNumber;
150+
// ... other configurations
151+
}
152+
153+
// Must be named "System" for omni-node compatibility
154+
pub type System = frame_system::Pallet<Runtime>;
155+
```
156+
157+
- **ParachainSystem Pallet**: This pallet ([`cumulus-pallet-parachain-system`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/index.html){target=\_blank}) enables parachain functionality and handles low-level details of being a parachain:
158+
159+
```rust title="runtime/src/lib.rs"
160+
impl cumulus_pallet_parachain_system::Config for Runtime {
161+
type RuntimeEvent = RuntimeEvent;
162+
type OnSystemEvent = ();
163+
// ... other configurations
164+
}
165+
166+
// Must be named "ParachainSystem" for omni-node compatibility
167+
pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet<Runtime>;
168+
```
169+
170+
- **Aura Pallet**: For block authoring consensus ([`pallet-aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}):
171+
172+
```rust title="runtime/src/lib.rs"
173+
impl pallet_aura::Config for Runtime {
174+
type AuthorityId = AuraId;
175+
type DisabledValidators = ();
176+
type MaxAuthorities = MaxAuthorities;
177+
type AllowMultipleBlocksPerSlot = ConstBool<false>;
178+
}
179+
180+
pub type Aura = pallet_aura::Pallet<Runtime>;
181+
```
182+
183+
- **ParachainInfo Pallet**: Provides parachain metadata ([`parachain-info`](https://paritytech.github.io/polkadot-sdk/master/staging_parachain_info/index.html){target=\_blank}):
184+
185+
```rust title="runtime/src/lib.rs"
186+
impl parachain_info::Config for Runtime {}
187+
188+
pub type ParachainInfo = parachain_info::Pallet<Runtime>;
189+
```
190+
191+
If you're migrating an existing parachain to use the `polkadot-omni-node`, you may need to perform runtime upgrades to add the required runtime APIs and pallets. Follow the standard parachain [runtime upgrade](/develop/parachains/maintenance/runtime-upgrades){target=\_blank} procedures to implement these changes on your live network.

llms.txt

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16520,6 +16520,98 @@ By default, `polkadot-omni-node` exposes a WebSocket endpoint at `ws://localhost
1652016520
- Custom scripts using compatible [libraries](/develop/toolkit/api-libraries/){target=\_blank}
1652116521

1652216522
Once connected, you can review blocks, call extrinsics, inspect storage, and interact with the runtime.
16523+
16524+
## Parachain Compatibility
16525+
16526+
The `polkadot-omni-node` is designed to work with most parachains out of the box, but your parachain runtime must meet certain requirements and follow specific conventions to be compatible. This section outlines what your runtime needs to implement and configure to work seamlessly with the `polkadot-omni-node`:
16527+
16528+
- Your runtime must implement the required runtime APIs (see below).
16529+
- Your runtime must include and configure the required pallets.
16530+
16531+
The [`parachain-template`](https://github.com/paritytech/polkadot-sdk-parachain-template/tree/v0.0.4){target=_blank} provides a complete reference implementation that is fully compatible with the `polkadot-omni-node`. You can use it as a starting point or reference for ensuring your runtime meets all compatibility requirements.
16532+
16533+
### Required Runtime APIs
16534+
16535+
Your parachain runtime must implement the following runtime APIs for the `polkadot-omni-node` to function properly:
16536+
16537+
- **GetParachainInfo Runtime API**: The omni-node requires the [`GetParachainInfo`](https://paritytech.github.io/polkadot-sdk/master/cumulus_primitives_core/trait.GetParachainInfo.html){target=\_blank} runtime API to identify and configure the parachain correctly. This API provides the parachain ID to the node.
16538+
16539+
```rust title="runtime/src/apis.rs"
16540+
impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
16541+
fn parachain_id() -> cumulus_primitives_core::ParaId {
16542+
// Return your parachain ID
16543+
ParachainInfo::parachain_id()
16544+
}
16545+
}
16546+
```
16547+
16548+
- **Aura Runtime API**: For consensus, the `polkadot-omni-node` expects the [Aura runtime API](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/runtime/apis/trait.AuraApi.html){target=\_blank} to be implemented:
16549+
16550+
```rust title="runtime/src/apis.rs"
16551+
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
16552+
fn slot_duration() -> sp_consensus_aura::SlotDuration {
16553+
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
16554+
}
16555+
16556+
fn authorities() -> Vec<AuraId> {
16557+
Aura::authorities().into_inner()
16558+
}
16559+
}
16560+
```
16561+
16562+
### Required Pallets
16563+
16564+
Your runtime must include and properly configure the following pallets:
16565+
16566+
- **System Pallet**: The System pallet ([`frame-system`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/prelude/frame_system/index.html){target=\_blank}) is fundamental and must be configured with appropriate types:
16567+
16568+
```rust title="runtime/src/lib.rs"
16569+
#[frame_support::runtime]
16570+
impl frame_system::Config for Runtime {
16571+
type Block = Block;
16572+
type BlockNumber = BlockNumber;
16573+
// ... other configurations
16574+
}
16575+
16576+
// Must be named "System" for omni-node compatibility
16577+
pub type System = frame_system::Pallet<Runtime>;
16578+
```
16579+
16580+
- **ParachainSystem Pallet**: This pallet ([`cumulus-pallet-parachain-system`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/index.html){target=\_blank}) enables parachain functionality and handles low-level details of being a parachain:
16581+
16582+
```rust title="runtime/src/lib.rs"
16583+
impl cumulus_pallet_parachain_system::Config for Runtime {
16584+
type RuntimeEvent = RuntimeEvent;
16585+
type OnSystemEvent = ();
16586+
// ... other configurations
16587+
}
16588+
16589+
// Must be named "ParachainSystem" for omni-node compatibility
16590+
pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet<Runtime>;
16591+
```
16592+
16593+
- **Aura Pallet**: For block authoring consensus ([`pallet-aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}):
16594+
16595+
```rust title="runtime/src/lib.rs"
16596+
impl pallet_aura::Config for Runtime {
16597+
type AuthorityId = AuraId;
16598+
type DisabledValidators = ();
16599+
type MaxAuthorities = MaxAuthorities;
16600+
type AllowMultipleBlocksPerSlot = ConstBool<false>;
16601+
}
16602+
16603+
pub type Aura = pallet_aura::Pallet<Runtime>;
16604+
```
16605+
16606+
- **ParachainInfo Pallet**: Provides parachain metadata ([`parachain-info`](https://paritytech.github.io/polkadot-sdk/master/staging_parachain_info/index.html){target=\_blank}):
16607+
16608+
```rust title="runtime/src/lib.rs"
16609+
impl parachain_info::Config for Runtime {}
16610+
16611+
pub type ParachainInfo = parachain_info::Pallet<Runtime>;
16612+
```
16613+
16614+
If you're migrating an existing parachain to use the `polkadot-omni-node`, you may need to perform runtime upgrades to add the required runtime APIs and pallets. Follow the standard parachain [runtime upgrade](/develop/parachains/maintenance/runtime-upgrades){target=\_blank} procedures to implement these changes on your live network.
1652316615
--- END CONTENT ---
1652416616

1652516617
Doc-Content: https://docs.polkadot.com/develop/toolkit/parachains/quickstart/

0 commit comments

Comments
 (0)