Skip to content

Commit 09b19dd

Browse files
nhussein11brunopgalvaoeshaben
authored
[FIX] - Adding parachain compatibility section to polkadot-omni-node page (#834)
* fix: adding parachain compatibility section * Update develop/toolkit/parachains/polkadot-omni-node.md Co-authored-by: Bruno Galvao <[email protected]> * fix: llms * Apply suggestions from code review Co-authored-by: Erin Shaben <[email protected]> * fix: llms --------- Co-authored-by: Bruno Galvao <[email protected]> Co-authored-by: Erin Shaben <[email protected]>
1 parent 7d5dfae commit 09b19dd

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; however, your parachain's runtime must meet specific requirements and follow certain 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
@@ -16882,6 +16882,98 @@ By default, `polkadot-omni-node` exposes a WebSocket endpoint at `ws://localhost
1688216882
- Custom scripts using compatible [libraries](/develop/toolkit/api-libraries/){target=\_blank}
1688316883

1688416884
Once connected, you can review blocks, call extrinsics, inspect storage, and interact with the runtime.
16885+
16886+
## Parachain Compatibility
16887+
16888+
The `polkadot-omni-node` is designed to work with most parachains out of the box; however, your parachain's runtime must meet specific requirements and follow certain conventions to be compatible. This section outlines what your runtime needs to implement and configure to work seamlessly with the `polkadot-omni-node`:
16889+
16890+
- Your runtime must implement the required runtime APIs (see below).
16891+
- Your runtime must include and configure the required pallets.
16892+
16893+
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.
16894+
16895+
### Required Runtime APIs
16896+
16897+
Your parachain runtime must implement the following runtime APIs for the `polkadot-omni-node` to function properly:
16898+
16899+
- **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.
16900+
16901+
```rust title="runtime/src/apis.rs"
16902+
impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
16903+
fn parachain_id() -> cumulus_primitives_core::ParaId {
16904+
// Return your parachain ID
16905+
ParachainInfo::parachain_id()
16906+
}
16907+
}
16908+
```
16909+
16910+
- **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:
16911+
16912+
```rust title="runtime/src/apis.rs"
16913+
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
16914+
fn slot_duration() -> sp_consensus_aura::SlotDuration {
16915+
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
16916+
}
16917+
16918+
fn authorities() -> Vec<AuraId> {
16919+
Aura::authorities().into_inner()
16920+
}
16921+
}
16922+
```
16923+
16924+
### Required Pallets
16925+
16926+
Your runtime must include and properly configure the following pallets:
16927+
16928+
- **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:
16929+
16930+
```rust title="runtime/src/lib.rs"
16931+
#[frame_support::runtime]
16932+
impl frame_system::Config for Runtime {
16933+
type Block = Block;
16934+
type BlockNumber = BlockNumber;
16935+
// ... other configurations
16936+
}
16937+
16938+
// Must be named "System" for omni-node compatibility
16939+
pub type System = frame_system::Pallet<Runtime>;
16940+
```
16941+
16942+
- **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:
16943+
16944+
```rust title="runtime/src/lib.rs"
16945+
impl cumulus_pallet_parachain_system::Config for Runtime {
16946+
type RuntimeEvent = RuntimeEvent;
16947+
type OnSystemEvent = ();
16948+
// ... other configurations
16949+
}
16950+
16951+
// Must be named "ParachainSystem" for omni-node compatibility
16952+
pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet<Runtime>;
16953+
```
16954+
16955+
- **Aura Pallet**: For block authoring consensus ([`pallet-aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}):
16956+
16957+
```rust title="runtime/src/lib.rs"
16958+
impl pallet_aura::Config for Runtime {
16959+
type AuthorityId = AuraId;
16960+
type DisabledValidators = ();
16961+
type MaxAuthorities = MaxAuthorities;
16962+
type AllowMultipleBlocksPerSlot = ConstBool<false>;
16963+
}
16964+
16965+
pub type Aura = pallet_aura::Pallet<Runtime>;
16966+
```
16967+
16968+
- **ParachainInfo Pallet**: Provides parachain metadata ([`parachain-info`](https://paritytech.github.io/polkadot-sdk/master/staging_parachain_info/index.html){target=\_blank}):
16969+
16970+
```rust title="runtime/src/lib.rs"
16971+
impl parachain_info::Config for Runtime {}
16972+
16973+
pub type ParachainInfo = parachain_info::Pallet<Runtime>;
16974+
```
16975+
16976+
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.
1688516977
--- END CONTENT ---
1688616978

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

0 commit comments

Comments
 (0)