Skip to content

Commit

Permalink
fix: Error in node update separate commands when new admin key is n…
Browse files Browse the repository at this point in the history
…ot supplied (#854)

Signed-off-by: Ivo Yankov <[email protected]>
  • Loading branch information
Ivo-Yankov authored Nov 20, 2024
1 parent e102ed8 commit 6e472b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/commands/node/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion src/core/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 6e472b5

Please sign in to comment.