Open
Conversation
Contributor
|
needs to merge in latest devnet-ready |
l0r1s
reviewed
Jan 6, 2026
Comment on lines
1433
to
1440
| let previous_consensus_u16 = Consensus::<T>::get(netuid); | ||
| previous_consensus_u16 | ||
| .iter() | ||
| .map(|&c| { | ||
| I32F32::saturating_from_num(c) | ||
| .safe_div(I32F32::saturating_from_num(u16::MAX)) | ||
| }) | ||
| .collect() |
Collaborator
There was a problem hiding this comment.
Duplicated below, should be extracted to a function
l0r1s
reviewed
Jan 6, 2026
Comment on lines
214
to
222
| let diff = if *res > expected { | ||
| *res - expected | ||
| } else { | ||
| expected - *res | ||
| }; | ||
| assert!( | ||
| diff < I32F32::from_num(0.001), | ||
| "Values should be approximately equal" | ||
| ); |
Collaborator
There was a problem hiding this comment.
assert_abs_diff_eq! can be useful here
l0r1s
reviewed
Jan 6, 2026
Comment on lines
260
to
268
| let diff = if *res > expected { | ||
| *res - expected | ||
| } else { | ||
| expected - *res | ||
| }; | ||
| assert!( | ||
| diff < I32F32::from_num(0.001), | ||
| "Should use previous consensus when bond_penalty == 1" | ||
| ); |
Collaborator
There was a problem hiding this comment.
assert_abs_diff_eq! can be useful here
l0r1s
reviewed
Jan 6, 2026
l0r1s
reviewed
Jan 6, 2026
- Extract duplicated consensus u16->I32F32 conversion to helper function - Replace manual diff assertions with assert_abs_diff_eq! macro - Add dispatchable extrinsic for set_liquid_alpha_consensus_mode
958be6e to
92b39a0
Compare
ppolewicz
reviewed
Feb 8, 2026
| Weight::from_parts(10_000, 0) | ||
| .saturating_add(T::DbWeight::get().reads(2)) | ||
| .saturating_add(T::DbWeight::get().writes(1)), | ||
| DispatchClass::Operational, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introducing consensus modes for liquid alpha calculations (using previous epoch or current epoch consensus)
The AUTO mode on default sets to CURRENT if bond_penalty != 1 and PREVIOUS if bond_penalty == 1
Type of Change
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyAdditional Notes
This is my first Subtensor contribution so please review it carefully and be lenient.