Skip to content

feat: implement opt-in receipt and record query failover#1220

Merged
rwalworth merged 6 commits intohiero-ledger:mainfrom
Adityarya11:feat/receipt-node-failover#1171
Mar 13, 2026
Merged

feat: implement opt-in receipt and record query failover#1220
rwalworth merged 6 commits intohiero-ledger:mainfrom
Adityarya11:feat/receipt-node-failover#1171

Conversation

@Adityarya11
Copy link
Copy Markdown
Contributor

@Adityarya11 Adityarya11 commented Mar 11, 2026

Description:

Implement opt-in receipt/record query failover to other nodes as described in issue. Implementation includes:

  • Add a single allowReceiptNodeFailover boolean flag to Client (default: false) that controls both receipt and record query failover, with corresponding getter/setter.
  • Place node-selection logic in TransactionResponse::getReceiptQuery and getRecordQuery, which accept an optional Client* parameter and build the complete node list before returning the query
  • Propagate the full transaction node account ID list through TransactionResponse via an extended constructor, supporting both explicit-node and default-client-network failover scenarios.
  • Fix getRecord(client, timeout) to route through getRecordQuery for consistent node pinning

Related issue(s):

Fixes #1171


Notes for reviewer:

  • Single flag allowReceiptNodeFailover governs both receipt and record queries, per the design proposal.
  • Node ordering is deterministic: submitting node first, then remaining nodes deduplicated by AccountId and sorted by shard → realm → account number ascending.
  • Two failover scenarios are supported: (1) transaction had explicit node IDs → [submittingNode, ...remainingTransactionNodes], (2) transaction used default client nodes → [submittingNode, ...clientNetworkNodes].
  • getNetwork() returns unordered_map<string, AccountId> where multiple URLs can map to the same AccountId; deduplication preserves first occurrence.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

Hey @Adityarya11 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

DCO Sign-off -- All commits have valid sign-offs. Nice work!


GPG Signature -- All commits have verified GPG signatures. Locked and loaded!


Merge Conflicts -- No merge conflicts detected. Smooth sailing!


Issue Link -- Linked to #1171 (assigned to you).


🎉 All checks passed! Your PR is ready for review. Great job!

@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review status: needs revision A pull request that requires changes before merge labels Mar 11, 2026
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @Adityarya11! The deterministic node sort and the bug fix in getRecord(client, timeout) routing through getRecordQuery() are both good catches.

However, after comparing the implementation against the design proposal, the architecture needs to be restructured before I can approve. The main points are:

  1. The design specifies a single allowReceiptNodeFailover flag that controls both receipt and record queries. Your PR introduces two separate flags.
  2. The node-selection logic should live in TransactionResponse (inside getReceiptQuery / getRecordQuery), not in onExecute overrides on the query classes. This eliminates the need for setSubmittingNodeId, the onExecute overrides, and the Query.h visibility change entirely.
  3. The failover node list doesn't account for transaction-specific node IDs ([submittingNode, ...restOfTxNodes]), only client network nodes.

I've left detailed comments below. Let me know if you have any questions — happy to help!

@rwalworth rwalworth added status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review labels Mar 11, 2026
@Adityarya11 Adityarya11 marked this pull request as draft March 12, 2026 04:28
@Adityarya11 Adityarya11 force-pushed the feat/receipt-node-failover#1171 branch from a6e705a to 863f594 Compare March 12, 2026 07:06
@Adityarya11 Adityarya11 marked this pull request as ready for review March 12, 2026 07:30
@Adityarya11 Adityarya11 requested a review from rwalworth March 12, 2026 07:30
@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review and removed status: needs revision A pull request that requires changes before merge labels Mar 12, 2026
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround @Adityarya11! The structure now matches the design proposal nicely.

I left a couple of comments below — one blocking item around the constructor change and a non-blocking suggestion from the Codacy findings. Let me know if you have any questions!

@rwalworth rwalworth added status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review labels Mar 12, 2026
Signed-off-by: Aditya Arya <arya050411@gmail.com>
Signed-off-by: Aditya Arya <arya050411@gmail.com>
Signed-off-by: Aditya Arya <arya050411@gmail.com>
@Adityarya11 Adityarya11 force-pushed the feat/receipt-node-failover#1171 branch from 863f594 to aaab8b6 Compare March 12, 2026 17:26
@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review and removed status: needs revision A pull request that requires changes before merge labels Mar 12, 2026
Signed-off-by: Aditya Arya <arya050411@gmail.com>
@Adityarya11 Adityarya11 force-pushed the feat/receipt-node-failover#1171 branch from aaab8b6 to 1c9f5ea Compare March 13, 2026 03:55
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

Awesome @Adityarya11, we're looking really good now! We're 99% of the way there, there's just one last thing to address that I missed in the previous review (sorry about that!) - it's a copy-paste fix. We should be good to merge after!

@rwalworth rwalworth added status: needs revision A pull request that requires changes before merge and removed status: needs review The pull request is ready for maintainer review labels Mar 13, 2026
Signed-off-by: Aditya Arya <arya050411@gmail.com>
@github-actions github-actions bot added status: needs review The pull request is ready for maintainer review and removed status: needs revision A pull request that requires changes before merge labels Mar 13, 2026
Copy link
Copy Markdown
Contributor

@rwalworth rwalworth left a comment

Choose a reason for hiding this comment

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

LGTM @Adityarya11, thanks for sticking with this! Once the workflows pass I will merge.

@rwalworth rwalworth merged commit 868ab27 into hiero-ledger:main Mar 13, 2026
11 checks passed
@rwalworth rwalworth removed the status: needs review The pull request is ready for maintainer review label Mar 13, 2026
@Adityarya11 Adityarya11 deleted the feat/receipt-node-failover#1171 branch March 14, 2026 10:52
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.

[Intermediate]: Implement opt-in receipt/record query failover to other nodes

2 participants