-
Notifications
You must be signed in to change notification settings - Fork 287
Add BondsPenalty hyperparam #181
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,8 @@ pub mod pallet { | |
| type InitialAdjustmentInterval: Get<u16>; | ||
| #[pallet::constant] // Initial bonds moving average. | ||
| type InitialBondsMovingAverage: Get<u64>; | ||
| #[pallet::constant] // Initial bonds penalty. | ||
| type InitialBondsPenalty: Get<u16>; | ||
| #[pallet::constant] // Initial target registrations per interval. | ||
| type InitialTargetRegistrationsPerInterval: Get<u16>; | ||
| #[pallet::constant] // Rho constant. | ||
|
|
@@ -530,6 +532,10 @@ pub mod pallet { | |
| T::InitialBondsMovingAverage::get() | ||
| } | ||
| #[pallet::type_value] | ||
| pub fn DefaultBondsPenalty<T: Config>() -> u16 { | ||
| T::InitialBondsPenalty::get() | ||
| } | ||
| #[pallet::type_value] | ||
| pub fn DefaultValidatorPruneLen<T: Config>() -> u64 { | ||
| T::InitialValidatorPruneLen::get() | ||
| } | ||
|
|
@@ -587,6 +593,9 @@ pub mod pallet { | |
| #[pallet::storage] // --- MAP ( netuid ) --> bonds_moving_average | ||
| pub type BondsMovingAverage<T> = | ||
| StorageMap<_, Identity, u16, u64, ValueQuery, DefaultBondsMovingAverage<T>>; | ||
| #[pallet::storage] // --- MAP ( netuid ) --> bonds_penalty | ||
| pub type BondsPenalty<T> = | ||
| StorageMap<_, Identity, u16, u16, ValueQuery, DefaultBondsPenalty<T>>; | ||
| #[pallet::storage] // --- MAP ( netuid ) --> weights_set_rate_limit | ||
| pub type WeightsSetRateLimit<T> = | ||
| StorageMap<_, Identity, u16, u64, ValueQuery, DefaultWeightsSetRateLimit<T>>; | ||
|
|
@@ -739,6 +748,7 @@ pub mod pallet { | |
| WeightsSetRateLimitSet(u16, u64), // --- Event created when weights set rate limit has been set for a subnet. | ||
| ImmunityPeriodSet(u16, u16), // --- Event created when immunity period is set for a subnet. | ||
| BondsMovingAverageSet(u16, u64), // --- Event created when bonds moving average is set for a subnet. | ||
| BondsPenaltySet(u16, u16), // --- Event created when bonds penalty is set for a subnet. | ||
| MaxAllowedValidatorsSet(u16, u16), // --- Event created when setting the max number of allowed validators on a subnet. | ||
| AxonServed(u16, T::AccountId), // --- Event created when the axon server information is added to the network. | ||
| PrometheusServed(u16, T::AccountId), // --- Event created when the prometheus server information is added to the network. | ||
|
|
@@ -1959,6 +1969,18 @@ pub mod pallet { | |
| ) -> DispatchResult { | ||
| Self::do_sudo_set_adjustment_alpha(origin, netuid, adjustment_alpha) | ||
| } | ||
|
|
||
| #[pallet::call_index(59)] | ||
| #[pallet::weight((Weight::from_ref_time(14_000_000) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this benchmarked? If not, will add it to the list of features that need benchmarking before we push latest chain upgrade.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No it wasn't benchmarked, but copied the time of another u16 hyperparam. |
||
| .saturating_add(T::DbWeight::get().reads(1)) | ||
| .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Operational, Pays::No))] | ||
| pub fn sudo_set_bonds_penalty( | ||
| origin: OriginFor<T>, | ||
| netuid: u16, | ||
| bonds_penalty: u16, | ||
| ) -> DispatchResult { | ||
| Self::do_sudo_set_bonds_penalty(origin, netuid, bonds_penalty) | ||
| } | ||
| } | ||
|
|
||
| // ---- Subtensor helper functions. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if the bonds penalty = 0.5, will the interpolate function return an average between weights and clipped weights?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct, the unit tests for
interpolatehas examples of this.