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: resolve node update test failures #856

Merged
merged 4 commits into from
Nov 22, 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
8 changes: 5 additions & 3 deletions .github/workflows/flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ jobs:
- { name: "Node PEM Kill", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-pem-kill-coverage-report }}" }
- { name: "Node Local Hedera", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-hedera-coverage-report }}" }
- { name: "Node Local PTT", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-ptt-coverage-report }}" }
- { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" }
- { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
- { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
# Node Add tests are disabled and are not viable for the amount of memory available. The teacher crashes during
# the reconnect attempt.
#- { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" }
#- { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
#- { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
- { name: "Node Update", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}" }
- { name: "Node Update - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-coverage-report }}" }
- { name: "Node Delete", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}" }
Expand Down
4 changes: 2 additions & 2 deletions resources/profiles/custom-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ local: # 3 nodes, ~850 TPS (Docker Desktop 8 cores, 16 GB RAM)
- name: JAVA_HEAP_MIN
value: 1g
- name: JAVA_HEAP_MAX
value: 3g
value: 6g
- name: JAVA_OPTS
value: "-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZAllocationSpikeTolerance=2 -XX:ConcGCThreads=2 -XX:ZMarkStackSpaceLimit=1g -XX:MaxDirectMemorySize=1g -XX:MetaspaceSize=100M -Xlog:gc*:gc.log --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true"
value: "-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZAllocationSpikeTolerance=2 -XX:ConcGCThreads=2 -XX:ZMarkStackSpaceLimit=1g -XX:MaxDirectMemorySize=2g -XX:MetaspaceSize=100M -Xlog:gc*:gc.log --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true"
haproxy: # use chart defaults
envoyProxy: # use chart defaults
rpcRelay:
Expand Down
18 changes: 15 additions & 3 deletions src/commands/node/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ export class NodeCommandTasks {
const treasuryPrivateKey = PrivateKey.fromStringED25519(treasuryKey.privateKey)
client.setOperator(TREASURY_ACCOUNT_ID, treasuryPrivateKey)

// check balance
const treasuryBalance = await new AccountBalanceQuery()
.setAccountId(TREASURY_ACCOUNT_ID)
.execute(client)
this.logger.debug(`Account ${TREASURY_ACCOUNT_ID} balance: ${treasuryBalance.hbars}`)

// get some initial balance
await this.accountManager.transferAmount(constants.TREASURY_ACCOUNT_ID, accountId, HEDERA_NODE_DEFAULT_STAKE_AMOUNT + 1)

Expand Down Expand Up @@ -518,15 +524,15 @@ export class NodeCommandTasks {
const { upgradeZipHash } = ctx
const { nodeClient, freezeAdminPrivateKey } = ctx.config
try {
// transfer some tiny amount to the freeze admin account
await this.accountManager.transferAmount(constants.TREASURY_ACCOUNT_ID, FREEZE_ADMIN_ACCOUNT, 100000)

// query the balance
const balance = await new AccountBalanceQuery()
.setAccountId(FREEZE_ADMIN_ACCOUNT)
.execute(nodeClient)
this.logger.debug(`Freeze admin account balance: ${balance.hbars}`)

// transfer some tiny amount to the freeze admin account
await this.accountManager.transferAmount(constants.TREASURY_ACCOUNT_ID, FREEZE_ADMIN_ACCOUNT, 100000)

// set operator of freeze transaction as freeze admin account
nodeClient.setOperator(FREEZE_ADMIN_ACCOUNT, freezeAdminPrivateKey)

Expand Down Expand Up @@ -561,6 +567,12 @@ export class NodeCommandTasks {
futureDate.setTime(futureDate.getTime() + 5000) // 5 seconds in the future
this.logger.debug(`Freeze time: ${futureDate}`)

// query the balance
const balance = await new AccountBalanceQuery()
.setAccountId(FREEZE_ADMIN_ACCOUNT)
.execute(nodeClient)
this.logger.debug(`Freeze admin account balance: ${balance.hbars}`)

nodeClient.setOperator(FREEZE_ADMIN_ACCOUNT, freezeAdminPrivateKey)
const freezeUpgradeTx = await new FreezeTransaction()
.setFreezeType(FreezeType.FreezeUpgrade)
Expand Down
37 changes: 24 additions & 13 deletions src/core/account_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,19 @@ export class AccountManager {
* @returns a node client that can be used to call transactions
*/
async _getNodeClient (namespace: string, networkNodeServicesMap: Map<string, NetworkNodeServices>, operatorId: string,
operatorKey: string) {
const nodes = {}
operatorKey: string, useFirstNodeOnly = true) {
jeromy-cannon marked this conversation as resolved.
Show resolved Hide resolved
let nodes = {}
try {
let localPort = constants.LOCAL_NODE_START_PORT

for (const networkNodeService of networkNodeServicesMap.values()) {
const usePortForward = this.shouldUseLocalHostPortForward(networkNodeService)
const host = usePortForward ? '127.0.0.1' : networkNodeService.haProxyLoadBalancerIp as string
const port = +networkNodeService.haProxyGrpcPort
const targetPort = usePortForward ? localPort : port
const addlNode = await this.configureNodeAccess(networkNodeService, localPort, networkNodeServicesMap.size)
nodes = { ...nodes, ...addlNode }
localPort++

if (usePortForward && this._portForwards.length < networkNodeServicesMap.size) {
this._portForwards.push(await this.k8.portForward(networkNodeService.haProxyPodName, localPort, port))
if (useFirstNodeOnly) {
break
}

// @ts-ignore
nodes[`${host}:${targetPort}`] = AccountId.fromString((networkNodeService.accountId as string))
await this.k8.testConnection(host, targetPort)
localPort++
}

this.logger.debug(`creating client from network configuration: ${JSON.stringify(nodes)}`)
Expand All @@ -250,6 +244,23 @@ export class AccountManager {
}
}

private async configureNodeAccess (networkNodeService: NetworkNodeServices, localPort: number, totalNodes: number) {
const obj = {}
const usePortForward = this.shouldUseLocalHostPortForward(networkNodeService)
const host = usePortForward ? '127.0.0.1' : networkNodeService.haProxyLoadBalancerIp as string
const port = +networkNodeService.haProxyGrpcPort
const targetPort = usePortForward ? localPort : port

if (usePortForward && this._portForwards.length < totalNodes) {
this._portForwards.push(await this.k8.portForward(networkNodeService.haProxyPodName, localPort, port))
}

await this.k8.testConnection(host, targetPort)
obj[`${host}:${targetPort}`] = AccountId.fromString((networkNodeService.accountId as string))

return obj
}

/**
* Gets a Map of the Hedera node services and the attributes needed
* @param namespace - the namespace of the solo network deployment
Expand Down
2 changes: 1 addition & 1 deletion version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
export const JAVA_VERSION = '21.0.1+12'
export const HELM_VERSION = 'v3.14.2'
export const SOLO_CHART_VERSION = '0.34.1'
export const HEDERA_PLATFORM_VERSION = 'v0.56.0'
export const HEDERA_PLATFORM_VERSION = 'v0.56.5'
export const MIRROR_NODE_VERSION = '0.116.0'
export const HEDERA_EXPLORER_VERSION = '0.2.1'
Loading