ava-labs / avalanche-cli

Other
99 stars 56 forks source link

Standarize subnet deploy and subnet describe output #1968

Open martineckardt opened 2 weeks ago

martineckardt commented 2 weeks ago

We have two outputs describing a Subnet that communicate similar information, but are formatted very differently and some information is only shown on one output.

Current Behaviour

Output of avalanche subnet deploy

...

Blockchain ready to use

+-------------------+----------------------------------------------------------------------------------------------------------------------------+
|                                                               mysubnet RPC URLs                                                                |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+
| Localhost         | http://127.0.0.1:9650/ext/bc/mysubnet/rpc                                                                                  |
+                   +----------------------------------------------------------------------------------------------------------------------------+
|                   | http://127.0.0.1:9650/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc                                        |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+
| Codespace         | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/mysubnet/rpc                                           |
+                   +----------------------------------------------------------------------------------------------------------------------------+
|                   | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+

+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
|                                                                  Nodes                                                                  |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| Name  | Node ID                                  | Localhost Endpoint    | Codespace Endpoint                                           |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node1 | NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg | http://127.0.0.1:9650 | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node2 | NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ | http://127.0.0.1:9652 | https://super-funicular-q7qvgwr656jc9vj6-9652.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node3 | NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN | http://127.0.0.1:9654 | https://super-funicular-q7qvgwr656jc9vj6-9654.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node4 | NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu | http://127.0.0.1:9656 | https://super-funicular-q7qvgwr656jc9vj6-9656.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node5 | NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5 | http://127.0.0.1:9658 | https://super-funicular-q7qvgwr656jc9vj6-9658.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+

Browser Extension connection details (any node URL from above works):
RPC URL:           http://127.0.0.1:9650/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc
Codespace RPC URL: https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc
Funded address:    0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC with 1000000 (10^18) - private key: 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027
Funded address:    0xC21d6a60062c7479Dc6A8439Fb532fF312654008 with 600 (10^18)
Network name:      mysubnet
Chain ID:          99999
Currency Symbol:   TOK

Output of avalanche subnet describe


 _____       _        _ _
