Skip to content

Comments

Convert Subnet To L1#2589

Merged
sukantoraymond merged 22 commits intomainfrom
convert-cmd
Feb 6, 2025
Merged

Convert Subnet To L1#2589
sukantoraymond merged 22 commits intomainfrom
convert-cmd

Conversation

@sukantoraymond
Copy link
Contributor

@sukantoraymond sukantoraymond commented Jan 31, 2025

Convert cmd avalanche blockchain convert converts a subnet into a sovereign L1

Before proceeding:

  • Ensure that the nodes intended to be bootstrap validators of sovereign L1 are tracking the blockchain.

To check, ssh into each of the nodes and go to ./avalanchego/configs/node.json. Ensure that the field track-subnets has value of the Blockchain ID of your blockchain.

  • That there is a publicly accessible RPC URL

This can be done through:

  • Setting up an API node that is tracking the blockchain. The RPC URL will look like http://API_NODE_IP_ADDRESS:9650/ext/bc/BLOCKCHAIN_ID/rpc

  • Or Make one of the bootstrap validators publicly accessible (http-host: 0.0.0.0), but this is not recommended for security reasons. The RPC URL will look like http://NODE_IP_ADDRESS:9650/ext/bc/BLOCKCHAIN_ID/rpc

Usage (for mult-sig):

./bin/avalanche blockchain convert <subnetName>

This command will create a file at specified output destination that contains the partially signed tx. Send this file to be signed by the remaining signers.

The remaining signers can sign this file by calling avalanche transaction sign --input-tx-filepath <filePath>.

Once everyone has signed, commit the tx by calling avalanche transaction commit --input-tx-filepath <filePath>. The command will return the ConvertToL1 Tx ID.

Once this part is complete, call ./bin/avalanche contract initValidatorManager <blockchainName> to initialize validator manager (this part is pending)

@sukantoraymond sukantoraymond marked this pull request as ready for review February 3, 2025 16:19
Copy link
Collaborator

@felipemadero felipemadero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably move the new functions, used both by deploy and convert, to helpers

partialSync, ok := partialSyncI.(bool)
if ok {
avagoConf.PartialSync = partialSync
if !ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this value not bool? probably we want to fix it on the input json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets just leave this as is

networkoptions.NonLocalSupportedNetworkOptions,
"",
)
setGlobalNetworkFlags(network)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this should be needed. Remaining code should use the network object, not the flags.
Can you fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed, otherwise it won't work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many functions in nodecmd is checking globalNetworkFlags for network

"please create your local node again and call blockchain deploy command again", err)
}
}
if err = HandleUsingLocalMachine(network, blockchainName, deployBalance, availableBalance); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give this a better name? What is the function doing? Something like StartLocalMachineNode or maybe better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

return nil
}

func InitializeValidatorManager(blockchainName, validatorManagerOwner string, subnetID, blockchainID ids.ID, network models.Network, avaGoBootstrapValidators []*txs.ConvertSubnetToL1Validator, pos bool) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls split arguments in lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

return tracked, nil
}

func convertSubnetToL1(bootstrapValidators []models.SubnetValidator, deployer *subnet.PublicDeployer, subnetID, blockchainID ids.ID, network models.Network, chain string, sidecar models.Sidecar, controlKeysList, subnetAuthKeysList []string) ([]*txs.ConvertSubnetToL1Validator, bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

* custom validator manager

* fix lint

* fix lint

* fix lint

* fix e2e

* address comments

* address comments

* address comments

* address errors

* address errors
@sukantoraymond sukantoraymond merged commit 9c4cd94 into main Feb 6, 2025
37 checks passed
@sukantoraymond sukantoraymond deleted the convert-cmd branch February 6, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants