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 generate new node id and bls info #2237

Merged
merged 2 commits into from
Oct 11, 2024
Merged
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
99 changes: 53 additions & 46 deletions cmd/blockchaincmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
}
deployer.CleanCacheWallet()
managerAddress := common.HexToAddress(validatormanager.ValidatorContractAddress)
isFullySigned, ConvertL1TxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertL1(
isFullySigned, convertL1TxID, tx, remainingSubnetAuthKeys, err := deployer.ConvertL1(
controlKeys,
subnetAuthKeys,
subnetID,
Expand All @@ -638,7 +638,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
}

savePartialTx = !isFullySigned && err == nil
ux.Logger.PrintToUser("ConvertL1Tx ID: %s", ConvertL1TxID)
ux.Logger.PrintToUser("ConvertL1Tx ID: %s", convertL1TxID)

if savePartialTx {
if err := SaveNotFullySignedTx(
Expand All @@ -656,7 +656,7 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {

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 @@ func deployBlockchain(cmd *cobra.Command, args []string) error {
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
Loading