-
Notifications
You must be signed in to change notification settings - Fork 329
Added root_claim_for #2784
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
Added root_claim_for #2784
Changes from 3 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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -345,6 +345,21 @@ impl<T: Config> Pallet<T> { | |||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| pub fn do_root_claim_checked( | ||||||||||||||||
| coldkey: T::AccountId, | ||||||||||||||||
| subnets: BTreeSet<NetUid>, | ||||||||||||||||
| ) -> Result<Weight, DispatchError> { | ||||||||||||||||
| ensure!(!subnets.is_empty(), Error::<T>::InvalidSubnetNumber); | ||||||||||||||||
| ensure!( | ||||||||||||||||
| subnets.len() <= crate::MAX_SUBNET_CLAIMS, | ||||||||||||||||
| Error::<T>::InvalidSubnetNumber | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| Self::maybe_add_coldkey_index(&coldkey); | ||||||||||||||||
|
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] Arbitrary coldkeys can pollute the root auto-claim index
Suggested change
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] Arbitrary coldkeys can pollute the root auto-claim index
|
||||||||||||||||
|
|
||||||||||||||||
| Self::do_root_claim(coldkey, Some(subnets)) | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| pub fn do_root_claim( | ||||||||||||||||
| coldkey: T::AccountId, | ||||||||||||||||
| subnets: Option<BTreeSet<NetUid>>, | ||||||||||||||||
|
|
||||||||||||||||
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]
claim_root_forreuses an existing runtime call index142is already assigned toset_reject_locked_alphalater in this pallet. Runtime calls are SCALE-encoded by call index, so a duplicate index makes dispatch bytes ambiguous across the runtime upgrade and can cause one call to decode as the other or make an existing call inaccessible. Assignclaim_root_foran unused index, e.g.143, and update any metadata/tests accordingly.