Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subnet describe for etna #2238

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 51 additions & 44 deletions cmd/blockchaincmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
}
deployer.CleanCacheWallet()
managerAddress := common.HexToAddress(validatormanager.ValidatorContractAddress)
isFullySigned, ConvertL1TxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertL1(

Check warning on line 627 in cmd/blockchaincmd/deploy.go

View workflow job for this annotation

GitHub Actions / Lint

unexported-naming: the symbol ConvertL1TxID is local, its name should start with a lowercase letter (revive)
controlKeys,
subnetAuthKeys,
subnetID,
Expand Down Expand Up @@ -656,7 +656,7 @@

bar, err := ux.TimedProgressBar(
30*time.Second,
"Waiting for Blockchain to be converted into Subnet Only Validator (SOV) Blockchain ...",
"Waiting for L1 to be converted into sovereign blockchain ...",
2,
)
if err != nil {
Expand Down Expand Up @@ -686,54 +686,61 @@
return err
}

clusterName, err := node.GetClusterNameFromList(app)
if err != nil {
return err
}
if !generateNodeID {
clusterName, err := node.GetClusterNameFromList(app)
if err != nil {
return err
}

if err = node.SyncSubnet(app, clusterName, blockchainName, true, nil); err != nil {
return err
}
if err = node.SyncSubnet(app, clusterName, blockchainName, true, nil); err != nil {
return err
}

if err := node.WaitForHealthyCluster(app, clusterName, node.HealthCheckTimeout, node.HealthCheckPoolTime); err != nil {
return err
}
if err := node.WaitForHealthyCluster(app, clusterName, node.HealthCheckTimeout, node.HealthCheckPoolTime); err != nil {
return err
}

chainSpec := contract.ChainSpec{
BlockchainName: blockchainName,
}
_, genesisPrivateKey, err := contract.GetEVMSubnetPrefundedKey(
app,
network,
chainSpec,
)
if err != nil {
return err
}
rpcURL, _, err := contract.GetBlockchainEndpoints(
app,
network,
chainSpec,
true,
false,
)
if err != nil {
return err
}
if err := validatormanager.SetupPoA(
app,
network,
rpcURL,
contract.ChainSpec{
chainSpec := contract.ChainSpec{
BlockchainName: blockchainName,
},
genesisPrivateKey,
common.HexToAddress(sidecar.PoAValidatorManagerOwner),
avaGoBootstrapValidators,
); err != nil {
return err
}
_, genesisPrivateKey, err := contract.GetEVMSubnetPrefundedKey(
app,
network,
chainSpec,
)
if err != nil {
return err
}
rpcURL, _, err := contract.GetBlockchainEndpoints(
app,
network,
chainSpec,
true,
false,
)
if err != nil {
return err
}
if err := validatormanager.SetupPoA(
app,
network,
rpcURL,
contract.ChainSpec{
BlockchainName: blockchainName,
},
genesisPrivateKey,
common.HexToAddress(sidecar.PoAValidatorManagerOwner),
avaGoBootstrapValidators,
); err != nil {
return err
}
ux.Logger.GreenCheckmarkToUser("L1 is successfully converted to sovereign blockchain")
} else {
ux.Logger.GreenCheckmarkToUser("Generated Node ID and BLS info for bootstrap validator(s)")
ux.Logger.PrintToUser("To convert L1 to sovereign blockchain, create the corresponding Avalanche node(s) with the provided Node ID and BLS Info")
ux.Logger.PrintToUser("Created Node ID and BLS Info can be found at %s", app.GetSidecarPath(blockchainName))
ux.Logger.PrintToUser("Once the Avalanche Node(s) are created and are tracking the blockchain, call `avalanche contract initPoaManager %s` to finish converting L1 to sovereign blockchain", blockchainName)
}
ux.Logger.GreenCheckmarkToUser("L1 is successfully converted to sovereign blockchain")
} else {
if err := app.UpdateSidecarNetworks(&sidecar, network, subnetID, blockchainID, "", "", nil); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/blockchaincmd/prompt_genesis_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ func promptBootstrapValidators(network models.Network) ([]models.SubnetValidator
}
var setUpNodes bool
if generateNodeID {
setUpNodes = true
setUpNodes = false
} else {
setUpNodes, err = promptSetUpNodes()
if err != nil {
return nil, err
}
generateNodeID = !setUpNodes
}
previousAddr := ""
for len(subnetValidators) < numBootstrapValidators {
Expand Down
1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const (
PrivateAccess HTTPAccess = false
FujiAPIEndpoint = "https://api.avax-test.network"
MainnetAPIEndpoint = "https://api.avax.network"
EtnaAPIEndpoint = "https://etna.avax-dev.network"

// this depends on bootstrap snapshot
LocalAPIEndpoint = "http://127.0.0.1:9650"
Expand Down
7 changes: 7 additions & 0 deletions pkg/models/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
Fuji
Local
Devnet
Etna
)

func (nk NetworkKind) String() string {
Expand All @@ -32,6 +33,8 @@ func (nk NetworkKind) String() string {
return "Local Network"
case Devnet:
return "Devnet"
case Etna:
Copy link
Collaborator

Choose a reason for hiding this comment

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

pls wait for #2233 to be merged as this PR implements this in a different way

return "Devnet https://etna.avax-dev.network"
}
return "invalid network"
}
Expand Down Expand Up @@ -76,6 +79,10 @@ func NewMainnetNetwork() Network {
return NewNetwork(Mainnet, avagoconstants.MainnetID, constants.MainnetAPIEndpoint, "")
}

func NewEtnaNetwork() Network {
return NewNetwork(Etna, 76, constants.EtnaAPIEndpoint, "")
}

func NewNetworkFromCluster(n Network, clusterName string) Network {
return NewNetwork(n.Kind, n.ID, n.Endpoint, clusterName)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/networkoptions/network_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func GetNetworkFromSidecarNetworkName(
return models.NewFujiNetwork(), nil
case networkName == models.Mainnet.String():
return models.NewMainnetNetwork(), nil
case networkName == models.Etna.String():
return models.NewEtnaNetwork(), nil
}
return models.UndefinedNetwork, fmt.Errorf("unsupported network name")
}
Expand Down
Loading