Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub enum ProxyType {
SwapHotkey,
SubnetLeaseBeneficiary,
RootClaim,
/// Root basket curation (`set_root_weights`) only.
SetRootWeights,
}

impl TryFrom<u8> for ProxyType {
Expand All @@ -67,6 +69,7 @@ impl TryFrom<u8> for ProxyType {
15 => Ok(Self::SwapHotkey),
16 => Ok(Self::SubnetLeaseBeneficiary),
17 => Ok(Self::RootClaim),
18 => Ok(Self::SetRootWeights),
_ => Err(()),
}
}
Expand All @@ -93,6 +96,7 @@ impl From<ProxyType> for u8 {
ProxyType::SwapHotkey => 15,
ProxyType::SubnetLeaseBeneficiary => 16,
ProxyType::RootClaim => 17,
ProxyType::SetRootWeights => 18,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/guides/proxies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Prefer the narrowest type that covers the job:
[`register_limit`](/code/pallets/subtensor/src/macros/dispatches.rs#L2242-L2249)).
* **ChildKeys** — [`set_children`](/code/pallets/subtensor/src/macros/dispatches.rs#L1093-L1101) and [`set_childkey_take`](/code/pallets/subtensor/src/macros/dispatches.rs#L935-L945);
**RootClaim** — [`claim_root`](/code/pallets/subtensor/src/macros/dispatches.rs#L1905-L1939) and [`claim_root_with_hotkey`](/code/pallets/subtensor/src/macros/dispatches.rs#L1941-L1970).
* **SetRootWeights** — root basket curation through `set_root_weights` only.
* **Owner** — subnet-owner admin calls; **NonCritical** — everything except
registrations, coldkey swaps, and subnet dissolution;
**SubnetLeaseBeneficiary** — the lease-scoped subset of owner calls.
Expand Down
2 changes: 1 addition & 1 deletion docs/tx/add-proxy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ only to keys you control or fully trust.
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `delegate_ss58` | string | yes | Key that will be allowed to sign for this account. |
| `proxy_type` | string | no | Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers. |
| `proxy_type` | string | no | Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim, SetRootWeights. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. SetRootWeights permits only set_root_weights. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers. |
| `delay` | integer | no | Announcement delay in blocks: the delegate must announce each call and wait this long before executing it, giving you time to veto. 0 executes immediately. |

Address parameters (`--hotkey`, `--coldkey`, `--dest`, ...) accept a raw ss58
Expand Down
2 changes: 1 addition & 1 deletion docs/tx/create-pure-proxy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ the pure proxy and anything it holds.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `proxy_type` | string | no | Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers. |
| `proxy_type` | string | no | Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim, SetRootWeights. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. SetRootWeights permits only set_root_weights. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers. |
| `delay` | integer | no | Announcement delay in blocks: the delegate must announce each call and wait this long before executing it, giving you time to veto. 0 executes immediately. |
| `index` | integer | no | Disambiguator so one signer can create several pure proxies in one block; also part of the derived address. Keep 0 unless batching. |

Expand Down
9 changes: 8 additions & 1 deletion runtime/src/proxy_filters/call_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ call_filter_group!(
]
);

// Curating a validator's root basket.
call_filter_group!(
RootWeightsCalls,
[RuntimeCall::SubtensorModule(
SubtensorCall::set_root_weights
),]
);

// A subnet's public identity and token symbol.
call_filter_group!(
SubnetIdentityCalls,
Expand All @@ -441,7 +449,6 @@ call_filter_group!(
SubtensorCommonCalls,
[
RuntimeCall::SubtensorModule(SubtensorCall::set_weights),
RuntimeCall::SubtensorModule(SubtensorCall::set_root_weights),
RuntimeCall::SubtensorModule(SubtensorCall::set_mechanism_weights),
RuntimeCall::SubtensorModule(SubtensorCall::batch_set_weights),
RuntimeCall::SubtensorModule(SubtensorCall::commit_weights),
Expand Down
23 changes: 22 additions & 1 deletion runtime/src/proxy_filters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type NonTransferAllowed = (
CriticalNetworkCalls,
ChildKeyCalls,
RootClaimCalls,
RootWeightsCalls,
SubnetIdentityCalls,
SubnetActivationCalls,
SubtensorCommonCalls,
Expand All @@ -78,6 +79,7 @@ type NonFungibleAllowed = (
CriticalNetworkCalls,
ChildKeyCalls,
RootClaimCalls,
RootWeightsCalls,
SubnetIdentityCalls,
SubnetActivationCalls,
SubtensorCommonCalls,
Expand All @@ -97,6 +99,7 @@ type NonCriticalAllowed = (
HotkeySwapCalls,
ChildKeyCalls,
RootClaimCalls,
RootWeightsCalls,
SubnetIdentityCalls,
SubnetActivationCalls,
SubtensorCommonCalls,
Expand All @@ -117,6 +120,7 @@ pub(crate) fn proxy_type_filter(proxy_type: &ProxyType, call: &RuntimeCall) -> b
ProxyType::SwapHotkey => HotkeySwapCalls::contains(call),
ProxyType::SubnetLeaseBeneficiary => SubnetLeaseAllowed::contains(call),
ProxyType::RootClaim => RootClaimCalls::contains(call),
ProxyType::SetRootWeights => RootWeightsCalls::contains(call),
ProxyType::SudoUncheckedSetCode => SudoSetCodeCalls::contains(call),
ProxyType::Triumvirate
| ProxyType::Senate
Expand Down Expand Up @@ -152,7 +156,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
| ProxyType::SudoUncheckedSetCode
| ProxyType::SwapHotkey
| ProxyType::SubnetLeaseBeneficiary
| ProxyType::RootClaim,
| ProxyType::RootClaim
| ProxyType::SetRootWeights,
) => true,
(ProxyType::Transfer, ProxyType::SmallTransfer) => true,
_ => false,
Expand Down Expand Up @@ -183,6 +188,7 @@ fn proxy_filter_mode(proxy_type: ProxyType) -> FilterMode {
ProxyType::SwapHotkey => FilterMode::Allow(HotkeySwapCalls::call_infos()),
ProxyType::SubnetLeaseBeneficiary => FilterMode::Allow(SubnetLeaseAllowed::call_infos()),
ProxyType::RootClaim => FilterMode::Allow(RootClaimCalls::call_infos()),
ProxyType::SetRootWeights => FilterMode::Allow(RootWeightsCalls::call_infos()),
ProxyType::SudoUncheckedSetCode => FilterMode::Allow(SudoSetCodeCalls::call_infos()),
ProxyType::Triumvirate
| ProxyType::Senate
Expand Down Expand Up @@ -238,6 +244,7 @@ mod tests {
string::{String, ToString},
vec,
};
use codec::Encode;
use frame_support::traits::GetCallMetadata;
use subtensor_runtime_common::CallInfo;

Expand Down Expand Up @@ -287,6 +294,7 @@ mod tests {
#[test]
fn any_allows_everything_and_deprecated_allow_nothing() {
assert_eq!(allowed_calls(ProxyType::Any), all_runtime_calls());
assert!(!ProxyType::SetRootWeights.is_deprecated());
for deprecated in [
ProxyType::Triumvirate,
ProxyType::Senate,
Expand All @@ -297,6 +305,14 @@ mod tests {
}
}

#[test]
fn set_root_weights_has_a_fresh_wire_index() {
assert_eq!(u8::from(ProxyType::RootWeights), 12);
assert_eq!(ProxyType::RootWeights.encode(), vec![12]);
assert_eq!(u8::from(ProxyType::SetRootWeights), 18);
assert_eq!(ProxyType::SetRootWeights.encode(), vec![18]);
}

// Broad proxies are specified subtractively here (all calls minus a few
// denied groups) and checked against the additive composition in the filter.
// Because the inventory groups partition every runtime call, the two must
Expand Down Expand Up @@ -398,6 +414,7 @@ mod tests {
ProxyType::SwapHotkey,
ProxyType::SubnetLeaseBeneficiary,
ProxyType::RootClaim,
ProxyType::SetRootWeights,
]
.into_iter()
.collect::<BTreeSet<_>>();
Expand Down Expand Up @@ -514,6 +531,10 @@ mod tests {
"SubtensorModule::claim_root_with_hotkey",
])
);
assert_eq!(
allowed_calls(ProxyType::SetRootWeights),
expected(&["SubtensorModule::set_root_weights"])
);
assert_eq!(
allowed_calls(ProxyType::SudoUncheckedSetCode),
expected(&["Sudo::sudo_unchecked_weight"])
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/bittensor/intents/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"SwapHotkey",
"SubnetLeaseBeneficiary",
"RootClaim",
"SetRootWeights",
)


Expand All @@ -58,7 +59,8 @@ def check_proxy_type(proxy_type: str) -> str:
+ ", ".join(PROXY_TYPES)
+ ". Triumvirate, Senate, Governance, and RootWeights are deprecated on "
"the current runtime: they deny all calls, so a proxy of those types can "
"dispatch nothing. Prefer the narrowest type that covers your use; Any "
"dispatch nothing. SetRootWeights permits only set_root_weights. Prefer the "
"narrowest type that covers your use; Any "
"can do everything the account can, including transfers."
)

Expand Down
4 changes: 2 additions & 2 deletions website/apps/bittensor-website/public/catalog/intents.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
"proxy_type": {
"type": "string",
"description": "Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers."
"description": "Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim, SetRootWeights. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. SetRootWeights permits only set_root_weights. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers."
},
"delay": {
"type": "integer",
Expand Down Expand Up @@ -871,7 +871,7 @@
"properties": {
"proxy_type": {
"type": "string",
"description": "Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers."
"description": "Scope of calls the delegation covers. One of: Any, Owner, NonCritical, NonTransfer, Senate, NonFungible, Triumvirate, Governance, Staking, Registration, Transfer, SmallTransfer, RootWeights, ChildKeys, SudoUncheckedSetCode, SwapHotkey, SubnetLeaseBeneficiary, RootClaim, SetRootWeights. Triumvirate, Senate, Governance, and RootWeights are deprecated on the current runtime: they deny all calls, so a proxy of those types can dispatch nothing. SetRootWeights permits only set_root_weights. Prefer the narrowest type that covers your use; Any can do everything the account can, including transfers."
},
"delay": {
"type": "integer",
Expand Down
Loading