Skip to content

Commit 41b9c28

Browse files
authored
Merge branch 'hiero-ledger:main' into main
2 parents 53d29e1 + 868ab27 commit 41b9c28

16 files changed

+709
-35
lines changed

.github/workflows/flow-pull-request-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: hiero-client-sdk-linux-large
3333
steps:
3434
- name: Harden the runner (Audit all outbound calls)
35-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
35+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
3636
with:
3737
egress-policy: audit
3838

.github/workflows/on-comment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
steps:
4949
- name: Harden Runner
50-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
50+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
5151
with:
5252
egress-policy: audit
5353

.github/workflows/on-pr-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Harden Runner
29-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
29+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
3030
with:
3131
egress-policy: audit
3232

.github/workflows/on-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Harden Runner
31-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
31+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
3232
with:
3333
egress-policy: audit
3434

.github/workflows/zxc-build-library.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ jobs:
4949

5050
steps:
5151
- name: Harden Runner
52-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
52+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
5353
with:
5454
egress-policy: audit
5555

5656
- name: Checkout Code
5757
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5858

5959
- name: Run Clang-Format
60-
uses: jidicula/clang-format-action@6cd220de46c89139a0365edae93eee8eb30ca8fe # v4.16.0
60+
uses: jidicula/clang-format-action@3a18028048f01a66653b4e3bf8d968d2e7e2cb8b # v4.17.0
6161
with:
6262
clang-format-version: "17"
6363
check-path: ${{ matrix.check-path }}
@@ -76,7 +76,7 @@ jobs:
7676

7777
steps:
7878
- name: Harden Runner
79-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
79+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
8080
with:
8181
egress-policy: audit
8282

@@ -127,7 +127,7 @@ jobs:
127127
submodules: true
128128

129129
- name: Use Node.js 22
130-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
130+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
131131
with:
132132
node-version: 22
133133

@@ -223,7 +223,7 @@ jobs:
223223

224224
steps:
225225
- name: Harden Runner
226-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
226+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
227227
with:
228228
egress-policy: audit
229229

@@ -284,7 +284,7 @@ jobs:
284284

285285
steps:
286286
- name: Harden Runner
287-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
287+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
288288
with:
289289
egress-policy: audit
290290

.github/workflows/zxc-test-bot-scripts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ jobs:
2828
runs-on: hiero-client-sdk-linux-large
2929
steps:
3030
- name: Harden Runner
31-
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
31+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
3232
with:
3333
egress-policy: audit
3434

3535
- name: Checkout Repository
3636
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3737

3838
- name: Setup Node.js
39-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
39+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
4040
with:
4141
node-version: "20"
4242

src/sdk/examples/AccountAllowanceSerializedExample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* - Attempt to exceed the remaining (1 Hbar) allowance (sending 2 Hbar) to demonstrate ledger enforcement.
2222
* - Modify the allowance to 3 Hbar and successfully re-attempt the (2 Hbar) transfer.
2323
* - Query account balances to verify the flow of funds.
24-
* - Clean up the ledger by resetting the allowance and deleting all generated accounts. *
24+
* - Clean up the ledger by resetting the allowance and deleting all generated accounts.
2525
*
2626
* This example highlights how transactions can be transported or stored
2727
* as raw bytes, reconstructed later, and still maintain correctness

src/sdk/main/include/Client.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,24 @@ class Client
349349
*/
350350
[[nodiscard]] bool isAutoValidateChecksumsEnabled() const;
351351

