Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updating subnet parameter extrinsics #77

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Storages:
- `TargetRegistrationsPerInterval` storage map removed: Integrated into ModuleBurnConfig.
- `AdjustmentAlpha` storage map removed: Integrated into ModuleBurnConfig.
- `MaxRegistrationsPerInterval` storage map removed: Integrated into ModuleBurnConfig.
- `DelegationFee` storage map is now bounded to a key and is global (does not take the netuid parameter)

Extrinsics:

Expand Down
21 changes: 13 additions & 8 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,12 @@ pub mod pallet {
#[pallet::weight((<T as pallet::Config>::WeightInfo::add_subnet_params_proposal(), DispatchClass::Normal, Pays::No))]
pub fn add_subnet_params_proposal(
origin: OriginFor<T>,
subnet_id: u16,
netuid: u16,
data: Vec<u8>,
founder: T::AccountId,
name: BoundedVec<u8, ConstU32<256>>,
founder_share: u16,
name: BoundedVec<u8, ConstU32<256>>,
metadata: Option<BoundedVec<u8, ConstU32<59>>>,
immunity_period: u16,
incentive_ratio: u16,
max_allowed_uids: u16,
Expand All @@ -235,16 +236,19 @@ pub mod pallet {
maximum_set_weight_calls_per_epoch: u16,
vote_mode: VoteMode,
bonds_ma: u64,
min_burn: u64,
max_burn: u64,
target_registrations_interval: u16,
target_registrations_per_interval: u16,
max_registrations_per_interval: u16,
adjustment_alpha: u64,
min_validator_stake: u64,
) -> DispatchResult {
let mut params = pallet_subspace::Pallet::subnet_params(subnet_id);
let mut params = pallet_subspace::Pallet::subnet_params(netuid);
params.founder = founder;
params.name = name;
params.founder_share = founder_share;
params.name = name;
params.metadata = metadata;
params.immunity_period = immunity_period;
params.incentive_ratio = incentive_ratio;
params.max_allowed_uids = max_allowed_uids;
Expand All @@ -256,13 +260,14 @@ pub mod pallet {
params.maximum_set_weight_calls_per_epoch = maximum_set_weight_calls_per_epoch;
params.governance_config.vote_mode = vote_mode;
params.bonds_ma = bonds_ma;
params.min_burn = min_burn;
params.max_burn = max_burn;
params.target_registrations_interval = target_registrations_interval;
params.target_registrations_per_interval = target_registrations_per_interval;
params.max_registrations_per_interval = max_registrations_per_interval;
params.adjustment_alpha = adjustment_alpha;
params.min_validator_stake = min_validator_stake;

Self::do_add_subnet_params_proposal(origin, subnet_id, data, params)
Self::do_add_subnet_params_proposal(origin, netuid, data, params)
}

#[pallet::call_index(2)]
Expand All @@ -275,10 +280,10 @@ pub mod pallet {
#[pallet::weight((<T as pallet::Config>::WeightInfo::add_subnet_custom_proposal(), DispatchClass::Normal, Pays::No))]
pub fn add_subnet_custom_proposal(
origin: OriginFor<T>,
subnet_id: u16,
netuid: u16,
data: Vec<u8>,
) -> DispatchResult {
Self::do_add_subnet_custom_proposal(origin, subnet_id, data)
Self::do_add_subnet_custom_proposal(origin, netuid, data)
}

#[pallet::call_index(4)]
Expand Down
4 changes: 2 additions & 2 deletions pallets/subspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,14 +996,14 @@ pub mod pallet {
netuid: u16,
founder: T::AccountId,
founder_share: u16,
name: BoundedVec<u8, ConstU32<256>>,
metadata: Option<BoundedVec<u8, ConstU32<59>>>,
immunity_period: u16,
incentive_ratio: u16,
max_allowed_uids: u16,
max_allowed_weights: u16,
min_allowed_weights: u16,
max_weight_age: u64,
name: BoundedVec<u8, ConstU32<256>>,
metadata: Option<BoundedVec<u8, ConstU32<59>>>,
tempo: u16,
trust_ratio: u16,
maximum_set_weight_calls_per_epoch: u16,
Expand Down
8 changes: 7 additions & 1 deletion tests/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,13 @@ fn subnet_params_proposal_accepted() {
min_allowed_weights,
max_weight_age,
name,
metadata,
tempo,
trust_ratio,
maximum_set_weight_calls_per_epoch,
bonds_ma,
min_burn,
max_burn,
target_registrations_interval,
target_registrations_per_interval,
max_registrations_per_interval,
Expand All @@ -340,8 +343,9 @@ fn subnet_params_proposal_accepted() {
0,
vec![b'0'; 64],
founder,
name,
founder_share,
name,
metadata,
immunity_period,
incentive_ratio,
max_allowed_uids,
Expand All @@ -353,6 +357,8 @@ fn subnet_params_proposal_accepted() {
maximum_set_weight_calls_per_epoch,
governance_config.vote_mode,
bonds_ma,
min_burn,
max_burn,
target_registrations_interval,
target_registrations_per_interval,
max_registrations_per_interval,
Expand Down
4 changes: 2 additions & 2 deletions tests/src/subspace/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ fn update_subnet_verifies_names_uniquiness_integrity() {
netuid,
params.founder,
params.founder_share,
params.name,
params.metadata,
params.immunity_period,
params.incentive_ratio,
params.max_allowed_uids,
params.max_allowed_weights,
params.min_allowed_weights,
params.max_weight_age,
params.name,
params.metadata,
params.tempo,
params.trust_ratio,
params.maximum_set_weight_calls_per_epoch,
Expand Down
Loading