Skip to content

Commit 7482efb

Browse files
committed
Added adjustment_alpha hyperparam
1 parent b02be96 commit 7482efb

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

pallets/subtensor/src/subnet_info.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub struct SubnetHyperparams {
4040
weights_version: Compact<u64>,
4141
weights_rate_limit: Compact<u64>,
4242
adjustment_interval: Compact<u16>,
43-
adjustment_alpha: Compact<u64>,
4443
activity_cutoff: Compact<u16>,
4544
registration_allowed: bool,
4645
target_regs_per_interval: Compact<u16>,
@@ -49,7 +48,8 @@ pub struct SubnetHyperparams {
4948
bonds_moving_avg: Compact<u64>,
5049
max_regs_per_block: Compact<u16>,
5150
serving_rate_limit: Compact<u64>,
52-
max_validators: Compact<u16>
51+
max_validators: Compact<u16>,
52+
adjustment_alpha: Compact<u64>,
5353
}
5454

5555
impl<T: Config> Pallet<T> {
@@ -141,7 +141,6 @@ impl<T: Config> Pallet<T> {
141141
let weights_version = Self::get_weights_version_key(netuid);
142142
let weights_rate_limit = Self::get_weights_set_rate_limit(netuid);
143143
let adjustment_interval = Self::get_adjustment_interval(netuid);
144-
let adjustment_alpha = Self::get_adjustment_alpha(netuid);
145144
let activity_cutoff = Self::get_activity_cutoff(netuid);
146145
let registration_allowed = Self::get_network_registration_allowed(netuid);
147146
let target_regs_per_interval = Self::get_target_registrations_per_interval(netuid);
@@ -151,6 +150,8 @@ impl<T: Config> Pallet<T> {
151150
let max_regs_per_block = Self::get_max_registrations_per_block(netuid);
152151
let serving_rate_limit = Self::get_serving_rate_limit(netuid);
153152
let max_validators = Self::get_max_allowed_validators(netuid);
153+
let adjustment_alpha = Self::get_adjustment_alpha(netuid);
154+
154155

155156
return Some(SubnetHyperparams {
156157
rho: rho.into(),
@@ -164,7 +165,6 @@ impl<T: Config> Pallet<T> {
164165
weights_version: weights_version.into(),
165166
weights_rate_limit: weights_rate_limit.into(),
166167
adjustment_interval: adjustment_interval.into(),
167-
adjustment_alpha: adjustment_alpha.into(),
168168
activity_cutoff: activity_cutoff.into(),
169169
registration_allowed,
170170
target_regs_per_interval: target_regs_per_interval.into(),
@@ -173,7 +173,8 @@ impl<T: Config> Pallet<T> {
173173
bonds_moving_avg: bonds_moving_avg.into(),
174174
max_regs_per_block: max_regs_per_block.into(),
175175
serving_rate_limit: serving_rate_limit.into(),
176-
max_validators: max_validators.into()
176+
max_validators: max_validators.into(),
177+
adjustment_alpha: adjustment_alpha.into()
177178
});
178179
}
179180
}

pallets/subtensor/tests/block_step.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn test_loaded_emission() {
1414
let emission: Vec<u64> = vec![1000000000];
1515
add_network(netuid, tempo, 0);
1616
SubtensorModule::set_max_allowed_uids(netuid, n);
17-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
17+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
1818
SubtensorModule::set_emission_values( &netuids, emission);
1919
for i in 0..n {
2020
SubtensorModule::append_neuron(netuid, &U256::from(i), 0);
@@ -175,7 +175,7 @@ fn test_burn_adjustment() {
175175
add_network(netuid, tempo, 0);
176176
SubtensorModule::set_burn(netuid, burn_cost);
177177
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
178-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
178+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
179179
SubtensorModule::set_target_registrations_per_interval(
180180
netuid,
181181
target_registrations_per_interval,
@@ -222,7 +222,7 @@ fn test_burn_adjustment_with_moving_average() {
222222
add_network(netuid, tempo, 0);
223223
SubtensorModule::set_burn(netuid, burn_cost);
224224
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
225-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
225+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
226226
SubtensorModule::set_target_registrations_per_interval(
227227
netuid,
228228
target_registrations_per_interval,
@@ -280,7 +280,7 @@ fn test_burn_adjustment_case_a() {
280280
SubtensorModule::set_difficulty(netuid, start_diff);
281281
SubtensorModule::set_min_difficulty(netuid, start_diff);
282282
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
283-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
283+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
284284
SubtensorModule::set_target_registrations_per_interval(
285285
netuid,
286286
target_registrations_per_interval,
@@ -372,7 +372,7 @@ fn test_burn_adjustment_case_b() {
372372
SubtensorModule::set_burn(netuid, burn_cost);
373373
SubtensorModule::set_difficulty(netuid, start_diff);
374374
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
375-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
375+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
376376
SubtensorModule::set_target_registrations_per_interval(
377377
netuid,
378378
target_registrations_per_interval,
@@ -454,7 +454,7 @@ fn test_burn_adjustment_case_c() {
454454
SubtensorModule::set_burn(netuid, burn_cost);
455455
SubtensorModule::set_difficulty(netuid, start_diff);
456456
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
457-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
457+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
458458
SubtensorModule::set_target_registrations_per_interval(
459459
netuid,
460460
target_registrations_per_interval,
@@ -547,7 +547,7 @@ fn test_burn_adjustment_case_d() {
547547
SubtensorModule::set_difficulty(netuid, start_diff);
548548
SubtensorModule::set_min_difficulty(netuid, 1);
549549
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
550-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
550+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
551551
SubtensorModule::set_target_registrations_per_interval(
552552
netuid,
553553
target_registrations_per_interval,
@@ -631,7 +631,7 @@ fn test_burn_adjustment_case_e() {
631631
SubtensorModule::set_difficulty(netuid, start_diff);
632632
SubtensorModule::set_min_difficulty(netuid, 1);
633633
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
634-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
634+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
635635
SubtensorModule::set_target_registrations_per_interval(
636636
netuid,
637637
target_registrations_per_interval,
@@ -706,7 +706,7 @@ fn test_burn_adjustment_case_f() {
706706
SubtensorModule::set_difficulty(netuid, start_diff);
707707
SubtensorModule::set_min_difficulty(netuid, start_diff);
708708
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
709-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
709+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
710710
SubtensorModule::set_target_registrations_per_interval(
711711
netuid,
712712
target_registrations_per_interval,
@@ -780,7 +780,7 @@ fn test_burn_adjustment_case_e_zero_registrations() {
780780
SubtensorModule::set_difficulty(netuid, start_diff);
781781
SubtensorModule::set_min_difficulty(netuid, 1);
782782
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
783-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
783+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
784784
SubtensorModule::set_target_registrations_per_interval(
785785
netuid,
786786
target_registrations_per_interval,

pallets/subtensor/tests/registration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn test_burn_adjustment() {
215215
add_network(netuid, tempo, 0);
216216
SubtensorModule::set_burn(netuid, burn_cost);
217217
SubtensorModule::set_adjustment_interval(netuid, adjustment_interval);
218-
SubtensorModule::set_adjustment_alpha(netuid, 58000); // Set to old value.
218+
SubtensorModule::set_adjustment_alpha(netuid, 17_893_341_751_498_265_066); // Set to old value.
219219
SubtensorModule::set_target_registrations_per_interval(
220220
netuid,
221221
target_registrations_per_interval,

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
121121
// `spec_version`, and `authoring_version` are the same between Wasm and native.
122122
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
123123
// the compatible custom types.
124-
spec_version: 172,
124+
spec_version: 173,
125125
impl_version: 1,
126126
apis: RUNTIME_API_VERSIONS,
127127
transaction_version: 1,

0 commit comments

Comments
 (0)