# Subnet Owner

The subnet owner is the registrar of the subnet, which entitles them to 20% of the total subnet emissions. The owner has control over many aspects of their subnet and is responsible for maintaining the subnet.

#### The owner has the following capabilities:

* [Activate Subnet](#activate-subnet)
* [Pause Subnet](#pause-subnet)
* [Unpause Subnet](#unpause-subnet)
* [Deactivate Subnet](#decommissioning-subnet)
* **Update Information**
  * [Name](#update-name)
  * [Repo](#update-repo)
  * [Description](#update-description)
  * [Miscillanous](#update-misc)
* [Update Churn Limit](#update-churn-limit)
* [Update Churn Limit Multiplier](#update-churn-limit-multiplier)
* [Update Min Stake](#update-min-stake)
* [Update Max Stake](#update-max-stake)
* [Update Max Registered Nodes](#update-max-registered-nodes)
* [Update Target Registrations Per Epoch](#update-target-registrations-per-epoch)
* [Update Node Burn Rate Alpha](#update-node-burn-rate-alpha)
* [Update Queue Immunity Epochs](#update-queue-immunity-epochs)
* [Update Bootnodes](#update-bootnodes)
* [Update Delegate Stake Percentage](#update-delegate-stake-percentage)
* **Update Classification Epochs**
  * [Registration Queue Epochs](#update-registration-queue-epochs)
  * [Idle Epochs](#update-idle-classification-epochs)
  * [Included Epochs](#update-included-classification-epochs)
* [Update Initial Coldkeys](#add-initial-coldkeys)
* [Remove Initial Coldkeys](#remove-initial-coldkeys)
* **Ownership**
  * [Transfer](#transfer-ownership)
  * [Undo](#undo-transfer-ownership)
  * [Accept](#accept-ownership)
* [Remove Subnet Node](#remove-subnet-node)
* **Reputation**
  * [Minimum Subnet Node Reputation](#update-minimum-subnet-node-reputation)
  * [Subnet Node Min Weight Decrease Reputation Threshold](#subnet-node-min-weight-decrease-reputation-threshold)
  * [Below Minimum Weight Decrease Reputation Factor](#below-minimum-weight-decrease-reputation-factor)
  * [Absent Decrease Reputation Factor](#update-absent-decrease-reputation-factor)
  * [Included Increase Reputation Factor](#update-included-increase-reputation-factor)
  * [Non Attestor Decrease Reputation Factor](#update-non-attestor-decrease-reputation-factor)
  * [Non Consensus Attestor Decrease Reputation Factor](#update-non-consensus-attestor-decrease-reputation-factor)
* **Emergency Validator Set**
  * [Set Emergency Validator Set](#set-emergency-validator-set)
  * [Revert Emergency Validator Set](#revert-emergency-validator-set)

***

## Activate Subnet

Activate the subnet in the enactment phase.

Call `activate_subnet` with the subnet ID from the coldkey of the subnet owner.

### Extrinsic

```rust
pub fn activate_subnet(
    origin: OriginFor<T>, 
    subnet_id: u32
)
```

***

## Pause Subnet

The subnet can temporarily be paused. This can be particularly useful in scenarios such as updates or bug fixes.

The subnet must be reactivated by the `MaxPauseEpochs`, otherwise it will begin to decrease its subnet reputation for each epoch that it is not unpaused until it reaches the minimum reputation and is removed.

Call `pause_subnet` with the subnet ID.

### Extrinsic

```rust
pub fn owner_pause_subnet(
    origin: OriginFor<T>, 
    subnet_id: u32
)
```

***

## Unpause Subnet

The owner can unpause the subnet if previously paused. Unpausing can take place at any time after the subnet is originally paused.

Call `unpause_subnet` with the subnet ID.

### Extrinsic

```rust
pub fn owner_unpause_subnet(
    origin: OriginFor<T>, 
    subnet_id: u32
)
```

***

## Decommissioning Subnet

The subnet can be removed from the blockchain.

Call `deactivate_subnet` with the subnet ID.

{% hint style="danger" %}
This is irreversible!
{% endhint %}

### Extrinsic

```rust
pub fn owner_deactivate_subnet(
    origin: OriginFor<T>, 
    subnet_id: u32
)
```

***

## Update Name

Update the unique name of the subnet.

### Extrinsic

```rust
pub fn owner_update_name(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: Vec<u8>
)
```

***

## Update Repo

Update the repo of the subnet. This is where the open-sourced code lives.

### Extrinsic

```rust
pub fn owner_update_repo(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: Vec<u8>
)
```

***

## Update Description

Update the description of the subnet.

### Extrinsic

```rust
pub fn owner_update_description(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: Vec<u8>
)
```

***

## Update Misc

Update miscellaneous information on the subnet.

### Extrinsic

```rust
pub fn owner_update_misc(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: Vec<u8>
)
```

***

## Update Churn Limit

The churn limit is how many nodes can activate per epoch from the registration queue.

When a subnet node registers, it is given a start epoch at which it can activate. The churn limit limits how many are allowed to activate on any given epoch, without taking the [grace epochs](#update-activation-grace-epochs) into account, which can extend the activation span.

For example, if the churn limit is 4 epochs and the queue registration epochs are 10 epochs, with 4 nodes registering on epoch 1,000, these 4 nodes will be appointed a start epoch of 1,010 (registration epoch + queue registration epochs). These nodes can then activate themselves on epoch 1,010.

If 4 more nodes register on the same epoch of 1,000, those four nodes will be appointed a start epoch of 1,011 because the churn limit is 4 per epoch.

Call `owner_update_churn_limit` with the subnet ID and the new churn limit.

{% hint style="info" %}
The queue epochs and churn limit are used together to calculate each subnet node's start epoch (the epoch they can activate) when they register.
{% endhint %}

### Extrinsic

```rust
pub fn owner_update_churn_limit(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u32
)
```

***

## Update Churn Limit Multiplier

The multiplier is used with the churn limit and defaults to 1.

For example, if the ChurnLimit is set to 4 activations, and the multiplier is set to 2, every 2 epochs, 4 nodes will be activated on that epoch.

If the multiplier is set to 1, 4 nodes can be activated each epoch.

Call `owner_update_churn_limit_multiplier` with the subnet ID and the new churn limit multiplier.

### Extrinsic

```rust
pub fn owner_update_churn_limit_multiplier(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u32
)
```

***

## Update Min Stake

The min stake is the minimum balance for a subnet node to register.

{% hint style="danger" %}
This can force nodes to be removed!
{% endhint %}

#### Balances are checked during the following actions:

* Registering
* Activating
* Validating
* Attesting

Call `owner_update_min_stake`with the subnet ID and new value.

### Extrinsic

```rust
pub fn owner_update_min_stake(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u128
)
```

***

## Update Max Stake

The max stake is the maximum balance for a subnet node to register. Balances can be higher than this threshold, although nodes cannot register or increase stake balance past this value.

Call `owner_update_max_stake`with the subnet ID and new value.

### Extrinsic

```rust
pub fn owner_update_max_stake(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u128
)
```

## Update Registration Queue Epochs

The registration queue epochs are the number of epochs a subnet node must be in the registration queue, which is the queue before activation (see [subnet node classifications](https://docs.hypertensor.org/subnet-node#classification)), before it can activate itself.

Call `owner_update_registration_queue_epochs` with the subnet ID and new value.

### Extrinsic

```rust
pub fn owner_update_registration_queue_epochs(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u32
)
```

***

***

## Update Idle Classification Epochs

The queue classification epochs are the number of epochs a subnet node must be in the queue classification before being upgraded to Included (see [subnet node classifications](https://docs.hypertensor.org/subnet-node#classification)).

Call `owner_update_queue_classification_epochs` with the subnet ID and new value.

### Extrinsic

```rust
pub fn owner_update_idle_classification_epochs(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u32
)
```

***

## Update Included Classification Epochs

The included classification epochs are the number of epochs a subnet node must be in the included classification, which is the period before being upgraded to Validator (see [subnet node classifications](https://docs.hypertensor.org/subnet-node#classification)).

Call `owner_update_included_classification_epochs` with the subnet ID and new value.

### Extrinsic

```rust
pub fn owner_update_included_classification_epochs(
    origin: OriginFor<T>, 
    subnet_id: u32,
    value: u32
)
```

***

## Add Initial Coldkeys

The initial coldkeys submitted during registration can be updated while the subnet is still in the registration phase.

Call `owner_add_initial_coldkeys` with the subnet ID you own, and a BTreeSet of coldkeys. This will mutate the `SubnetRegistrationInitialColdkeys` to include the new coldkeys.

### Extrinsic

```rust
pub fn owner_add_initial_coldkeys(
    origin: OriginFor<T>, 
    subnet_id: u32,
    coldkeys: BTreeSet<T::AccountId>
)
```

***

## Remove Initial Coldkeys

Initial coldkeys can be removed.

Call `owner_remove_initial_coldkeys` with the subnet ID you own and a BTreeSet of coldkeys.&#x20;

* This will mutate the `SubnetRegistrationInitialColdkeys` to remove the coldkeys passed through to the function.

{% hint style="info" %}
If you remove a coldkey and the subnet node is already registered, the owner must separately remove the node.
{% endhint %}

### Extrinsic

```rust
pub fn owner_remove_initial_coldkeys(
    origin: OriginFor<T>, 
    subnet_id: u32,
    coldkeys: BTreeSet<T::AccountId>
)
```

***

## Ownership

The owner can transfer ownership in a two-step process.

### Transfer Ownership

Call `transfer_subnet_ownership` with the subnet ID and the account of the new subnet owner.

### Extrinsic

```rust
pub fn transfer_subnet_ownership(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    new_owner: T::AccountId,
)
```

### Accept Ownership

Call `accept_subnet_ownership` with the subnet ID from the coldkey.

### Extrinsic

```rust
pub fn accept_subnet_ownership(
    origin: OriginFor<T>, 
    subnet_id: u32, 
)
```

### Undo Transfer Ownership

An ownership transfer can be undone before the new owner accepts the transfer.

Call `transfer_subnet_ownership` with the zero address as the new owner.

### Extrinsic

```rust
pub fn transfer_subnet_ownership(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    new_owner: T::AccountId, // Zero Address
)
```

***

## Remove Subnet Node

Subnet nodes can be removed.

Call `owner_remove_subnet_node` with the subnet ID.

### Extrinsic

```rust
pub fn owner_remove_subnet_node(
    origin: OriginFor<T>, 
    subnet_id: u32,
    subnet_node_id: u32
)
```

***

## Update Key Type

Update the subnets key type.

Call `owner_update_key_types` with the subnet ID and the set of key types the subnet utilizes.

### Extrinsic

```rust
pub fn owner_update_key_types(
    origin: OriginFor<T>, 
    subnet_id: u32,
    key_types: BTreeSet<KeyType>,
)
```

***

## Update Delegate Stake Percentage

Update the delegate stake percentage.

Call `owner_update_delegate_stake_percentage` with the subnet ID and the new delegate stake percentage.

### Extrinsic

```rust
pub fn owner_update_delegate_stake_percentage(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Update Max Registered Nodes

Update the maximum registered nodes.

Call `owner_update_max_registered_nodes` with the subnet ID and the new maximum registered nodes.

### Extrinsic

```rust
pub fn owner_update_max_registered_nodes(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Add Bootnodes Access

Update the accounts that have access to update the bootnodes.

Call `owner_add_bootnode_access` with the subnet ID and the new maximum registered nodes.

### Extrinsic

```rust
pub fn owner_add_bootnode_access(
    origin: OriginFor<T>,
    subnet_id: u32,
    new_account: T::AccountId,
)
```

***

## Update Target Registrations Per Epoch

Update the target registrations per epoch. This impacts the node registration burn rate.

Call `owner_update_target_registrations_per_epoch` with the subnet ID and the new target node registrations per epoch.

### Extrinsic

```rust
pub fn owner_update_target_registrations_per_epoch(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u32,
)
```

***

## Update Node Burn Rate Alpha

Update the node burn rate alpha. This is a **smoothing factor** (also called a learning rate) that controls how quickly the burn rate adjusts to changes in registration activity

Call `owner_update_node_burn_rate_alpha` with the subnet ID and the new alpha.

### Extrinsic

```rust
pub fn owner_update_node_burn_rate_alpha(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Update Queue Immunity Epochs

Update the queue immunity epochs. This makes nodes immune to being removed via consensus while in the registration queue. See `remove_queue_node_id` in consensus.

Call `owner_update_queue_immunity_epochs` with the subnet ID and the new immunity epochs.

### Extrinsic

```rust
pub fn owner_update_queue_immunity_epochs(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u32,
)
```

***

## Update Bootnodes

Update the subnets' main bootnodes. Owners and accounts with access (See `owner_add_bootnode_access`) and utilize this function.

Call `update_bootnodes` with the subnet ID and the bootnodes to add or remove.

### Extrinsic

```rust
pub fn update_bootnodes(
    origin: OriginFor<T>,
    subnet_id: u32,
    add: BTreeSet<BoundedVec<u8, DefaultMaxVectorLength>>,
    remove: BTreeSet<BoundedVec<u8, DefaultMaxVectorLength>>,
)
```

***

## Update Minimum Subnet Node Reputation

Update the minimum subnet node reputation for the subnet. When nodes are below this threshold, they are removed from the subnet.

Call `owner_update_min_subnet_node_reputation` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_min_subnet_node_reputation(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Subnet Node Min Weight Decrease Reputation Threshold

Update the subnet node minimum weight decrease reputation threshold. When a node is below the minimum weight, its reputation will be decreased based on the `BelowMinWeightDecreaseReputationFactor` (see [Below Minimum Weight Decrease Reputation Factor](#below-minimum-weight-decrease-reputation-factor)).

Call `owner_update_subnet_node_min_weight_decrease_reputation_threshold` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_subnet_node_min_weight_decrease_reputation_threshold(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Below Minimum Weight Decrease Reputation Factor

Update the below minimum weight reputation factor. When a node is below the minimum weight threshold (see [Subnet Node Min Weight Decrease Reputation Threshold](#subnet-node-min-weight-decrease-reputation-threshold)), its reputation will be decreased based on this factor.

Call `owner_update_below_min_weight_decrease_reputation_factor` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_below_min_weight_decrease_reputation_factor(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

## Update Absent Decrease Reputation Factor

Update the subnet node absent decrease reputation factor. When a node is absent from an in-consensus validator proposal, its reputation will be decreased based on this factor.

Call `owner_update_absent_decrease_reputation_factor` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_absent_decrease_reputation_factor(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Update Included Increase Reputation Factor

Update the subnet node included increase reputation factor. When a node is included in an in-consensus validator proposal, its reputation will be increased based on this factor.

Call `owner_update_included_increase_reputation_factor` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_included_increase_reputation_factor(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Update Non Attestor Decrease Reputation Factor

Update the below minimum weight reputation factor. When a node doesn't attest to an in-consensus proposal, its reputation will be decreased based on this factor.

Call `owner_update_non_attestor_decrease_reputation_factor` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_non_attestor_decrease_reputation_factor(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Update Non Consensus Attestor Decrease Reputation Factor

Update the below minimum weight reputation factor. When a node attests to a proposal that is not in consensus, its reputation will be decreased based on this factor.

Call `owner_update_non_consensus_attestor_decrease_reputation_factor` with the subnet ID and the new value.

### Extrinsic

```rust
pub fn owner_update_non_consensus_attestor_decrease_reputation_factor(
    origin: OriginFor<T>,
    subnet_id: u32,
    value: u128,
)
```

***

## Set Emergency Validator Set

Set a temporary [emergency validator set](https://docs.hypertensor.org/network/subnet/emergency-validator-set).

Call `owner_set_emergency_validator_set` with the subnet ID and a vector of subnet node IDs.

### Extrinsic

```rust
pub fn owner_set_emergency_validator_set(
    origin: OriginFor<T>,
    subnet_id: u32,
    mut subnet_node_ids: Vec<u32>
)
```

***

## Revert Emergency Validator Set

Remove the temporary [emergency validator set](https://docs.hypertensor.org/network/subnet/emergency-validator-set).

Call `owner_revert_emergency_validator_set` with the subnet ID.

### Extrinsic

```rust
pub fn owner_revert_emergency_validator_set(
    origin: OriginFor<T>,
    subnet_id: u32,
)
```
