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
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
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
Loading