From efe5419cad090c595d6c0c8d155020ee9e2003e9 Mon Sep 17 00:00:00 2001 From: Honza <115138297+Supremesource@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:11:36 +0200 Subject: [PATCH] feat/adding-missing-subnet-parameters (#78) * chore: bump versions * feat: adding missing subnet parameter --- Cargo.lock | 4 ++-- pallets/governance/src/lib.rs | 2 ++ pallets/subspace/Cargo.toml | 2 +- pallets/subspace/src/lib.rs | 4 ++++ pallets/subspace/src/subnet.rs | 1 + runtime/Cargo.toml | 2 +- tests/src/governance.rs | 2 ++ tests/src/subspace/subnet.rs | 3 +++ 8 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dbf52a9e7..a9752383b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4804,7 +4804,7 @@ dependencies = [ [[package]] name = "node-subspace-runtime" -version = "1.8.1" +version = "1.8.2" dependencies = [ "fp-account", "fp-rpc", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "pallet-subspace" -version = "1.8.1" +version = "1.8.2" dependencies = [ "bty", "frame-benchmarking", diff --git a/pallets/governance/src/lib.rs b/pallets/governance/src/lib.rs index f905f99b2..1128067e2 100644 --- a/pallets/governance/src/lib.rs +++ b/pallets/governance/src/lib.rs @@ -243,6 +243,7 @@ pub mod pallet { max_registrations_per_interval: u16, adjustment_alpha: u64, min_validator_stake: u64, + max_allowed_validators: Option, ) -> DispatchResult { let mut params = pallet_subspace::Pallet::subnet_params(netuid); params.founder = founder; @@ -267,6 +268,7 @@ pub mod pallet { params.max_registrations_per_interval = max_registrations_per_interval; params.adjustment_alpha = adjustment_alpha; params.min_validator_stake = min_validator_stake; + params.max_allowed_validators = max_allowed_validators; Self::do_add_subnet_params_proposal(origin, netuid, data, params) } diff --git a/pallets/subspace/Cargo.toml b/pallets/subspace/Cargo.toml index bc33166b7..b612240f4 100644 --- a/pallets/subspace/Cargo.toml +++ b/pallets/subspace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-subspace" -version = "1.8.1" +version = "1.8.2" description = "FRAME pallet for runtime logic of Subspace Blockchain." authors = ["Commune Community"] homepage = "https://commune.com" diff --git a/pallets/subspace/src/lib.rs b/pallets/subspace/src/lib.rs index d881904bd..b48c731c3 100644 --- a/pallets/subspace/src/lib.rs +++ b/pallets/subspace/src/lib.rs @@ -366,6 +366,7 @@ pub mod pallet { adjustment_alpha: module_burn_defaults.adjustment_alpha, min_validator_stake: DefaultMinValidatorStake::::get(), + max_allowed_validators: None, governance_config: GovernanceConfiguration { vote_mode: VoteMode::Authority, ..Default::default() @@ -406,6 +407,7 @@ pub mod pallet { pub max_registrations_per_interval: u16, pub adjustment_alpha: u64, pub min_validator_stake: u64, + pub max_allowed_validators: Option, pub governance_config: GovernanceConfiguration, } @@ -1016,6 +1018,7 @@ pub mod pallet { max_registrations_per_interval: u16, adjustment_alpha: u64, min_validator_stake: u64, + max_allowed_validators: Option, ) -> DispatchResult { let params = SubnetParams { founder, @@ -1038,6 +1041,7 @@ pub mod pallet { max_registrations_per_interval, adjustment_alpha, min_validator_stake, + max_allowed_validators, governance_config: GovernanceConfiguration { vote_mode, ..T::get_subnet_governance_configuration(netuid) diff --git a/pallets/subspace/src/subnet.rs b/pallets/subspace/src/subnet.rs index d3731367b..3ea3dfc1d 100644 --- a/pallets/subspace/src/subnet.rs +++ b/pallets/subspace/src/subnet.rs @@ -188,6 +188,7 @@ impl Pallet { adjustment_alpha: module_burn_config.adjustment_alpha, min_validator_stake: MinValidatorStake::::get(netuid), + max_allowed_validators: MaxAllowedValidators::::get(netuid), governance_config: T::get_subnet_governance_configuration(netuid), metadata: SubnetMetadata::::get(netuid), } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index e62b21455..6cf0fdf11 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node-subspace-runtime" -version = "1.8.1" +version = "1.8.2" description = "A Substrate node for commune-ai" authors = ["Commune Community"] homepage = "https://substrate.io/" diff --git a/tests/src/governance.rs b/tests/src/governance.rs index 5d62e1d43..d889c74a0 100644 --- a/tests/src/governance.rs +++ b/tests/src/governance.rs @@ -332,6 +332,7 @@ fn subnet_params_proposal_accepted() { max_registrations_per_interval, adjustment_alpha, min_validator_stake, + max_allowed_validators, mut governance_config, .. } = SubspaceMod::subnet_params(0); @@ -364,6 +365,7 @@ fn subnet_params_proposal_accepted() { max_registrations_per_interval, adjustment_alpha, min_validator_stake, + max_allowed_validators, ) .unwrap(); diff --git a/tests/src/subspace/subnet.rs b/tests/src/subspace/subnet.rs index d3b1c183a..a416b4da3 100644 --- a/tests/src/subspace/subnet.rs +++ b/tests/src/subspace/subnet.rs @@ -64,6 +64,7 @@ fn subnet_update_changes_all_parameter_values() { max_registrations_per_interval: 16, adjustment_alpha: 17, min_validator_stake: to_nano(50_000), + max_allowed_validators: Some(18), governance_config: GovernanceConfiguration { proposal_cost: 18, proposal_expiration: 19, @@ -98,6 +99,7 @@ fn subnet_update_changes_all_parameter_values() { max_registrations_per_interval, adjustment_alpha, min_validator_stake, + max_allowed_validators, governance_config, } = params.clone(); @@ -257,6 +259,7 @@ fn update_subnet_verifies_names_uniquiness_integrity() { params.max_registrations_per_interval, params.adjustment_alpha, params.min_validator_stake, + params.max_allowed_validators, ) };