Skip to content

Conversation

@jankun4
Copy link
Contributor

@jankun4 jankun4 commented Oct 28, 2025

Description

Adds third value to D-Param feature. Now it supports native stake (mNIGHT) validators to take part in the consensus.
link

Checklist

  • Commit sequence broadly makes sense and commits have useful messages.
  • The size limit of 400 LOC isn't needlessly exceeded
  • The PR refers to a JIRA ticket (if one exists)
  • New tests are added if needed and existing tests are updated.
  • New code is documented and existing documentation is updated.
  • Relevant logging and metrics added
  • Any changes are noted in the changelog.md for affected crate
  • Self-reviewed the diff

@jankun4 jankun4 force-pushed the native-stake-d-param branch 6 times, most recently from 9447854 to 775efeb Compare October 29, 2025 13:22
Copy link
Contributor

@AmbientTea AmbientTea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make the d-param and selection pallet versioned for this to be backwards compatible. Let me know if you need support with this.

pub num_permissioned_candidates: u16,
/// The number of registered candidates
pub num_registered_candidates: u16,
/// The number of native stake validators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The number of native stake validators
/// The number of native stake candidates

)]
#[cfg_attr(feature = "serde", derive(Serialize))]
/// Parameter controlling the number and proportion of registered and permissioned candidates
/// Parameter controlling the number and proportion of registered, permissioned candidates and native stake validators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Parameter controlling the number and proportion of registered, permissioned candidates and native stake validators
/// Parameter controlling the number and proportion of registered, permissioned, and native stake candidates

pub num_permissioned_candidates: u16,
/// Expected number of registered candidates selected for a committee
pub num_registered_candidates: u16,
/// Expected number of native stake validators selected for a committee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Expected number of native stake validators selected for a committee
/// Expected number of native stake candidates selected for a committee

/// Number of registered candidates
registered_candidates_count: u16,
#[arg(long)]
/// Number of native stake validators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Number of native stake validators
/// Number of native stake candidates

Comment on lines 54 to +69
impl From<DParamDatum> for sidechain_domain::DParameter {
fn from(datum: DParamDatum) -> Self {
match datum {
DParamDatum::V0 { num_permissioned_candidates, num_registered_candidates } => {
Self { num_permissioned_candidates, num_registered_candidates }
DParamDatum::V0 { num_permissioned_candidates, num_registered_candidates } => Self {
num_permissioned_candidates,
num_registered_candidates,
num_native_stake_candidates: 0,
},
DParamDatum::V1 {
num_permissioned_candidates,
num_registered_candidates,
num_native_stake_candidates,
} => Self {
num_permissioned_candidates,
num_registered_candidates,
num_native_stake_candidates,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested upgrading a chain to this version? I'm pretty sure this will break existing chains that use the current 2-value d-param. We need to introduce DParameterV2, bump the selection pallet's version, and modify the Ariadne IDP to be version-aware so it knows what schema of inputs it should provide to the pallet.

@jankun4 jankun4 force-pushed the native-stake-d-param branch from 775efeb to ba9b7aa Compare October 30, 2025 12:37
@jankun4 jankun4 force-pushed the native-stake-d-param branch from ba9b7aa to ad992c8 Compare October 30, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants