From ccc137ccca5309502c8978dc58a0b5a768933e65 Mon Sep 17 00:00:00 2001
From: Raymond Sukanto <rsukanto@umich.edu>
Date: Wed, 2 Oct 2024 11:43:36 -0400
Subject: [PATCH 1/2] rename convert subnet

---
 cmd/blockchaincmd/convert.go | 36 +++++++++++++++++++-----------------
 cmd/blockchaincmd/deploy.go  |  6 +++---
 pkg/subnet/public.go         | 14 +++++++-------
 3 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/cmd/blockchaincmd/convert.go b/cmd/blockchaincmd/convert.go
index 8306a2beb..979a5a5a8 100644
--- a/cmd/blockchaincmd/convert.go
+++ b/cmd/blockchaincmd/convert.go
@@ -8,24 +8,26 @@ import (
 	"github.com/spf13/cobra"
 )
 
-// avalanche blockchain convert
+// avalanche l1 convert
 func newConvertCmd() *cobra.Command {
 	cmd := &cobra.Command{
-		Use:   "convert [blockchainName]",
-		Short: "Converts an Avalanche blockchain into a SOV (Subnet Only Validator) blockchain",
-		Long: `The blockchain convert command converts a non-SOV Avalanche blockchain (which requires
-subnet validators to have at least 2000 AVAX staked in the Primary Network) into a SOV (Subnet Only 
-Validator) blockchain.
+		Use:   "convert [l1Name]",
+		Short: "Converts an Avalanche L1 into a SOV (Subnet Only Validator) L1",
+		Long: `The l1 convert command converts a non-SOV Avalanche L1 (which requires subnet 
+validators to have at least 2000 AVAX staked in the Primary Network) into an SOV (Subnet Only 
+Validator) L1.
 
-At the end of the call, the Owner Keys .
+Once an L1 is successfully converted into a an SOV, the Owner Keys can no longer be used to modify 
+the L1's validator set. In addition, AddSubnetValidatorTx is disabled on the Subnet going forward. 
+The only action that the Owner key is able to take is removing any L1 validators that were added 
+using AddSubnetValidatorTx previously via RemoveSubnetValidatorTx. 
 
-Avalanche-CLI only supports deploying an individual Blockchain once per network. Subsequent
-attempts to deploy the same Blockchain to the same network (local, Fuji, Mainnet) aren't
-allowed. If you'd like to redeploy a Blockchain locally for testing, you must first call
-avalanche network clean to reset all deployed chain state. Subsequent local deploys
-redeploy the chain with fresh state. You can deploy the same Blockchain to multiple networks,
-so you can take your locally tested Subnet and deploy it on Fuji or Mainnet.`,
-		RunE:              convertSubnet,
+Unless removed by the Owner key, any Subnet Validators added previously with an AddSubnetValidatorTx 
+will continue to validate the Subnet until their End time is reached. Once all Subnet Validators 
+added with AddSubnetValidatorTx are no longer in the validator set, the Owner key is powerless. 
+RegisterL1ValidatorTx and SetL1ValidatorWeightTx must be used to manage the Subnet's 
+validator set going forward.`,
+		RunE:              convertL1,
 		PersistentPostRun: handlePostRun,
 		Args:              cobrautils.ExactArgs(1),
 	}
@@ -58,8 +60,8 @@ so you can take your locally tested Subnet and deploy it on Fuji or Mainnet.`,
 	return cmd
 }
 
-// // convertSubnet is the cobra command run for deploying subnets
-func convertSubnet(cmd *cobra.Command, args []string) error {
+// // convertL1 is the cobra command run for deploying subnets
+func convertL1(cmd *cobra.Command, args []string) error {
 	//blockchainName := args[0]
 	//
 	//if err := CreateBlockchainFirst(cmd, blockchainName, skipCreatePrompt); err != nil {
@@ -387,7 +389,7 @@ func convertSubnet(cmd *cobra.Command, args []string) error {
 	////	return err
 	////}
 	//// TODO: replace with avalanchego subnetValidators once implemented
-	//isFullySigned, convertSubnetTxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertSubnet(
+	//isFullySigned, convertSubnetTxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertL1(
 	//	controlKeys,
 	//	subnetAuthKeys,
 	//	subnetID,
diff --git a/cmd/blockchaincmd/deploy.go b/cmd/blockchaincmd/deploy.go
index dc7c67570..98b49b725 100644
--- a/cmd/blockchaincmd/deploy.go
+++ b/cmd/blockchaincmd/deploy.go
@@ -629,7 +629,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
 		//	return err
 		//}
 		// TODO: replace with avalanchego subnetValidators once implemented
-		isFullySigned, convertSubnetTxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertSubnet(
+		isFullySigned, ConvertL1TxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertL1(
 			controlKeys,
 			subnetAuthKeys,
 			subnetID,
@@ -643,11 +643,11 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
 		}
 
 		savePartialTx = !isFullySigned && err == nil
-		ux.Logger.PrintToUser("ConvertSubnetTx ID: %s", convertSubnetTxID)
+		ux.Logger.PrintToUser("ConvertL1Tx ID: %s", ConvertL1TxID)
 
 		if savePartialTx {
 			if err := SaveNotFullySignedTx(
-				"ConvertSubnetTx",
+				"ConvertL1Tx",
 				tx,
 				chain,
 				subnetAuthKeys,
diff --git a/pkg/subnet/public.go b/pkg/subnet/public.go
index 6b75bff40..eef3c5fd7 100644
--- a/pkg/subnet/public.go
+++ b/pkg/subnet/public.go
@@ -411,15 +411,15 @@ func (d *PublicDeployer) DeployBlockchain(
 	return isFullySigned, id, tx, remainingSubnetAuthKeys, nil
 }
 
-// TODO: update ConvertSubnet once avalanchego implementation is up for ACP77
-func (d *PublicDeployer) ConvertSubnet(
+// TODO: update ConvertL1 once avalanchego implementation is up for ACP77
+func (d *PublicDeployer) ConvertL1(
 	controlKeys []string,
 	subnetAuthKeysStrs []string,
 	subnetID ids.ID,
 	chainID ids.ID,
 	// validators []blockchaincmd.SubnetValidator,
 ) (bool, ids.ID, *txs.Tx, []string, error) {
-	ux.Logger.PrintToUser("Now calling ConvertSubnet Tx...")
+	ux.Logger.PrintToUser("Now calling ConvertL1 Tx...")
 
 	wallet, err := d.loadCacheWallet(subnetID)
 	if err != nil {
@@ -431,12 +431,12 @@ func (d *PublicDeployer) ConvertSubnet(
 		return false, ids.Empty, nil, nil, fmt.Errorf("failure parsing subnet auth keys: %w", err)
 	}
 
-	showLedgerSignatureMsg(d.kc.UsesLedger, d.kc.HasOnlyOneKey(), "ConvertSubnet transaction")
+	showLedgerSignatureMsg(d.kc.UsesLedger, d.kc.HasOnlyOneKey(), "ConvertL1 transaction")
 
 	var validatorManagerAddress []byte
 	// var validators []avalanchego.SubnetValidator
 
-	tx, err := d.createConvertSubnetTx(subnetAuthKeys, subnetID, chainID, validatorManagerAddress, wallet)
+	tx, err := d.createConvertL1Tx(subnetAuthKeys, subnetID, chainID, validatorManagerAddress, wallet)
 	if err != nil {
 		return false, ids.Empty, nil, nil, err
 	}
@@ -605,7 +605,7 @@ func (d *PublicDeployer) createBlockchainTx(
 	return &tx, nil
 }
 
-func (d *PublicDeployer) createConvertSubnetTx(
+func (d *PublicDeployer) createConvertL1Tx(
 	subnetAuthKeys []ids.ShortID,
 	subnetID ids.ID,
 	chainID ids.ID,
@@ -615,7 +615,7 @@ func (d *PublicDeployer) createConvertSubnetTx(
 ) (*txs.Tx, error) {
 	//fxIDs := make([]ids.ID, 0)
 	//options := d.getMultisigTxOptions(subnetAuthKeys)
-	//unsignedTx, err := wallet.P().Builder().NewConvertSubnetTx(
+	//unsignedTx, err := wallet.P().Builder().NewConvertL1Tx(
 	//	subnetID,
 	//chainID,
 	//address,

From a9dc3eaabdc02b9818ec58ba224d0075b1f5b921 Mon Sep 17 00:00:00 2001
From: Raymond Sukanto <rsukanto@umich.edu>
Date: Wed, 2 Oct 2024 12:00:23 -0400
Subject: [PATCH 2/2] rename to l1

---
 cmd/blockchaincmd/add_validator.go    |  2 +-
 cmd/blockchaincmd/blockchain.go       |  2 +-
 cmd/blockchaincmd/change_weight.go    | 14 +++++++-------
 cmd/blockchaincmd/remove_validator.go |  2 +-
 pkg/subnet/public.go                  |  8 ++++----
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/cmd/blockchaincmd/add_validator.go b/cmd/blockchaincmd/add_validator.go
index cde448993..12cfbff40 100644
--- a/cmd/blockchaincmd/add_validator.go
+++ b/cmd/blockchaincmd/add_validator.go
@@ -267,7 +267,7 @@ func CallAddValidator(
 	if err != nil {
 		return err
 	}
-	tx, err := deployer.RegisterSubnetValidator(balance, blsInfo, changeOwner, message)
+	tx, err := deployer.RegisterL1Validator(balance, blsInfo, changeOwner, message)
 	if err != nil {
 		return err
 	}
diff --git a/cmd/blockchaincmd/blockchain.go b/cmd/blockchaincmd/blockchain.go
index 54989cd6c..8d937ee27 100644
--- a/cmd/blockchaincmd/blockchain.go
+++ b/cmd/blockchaincmd/blockchain.go
@@ -61,6 +61,6 @@ manage your Blockchain configurations and live deployments.`,
 	// subnet changeOwner
 	cmd.AddCommand(newChangeOwnerCmd())
 	// subnet changeWeight
-	cmd.AddCommand(newChangeWeightCmd())
+	cmd.AddCommand(newSetWeightCmd())
 	return cmd
 }
