-
Notifications
You must be signed in to change notification settings - Fork 167
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
Override childkey take to zero if sharing coldkey with parent #1103
Conversation
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.
little nit for a comment, but looks good
Co-authored-by: Cameron Fairchild <cameron@opentensor.ai>
)); | ||
|
||
// Set zero hotkey take for childkey | ||
SubtensorModule::set_min_delegate_take(0); |
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.
In this test child take and childkey take should be non-zero and it should be observed that the parent didn't get a deduction from either and has extraced full dividend that was due. The current implementation doesn't have this bug, but the test should not assume that - one day someone might be refactoring the code and might make a mistake that this test would then not detect. Maybe just use 0.01, 0.02, 0.05 so that we are sure they have never been confused with each other.
@@ -3437,7 +3438,8 @@ fn test_childkey_take_drain() { | |||
#[test] | |||
fn test_childkey_take_drain_validator_take() { |
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.
This test should be refactored into a helper function that would then be used in two tests:
- test_childkey_take_same_coldkey
- test_childkey_take_drain_validator_take
The helper function in question wouild accept parameters for coldkey_parent
and coldkey_child
, which would be the same in the first test and different in the other test. The other parameters of the helper would be:
expected_child_emission
expected_parent_emission
expected_nominator_emission
This should save ~120 LOC and it will make maintenance of the test suite less costly as adjustments to the internal subtensor interface woudln't have to be replicated in two places, but only in one.
Description
If parent and child are sharing the same coldkey, the childkey take is ignored and overridden with zero.
Related Issue(s)
n/a
Type of Change
Breaking Change
n/a
Checklist
cargo fmt
andcargo clippy
to ensure my code is formatted and linted correctly