Skip to content

Commit

Permalink
feat/adding-missing-subnet-parameters (#78)
Browse files Browse the repository at this point in the history
* chore: bump versions

* feat: adding missing subnet parameter
  • Loading branch information
functor-flow authored Aug 10, 2024
1 parent be12fce commit efe5419
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ pub mod pallet {
max_registrations_per_interval: u16,
adjustment_alpha: u64,
min_validator_stake: u64,
max_allowed_validators: Option<u16>,
) -> DispatchResult {
let mut params = pallet_subspace::Pallet::subnet_params(netuid);
params.founder = founder;
Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 4 additions & 0 deletions pallets/subspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ pub mod pallet {
adjustment_alpha: module_burn_defaults.adjustment_alpha,

min_validator_stake: DefaultMinValidatorStake::<T>::get(),
max_allowed_validators: None,
governance_config: GovernanceConfiguration {
vote_mode: VoteMode::Authority,
..Default::default()
Expand Down Expand Up @@ -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<u16>,
pub governance_config: GovernanceConfiguration,
}

Expand Down Expand Up @@ -1016,6 +1018,7 @@ pub mod pallet {
max_registrations_per_interval: u16,
adjustment_alpha: u64,
min_validator_stake: u64,
max_allowed_validators: Option<u16>,
) -> DispatchResult {
let params = SubnetParams {
founder,
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pallets/subspace/src/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl<T: Config> Pallet<T> {
adjustment_alpha: module_burn_config.adjustment_alpha,

min_validator_stake: MinValidatorStake::<T>::get(netuid),
max_allowed_validators: MaxAllowedValidators::<T>::get(netuid),
governance_config: T::get_subnet_governance_configuration(netuid),
metadata: SubnetMetadata::<T>::get(netuid),
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
2 changes: 2 additions & 0 deletions tests/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -364,6 +365,7 @@ fn subnet_params_proposal_accepted() {
max_registrations_per_interval,
adjustment_alpha,
min_validator_stake,
max_allowed_validators,
)
.unwrap();

Expand Down
3 changes: 3 additions & 0 deletions tests/src/subspace/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -98,6 +99,7 @@ fn subnet_update_changes_all_parameter_values() {
max_registrations_per_interval,
adjustment_alpha,
min_validator_stake,
max_allowed_validators,

Check warning on line 102 in tests/src/subspace/subnet.rs

View workflow job for this annotation

GitHub Actions / check

unused variable: `max_allowed_validators`
governance_config,
} = params.clone();

Expand Down Expand Up @@ -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,
)
};

Expand Down

0 comments on commit efe5419

Please sign in to comment.