diff --git a/cmd/blockchaincmd/change_weight.go b/cmd/blockchaincmd/change_weight.go
index 3e73a95ef..46049160d 100644
--- a/cmd/blockchaincmd/change_weight.go
+++ b/cmd/blockchaincmd/change_weight.go
@@ -20,15 +20,15 @@ import (
 
 var ()
 
-// avalanche blockchain addValidator
-func newChangeWeightCmd() *cobra.Command {
+// avalanche blockchain setWeight
+func newSetWeightCmd() *cobra.Command {
 	cmd := &cobra.Command{
-		Use:   "changeWeight [blockchainName] [nodeID]",
-		Short: "Changes the weight of a Subnet validator",
-		Long: `The blockchain changeWeight command changes the weight of a Subnet Validator.
+		Use:   "setWeight [blockchainName] [nodeID]",
+		Short: "Updates the weight of a Subnet validator",
+		Long: `The blockchain changeWeight command updates the weight of a Subnet Validator.
 
 The Subnet has to be a Proof of Authority Subnet-Only Validator Subnet.`,
-		RunE: updateWeight,
+		RunE: setWeight,
 		Args: cobrautils.ExactArgs(2),
 	}
 	networkoptions.AddNetworkFlagsToCmd(cmd, &globalNetworkFlags, true, addValidatorSupportedNetworkOptions)
@@ -41,7 +41,7 @@ The Subnet has to be a Proof of Authority Subnet-Only Validator Subnet.`,
 	return cmd
 }
 
-func updateWeight(_ *cobra.Command, args []string) error {
+func setWeight(_ *cobra.Command, args []string) error {
 	blockchainName := args[0]
 	_, err := ids.NodeIDFromString(args[1])
 	if err != nil {
diff --git a/cmd/blockchaincmd/remove_validator.go b/cmd/blockchaincmd/remove_validator.go
index df6c077b7..5fe8ed3d3 100644
--- a/cmd/blockchaincmd/remove_validator.go
+++ b/cmd/blockchaincmd/remove_validator.go
@@ -208,7 +208,7 @@ func removeValidatorSOV(deployer *subnet.PublicDeployer, network models.Network,
 	if err != nil {
 		return err
 	}
-	tx, err := deployer.SetSubnetValidatorWeight(message)
+	tx, err := deployer.SetL1ValidatorWeight(message)
 	if err != nil {
 		return err
 	}
diff --git a/pkg/subnet/public.go b/pkg/subnet/public.go
index eef3c5fd7..82bc424bd 100644
--- a/pkg/subnet/public.go
+++ b/pkg/subnet/public.go
@@ -123,11 +123,11 @@ func (d *PublicDeployer) AddValidatorNonSOV(
 //		//   - Weight
 //		Message warp.Message `json:"message"`
 //	}
-func (d *PublicDeployer) SetSubnetValidatorWeight(
+func (d *PublicDeployer) SetL1ValidatorWeight(
 	message warp.Message,
 ) (*txs.Tx, error) {
 	// create tx
-	//unsignedTx, err := wallet.P().Builder().NewSetSubnetValidatorWeightTx(args...)
+	//unsignedTx, err := wallet.P().Builder().NewSetL1ValidatorWeightTx(args...)
 	//if err != nil {
 	//	return nil, fmt.Errorf("error building tx: %w", err)
 	//}
@@ -141,14 +141,14 @@ func (d *PublicDeployer) SetSubnetValidatorWeight(
 	return nil, nil
 }
 
-func (d *PublicDeployer) RegisterSubnetValidator(
+func (d *PublicDeployer) RegisterL1Validator(
 	balance uint64,
 	signer signer.Signer,
 	changeOwner fx.Owner,
 	message warp.Message,
 ) (*txs.Tx, error) {
 	// create tx
-	//unsignedTx, err := wallet.P().Builder().NewRegisterSubnetValidatorTx(args...)
+	//unsignedTx, err := wallet.P().Builder().NewRegisterL1ValidatorTx(args...)
 	//if err != nil {
 	//	return nil, fmt.Errorf("error building tx: %w", err)
 	//}