|  __ \     | |      (_) |
| |  | | ___| |_ __ _ _| |___
| |  | |/ _ \ __/ _  | | / __|
| |__| |  __/ || (_| | | \__ \
|_____/ \___|\__\__,_|_|_|___/
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
|           PARAMETER            |                                                           VALUE                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Subnet Name                    | mysubnet                                                                                                                   |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| ChainID                        | 99999                                                                                                                      |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Token Name                     | TOK Token                                                                                                                  |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Token Symbol                   | TOK                                                                                                                        |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| VM Version                     | v0.6.6                                                                                                                     |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| VM ID                          | qDNsVQJfGpi2RfCcESbeZauGqPVjtXwoopVMtrGkdoUxmFKov                                                                          |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network SubnetID         | 26eqgD4Kt1MvTKXC9BDjEwBAfhcBcHCKj2EXjR2UuFpSWoAHhw                                                                         |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network RPC URL          | http://127.0.0.1:9650/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc                                        |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Codespace RPC URL              | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network BlockchainID     | 232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ                                                                         |
| (CB58)                         |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network BlockchainID     | 0x884c7e8415650ee9a2bb6ce5a6a0ccf271c8a8dbd089b2dea317380819a6fd65                                                         |
| (HEX)                          |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf                                                                                 |
| Messenger Address              |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0x47F1Ebb116Dcbe0E6ac90ea74bf163B45fE5d59a                                                                                 |
| Registry Address               |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+

  _____              _____             __ _
 / ____|            / ____|           / _(_)
| |  __  __ _ ___  | |     ___  _ __ | |_ _  __ _
| | |_ |/ _  / __| | |    / _ \| '_ \|  _| |/ _  |
| |__| | (_| \__ \ | |___| (_) | | | | | | | (_| |
 \_____|\__,_|___/  \_____\___/|_| |_|_| |_|\__, |
                                             __/ |
                                            |___/
+--------------------------+-------------+
|      GAS PARAMETER       |    VALUE    |
+--------------------------+-------------+
| GasLimit                 |     8000000 |
+--------------------------+-------------+
| MinBaseFee               | 25000000000 |
+--------------------------+-------------+
| TargetGas (per 10s)      |    15000000 |
+--------------------------+-------------+
| BaseFeeChangeDenominator |          36 |
+--------------------------+-------------+
| MinBlockGasCost          |           0 |
+--------------------------+-------------+
| MaxBlockGasCost          |     1000000 |
+--------------------------+-------------+
| TargetBlockRate          |           2 |
+--------------------------+-------------+
| BlockGasCostStep         |      200000 |
+--------------------------+-------------+

          _         _
    /\   (_)       | |
   /  \   _ _ __ __| |_ __ ___  _ __
  / /\ \ | | '__/ _  | '__/ _ \| '_ \
 / ____ \| | | | (_| | | | (_) | |_) |
/_/    \_\_|_|  \__,_|_|  \___/| .__/
                               | |
                               |_|
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
|          DESCRIPTION           |                  ADDRESS                   | AIRDROP AMOUNT (10^18) |   AIRDROP AMOUNT (WEI)    |                           PRIVATE KEY                            |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
| Main funded account EWOQ       | 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |                1000000 | 1000000000000000000000000 | 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
| Teleporter deploys             | 0xC21d6a60062c7479Dc6A8439Fb532fF312654008 |                    600 |     600000000000000000000 | ac13a731d93b0fefca994a3a735121e1e45ca2c59b55c4679c01235ffffa60f3 |
| cli-teleporter-deployer        |                                            |                        |                           |                                                                  |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+

  _____                                    _ _
 |  __ \                                  (_) |
 | |__) | __ ___  ___ ___  _ __ ___  _ __  _| | ___  ___
 |  ___/ '__/ _ \/ __/ _ \| '_   _ \| '_ \| | |/ _ \/ __|
 | |   | | |  __/ (_| (_) | | | | | | |_) | | |  __/\__ \
 |_|   |_|  \___|\___\___/|_| |_| |_| .__/|_|_|\___||___/
                                    | |
                                    |_|

+------------+-----------------+-------------------+
| PRECOMPILE | ADMIN ADDRESSES | ENABLED ADDRESSES |
+------------+-----------------+-------------------+
| Warp       | n/a             | n/a               |
+------------+-----------------+-------------------+

Problem

Not all information is available and developers have to understand both formats. In the academy our instructions are often saying "use avalanche subnet deploy" and shortly after for example "get the Teleleporter Messenger address by using avalanche subnet describe".

Suggested Solution

Let's create one subnet description format that is used after avalanche subnet deploy and avalanche subnet describe:

+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
|                                                               MYSUBNET                                                                                    |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Subnet Name                    | mysubnet                                                                                                                   |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| ChainID                        | 99999                                                                                                                      |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| VM ID                          | qDNsVQJfGpi2RfCcESbeZauGqPVjtXwoopVMtrGkdoUxmFKov                                                                          |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| VM Version                     | v0.6.6                                                                                                                     |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network SubnetID         | 26eqgD4Kt1MvTKXC9BDjEwBAfhcBcHCKj2EXjR2UuFpSWoAHhw                                                                         |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network BlockchainID     | 232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ                                                                         |
| (CB58)                         |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network BlockchainID     | 0x884c7e8415650ee9a2bb6ce5a6a0ccf271c8a8dbd089b2dea317380819a6fd65                                                         |
| (HEX)                          |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+

+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
|                                                               TELEPORTER                                                                                    |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf                                                                                 |
| Messenger Address              |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Local Network Teleporter       | 0x47F1Ebb116Dcbe0E6ac90ea74bf163B45fE5d59a                                                                                 |
| Registry Address               |                                                                                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+

+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
|                                                                 TOKEN                                                                                    |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Token Name                     | TOK Token                                                                                                                  |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+
| Token Symbol                   | TOK                                                                                                                        |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------+

+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
|                                                                                    INITIAL TOKEN ALLOCATION                                                                        |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
|          DESCRIPTION           |                  ADDRESS                   |  AMOUNT (10^18) |    AMOUNT (WEI)    |                           PRIVATE KEY                            |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
| Main funded account EWOQ       | 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |                1000000 | 1000000000000000000000000 | 56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027 |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
| Teleporter deploys             | 0xC21d6a60062c7479Dc6A8439Fb532fF312654008 |                    600 |     600000000000000000000 | ac13a731d93b0fefca994a3a735121e1e45ca2c59b55c4679c01235ffffa60f3 |
| cli-teleporter-deployer        |                                            |                        |                           |                                                                  |
+--------------------------------+--------------------------------------------+------------------------+---------------------------+------------------------------------------------------------------+
Changes: 
- Show Address and Private Key in one column with line break to avoid such a large table width
- Remove word "Airdrop" for amount columns to save width

+------------+-----------------+-------------------+
|                   PRECOMPILES                    |
+------------+-----------------+-------------------+
| PRECOMPILE | ADMIN ADDRESSES | ENABLED ADDRESSES |
+------------+-----------------+-------------------+
| Warp       | n/a             | n/a               |
+------------+-----------------+-------------------+
Changes:
- Also show manager addresses here

+-------------------+----------------------------------------------------------------------------------------------------------------------------+
|                                                               mysubnet RPC URLs                                                                |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+
| Localhost         | http://127.0.0.1:9650/ext/bc/mysubnet/rpc                                                                                  |
+                   +----------------------------------------------------------------------------------------------------------------------------+
|                   | http://127.0.0.1:9650/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc                                        |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+
| Codespace         | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/mysubnet/rpc                                           |
+                   +----------------------------------------------------------------------------------------------------------------------------+
|                   | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev/ext/bc/232a4fJpeVQdkXVvVWM2r3pQeV6pTBgLWFS1RSxARwkVGxzHtZ/rpc |
+-------------------+----------------------------------------------------------------------------------------------------------------------------+

+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
|                                                                  Nodes                                                                  |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| Name  | Node ID                                  | Localhost Endpoint    | Codespace Endpoint                                           |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node1 | NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg | http://127.0.0.1:9650 | https://super-funicular-q7qvgwr656jc9vj6-9650.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node2 | NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ | http://127.0.0.1:9652 | https://super-funicular-q7qvgwr656jc9vj6-9652.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node3 | NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN | http://127.0.0.1:9654 | https://super-funicular-q7qvgwr656jc9vj6-9654.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node4 | NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu | http://127.0.0.1:9656 | https://super-funicular-q7qvgwr656jc9vj6-9656.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+
| node5 | NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5 | http://127.0.0.1:9658 | https://super-funicular-q7qvgwr656jc9vj6-9658.app.github.dev |
+-------+------------------------------------------+-----------------------+--------------------------------------------------------------+

|       WALLET CONNECTION       |
|-----------------  |---    |
| Network RPC URL   | Show localhost with alias if not in Codespace, otherwise show codespace URL with alias and note "Please make sure to set visibility of port 9650 to public"   |
| Network Name      |   mysubnet    |
| Chain ID          |   9999    |
| Token Symbol      |   Tok |
| Token Name        |   Tok Token   |