352+
/**
353+
* Set whether receipt and record queries may fail over to other nodes when the submitting node is unavailable.
354+
* When enabled, queries still start with the submitting node and advance
355+
* to other eligible nodes in deterministic order only on failure. When
356+
* disabled (default), strict single-node pinning is preserved.
357+
*
358+
* @param allow \c true to allow receipt/record query failover to other nodes.
359+
* @return A reference to this Client with the newly-set failover policy.
360+
*/
361+
Client& setAllowReceiptNodeFailover(bool allow);
362+
363+
/**
364+
* Is receipt/record query node failover allowed for this Client?
365+
*
366+
* @return \c TRUE if node failover is allowed for receipt/record queries, otherwise \c FALSE.
367+
*/
368+
[[nodiscard]] bool getAllowReceiptNodeFailover() const;
369+
352370
/**
353371
* Replace the network being used by this Client with nodes contained in an address book.
354372
*

src/sdk/main/include/Transaction.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,23 @@ class Transaction
162162
[[nodiscard]] virtual std::map<AccountId, std::map<std::shared_ptr<PublicKey>, std::vector<std::byte>>>
163163
getSignatures() const;
164164

165+
/**
166+
* This method removes all signatures from the transaction based on the public key provided.
167+
*
168+
* @param publicKey The public key associated with the signature to remove.
169+
* @return The removed signatures.
170+
* @throws IllegalStateException if transaction is not frozen or the given key didn't sign it off.
171+
*/
172+
std::vector<std::vector<std::byte>> removeSignature(const std::shared_ptr<PublicKey>& publicKey);
173+
174+
/**
175+
* Remove all signatures from the transaction.
176+
*
177+
* @return The removed signatures grouped by their associated public key.
178+
* @throws IllegalStateException if the transaction is not frozen.
179+
*/
180+
std::map<std::shared_ptr<PublicKey>, std::vector<std::vector<std::byte>>> removeAllSignatures();
181+
165182
/**
166183
* Freeze this Transaction.
167184
*
@@ -575,4 +592,4 @@ class Transaction
575592

576593
} // namespace Hiero
577594

578-
#endif // HIERO_SDK_CPP_TRANSACTION_H_
595+
#endif // HIERO_SDK_CPP_TRANSACTION_H_

src/sdk/main/include/TransactionResponse.h

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ class TransactionResponse
4040
* @param nodeId The ID of the node account to which this TransactionResponse's corresponding Transaction was sent.
4141
* @param transactionId The ID of this TransactionResponse's corresponding Transaction.
4242
* @param hash The hash of this TransactionResponse's corresponding Transaction.
43+
* @param transactionNodeAccountIds The list of node account IDs configured on the transaction at execution time.
4344
*/
44-
TransactionResponse(AccountId nodeId, TransactionId transactionId, std::vector<std::byte> hash);
45+
TransactionResponse(AccountId nodeId,
46+
TransactionId transactionId,
47+
std::vector<std::byte> hash,
48+
std::vector<AccountId> transactionNodeAccountIds = {});
4549

4650
/**
4751
* Get a TransactionReceipt for this TransactionResponse's corresponding Transaction.
@@ -74,10 +78,16 @@ class TransactionResponse
7478

7579
/**
7680
* Construct a TransactionReceiptQuery for this TransactionResponse's corresponding Transaction.
81+
* When a non-null Client is provided and its failover flag is
82+
* enabled, the query will target the submitting node first, then
83+
* other eligible nodes in deterministic order.
7784
*
85+
* @param client Optional pointer to the Client. When null or
86+
* failover is disabled, the query is pinned to the submitting
87+
* node only.
7888
* @return The constructed TransactionReceiptQuery.
7989
*/
80-
[[nodiscard]] TransactionReceiptQuery getReceiptQuery() const;
90+
[[nodiscard]] TransactionReceiptQuery getReceiptQuery(const Client* client = nullptr) const;
8191

8292
/**
8393
* Get a TransactionReceipt for this TransactionResponse's corresponding Transaction asynchronously.
@@ -214,10 +224,14 @@ class TransactionResponse
214224

215225
/**
216226
* Construct a TransactionRecordQuery for this TransactionResponse's corresponding Transaction.
227+
* When a non-null Client is provided and its failover flag is enabled, the query will target
228+
* the submitting node first, then other eligible nodes in deterministic order.
217229
*
230+
* @param client Optional pointer to the Client. When null or failover is disabled, the query is
231+
* pinned to the submitting node only.
218232
* @return The constructed TransactionRecordQuery.
219233
*/
220-
[[nodiscard]] TransactionRecordQuery getRecordQuery() const;
234+
[[nodiscard]] TransactionRecordQuery getRecordQuery(const Client* client = nullptr) const;
221235

222236
/**
223237
* Get a TransactionRecord for this TransactionResponse's corresponding Transaction asynchronously.
@@ -374,6 +388,20 @@ class TransactionResponse
374388
TransactionId mTransactionId;
375389

376390
private:
391+
/**
392+
* Build a deduplicated, deterministically sorted failover node list starting with the submitting
393+
* node, using either the transaction's own node IDs or the client's network nodes as candidates.
394+
*
395+
* @param client The Client whose network is used when transaction node IDs are unavailable.
396+
* @return An ordered vector of AccountId values for query node targeting.
397+
*/
398+
[[nodiscard]] std::vector<AccountId> buildFailoverNodeList(const Client& client) const;
399+
400+
/**
401+
* The node account IDs that were configured on the transaction during execution.
402+
*/
403+
std::vector<AccountId> mTransactionNodeAccountIds;
404+
377405
/**
378406
* Did this TransactionResponse's corresponding Transaction have a successful pre-check?
379407
*/

0 commit comments

Comments
 (0)