Skip to content

Conversation

@ivaylonikolov7
Copy link
Contributor

@ivaylonikolov7 ivaylonikolov7 commented Nov 5, 2025

Summary

This PR implements the test plan for validating updates to the
account_id field in NodeUpdateTransactionBody as part of the Dynamic
Address Book (DAB) enhancement. It also covers new SDK behaviors that
improve reliability when node account IDs become outdated or invalid.

Scope

Test coverage for account_id updates

  • Verifies successful updates to a node's account_id.
  • Tests rejection of invalid or improperly formatted account IDs.
  • Ensures only authorized entities can perform the update.
  • Confirms no regressions when the field is unchanged.

SDK node-selection and retry behavior

  1. Signing with all nodes
    Ensures the SDK signs transactions with all nodes to reduce the
    chance of failures caused by outdated node account IDs.

  2. Client network refresh via mirror node
    When an invalid node account error occurs, the SDK retrieves updated
    network information from a mirror node and retries the transaction.

  3. Fallback behavior without a mirror network
    If no mirror node is configured, the SDK retries execution using the
    next node ID in the transaction's node list until all options are
    exhausted.

Alignment

The implementation aligns with the design described in:
"Changing of Node Account IDs for Nodes" (sdk-collaboration-hub#53)

Rationale

These tests ensure the robustness of Dynamic Address Book functionality,
reliable handling of account ID changes, and improved resilience in
transaction execution workflows.

Related issue(s):
#3370

Fixes #3370

@lfdt-bot
Copy link
Contributor

lfdt-bot commented Nov 5, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

for (const nodeAddress of addressBook.nodeAddresses) {
for (const endpoint of nodeAddress.addresses) {
if (nodeAddress.accountId != null) {
// Exclude nodes with account ID 0.0.0 (removed node account IDs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic was removed from the HIP, it's not possible to set node account id to 0 => remove this change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

if (
endpoint.port === port &&
nodeAddress.accountId != null &&
nodeAddress.accountId.toString() !== "0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic was removed from the HIP, it's not possible to set node account id to 0 => remove this change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

expect(receipt.status).to.equal(Status.Success);
});

it("should successfully remove node account ID (set to 0.0.0) with admin key signature", async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should fail

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are reworked please check again

});

describe("Node Account ID Update Operations", function () {
it("should successfully update node account ID with both admin and account key signatures", async function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test should bring back the original node account id at the end of the test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are reworked please check

Comment on lines 290 to 293
if (error instanceof PrecheckStatusError) {
expect(error.status).to.equal(Status.InvalidAccountId);
} else if (error instanceof StatusError) {
expect(error.status).to.equal(Status.InvalidAccountId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifs don't make sense

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some for other tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed

let originalNodeAccountId;

beforeAll(async function () {
env = await IntegrationTestEnv.new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not work in CI, because in CI we don't use account 0.0.2. You should hard-code the client's operator (0.0.2) and it's 2 nodes 0.0.3 and 0.0.4 here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done


describe("SDK Retry and Network Update Behavior", function () {
it("should retry with another node when encountering INVALID_NODE_ACCOUNT_ID", async function () {
const transaction = new TransferTransaction()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowhere in this test i see the node account being updated, if it's using some of the above tests for doing the update -> it's a bad test. It should be self contained. See go's test https://github.com/hiero-ledger/hiero-sdk-go/blob/4c901a9700c8c9aefde6ef779a0e109993a5976a/sdk/node_update_transaction_e2e_test.go#L246

@venilinvasilev venilinvasilev force-pushed the feat/changing-node-account-ids branch from 55e9bfb to 62cb6b7 Compare November 10, 2025 09:52
@venilinvasilev venilinvasilev self-assigned this Nov 10, 2025
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 35.29412% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Executable.js 8.82% 31 Missing ⚠️
src/Status.js 83.33% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/channel/WebChannel.js 86.69% <100.00%> (+0.10%) ⬆️
src/client/Network.js 84.55% <100.00%> (-0.30%) ⬇️
src/transaction/Transaction.js 92.29% <100.00%> (+<0.01%) ⬆️
src/Status.js 99.82% <83.33%> (-0.06%) ⬇️
src/Executable.js 83.56% <8.82%> (-3.13%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@venilinvasilev venilinvasilev force-pushed the feat/changing-node-account-ids branch 6 times, most recently from be6f7db to 2cf661a Compare November 13, 2025 15:34
@venilinvasilev venilinvasilev changed the title wip: changing node account ids feat: changing node account ids Nov 14, 2025
@venilinvasilev venilinvasilev marked this pull request as ready for review November 14, 2025 08:43
@venilinvasilev venilinvasilev requested review from a team as code owners November 14, 2025 08:43
Signed-off-by: venilinvasilev <[email protected]>
Signed-off-by: venilinvasilev <[email protected]>
Signed-off-by: venilinvasilev <[email protected]>
Signed-off-by: venilinvasilev <[email protected]>
Signed-off-by: venilinvasilev <[email protected]>
@venilinvasilev venilinvasilev force-pushed the feat/changing-node-account-ids branch from 1e6bf46 to 5e5fa1b Compare November 17, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing Node Account Ids

5 participants