Skip to content

Commit

Permalink
Implementation of ah-client and rc-client staking pallets (paritytech…
Browse files Browse the repository at this point in the history
…#7582)

Recreation of paritytech#7357 on
top of master. The old PR messes up the git history too much so I am
recreating it from scratch.

This PR is work in progress. It's purpose is to commit initial structure
of `pallet-staking-ah-client` and `pallet-staking-rc-client` to master.
The changes will be polished by a follow up PRs which will be
backported.

Related issues: paritytech#6167
and paritytech#6166

This PR introduces the initial structure for `pallet-ah-client` and
`pallet-rc-client`. These pallets will reside on the relay chain and
AssetHub, respectively, and will manage the interaction between
`pallet-session` on the relay chain and `pallet-staking` on AssetHub.

Both pallets are experimental and not intended for production use.

TODOs:
- [ ] Probably handle
paritytech#6344 here.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ankan <[email protected]>
  • Loading branch information
3 people authored and clangenb committed Feb 19, 2025
1 parent b503825 commit 1c56d05
Show file tree
Hide file tree
Showing 11 changed files with 707 additions and 2 deletions.
38 changes: 38 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ members = [
"substrate/frame/session/benchmarking",
"substrate/frame/society",
"substrate/frame/staking",
"substrate/frame/staking/ah-client",
"substrate/frame/staking/rc-client",
"substrate/frame/staking/reward-curve",
"substrate/frame/staking/reward-fn",
"substrate/frame/staking/runtime-api",
Expand Down Expand Up @@ -998,6 +1000,8 @@ pallet-session-benchmarking = { path = "substrate/frame/session/benchmarking", d
pallet-skip-feeless-payment = { path = "substrate/frame/transaction-payment/skip-feeless-payment", default-features = false }
pallet-society = { path = "substrate/frame/society", default-features = false }
pallet-staking = { path = "substrate/frame/staking", default-features = false }
pallet-staking-ah-client = { path = "substrate/frame/staking/ah-client", default-features = false }
pallet-staking-rc-client = { path = "substrate/frame/staking/rc-client", default-features = false }
pallet-staking-reward-curve = { path = "substrate/frame/staking/reward-curve", default-features = false }
pallet-staking-reward-fn = { path = "substrate/frame/staking/reward-fn", default-features = false }
pallet-staking-runtime-api = { path = "substrate/frame/staking/runtime-api", default-features = false }
Expand Down
17 changes: 17 additions & 0 deletions prdoc/pr_7582.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
title: Implementation of `ah-client` and `rc-client` staking pallets
doc:
- audience: Runtime Dev
description: |-
This PR introduces the initial structure for `pallet-ah-client` and `pallet-rc-client`. These
pallets will reside on the relay chain and AssetHub, respectively, and will manage the interaction
between `pallet-session` on the relay chain and `pallet-staking` on AssetHub.
Both pallets are experimental and not intended for production use.
crates:
- name: pallet-staking-ah-client
bump: major
- name: pallet-staking-rc-client
bump: major
- name: pallet-election-provider-multi-block
bump: minor
- name: pallet-staking
bump: major
2 changes: 1 addition & 1 deletion substrate/frame/election-provider-multi-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
//!
//! ## Pagination
//!
//! Most of the external APIs of this pallet are paginated. All pagination follow a patter where if
//! Most of the external APIs of this pallet are paginated. All pagination follow a pattern where if
//! `N` pages exist, the first paginated call is `function(N-1)` and the last one is `function(0)`.
//! For example, with 3 pages, the `elect` of [`ElectionProvider`] is expected to be called as
//! `elect(2) -> elect(1) -> elect(0)`. In essence, calling a paginated function with index 0 is
Expand Down
66 changes: 66 additions & 0 deletions substrate/frame/staking/ah-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[package]
name = "pallet-staking-ah-client"
description = "Pallet handling the communication with staking-rc-client. It's role is to glue the staking pallet (on AssetHub chain) and session pallet (on Relay Chain) in a transparent way."
license = "Apache-2.0"
version = "0.1.0"
edition.workspace = true
authors.workspace = true
repository.workspace = true

[dependencies]
codec = { workspace = true, features = ["derive"] }
frame-support = { workspace = true }
frame-system = { workspace = true }
log = { workspace = true }
pallet-authorship = { workspace = true }
pallet-session = { features = ["historical"], workspace = true }
pallet-staking = { workspace = true }
pallet-staking-rc-client = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-runtime-parachains = { workspace = true }
scale-info = { workspace = true, features = ["derive"] }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-staking = { workspace = true }
xcm = { workspace = true }

[features]
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-authorship/std",
"pallet-session/std",
"pallet-staking-rc-client/std",
"pallet-staking/std",
"polkadot-primitives/std",
"polkadot-runtime-parachains/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-staking/std",
"xcm/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-staking-rc-client/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-authorship/try-runtime",
"pallet-session/try-runtime",
"pallet-staking-rc-client/try-runtime",
"pallet-staking/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
]
Loading

0 comments on commit 1c56d05

Please sign in to comment.