Update transaction_payment_wrapper: charge fees for hotkey from its coldkey#2570
Open
evgeny-s wants to merge 11 commits intodevnet-readyfrom
Open
Update transaction_payment_wrapper: charge fees for hotkey from its coldkey#2570evgeny-s wants to merge 11 commits intodevnet-readyfrom
evgeny-s wants to merge 11 commits intodevnet-readyfrom
Conversation
l0r1s
reviewed
Apr 7, 2026
evgeny-s
commented
Apr 8, 2026
|
|
||
| fn is_coldkey_fee_payer_eligible(call: &RuntimeCallOf<T>) -> bool { | ||
| match call.is_sub_type() { | ||
| Some(pallet_subtensor::Call::set_weights { .. }) => true, |
Collaborator
Author
There was a problem hiding this comment.
@l0r1s , added the additional validation for the list of extrinsics we want to apply this to.
l0r1s
reviewed
Apr 10, 2026
Comment on lines
+191
to
+194
|
|
||
| pub fn maybe_coldkey_for_hotkey(hotkey: &T::AccountId) -> Option<T::AccountId> { | ||
| Owner::<T>::try_get(hotkey).ok() | ||
| } |
Collaborator
There was a problem hiding this comment.
That is super weird that there is a DefaultAccount for a Owner, it should probably be an OptionQuery but that is something for another discussion
l0r1s
reviewed
Apr 10, 2026
Comment on lines
+250
to
+255
| } else if Self::is_coldkey_fee_payer_eligible(call) { | ||
| if let Some(coldkey) = Self::extract_coldkey_fee_payer(&origin) { | ||
| frame_system::RawOrigin::Signed(coldkey).into() | ||
| } else { | ||
| origin.clone() | ||
| } |
Collaborator
There was a problem hiding this comment.
Can't just have extract_coldkey_fee_payer returns None when not eligible directly in the same function to collapse both into one?
Make things cleaner, wdyt?
Suggested change
| } else if Self::is_coldkey_fee_payer_eligible(call) { | |
| if let Some(coldkey) = Self::extract_coldkey_fee_payer(&origin) { | |
| frame_system::RawOrigin::Signed(coldkey).into() | |
| } else { | |
| origin.clone() | |
| } | |
| } else if let Some(coldkey) Self::extract_coldkey_fee_payer(call, &origin) { | |
| frame_system::RawOrigin::Signed(coldkey).into() |
l0r1s
reviewed
Apr 10, 2026
Comment on lines
+1
to
+3
| #![allow(clippy::arithmetic_side_effects, clippy::unwrap_used)] | ||
|
|
||
| use { |
Collaborator
There was a problem hiding this comment.
This is subtensor pallet specific if we think about it. Maybe exposing the mock from the subtensor pallet make it easier?
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
Coldkey should pay transaction fees in case the origin is a hotkey
Extrinsics to be enabled:
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.