From 18396d0198729e419e30b2c9db72a5a77a23e92b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 13 Jul 2026 12:25:22 +0300 Subject: [PATCH 1/6] AHM v2 scaffolding Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 56 ++++++++++++++ Cargo.toml | 6 ++ substrate/frame/hrmp/README.md | 5 ++ substrate/frame/hrmp/para/Cargo.toml | 38 +++++++++ substrate/frame/hrmp/para/src/lib.rs | 57 ++++++++++++++ substrate/frame/hrmp/primitives/Cargo.toml | 26 +++++++ substrate/frame/hrmp/primitives/src/lib.rs | 76 ++++++++++++++++++ substrate/frame/hrmp/relay/Cargo.toml | 38 +++++++++ substrate/frame/hrmp/relay/src/lib.rs | 52 +++++++++++++ substrate/frame/registrar/README.md | 5 ++ substrate/frame/registrar/para/Cargo.toml | 38 +++++++++ substrate/frame/registrar/para/src/lib.rs | 51 ++++++++++++ .../frame/registrar/primitives/Cargo.toml | 26 +++++++ .../frame/registrar/primitives/src/lib.rs | 77 +++++++++++++++++++ substrate/frame/registrar/relay/Cargo.toml | 38 +++++++++ substrate/frame/registrar/relay/src/lib.rs | 56 ++++++++++++++ 16 files changed, 645 insertions(+) create mode 100644 substrate/frame/hrmp/README.md create mode 100644 substrate/frame/hrmp/para/Cargo.toml create mode 100644 substrate/frame/hrmp/para/src/lib.rs create mode 100644 substrate/frame/hrmp/primitives/Cargo.toml create mode 100644 substrate/frame/hrmp/primitives/src/lib.rs create mode 100644 substrate/frame/hrmp/relay/Cargo.toml create mode 100644 substrate/frame/hrmp/relay/src/lib.rs create mode 100644 substrate/frame/registrar/README.md create mode 100644 substrate/frame/registrar/para/Cargo.toml create mode 100644 substrate/frame/registrar/para/src/lib.rs create mode 100644 substrate/frame/registrar/primitives/Cargo.toml create mode 100644 substrate/frame/registrar/primitives/src/lib.rs create mode 100644 substrate/frame/registrar/relay/Cargo.toml create mode 100644 substrate/frame/registrar/relay/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1675162eae9b..a127d7be786f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8706,6 +8706,14 @@ dependencies = [ "winapi", ] +[[package]] +name = "hrmp-primitives" +version = "0.1.0" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + [[package]] name = "http" version = "0.2.9" @@ -13500,6 +13508,26 @@ dependencies = [ "sp-tracing 16.0.0", ] +[[package]] +name = "pallet-hrmp-para" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "pallet-hrmp-relay" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "pallet-identity" version = "29.0.0" @@ -14156,6 +14184,26 @@ dependencies = [ "sp-runtime 31.0.1", ] +[[package]] +name = "pallet-registrar-para" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "pallet-registrar-relay" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", +] + [[package]] name = "pallet-remark" version = "28.0.0" @@ -19725,6 +19773,14 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "registrar-primitives" +version = "0.1.0" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + [[package]] name = "relative-path" version = "1.9.2" diff --git a/Cargo.toml b/Cargo.toml index 4f7d1fcbb4b6..9fb11bd0d77e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -389,6 +389,9 @@ members = [ "substrate/frame/grandpa", "substrate/frame/honzon/oracle", "substrate/frame/honzon/oracle/runtime-api", + "substrate/frame/hrmp/para", + "substrate/frame/hrmp/primitives", + "substrate/frame/hrmp/relay", "substrate/frame/identity", "substrate/frame/im-online", "substrate/frame/indices", @@ -428,6 +431,9 @@ members = [ "substrate/frame/ranked-collective", "substrate/frame/recovery", "substrate/frame/referenda", + "substrate/frame/registrar/para", + "substrate/frame/registrar/primitives", + "substrate/frame/registrar/relay", "substrate/frame/remark", "substrate/frame/revive", "substrate/frame/revive/dev-node/node", diff --git a/substrate/frame/hrmp/README.md b/substrate/frame/hrmp/README.md new file mode 100644 index 000000000000..e7486a8e52f4 --- /dev/null +++ b/substrate/frame/hrmp/README.md @@ -0,0 +1,5 @@ +# HRMP channels + +- `para/` — `pallet-hrmp-para`: control-plane, runs on the Coretime chain. +- `relay/` — `pallet-hrmp-relay`: consensus-plane, runs on the relay chain. +- `primitives/` — `hrmp-primitives`: shared CT↔RC XCM message types. diff --git a/substrate/frame/hrmp/para/Cargo.toml b/substrate/frame/hrmp/para/Cargo.toml new file mode 100644 index 000000000000..6ebc56e1eabb --- /dev/null +++ b/substrate/frame/hrmp/para/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "pallet-hrmp-para" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "AHM v2: Coretime-chain control-plane pallet for HRMP channels. Holds channel deposits and drives HRMP open/accept/close on the relay chain over XCM." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +frame-support = { workspace = true } +frame-system = { workspace = true } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", +] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/substrate/frame/hrmp/para/src/lib.rs b/substrate/frame/hrmp/para/src/lib.rs new file mode 100644 index 000000000000..14990fa9ea31 --- /dev/null +++ b/substrate/frame/hrmp/para/src/lib.rs @@ -0,0 +1,57 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # AHM v2 — Coretime-chain HRMP pallet +//! +//! Control-plane half of HRMP channel management for Asset Hub Migration v2. Runs on the Coretime +//! chain, holding channel deposits and driving open / accept / close on the relay-chain +//! counterpart ([`pallet-hrmp-relay`]) over XCM. +//! +//! All user-facing extrinsics live on this (para) side — it owns the entire signed user surface; +//! the relay half has none. +//! +//! Bare scaffold — the config, storage, calls and logic land later. Kept +//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and +//! Polkadot. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +/// Used to send an XCM `Transact` to the HRMP pallet on the remote relay chain. +pub trait SendToRelay {} + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Sends a messages to the relay chain. + type SendToRelay: SendToRelay; + } + + #[pallet::pallet] + pub struct Pallet(_); + + // - TODO: hrmp_init_open_channel — request to open a channel; holds the sender deposit, XCM to the relay. + // - TODO: hrmp_accept_open_channel — accept a pending open request; holds the recipient deposit. + // - TODO: hrmp_close_channel — close a channel; releases both deposits. + // - TODO: hrmp_cancel_open_request — cancel a pending open request; releases the sender deposit. + // - TODO: establish_channel_with_system — open a bidirectional channel with a system chain (no deposit). + // - TODO: poke_channel_deposits — re-sync a channel's deposits to the current config. +} diff --git a/substrate/frame/hrmp/primitives/Cargo.toml b/substrate/frame/hrmp/primitives/Cargo.toml new file mode 100644 index 000000000000..a3532be0d974 --- /dev/null +++ b/substrate/frame/hrmp/primitives/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "hrmp-primitives" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "Shared, network-agnostic primitives and versioned CT<->RC XCM message types for the HRMP-channel para/relay pallet pair." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "scale-info/std", +] diff --git a/substrate/frame/hrmp/primitives/src/lib.rs b/substrate/frame/hrmp/primitives/src/lib.rs new file mode 100644 index 000000000000..d39532af9199 --- /dev/null +++ b/substrate/frame/hrmp/primitives/src/lib.rs @@ -0,0 +1,76 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # HRMP-channel shared primitives +//! +//! Types shared by the two halves of AHM v2 HRMP-channel management — the control-plane pallet on +//! the Coretime chain ([`pallet-hrmp-para`]) and the consensus-plane pallet on the relay chain +//! ([`pallet-hrmp-relay`]). This crate is deliberately free of any FRAME, XCM, or network-specific +//! dependency, so a single version of the wire types serves Westend, Kusama and Polkadot, and so +//! both halves can depend on it without forming a dependency cycle between the pallets. +//! +//! ## Versioning +//! +//! The cross-chain message payloads are the interface seam that is expensive to change once +//! deployed (XCM messages are long-lived on the wire). They are therefore modelled as a versioned +//! wrapper enum whose codec index is the on-wire version tag: add new versions as new variants and +//! **never** renumber or remove an existing one. + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode}; +use scale_info::TypeInfo; + +/// HRMP control-plane messages sent to the relay chain. +/// +/// The variant's `#[codec(index)]` is the on-wire version tag. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToRelay { + /// Version 1 of the HRMP control-plane messages to the relay chain. + #[codec(index = 0)] + V1(MessageToRelayV1), +} + +/// Version 1 payloads for [`MessageToRelay`]. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToRelayV1 { + /// Placeholder so the crate compiles before the control-plane operations land. + /// + /// Replaced by the real messages: open / accept / close HRMP channel. + #[codec(index = 0)] + Placeholder, +} + +/// HRMP report messages sent back to the parachain. +/// +/// The variant's `#[codec(index)]` is the on-wire version tag. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToPara { + /// Version 1 of the HRMP report messages to the parachain. + #[codec(index = 0)] + V1(MessageToParaV1), +} + +/// Version 1 payloads for [`MessageToPara`]. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToParaV1 { + /// Placeholder so the crate compiles before the report operations land. + /// + /// Replaced by the real reports: confirm / fail / refund for a channel operation. + #[codec(index = 0)] + Placeholder, +} diff --git a/substrate/frame/hrmp/relay/Cargo.toml b/substrate/frame/hrmp/relay/Cargo.toml new file mode 100644 index 000000000000..6b88725e7a6d --- /dev/null +++ b/substrate/frame/hrmp/relay/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "pallet-hrmp-relay" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "AHM v2: Relay-chain consensus-plane pallet for HRMP channels. Applies channel operations from the Coretime chain to the relay's HRMP routing table and reports back." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +frame-support = { workspace = true } +frame-system = { workspace = true } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", +] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/substrate/frame/hrmp/relay/src/lib.rs b/substrate/frame/hrmp/relay/src/lib.rs new file mode 100644 index 000000000000..c4a0316f051f --- /dev/null +++ b/substrate/frame/hrmp/relay/src/lib.rs @@ -0,0 +1,52 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # AHM v2 — Relay-chain HRMP pallet +//! +//! Consensus-plane half of HRMP channel management for Asset Hub Migration v2. Runs on the relay +//! chain, applying channel operations received from the Coretime chain +//! ([`pallet-hrmp-para`]) to the relay's legacy `hrmp` routing table and reporting back. +//! +//! No user-facing extrinsics — this half is driven entirely by XCM `Transact` from the para half. +//! +//! Bare scaffold — the config, storage, calls and logic land later. Kept +//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and +//! Polkadot. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +/// Used to send an XCM `Transact` to the HRMP pallet on the remote parachain. +pub trait SendToPara {} + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Sends a messages to the para chain. + type SendToPara: SendToPara; + } + + #[pallet::pallet] + pub struct Pallet(_); + + // No user-facing extrinsics on the relay side — all user ops live on the para half + // ([`pallet-hrmp-para`]) and arrive here as XCM `Transact` to drive the relay's `hrmp` routing. +} diff --git a/substrate/frame/registrar/README.md b/substrate/frame/registrar/README.md new file mode 100644 index 000000000000..9a9994b1390b --- /dev/null +++ b/substrate/frame/registrar/README.md @@ -0,0 +1,5 @@ +# Parachain registrar + +- `para/` — `pallet-registrar-para`: control-plane, runs on the Coretime chain. +- `relay/` — `pallet-registrar-relay`: consensus-plane, runs on the relay chain. +- `primitives/` — `registrar-primitives`: shared CT↔RC XCM message types. diff --git a/substrate/frame/registrar/para/Cargo.toml b/substrate/frame/registrar/para/Cargo.toml new file mode 100644 index 000000000000..a51b481c56fa --- /dev/null +++ b/substrate/frame/registrar/para/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "pallet-registrar-para" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "AHM v2: Coretime-chain control-plane pallet for the parachain registrar. Holds registration intent and deposit, driving the relay chain over XCM." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +frame-support = { workspace = true } +frame-system = { workspace = true } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", +] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/substrate/frame/registrar/para/src/lib.rs b/substrate/frame/registrar/para/src/lib.rs new file mode 100644 index 000000000000..295a0042e147 --- /dev/null +++ b/substrate/frame/registrar/para/src/lib.rs @@ -0,0 +1,51 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # User Interface Pallet For Parachain Registrations +//! +//! This pallet exposes the extrinsics that can be used to manage parachain registrations. It communicates +//! over XCM with the `pallet-registrar-relay` + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +/// Used to send an XCM `Transact` to the registrar pallet on the remote relay chain. +pub trait SendToRelay {} + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Sends a messages to the relay chain. + type SendToRelay: SendToRelay; + } + + #[pallet::pallet] + pub struct Pallet(_); + + // - TODO: reserve — reserve a ParaId; holds the ParaId deposit. + // - TODO: register — register code+head for a reserved ParaId; holds the code deposit, XCM-authorizes on the relay. + // - TODO: deregister — free the ParaId; releases both deposits. + // - TODO: swap — swap the slots of two paras. + // - TODO: add_lock — add the manager lock. + // - TODO: remove_lock — remove the manager lock. + // - TODO: schedule_code_upgrade — schedule a validation-code upgrade (XCM to the relay). + // - TODO: set_current_head — set the current head data (XCM to the relay). +} diff --git a/substrate/frame/registrar/primitives/Cargo.toml b/substrate/frame/registrar/primitives/Cargo.toml new file mode 100644 index 000000000000..d2411d088c08 --- /dev/null +++ b/substrate/frame/registrar/primitives/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "registrar-primitives" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "Shared, network-agnostic primitives and versioned CT<->RC XCM message types for the parachain registrar para/relay pallet pair." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "scale-info/std", +] diff --git a/substrate/frame/registrar/primitives/src/lib.rs b/substrate/frame/registrar/primitives/src/lib.rs new file mode 100644 index 000000000000..f68905083af8 --- /dev/null +++ b/substrate/frame/registrar/primitives/src/lib.rs @@ -0,0 +1,77 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Parachain-registrar shared primitives +//! +//! Types shared by the two halves of the AHM v2 parachain registrar — the control-plane pallet on +//! the Coretime chain ([`pallet-registrar-para`]) and the consensus-plane pallet on the relay chain +//! ([`pallet-registrar-relay`]). This crate is deliberately free of any FRAME, XCM, or +//! network-specific dependency, so a single version of the wire types serves Westend, Kusama and +//! Polkadot, and so both halves can depend on it without forming a dependency cycle between the +//! pallets. +//! +//! ## Versioning +//! +//! The cross-chain message payloads are the interface seam that is expensive to change once +//! deployed (XCM messages are long-lived on the wire). They are therefore modelled as a versioned +//! wrapper enum whose codec index is the on-wire version tag: add new versions as new variants and +//! **never** renumber or remove an existing one. + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode}; +use scale_info::TypeInfo; + +/// Registrar control-plane messages sent to the relay chain. +/// +/// The variant's `#[codec(index)]` is the on-wire version tag. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToRelay { + /// Version 1 of the registrar control-plane messages to the relay chain. + #[codec(index = 0)] + V1(MessageToRelayV1), +} + +/// Version 1 payloads for [`MessageToRelay`]. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToRelayV1 { + /// Placeholder so the crate compiles before the control-plane operations land. + /// + /// Replaced by the real message(s): authorize parachain registration. + #[codec(index = 0)] + Placeholder, +} + +/// Registrar report messages sent back to the parachain. +/// +/// The variant's `#[codec(index)]` is the on-wire version tag. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToPara { + /// Version 1 of the registrar report messages to the parachain. + #[codec(index = 0)] + V1(MessageToParaV1), +} + +/// Version 1 payloads for [`MessageToPara`]. +#[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] +pub enum MessageToParaV1 { + /// Placeholder so the crate compiles before the report operations land. + /// + /// Replaced by the real reports: confirm / fail / refund for a registration. + #[codec(index = 0)] + Placeholder, +} diff --git a/substrate/frame/registrar/relay/Cargo.toml b/substrate/frame/registrar/relay/Cargo.toml new file mode 100644 index 000000000000..570e01431850 --- /dev/null +++ b/substrate/frame/registrar/relay/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "pallet-registrar-relay" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "Apache-2.0" +homepage.workspace = true +repository.workspace = true +description = "AHM v2: Relay-chain consensus-plane pallet for the parachain registrar. Applies registrations authorized on the Coretime chain and drives the relay's paras state." + +[package.metadata.polkadot-sdk] +exclude-from-umbrella = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { workspace = true, features = ["derive"] } +frame-support = { workspace = true } +frame-system = { workspace = true } +scale-info = { workspace = true, features = ["derive"] } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "scale-info/std", +] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/substrate/frame/registrar/relay/src/lib.rs b/substrate/frame/registrar/relay/src/lib.rs new file mode 100644 index 000000000000..1093f9a544af --- /dev/null +++ b/substrate/frame/registrar/relay/src/lib.rs @@ -0,0 +1,56 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # AHM v2 — Relay-chain registrar pallet +//! +//! Consensus-plane half of the parachain registrar for Asset Hub Migration v2. Runs on the relay +//! chain, applying registrations authorized on the Coretime chain +//! ([`pallet-registrar-para`]) and driving the relay's legacy `paras` state. +//! +//! No user-facing *signed* extrinsics — this half is driven entirely by XCM `Transact` from the +//! para half. The one exception is the unavoidable unsigned code upload (below). +//! +//! Bare scaffold — the config, storage, calls and logic land later. Kept +//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and +//! Polkadot. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; + +/// Used to send an XCM `Transact` to the registrar pallet on the remote parachain. +pub trait SendToPara {} + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + /// Sends a messages to the para chain. + type SendToPara: SendToPara; + } + + #[pallet::pallet] + pub struct Pallet(_); + + // No user-facing signed extrinsics on the relay side — all signed user ops live on the para + // half ([`pallet-registrar-para`]) and arrive here as XCM `Transact`. + // TODO: the one necessary exception — an *unsigned*, `ValidateUnsigned`-gated + // `apply_authorized_parachain_registration` that uploads the actual wasm+head matching a prior + // authorization (the unavoidable on-relay upload). +} From 3a169928d884b970d115a31653e52530a65a462e Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 13 Jul 2026 12:34:41 +0300 Subject: [PATCH 2/6] unslop Signed-off-by: Oliver Tale-Yazdi --- substrate/frame/hrmp/README.md | 6 +++--- substrate/frame/hrmp/para/Cargo.toml | 2 +- substrate/frame/hrmp/primitives/Cargo.toml | 2 +- substrate/frame/hrmp/relay/Cargo.toml | 2 +- substrate/frame/registrar/README.md | 6 +++--- substrate/frame/registrar/para/Cargo.toml | 2 +- substrate/frame/registrar/primitives/Cargo.toml | 2 +- substrate/frame/registrar/relay/Cargo.toml | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/substrate/frame/hrmp/README.md b/substrate/frame/hrmp/README.md index e7486a8e52f4..b00c5b39abad 100644 --- a/substrate/frame/hrmp/README.md +++ b/substrate/frame/hrmp/README.md @@ -1,5 +1,5 @@ # HRMP channels -- `para/` — `pallet-hrmp-para`: control-plane, runs on the Coretime chain. -- `relay/` — `pallet-hrmp-relay`: consensus-plane, runs on the relay chain. -- `primitives/` — `hrmp-primitives`: shared CT↔RC XCM message types. +- `para/` — `pallet-hrmp-para`: user facing control-plane, runs on the Coretime chain. +- `relay/` — `pallet-hrmp-relay`: receives messages from the controller, runs on the relay chain. +- `primitives/` — `hrmp-primitives`: shared Para<->RC XCM message types. diff --git a/substrate/frame/hrmp/para/Cargo.toml b/substrate/frame/hrmp/para/Cargo.toml index 6ebc56e1eabb..1b17f2bf9199 100644 --- a/substrate/frame/hrmp/para/Cargo.toml +++ b/substrate/frame/hrmp/para/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "AHM v2: Coretime-chain control-plane pallet for HRMP channels. Holds channel deposits and drives HRMP open/accept/close on the relay chain over XCM." +description = "User facing control plane for managing HRMP channels that are stored on the relay chain." [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/hrmp/primitives/Cargo.toml b/substrate/frame/hrmp/primitives/Cargo.toml index a3532be0d974..47e83cf2da09 100644 --- a/substrate/frame/hrmp/primitives/Cargo.toml +++ b/substrate/frame/hrmp/primitives/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "Shared, network-agnostic primitives and versioned CT<->RC XCM message types for the HRMP-channel para/relay pallet pair." +description = "Shared Para<->Relay message types." [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/hrmp/relay/Cargo.toml b/substrate/frame/hrmp/relay/Cargo.toml index 6b88725e7a6d..cdc0f09f8245 100644 --- a/substrate/frame/hrmp/relay/Cargo.toml +++ b/substrate/frame/hrmp/relay/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "AHM v2: Relay-chain consensus-plane pallet for HRMP channels. Applies channel operations from the Coretime chain to the relay's HRMP routing table and reports back." +description = "Relay pallet as counter-part for the pallet-hrmp-para" [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/registrar/README.md b/substrate/frame/registrar/README.md index 9a9994b1390b..7bbfb7f977dc 100644 --- a/substrate/frame/registrar/README.md +++ b/substrate/frame/registrar/README.md @@ -1,5 +1,5 @@ # Parachain registrar -- `para/` — `pallet-registrar-para`: control-plane, runs on the Coretime chain. -- `relay/` — `pallet-registrar-relay`: consensus-plane, runs on the relay chain. -- `primitives/` — `registrar-primitives`: shared CT↔RC XCM message types. +- `para/` — `pallet-registrar-para`: user facing control-plane, runs on the Coretime chain. +- `relay/` — `pallet-registrar-relay`: receives messages from the controller, runs on the relay chain. +- `primitives/` — `registrar-primitives`: shared Para<->RC XCM message types. diff --git a/substrate/frame/registrar/para/Cargo.toml b/substrate/frame/registrar/para/Cargo.toml index a51b481c56fa..a4be56e781a7 100644 --- a/substrate/frame/registrar/para/Cargo.toml +++ b/substrate/frame/registrar/para/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "AHM v2: Coretime-chain control-plane pallet for the parachain registrar. Holds registration intent and deposit, driving the relay chain over XCM." +description = "User facing control plane for managing parachain registrations that are stored on the relay chain." [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/registrar/primitives/Cargo.toml b/substrate/frame/registrar/primitives/Cargo.toml index d2411d088c08..9d835da3cd18 100644 --- a/substrate/frame/registrar/primitives/Cargo.toml +++ b/substrate/frame/registrar/primitives/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "Shared, network-agnostic primitives and versioned CT<->RC XCM message types for the parachain registrar para/relay pallet pair." +description = "Shared Para<->Relay message types." [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/registrar/relay/Cargo.toml b/substrate/frame/registrar/relay/Cargo.toml index 570e01431850..6acfaf00e7e4 100644 --- a/substrate/frame/registrar/relay/Cargo.toml +++ b/substrate/frame/registrar/relay/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license = "Apache-2.0" homepage.workspace = true repository.workspace = true -description = "AHM v2: Relay-chain consensus-plane pallet for the parachain registrar. Applies registrations authorized on the Coretime chain and drives the relay's paras state." +description = "Relay pallet as counter-part for the pallet-registrar-para" [package.metadata.polkadot-sdk] exclude-from-umbrella = true From 78d95d34adb49fee67bcf56511826433eceab37b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 13 Jul 2026 12:39:55 +0300 Subject: [PATCH 3/6] unslop Signed-off-by: Oliver Tale-Yazdi --- substrate/frame/hrmp/README.md | 6 ++--- substrate/frame/hrmp/para/src/lib.rs | 23 +++++++++++-------- substrate/frame/hrmp/primitives/src/lib.rs | 5 ++-- substrate/frame/hrmp/relay/src/lib.rs | 15 ++++++------ substrate/frame/registrar/README.md | 6 ++--- substrate/frame/registrar/para/src/lib.rs | 9 ++++---- .../frame/registrar/primitives/src/lib.rs | 10 ++++---- substrate/frame/registrar/relay/src/lib.rs | 16 ++++++------- 8 files changed, 46 insertions(+), 44 deletions(-) diff --git a/substrate/frame/hrmp/README.md b/substrate/frame/hrmp/README.md index b00c5b39abad..79d039f01264 100644 --- a/substrate/frame/hrmp/README.md +++ b/substrate/frame/hrmp/README.md @@ -1,5 +1,5 @@ # HRMP channels -- `para/` — `pallet-hrmp-para`: user facing control-plane, runs on the Coretime chain. -- `relay/` — `pallet-hrmp-relay`: receives messages from the controller, runs on the relay chain. -- `primitives/` — `hrmp-primitives`: shared Para<->RC XCM message types. +- `para/` — `pallet-hrmp-para`: user facing control-plane, runs on a parachain. +- `relay/` — `pallet-hrmp-relay`: receives messages from the parachain, runs on the relay chain. +- `primitives/` — `hrmp-primitives`: shared parachain<->relay XCM message types. diff --git a/substrate/frame/hrmp/para/src/lib.rs b/substrate/frame/hrmp/para/src/lib.rs index 14990fa9ea31..782809104288 100644 --- a/substrate/frame/hrmp/para/src/lib.rs +++ b/substrate/frame/hrmp/para/src/lib.rs @@ -15,13 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # AHM v2 — Coretime-chain HRMP pallet +//! # Parachain HRMP pallet //! -//! Control-plane half of HRMP channel management for Asset Hub Migration v2. Runs on the Coretime -//! chain, holding channel deposits and driving open / accept / close on the relay-chain -//! counterpart ([`pallet-hrmp-relay`]) over XCM. +//! User-facing half of HRMP channel management. Runs on a parachain, holding channel deposits and +//! driving open / accept / close on the relay-chain counterpart ([`pallet-hrmp-relay`]) over XCM. //! -//! All user-facing extrinsics live on this (para) side — it owns the entire signed user surface; +//! All user-facing extrinsics live on this parachain side — it owns the entire signed user surface; //! the relay half has none. //! //! Bare scaffold — the config, storage, calls and logic land later. Kept @@ -41,17 +40,21 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// Sends a messages to the relay chain. + /// Sends messages to the relay chain. type SendToRelay: SendToRelay; } #[pallet::pallet] pub struct Pallet(_); - // - TODO: hrmp_init_open_channel — request to open a channel; holds the sender deposit, XCM to the relay. - // - TODO: hrmp_accept_open_channel — accept a pending open request; holds the recipient deposit. + // - TODO: hrmp_init_open_channel — request to open a channel; holds the sender deposit, XCM to + // the relay. + // - TODO: hrmp_accept_open_channel — accept a pending open request; holds the recipient + // deposit. // - TODO: hrmp_close_channel — close a channel; releases both deposits. - // - TODO: hrmp_cancel_open_request — cancel a pending open request; releases the sender deposit. - // - TODO: establish_channel_with_system — open a bidirectional channel with a system chain (no deposit). + // - TODO: hrmp_cancel_open_request — cancel a pending open request; releases the sender + // deposit. + // - TODO: establish_channel_with_system — open a bidirectional channel with a system chain (no + // deposit). // - TODO: poke_channel_deposits — re-sync a channel's deposits to the current config. } diff --git a/substrate/frame/hrmp/primitives/src/lib.rs b/substrate/frame/hrmp/primitives/src/lib.rs index d39532af9199..085375efc3c2 100644 --- a/substrate/frame/hrmp/primitives/src/lib.rs +++ b/substrate/frame/hrmp/primitives/src/lib.rs @@ -17,11 +17,10 @@ //! # HRMP-channel shared primitives //! -//! Types shared by the two halves of AHM v2 HRMP-channel management — the control-plane pallet on -//! the Coretime chain ([`pallet-hrmp-para`]) and the consensus-plane pallet on the relay chain +//! Types shared by the parachain pallet ([`pallet-hrmp-para`]) and relay-chain pallet //! ([`pallet-hrmp-relay`]). This crate is deliberately free of any FRAME, XCM, or network-specific //! dependency, so a single version of the wire types serves Westend, Kusama and Polkadot, and so -//! both halves can depend on it without forming a dependency cycle between the pallets. +//! both pallets can depend on it without forming a dependency cycle. //! //! ## Versioning //! diff --git a/substrate/frame/hrmp/relay/src/lib.rs b/substrate/frame/hrmp/relay/src/lib.rs index c4a0316f051f..60cc0061f6e2 100644 --- a/substrate/frame/hrmp/relay/src/lib.rs +++ b/substrate/frame/hrmp/relay/src/lib.rs @@ -15,13 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # AHM v2 — Relay-chain HRMP pallet +//! # Relay-chain HRMP pallet //! -//! Consensus-plane half of HRMP channel management for Asset Hub Migration v2. Runs on the relay -//! chain, applying channel operations received from the Coretime chain -//! ([`pallet-hrmp-para`]) to the relay's legacy `hrmp` routing table and reporting back. +//! Relay half of HRMP channel management. Runs on the relay chain, applying channel operations +//! received from a parachain ([`pallet-hrmp-para`]) to the relay's legacy `hrmp` routing table and +//! reporting back. //! -//! No user-facing extrinsics — this half is driven entirely by XCM `Transact` from the para half. +//! No user-facing extrinsics — this half is driven entirely by XCM `Transact` from the parachain +//! half. //! //! Bare scaffold — the config, storage, calls and logic land later. Kept //! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and @@ -40,13 +41,13 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// Sends a messages to the para chain. + /// Sends messages to the parachain. type SendToPara: SendToPara; } #[pallet::pallet] pub struct Pallet(_); - // No user-facing extrinsics on the relay side — all user ops live on the para half + // No user-facing extrinsics on the relay side — all user ops live on the parachain half // ([`pallet-hrmp-para`]) and arrive here as XCM `Transact` to drive the relay's `hrmp` routing. } diff --git a/substrate/frame/registrar/README.md b/substrate/frame/registrar/README.md index 7bbfb7f977dc..f102e5395ad6 100644 --- a/substrate/frame/registrar/README.md +++ b/substrate/frame/registrar/README.md @@ -1,5 +1,5 @@ # Parachain registrar -- `para/` — `pallet-registrar-para`: user facing control-plane, runs on the Coretime chain. -- `relay/` — `pallet-registrar-relay`: receives messages from the controller, runs on the relay chain. -- `primitives/` — `registrar-primitives`: shared Para<->RC XCM message types. +- `para/` — `pallet-registrar-para`: user facing control-plane, runs on a parachain. +- `relay/` — `pallet-registrar-relay`: receives messages from the parachain, runs on the relay chain. +- `primitives/` — `registrar-primitives`: shared parachain<->relay XCM message types. diff --git a/substrate/frame/registrar/para/src/lib.rs b/substrate/frame/registrar/para/src/lib.rs index 295a0042e147..799e32b59b99 100644 --- a/substrate/frame/registrar/para/src/lib.rs +++ b/substrate/frame/registrar/para/src/lib.rs @@ -17,8 +17,8 @@ //! # User Interface Pallet For Parachain Registrations //! -//! This pallet exposes the extrinsics that can be used to manage parachain registrations. It communicates -//! over XCM with the `pallet-registrar-relay` +//! This pallet exposes the extrinsics that can be used to manage parachain registrations. It +//! communicates over XCM with the `pallet-registrar-relay` #![cfg_attr(not(feature = "std"), no_std)] @@ -33,7 +33,7 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// Sends a messages to the relay chain. + /// Sends messages to the relay chain. type SendToRelay: SendToRelay; } @@ -41,7 +41,8 @@ pub mod pallet { pub struct Pallet(_); // - TODO: reserve — reserve a ParaId; holds the ParaId deposit. - // - TODO: register — register code+head for a reserved ParaId; holds the code deposit, XCM-authorizes on the relay. + // - TODO: register — register code+head for a reserved ParaId; holds the code deposit, + // XCM-authorizes on the relay. // - TODO: deregister — free the ParaId; releases both deposits. // - TODO: swap — swap the slots of two paras. // - TODO: add_lock — add the manager lock. diff --git a/substrate/frame/registrar/primitives/src/lib.rs b/substrate/frame/registrar/primitives/src/lib.rs index f68905083af8..ba2c9dc3db27 100644 --- a/substrate/frame/registrar/primitives/src/lib.rs +++ b/substrate/frame/registrar/primitives/src/lib.rs @@ -17,12 +17,10 @@ //! # Parachain-registrar shared primitives //! -//! Types shared by the two halves of the AHM v2 parachain registrar — the control-plane pallet on -//! the Coretime chain ([`pallet-registrar-para`]) and the consensus-plane pallet on the relay chain -//! ([`pallet-registrar-relay`]). This crate is deliberately free of any FRAME, XCM, or -//! network-specific dependency, so a single version of the wire types serves Westend, Kusama and -//! Polkadot, and so both halves can depend on it without forming a dependency cycle between the -//! pallets. +//! Types shared by the parachain registrar pallet ([`pallet-registrar-para`]) and relay-chain +//! registrar pallet ([`pallet-registrar-relay`]). This crate is deliberately free of any FRAME, +//! XCM, or network-specific dependency, so a single version of the wire types serves Westend, +//! Kusama and Polkadot, and so both pallets can depend on it without forming a dependency cycle. //! //! ## Versioning //! diff --git a/substrate/frame/registrar/relay/src/lib.rs b/substrate/frame/registrar/relay/src/lib.rs index 1093f9a544af..3c07b249b143 100644 --- a/substrate/frame/registrar/relay/src/lib.rs +++ b/substrate/frame/registrar/relay/src/lib.rs @@ -15,14 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # AHM v2 — Relay-chain registrar pallet +//! # Relay-chain registrar pallet //! -//! Consensus-plane half of the parachain registrar for Asset Hub Migration v2. Runs on the relay -//! chain, applying registrations authorized on the Coretime chain -//! ([`pallet-registrar-para`]) and driving the relay's legacy `paras` state. +//! Relay half of the parachain registrar. Runs on the relay chain, applying registrations +//! authorized on a parachain ([`pallet-registrar-para`]) and driving the relay's legacy `paras` +//! state. //! //! No user-facing *signed* extrinsics — this half is driven entirely by XCM `Transact` from the -//! para half. The one exception is the unavoidable unsigned code upload (below). +//! parachain half. The one exception is the unavoidable unsigned code upload (below). //! //! Bare scaffold — the config, storage, calls and logic land later. Kept //! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and @@ -41,15 +41,15 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// Sends a messages to the para chain. + /// Sends messages to the parachain. type SendToPara: SendToPara; } #[pallet::pallet] pub struct Pallet(_); - // No user-facing signed extrinsics on the relay side — all signed user ops live on the para - // half ([`pallet-registrar-para`]) and arrive here as XCM `Transact`. + // No user-facing signed extrinsics on the relay side — all signed user ops live on the + // parachain half ([`pallet-registrar-para`]) and arrive here as XCM `Transact`. // TODO: the one necessary exception — an *unsigned*, `ValidateUnsigned`-gated // `apply_authorized_parachain_registration` that uploads the actual wasm+head matching a prior // authorization (the unavoidable on-relay upload). From 8b39f5511f4defa3e8db632bada7c3ca71dd7d4c Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 13 Jul 2026 12:46:22 +0300 Subject: [PATCH 4/6] unslop Signed-off-by: Oliver Tale-Yazdi --- substrate/frame/hrmp/para/src/lib.rs | 7 ------- substrate/frame/hrmp/relay/src/lib.rs | 10 ---------- substrate/frame/registrar/relay/src/lib.rs | 13 ------------- 3 files changed, 30 deletions(-) diff --git a/substrate/frame/hrmp/para/src/lib.rs b/substrate/frame/hrmp/para/src/lib.rs index 782809104288..9f480a25f55c 100644 --- a/substrate/frame/hrmp/para/src/lib.rs +++ b/substrate/frame/hrmp/para/src/lib.rs @@ -19,13 +19,6 @@ //! //! User-facing half of HRMP channel management. Runs on a parachain, holding channel deposits and //! driving open / accept / close on the relay-chain counterpart ([`pallet-hrmp-relay`]) over XCM. -//! -//! All user-facing extrinsics live on this parachain side — it owns the entire signed user surface; -//! the relay half has none. -//! -//! Bare scaffold — the config, storage, calls and logic land later. Kept -//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and -//! Polkadot. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/hrmp/relay/src/lib.rs b/substrate/frame/hrmp/relay/src/lib.rs index 60cc0061f6e2..8f569147d922 100644 --- a/substrate/frame/hrmp/relay/src/lib.rs +++ b/substrate/frame/hrmp/relay/src/lib.rs @@ -20,13 +20,6 @@ //! Relay half of HRMP channel management. Runs on the relay chain, applying channel operations //! received from a parachain ([`pallet-hrmp-para`]) to the relay's legacy `hrmp` routing table and //! reporting back. -//! -//! No user-facing extrinsics — this half is driven entirely by XCM `Transact` from the parachain -//! half. -//! -//! Bare scaffold — the config, storage, calls and logic land later. Kept -//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and -//! Polkadot. #![cfg_attr(not(feature = "std"), no_std)] @@ -47,7 +40,4 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(_); - - // No user-facing extrinsics on the relay side — all user ops live on the parachain half - // ([`pallet-hrmp-para`]) and arrive here as XCM `Transact` to drive the relay's `hrmp` routing. } diff --git a/substrate/frame/registrar/relay/src/lib.rs b/substrate/frame/registrar/relay/src/lib.rs index 3c07b249b143..1ee6703570d2 100644 --- a/substrate/frame/registrar/relay/src/lib.rs +++ b/substrate/frame/registrar/relay/src/lib.rs @@ -20,13 +20,6 @@ //! Relay half of the parachain registrar. Runs on the relay chain, applying registrations //! authorized on a parachain ([`pallet-registrar-para`]) and driving the relay's legacy `paras` //! state. -//! -//! No user-facing *signed* extrinsics — this half is driven entirely by XCM `Transact` from the -//! parachain half. The one exception is the unavoidable unsigned code upload (below). -//! -//! Bare scaffold — the config, storage, calls and logic land later. Kept -//! abstract (no network-specific dependency) so the same pallet serves Westend, Kusama and -//! Polkadot. #![cfg_attr(not(feature = "std"), no_std)] @@ -47,10 +40,4 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(_); - - // No user-facing signed extrinsics on the relay side — all signed user ops live on the - // parachain half ([`pallet-registrar-para`]) and arrive here as XCM `Transact`. - // TODO: the one necessary exception — an *unsigned*, `ValidateUnsigned`-gated - // `apply_authorized_parachain_registration` that uploads the actual wasm+head matching a prior - // authorization (the unavoidable on-relay upload). } From f49dbbe5f9e8508abc2c34ba6e9a0071e78ec651 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 13 Jul 2026 12:49:46 +0300 Subject: [PATCH 5/6] unslop Signed-off-by: Oliver Tale-Yazdi --- substrate/frame/hrmp/para/src/lib.rs | 5 +++++ substrate/frame/hrmp/primitives/src/lib.rs | 7 ------- substrate/frame/hrmp/relay/src/lib.rs | 2 ++ substrate/frame/registrar/para/src/lib.rs | 7 +++++++ substrate/frame/registrar/primitives/src/lib.rs | 7 ------- substrate/frame/registrar/relay/src/lib.rs | 2 ++ 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/substrate/frame/hrmp/para/src/lib.rs b/substrate/frame/hrmp/para/src/lib.rs index 9f480a25f55c..54b54912ae2c 100644 --- a/substrate/frame/hrmp/para/src/lib.rs +++ b/substrate/frame/hrmp/para/src/lib.rs @@ -42,12 +42,17 @@ pub mod pallet { // - TODO: hrmp_init_open_channel — request to open a channel; holds the sender deposit, XCM to // the relay. + // - TODO: hrmp_accept_open_channel — accept a pending open request; holds the recipient // deposit. + // - TODO: hrmp_close_channel — close a channel; releases both deposits. + // - TODO: hrmp_cancel_open_request — cancel a pending open request; releases the sender // deposit. + // - TODO: establish_channel_with_system — open a bidirectional channel with a system chain (no // deposit). + // - TODO: poke_channel_deposits — re-sync a channel's deposits to the current config. } diff --git a/substrate/frame/hrmp/primitives/src/lib.rs b/substrate/frame/hrmp/primitives/src/lib.rs index 085375efc3c2..2edc7d6dd3ea 100644 --- a/substrate/frame/hrmp/primitives/src/lib.rs +++ b/substrate/frame/hrmp/primitives/src/lib.rs @@ -21,13 +21,6 @@ //! ([`pallet-hrmp-relay`]). This crate is deliberately free of any FRAME, XCM, or network-specific //! dependency, so a single version of the wire types serves Westend, Kusama and Polkadot, and so //! both pallets can depend on it without forming a dependency cycle. -//! -//! ## Versioning -//! -//! The cross-chain message payloads are the interface seam that is expensive to change once -//! deployed (XCM messages are long-lived on the wire). They are therefore modelled as a versioned -//! wrapper enum whose codec index is the on-wire version tag: add new versions as new variants and -//! **never** renumber or remove an existing one. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/hrmp/relay/src/lib.rs b/substrate/frame/hrmp/relay/src/lib.rs index 8f569147d922..7449110cb70b 100644 --- a/substrate/frame/hrmp/relay/src/lib.rs +++ b/substrate/frame/hrmp/relay/src/lib.rs @@ -40,4 +40,6 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(_); + + // - TODO: Extrinsic to accept the messages from the para. } diff --git a/substrate/frame/registrar/para/src/lib.rs b/substrate/frame/registrar/para/src/lib.rs index 799e32b59b99..6dab8ff2e7fe 100644 --- a/substrate/frame/registrar/para/src/lib.rs +++ b/substrate/frame/registrar/para/src/lib.rs @@ -41,12 +41,19 @@ pub mod pallet { pub struct Pallet(_); // - TODO: reserve — reserve a ParaId; holds the ParaId deposit. + // - TODO: register — register code+head for a reserved ParaId; holds the code deposit, // XCM-authorizes on the relay. + // - TODO: deregister — free the ParaId; releases both deposits. + // - TODO: swap — swap the slots of two paras. + // - TODO: add_lock — add the manager lock. + // - TODO: remove_lock — remove the manager lock. + // - TODO: schedule_code_upgrade — schedule a validation-code upgrade (XCM to the relay). + // - TODO: set_current_head — set the current head data (XCM to the relay). } diff --git a/substrate/frame/registrar/primitives/src/lib.rs b/substrate/frame/registrar/primitives/src/lib.rs index ba2c9dc3db27..31c6ac0b2560 100644 --- a/substrate/frame/registrar/primitives/src/lib.rs +++ b/substrate/frame/registrar/primitives/src/lib.rs @@ -21,13 +21,6 @@ //! registrar pallet ([`pallet-registrar-relay`]). This crate is deliberately free of any FRAME, //! XCM, or network-specific dependency, so a single version of the wire types serves Westend, //! Kusama and Polkadot, and so both pallets can depend on it without forming a dependency cycle. -//! -//! ## Versioning -//! -//! The cross-chain message payloads are the interface seam that is expensive to change once -//! deployed (XCM messages are long-lived on the wire). They are therefore modelled as a versioned -//! wrapper enum whose codec index is the on-wire version tag: add new versions as new variants and -//! **never** renumber or remove an existing one. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/registrar/relay/src/lib.rs b/substrate/frame/registrar/relay/src/lib.rs index 1ee6703570d2..20a39c69cd55 100644 --- a/substrate/frame/registrar/relay/src/lib.rs +++ b/substrate/frame/registrar/relay/src/lib.rs @@ -40,4 +40,6 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(_); + + // - TODO: Extrinsic to accept the messages from the para. } From e1d29882f9fb1affc88443ce33d0666194974933 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 14 Jul 2026 13:30:29 +0300 Subject: [PATCH 6/6] cleanup --- substrate/frame/hrmp/primitives/src/lib.rs | 10 ++-------- substrate/frame/registrar/para/src/lib.rs | 2 +- substrate/frame/registrar/primitives/src/lib.rs | 10 ++-------- substrate/frame/registrar/relay/src/lib.rs | 2 ++ 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/substrate/frame/hrmp/primitives/src/lib.rs b/substrate/frame/hrmp/primitives/src/lib.rs index 2edc7d6dd3ea..ff12d858b1d8 100644 --- a/substrate/frame/hrmp/primitives/src/lib.rs +++ b/substrate/frame/hrmp/primitives/src/lib.rs @@ -40,11 +40,8 @@ pub enum MessageToRelay { /// Version 1 payloads for [`MessageToRelay`]. #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] pub enum MessageToRelayV1 { - /// Placeholder so the crate compiles before the control-plane operations land. - /// - /// Replaced by the real messages: open / accept / close HRMP channel. #[codec(index = 0)] - Placeholder, + TODO, } /// HRMP report messages sent back to the parachain. @@ -60,9 +57,6 @@ pub enum MessageToPara { /// Version 1 payloads for [`MessageToPara`]. #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] pub enum MessageToParaV1 { - /// Placeholder so the crate compiles before the report operations land. - /// - /// Replaced by the real reports: confirm / fail / refund for a channel operation. #[codec(index = 0)] - Placeholder, + TODO, } diff --git a/substrate/frame/registrar/para/src/lib.rs b/substrate/frame/registrar/para/src/lib.rs index 6dab8ff2e7fe..e62a6d509c61 100644 --- a/substrate/frame/registrar/para/src/lib.rs +++ b/substrate/frame/registrar/para/src/lib.rs @@ -47,7 +47,7 @@ pub mod pallet { // - TODO: deregister — free the ParaId; releases both deposits. - // - TODO: swap — swap the slots of two paras. + // - TODO: swap — swap the slots of two paras. (Do we still need this? leases are deprecated) // - TODO: add_lock — add the manager lock. diff --git a/substrate/frame/registrar/primitives/src/lib.rs b/substrate/frame/registrar/primitives/src/lib.rs index 31c6ac0b2560..7bb1d60189c3 100644 --- a/substrate/frame/registrar/primitives/src/lib.rs +++ b/substrate/frame/registrar/primitives/src/lib.rs @@ -40,11 +40,8 @@ pub enum MessageToRelay { /// Version 1 payloads for [`MessageToRelay`]. #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] pub enum MessageToRelayV1 { - /// Placeholder so the crate compiles before the control-plane operations land. - /// - /// Replaced by the real message(s): authorize parachain registration. #[codec(index = 0)] - Placeholder, + TODO, } /// Registrar report messages sent back to the parachain. @@ -60,9 +57,6 @@ pub enum MessageToPara { /// Version 1 payloads for [`MessageToPara`]. #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug, TypeInfo)] pub enum MessageToParaV1 { - /// Placeholder so the crate compiles before the report operations land. - /// - /// Replaced by the real reports: confirm / fail / refund for a registration. #[codec(index = 0)] - Placeholder, + TODO, } diff --git a/substrate/frame/registrar/relay/src/lib.rs b/substrate/frame/registrar/relay/src/lib.rs index 20a39c69cd55..6bf51522c11e 100644 --- a/substrate/frame/registrar/relay/src/lib.rs +++ b/substrate/frame/registrar/relay/src/lib.rs @@ -42,4 +42,6 @@ pub mod pallet { pub struct Pallet(_); // - TODO: Extrinsic to accept the messages from the para. + + // - TODO: Accept unsigned TX for PVF upload }