What-If Analysis of Subnet Decentralization¶
The WhatifDecentralization subcommand in the DRE tool allows users to perform "what-if" scenarios on the membership of a subnet and see the effect that the membership change would have on the subnet decentralization, without actually applying them, enabling better decision-making and risk assessment.
Command Structure¶
The whatif-decentralization command is a subcommand of the subnet command. The command accepts various parameters that specify the nodes to be added or removed, as well as specifying the subnet on which the analysis is performed.
Usage¶
subnet whatif-decentralization <SUBNET_ID> [--add-nodes <node-id...>] [--remove-nodes <node-id...>] [--subnet-nodes-initial <node-id...>]
Parameters:¶
-
<SUBNET_ID>: The ID of the subnet where the analysis is performed. This parameter is required.Example:
tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe -
--add-nodes: A list of node IDs that you want to simulate adding to the subnet.Example:
--add-nodes yahq2-6rnmm-n7ubm-q76zd-256dl-5f7k6-jxx5l-njyo2-hl7tk-sqcet-6ae tn2ne-tskw6-dfk3n-urdmd-krtq6-tcebq-dx2xr-kokq7-eood7-fadkg-5qewould show the impact on subnet decentralization if we add nodes
yahq2andtn2neto the subnet. -
--remove-nodes: A list of node IDs that you want to simulate removing from the subnet.--remove-nodes gvm7l-ds4n6-vkyjn-gwalp-3vdo6-qfmq7-pxhu4-zvqcu-ozvb7-qz3gr-vqe w2sev-mtuls-aa7m5-cdjgi-5vipg-2jn7i-4awvf-o6suu-73ebs-sw5db-kqewould show the impact on subnet decentralization if we remove nodes
gvm7landw2sevfrom the subnet. -
--subnet-nodes-initial: A list of node IDs representing the initial state of the subnet. This can be used to override the current list of nodes in the subnet for the purpose of analysis.Example:
--subnet-nodes-initial ncr4b-rasb7-tueb3-n4uos-5nxou-3wbxv-xmyt3-wfdsd-vu4b6-5x3cp-aqe ouffe-miylc-6zcwl-afv2d-lai62-qwzns-xtlji-p7pu2-qkx2e-x72y2-sqe tm3pc-2bjsx-hhv3v-fsrt7-wotdj-nbu3t-ewloq-uporp-tacou-lupdn-oaeNote that it is necessary to provide the complete list of nodes in the subnet, so most likely you will need to provide 13 or more nodes in the list.
Please note that the number of nodes in the subnet should typically stay unchanged.
Example Usage¶
-
Querying decentralization of an existing subnet:
-
Adding and Removing Nodes from a Subnet: To simulate the effect of adding nodes
node4andnode5and removing nodesnode6andnode7from subnetsubnet123, use the following command: -
Specifying Initial Nodes: If you want to override the current nodes in the subnet with a custom set for the analysis:
How It Works¶
- The command creates a
ChangeSubnetMembershipPayloadthat represents the proposed changes. - The specified
SUBNET_IDis used as the target subnet for the analysis. - If the
subnet-nodes-initialis specified, the analysis uses this custom list of nodes as the starting point; otherwise, it uses the current nodes in the subnet. - The
decentralization_changefunction then performs the analysis based on the information from the NNS registry, simulating the removal and addition of nodes, and prints the results.