Skip to content

Commit 26e2e8f

Browse files
fix: update the address book and perform helm upgrade to fix mirror node importer (#52)
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent b7e60c1 commit 26e2e8f

File tree

10 files changed

+229
-36
lines changed

10 files changed

+229
-36
lines changed

.github/workflows/zxc-compile-code.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ jobs:
152152
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
153153
run: npm run test-e2e
154154

155+
- name: Upload E2E Logs to GitHub
156+
if: ${{ inputs.enable-e2e-tests && !cancelled() }}
157+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
158+
with:
159+
name: solo.log
160+
path: ~/.solo/logs/solo.log
161+
overwrite: true
162+
if-no-files-found: error
163+
155164
- name: Publish E2E Test Report
156165
uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98 # v2.14.0
157166
if: ${{ inputs.enable-e2e-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }}

package-lock.json

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"author": "Swirlds Labs",
2626
"license": "Apache2.0",
2727
"dependencies": {
28+
"@hashgraph/proto": "^2.14.0-beta.3",
2829
"@hashgraph/sdk": "^2.41.0",
2930
"@kubernetes/client-node": "^0.20.0",
3031
"@listr2/prompt-adapter-enquirer": "^2.0.2",
@@ -37,6 +38,7 @@
3738
"figlet": "^1.7.0",
3839
"got": "^14.2.0",
3940
"inquirer": "^9.2.15",
41+
"js-base64": "^3.7.6",
4042
"listr2": "^8.0.2",
4143
"tar": "^6.2.0",
4244
"uuid": "^9.0.1",
@@ -46,6 +48,7 @@
4648
},
4749
"devDependencies": {
4850
"@jest/globals": "^29.7.0",
51+
"@jest/test-sequencer": "^29.7.0",
4952
"eslint": "^8.56.0",
5053
"eslint-config-standard": "^17.1.0",
5154
"eslint-plugin-headers": "^1.1.2",

src/commands/account.mjs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,10 @@ export class AccountCommand extends BaseCommand {
7373
const serviceMap = await this.accountManager.getNodeServiceMap(ctx.config.namespace)
7474

7575
ctx.nodeClient = await this.accountManager.getNodeClient(ctx.config.namespace,
76-
serviceMap, ctx.treasuryAccountId, ctx.treasuryPrivateKey)
76+
serviceMap, ctx.treasuryAccountInfo.accountId, ctx.treasuryAccountInfo.privateKey)
7777
this.nodeClient = ctx.nodeClient // store in class so that we can make sure connections are closed
7878
}
7979

80-
async loadTreasuryAccount (ctx) {
81-
ctx.treasuryAccountId = constants.TREASURY_ACCOUNT_ID
82-
// check to see if the treasure account is in the secrets
83-
const accountInfo = await this.accountManager.getAccountKeysFromSecret(ctx.treasuryAccountId, ctx.config.namespace)
84-
85-
// if it isn't in the secrets we can load genesis key
86-
if (accountInfo) {
87-
ctx.treasuryPrivateKey = accountInfo.privateKey
88-
} else {
89-
ctx.treasuryPrivateKey = constants.GENESIS_KEY
90-
}
91-
}
92-
9380
async getAccountInfo (ctx) {
9481
return this.accountManager.accountInfoQuery(ctx.config.accountId, ctx.nodeClient)
9582
}
@@ -101,7 +88,6 @@ export class AccountCommand extends BaseCommand {
10188
this.logger.error(`failed to update account keys for accountId ${ctx.accountInfo.accountId}`)
10289
return false
10390
}
104-
this.logger.debug(`sent account key update for account ${ctx.accountInfo.accountId}`)
10591
} else {
10692
amount = amount || flags.amount.definition.defaultValue
10793
}
@@ -156,7 +142,7 @@ export class AccountCommand extends BaseCommand {
156142

157143
self.logger.debug('Initialized config', { config })
158144

159-
await self.loadTreasuryAccount(ctx)
145+
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
160146
await self.loadNodeClient(ctx)
161147
}
162148
},
@@ -219,7 +205,7 @@ export class AccountCommand extends BaseCommand {
219205
{
220206
title: 'get the account info',
221207
task: async (ctx, task) => {
222-
await self.loadTreasuryAccount(ctx)
208+
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
223209
await self.loadNodeClient(ctx)
224210
ctx.accountInfo = await self.buildAccountInfo(await self.getAccountInfo(ctx), ctx.config.namespace, ctx.config.privateKey)
225211
}
@@ -286,7 +272,7 @@ export class AccountCommand extends BaseCommand {
286272
{
287273
title: 'get the account info',
288274
task: async (ctx, task) => {
289-
await self.loadTreasuryAccount(ctx)
275+
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
290276
await self.loadNodeClient(ctx)
291277
self.accountInfo = await self.buildAccountInfo(await self.getAccountInfo(ctx), ctx.config.namespace, false)
292278
this.logger.showJSON('account info', self.accountInfo)

src/commands/network.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ export class NetworkCommand extends BaseCommand {
7676

7777
valuesArg += this.prepareValuesFiles(config.valuesFile)
7878

79-
valuesArg += ` --set hedera-mirror-node.enabled=${config.deployMirrorNode} --set hedera-explorer.enabled=${config.deployHederaExplorer}`
79+
// do not deploy mirror node until after we have the updated address book
80+
valuesArg += ' --set hedera-mirror-node.enabled=false --set hedera-explorer.enabled=false'
81+
8082
valuesArg += ` --set telemetry.prometheus.svcMonitor.enabled=${config.enablePrometheusSvcMonitor}`
8183

8284
if (config.enableHederaExplorerTls) {

src/commands/node.mjs

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,16 +419,29 @@ export class NodeCommand extends BaseCommand {
419419
self.configManager.update(argv)
420420
await prompts.execute(task, self.configManager, [
421421
flags.namespace,
422+
flags.chartDirectory,
423+
flags.fstChartVersion,
422424
flags.nodeIDs,
425+
flags.deployHederaExplorer,
426+
flags.deployMirrorNode,
423427
flags.updateAccountKeys
424428
])
425429

426430
ctx.config = {
427431
namespace: self.configManager.getFlag(flags.namespace),
432+
chartDir: this.configManager.getFlag(flags.chartDirectory),
433+
fstChartVersion: this.configManager.getFlag(flags.fstChartVersion),
428434
nodeIds: helpers.parseNodeIDs(self.configManager.getFlag(flags.nodeIDs)),
435+
deployMirrorNode: this.configManager.getFlag(flags.deployMirrorNode),
436+
deployHederaExplorer: this.configManager.getFlag(flags.deployHederaExplorer),
429437
updateAccountKeys: self.configManager.getFlag(flags.updateAccountKeys)
430438
}
431439

440+
ctx.config.chartPath = await this.prepareChartPath(ctx.config.chartDir,
441+
constants.FULLSTACK_TESTING_CHART, constants.FULLSTACK_DEPLOYMENT_CHART)
442+
443+
ctx.config.valuesArg = ` --set hedera-mirror-node.enabled=${ctx.config.deployMirrorNode} --set hedera-explorer.enabled=${ctx.config.deployHederaExplorer}`
444+
432445
if (!await this.k8.hasNamespace(ctx.config.namespace)) {
433446
throw new FullstackTestingError(`namespace ${ctx.config.namespace} does not exist`)
434447
}
@@ -483,6 +496,36 @@ export class NodeCommand extends BaseCommand {
483496
})
484497
}
485498
},
499+
{
500+
title: 'Enable mirror node',
501+
task: async (ctx, parentTask) => {
502+
const subTasks = [
503+
{
504+
title: 'Get the mirror node importer address book',
505+
task: async (ctx, _) => {
506+
ctx.addressBook = await self.getAddressBook(ctx.config.namespace)
507+
ctx.config.valuesArg += ` --set "hedera-mirror-node.importer.addressBook=${ctx.addressBook}"`
508+
}
509+
},
510+
{
511+
title: `Upgrade chart '${constants.FULLSTACK_DEPLOYMENT_CHART}'`,
512+
task: async (ctx, _) => {
513+
await this.chartManager.upgrade(
514+
ctx.config.namespace,
515+
constants.FULLSTACK_DEPLOYMENT_CHART,
516+
ctx.config.chartPath,
517+
ctx.config.valuesArg
518+
)
519+
}
520+
}
521+
]
522+
523+
return parentTask.newListr(subTasks, {
524+
concurrent: false,
525+
rendererOptions: constants.LISTR_DEFAULT_RENDERER_OPTION
526+
})
527+
}
528+
},
486529
{
487530
title: 'Update special account keys',
488531
task: async (ctx, task) => {
@@ -493,8 +536,17 @@ export class NodeCommand extends BaseCommand {
493536
'skipping special account keys update, special accounts will retain genesis private keys'))
494537
}
495538
}
496-
}
497-
], {
539+
},
540+
{
541+
title: 'Waiting for explorer pod to be ready',
542+
task: async (ctx, _) => {
543+
if (ctx.config.deployHederaExplorer) {
544+
await this.k8.waitForPod(constants.POD_STATUS_RUNNING, [
545+
'app.kubernetes.io/component=hedera-explorer', 'app.kubernetes.io/name=hedera-explorer'
546+
], 1)
547+
}
548+
}
549+
}], {
498550
concurrent: false,
499551
rendererOptions: constants.LISTR_DEFAULT_RENDERER_OPTION
500552
})
@@ -508,6 +560,32 @@ export class NodeCommand extends BaseCommand {
508560
return true
509561
}
510562

563+
/**
564+
* Will get the address book from the network (base64 encoded)
565+
* @param namespace
566+
* @returns {Promise<string>} the base64 encoded address book for the network
567+
*/
568+
async getAddressBook (namespace) {
569+
const treasuryAccountInfo = await this.accountManager.getTreasuryAccountKeys(namespace)
570+
const serviceMap = await this.accountManager.getNodeServiceMap(namespace)
571+
572+
const nodeClient = await this.accountManager.getNodeClient(namespace,
573+
serviceMap, treasuryAccountInfo.accountId, treasuryAccountInfo.privateKey)
574+
575+
try {
576+
// Retrieve the AddressBook as base64
577+
return await this.accountManager.prepareAddressBookBase64(nodeClient)
578+
} catch (e) {
579+
throw new FullstackTestingError('an error was encountered while trying to prepare the address book')
580+
} finally {
581+
await this.accountManager.stopPortForwards()
582+
if (nodeClient) {
583+
nodeClient.close()
584+
}
585+
await sleep(5) // sleep a few ticks to allow network connections to close
586+
}
587+
}
588+
511589
async stop (argv) {
512590
const self = this
513591

0 commit comments

Comments
 (0)