-
Notifications
You must be signed in to change notification settings - Fork 337
Liquid Alpha 2.1 Consensus Modes #3070
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 10 commits
76671f6
777fe85
53bace4
f3165a6
959e703
35e8331
538e2a7
479868e
8879c12
e6ed706
57cefe3
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 |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ pub mod pallet { | |
| use frame_system::pallet_prelude::*; | ||
| use pallet_evm_chain_id::{self, ChainId}; | ||
| use pallet_subtensor::{ | ||
| DefaultMaxAllowedUids, | ||
| ConsensusMode, DefaultMaxAllowedUids, MAX_BONDS_MOVING_AVERAGE, | ||
| utils::rate_limiting::{Hyperparameter, TransactionType}, | ||
| }; | ||
| use sp_runtime::{BoundedVec, PerU16}; | ||
|
|
@@ -921,7 +921,7 @@ pub mod pallet { | |
| pallet_subtensor::Pallet::<T>::ensure_admin_window_open(netuid)?; | ||
| if maybe_owner.is_some() { | ||
| ensure!( | ||
| bonds_moving_average <= 975000, | ||
| bonds_moving_average <= MAX_BONDS_MOVING_AVERAGE, | ||
| Error::<T>::BondsMovingAverageMaxReached | ||
| ) | ||
| } | ||
|
|
@@ -1340,6 +1340,29 @@ pub mod pallet { | |
| res | ||
| } | ||
|
|
||
| /// Sets which consensus values liquid alpha uses for a subnet. | ||
| #[pallet::call_index(104)] | ||
| #[pallet::weight(<T as pallet::Config>::WeightInfo::sudo_set_alpha_values())] | ||
|
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. [HIGH] Use the benchmarked weight for the new extrinsic This new extrinsic is charged as
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. [HIGH] Use the benchmarked weight for the new extrinsic The benchmark function now exists, but generated
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. [HIGH] Use the benchmarked weight for the new extrinsic The benchmark definition now exists, but
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. [HIGH] Use the benchmarked weight for the new extrinsic The benchmark now exists, but this extrinsic still charges |
||
| pub fn sudo_set_liquid_alpha_consensus_mode( | ||
| origin: OriginFor<T>, | ||
| netuid: NetUid, | ||
| mode: ConsensusMode, | ||
| ) -> DispatchResult { | ||
| let maybe_owner = pallet_subtensor::Pallet::<T>::ensure_sn_owner_or_root_with_limits( | ||
| origin, | ||
| netuid, | ||
| &[Hyperparameter::LiquidAlphaConsensusMode.into()], | ||
| )?; | ||
| pallet_subtensor::Pallet::<T>::ensure_admin_window_open(netuid)?; | ||
| pallet_subtensor::Pallet::<T>::set_liquid_alpha_consensus_mode(netuid, mode); | ||
| pallet_subtensor::Pallet::<T>::record_owner_rl( | ||
| maybe_owner, | ||
| netuid, | ||
| &[Hyperparameter::LiquidAlphaConsensusMode.into()], | ||
| ); | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// Sets the duration of the dissolve network schedule. | ||
| /// | ||
| /// This extrinsic allows the root account to set the duration for the dissolve network schedule. | ||
|
|
||
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.
[HIGH] Use the benchmarked weight for the new extrinsic
The benchmark definition was added, but
WeightInfoand both generated implementations still lacksudo_set_liquid_alpha_consensus_mode(). Reusingsudo_set_alpha_values()assigns a profile for different storage accesses and leaves this extrinsic without a generated weight. Run the benchmark action, propagate its output intoweights.rs, and reference the new weight function here.