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: Error in node update separate commands when new admin key is not supplied #854

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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
3 changes: 1 addition & 2 deletions src/commands/node/handlers.ts
Original file line number Diff line number Diff line change
@@ -196,13 +196,13 @@ export class NodeCommandHandlers {
return [
this.tasks.sendNodeUpdateTransaction(),
this.tasks.sendPrepareUpgradeTransaction(),
this.tasks.downloadNodeGeneratedFiles(),
this.tasks.sendFreezeUpgradeTransaction(),
]
}

updateExecuteTasks (argv) {
return [
this.tasks.downloadNodeGeneratedFiles(),
this.tasks.prepareStagingDirectory('allNodeAliases'),
this.tasks.copyNodeKeysToSecrets(),
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
@@ -319,7 +319,6 @@ export class NodeCommandHandlers {
const action = helpers.commandActionBuilder([
this.tasks.initialize(argv, updateConfigBuilder.bind(this), lease),
this.tasks.loadContextData(argv, NodeCommandHandlers.UPDATE_CONTEXT_FILE, helpers.updateLoadContextParser),
this.tasks.loadAdminKey(),
...this.updateSubmitTransactionsTasks(argv)
], {
concurrent: false,
8 changes: 7 additions & 1 deletion src/core/helpers.ts
Original file line number Diff line number Diff line change
@@ -384,6 +384,7 @@ export function updateSaveContextParser (ctx: { config: NodeUpdateConfigClass, u
const exportedCtx: any = {}

const config = /** @type {NodeUpdateConfigClass} **/ ctx.config
exportedCtx.adminKey = config.adminKey.toString()
exportedCtx.newAdminKey = config.newAdminKey.toString()
exportedCtx.freezeAdminPrivateKey = config.freezeAdminPrivateKey.toString()
exportedCtx.treasuryKey = config.treasuryKey.toString()
@@ -409,9 +410,14 @@ export function updateSaveContextParser (ctx: { config: NodeUpdateConfigClass, u
*/
export function updateLoadContextParser (ctx: { config: NodeUpdateConfigClass, upgradeZipHash: any }, ctxData: any) {
const config = ctx.config
config.newAdminKey = PrivateKey.fromStringED25519(ctxData.newAdminKey)

if (ctxData.newAdminKey && ctxData.newAdminKey.length) {
config.newAdminKey = PrivateKey.fromStringED25519(ctxData.newAdminKey)
}

config.freezeAdminPrivateKey = PrivateKey.fromStringED25519(ctxData.freezeAdminPrivateKey)
config.treasuryKey = PrivateKey.fromStringED25519(ctxData.treasuryKey)
config.adminKey = PrivateKey.fromStringED25519(ctxData.adminKey)
config.existingNodeAliases = ctxData.existingNodeAliases
config.nodeAlias = ctxData.nodeAlias
config.newAccountNumber = ctxData.newAccountNumber

Unchanged files with check annotations Beta

/**
* Prepare values arg for cluster setup command
*
* @param [chartDir] - local charts directory (default is empty)

Check warning on line 329 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
* @param [prometheusStackEnabled] - a bool to denote whether to install prometheus stack

Check warning on line 330 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
* @param [minioEnabled] - a bool to denote whether to install minio

Check warning on line 331 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
* @param [certManagerEnabled] - a bool to denote whether to install cert manager

Check warning on line 332 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
* @param [certManagerCrdsEnabled] - a bool to denote whether to install cert manager CRDs

Check warning on line 333 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
*/
prepareValuesArg (
chartDir = flags.chartDirectory.definition.defaultValue as string,
/**
* Prepare chart path
* @param [chartDir] - local charts directory (default is empty)

Check warning on line 359 in src/commands/cluster.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-with-invalid-optional-name: The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets
*/
async prepareChartPath (chartDir = flags.chartDirectory.definition.defaultValue as string) {
let chartPath = 'solo-charts/solo-cluster-setup'
/**
* Set flag from the flag option
* @param y instance of yargs

Check warning on line 25 in src/commands/flags.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
* @param commandFlags a set of command flags

Check warning on line 26 in src/commands/flags.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
*
*/
export function setCommandFlags (y: any, ...commandFlags: CommandFlag[]) {
/**
* Return a list of Yargs command builder to be exposed through CLI
* @param opts it is an Options object containing logger

Check warning on line 29 in src/commands/index.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
* @returns an array of Yargs command builder
*/
function Initialize (opts: Opts) {
export class InitCommand extends BaseCommand {
/**
* Setup home directories
* @param dirs a list of directories that need to be created in sequence

Check warning on line 33 in src/commands/init.ts

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
*/
setupHomeDirectory (dirs: string[] = [
constants.SOLO_HOME_DIR,