Skip to content

Commit

Permalink
enable change owner for sov (#2621)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero authored Feb 21, 2025
1 parent 3b253af commit 394ce8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
11 changes: 2 additions & 9 deletions cmd/blockchaincmd/change_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package blockchaincmd

import (
"errors"
"fmt"

"github.com/ava-labs/avalanche-cli/pkg/cobrautils"
Expand All @@ -15,6 +14,7 @@ import (
"github.com/ava-labs/avalanche-cli/pkg/utils"
"github.com/ava-labs/avalanche-cli/pkg/ux"
"github.com/ava-labs/avalanchego/ids"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -90,22 +90,15 @@ func changeOwner(_ *cobra.Command, args []string) error {
return err
}

if sc.Sovereign {
return errors.New("avalanche blockchain changeOwner is not applicable to sovereign blockchains")
}

subnetID := sc.Networks[network.Name()].SubnetID
if subnetID == ids.Empty {
return errNoSubnetID
}

isPermissioned, currentControlKeys, currentThreshold, err := txutils.GetOwners(network, subnetID)
_, currentControlKeys, currentThreshold, err := txutils.GetOwners(network, subnetID)
if err != nil {
return err
}
if !isPermissioned {
return ErrNotPermissionedSubnet
}

// add control keys to the keychain whenever possible
if err := kc.AddAddresses(currentControlKeys); err != nil {
Expand Down
6 changes: 2 additions & 4 deletions cmd/blockchaincmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,11 @@ func PrintSubnetInfo(blockchainName string, onlyLocalnetInfo bool) error {
}
if data.SubnetID != ids.Empty {
t.AppendRow(table.Row{net, "SubnetID", data.SubnetID.String()})
isPermissioned, owners, threshold, err := txutils.GetOwners(network, data.SubnetID)
_, owners, threshold, err := txutils.GetOwners(network, data.SubnetID)
if err != nil {
return err
}
if isPermissioned {
t.AppendRow(table.Row{net, fmt.Sprintf("Owners (Threhold=%d)", threshold), strings.Join(owners, "\n")})
}
t.AppendRow(table.Row{net, fmt.Sprintf("Owners (Threhold=%d)", threshold), strings.Join(owners, "\n")})
}
if data.BlockchainID != ids.Empty {
hexEncoding := "0x" + hex.EncodeToString(data.BlockchainID[:])
Expand Down

0 comments on commit 394ce8e

Please sign in to comment.