Skip to content

Commit 54f87bb

Browse files
Merge branch 'main' into fix/2178-standardize-gfi-label
2 parents d97d972 + 8396dac commit 54f87bb

12 files changed

Lines changed: 441 additions & 44 deletions

.github/scripts/coderabbit_plan_trigger.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
const CODERABBIT_MARKER = '<!-- CodeRabbit Plan Trigger -->';
44

5-
async function triggerCodeRabbitPlan(github, owner, repo, issue, marker = CODERABBIT_MARKER, isDryRun = false) {
5+
async function triggerCodeRabbitPlan(github, owner, repo, issue, marker = CODERABBIT_MARKER) {
66
const comment = `${marker} @coderabbitai plan`;
77

8-
if (isDryRun) {
9-
console.log(`[DRY RUN] Would trigger CodeRabbit plan for issue #${issue.number}`);
10-
return true;
11-
}
12-
138
try {
149
await github.rest.issues.createComment({
1510
owner,
@@ -105,11 +100,8 @@ async function main({ github, context }) {
105100
return console.log(`CodeRabbit plan already triggered for #${issue.number}`);
106101
}
107102

108-
// Check for dry run (default to true if not specified, for safety)
109-
const isDryRun = (process.env.DRY_RUN || 'true').toLowerCase() === 'true';
110-
111103
// Post CodeRabbit plan trigger
112-
await triggerCodeRabbitPlan(github, owner, repo, issue, CODERABBIT_MARKER, isDryRun);
104+
await triggerCodeRabbitPlan(github, owner, repo, issue, CODERABBIT_MARKER);
113105

114106
logSummary(owner, repo, issue);
115107
} catch (err) {

.github/workflows/bot-coderabbit-plan-trigger.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ name: CodeRabbit Plan Trigger
55
on:
66
issues:
77
types: [labeled]
8-
workflow_dispatch:
9-
inputs:
10-
dry_run:
11-
description: "Run without posting comments"
12-
required: false
13-
default: "true"
14-
type: choice
15-
options:
16-
- "true"
17-
- "false"
188

199
permissions:
2010
issues: write
@@ -28,10 +18,9 @@ jobs:
2818
cancel-in-progress: false
2919
# Only run when the newly added label is beginner, intermediate, or advanced (case-insensitive)
3020
if: >
31-
github.event_name == 'workflow_dispatch' ||
32-
(github.event.action == 'labeled' &&
21+
github.event.action == 'labeled' &&
3322
github.event.issue.state == 'open' &&
34-
contains(fromJson('["beginner","intermediate","advanced","Beginner","Intermediate","Advanced"]'), github.event.label.name))
23+
contains(fromJson('["beginner","intermediate","advanced","Beginner","Intermediate","Advanced"]'), github.event.label.name)
3524
3625
steps:
3726
- name: Harden the runner
@@ -45,7 +34,6 @@ jobs:
4534
- name: Trigger CodeRabbit Plan
4635
env:
4736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
4937
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 #v9.0.0
5038
with:
5139
script: |

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ requires-python = ">=3.10, <4"
1616
dependencies = [
1717
"protobuf>=4.21.12,<8",
1818
"grpcio>=1.76.0,<2",
19-
"cryptography>=44.0.1,<47",
19+
"cryptography>=44.0.1,<48",
2020
"requests>=2.31.0,<3",
2121
"pycryptodome>=3.18.0,<4",
2222
"eth-abi>=5.1.0,<6",

src/hiero_sdk_python/consensus/topic_create_transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from hiero_sdk_python.account.account_id import AccountId
1313
from hiero_sdk_python.channels import _Channel
14+
from hiero_sdk_python.crypto.key import Key
1415
from hiero_sdk_python.Duration import Duration
1516
from hiero_sdk_python.executable import _Method
1617
from hiero_sdk_python.hapi.services import consensus_create_topic_pb2, transaction_pb2
@@ -19,7 +20,7 @@
1920
)
2021
from hiero_sdk_python.tokens.custom_fixed_fee import CustomFixedFee
2122
from hiero_sdk_python.transaction.transaction import Transaction
22-
from hiero_sdk_python.utils.key_utils import Key, key_to_proto
23+
from hiero_sdk_python.utils.key_utils import key_to_proto
2324

2425

2526
class TopicCreateTransaction(Transaction):

src/hiero_sdk_python/query/transaction_get_receipt_query.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,17 +277,22 @@ def _map_status_error(self, response: response_pb2.Response) -> PrecheckError |
277277
TransactionReceipt._from_proto(response.transactionGetReceipt.receipt, self.transaction_id),
278278
)
279279

280-
def _map_receipt_list(self, receipts: list[transaction_receipt_pb2.TransactionReceipt]) -> list[TransactionReceipt]:
280+
def _map_receipt_list(
281+
self, receipts: list[transaction_receipt_pb2.TransactionReceipt], include_parent_tx_id: bool = False
282+
) -> list[TransactionReceipt]:
281283
"""
282284
Maps a list of protobuf transaction receipts to TransactionReceipt objects.
283285
284286
Args:
285287
receipts: A list of protobuf TransactionReceipt objects
288+
include_parent_tx_id: If True, pass parent transaction_id to mapped receipts (for duplicates).
289+
If False, pass None (for child receipts).
286290
287291
Returns:
288292
A list of TransactionReceipt objects
289293
"""
290-
return [TransactionReceipt._from_proto(receipt_proto, self.transaction_id) for receipt_proto in receipts]
294+
transaction_id = self.transaction_id if include_parent_tx_id else None
295+
return [TransactionReceipt._from_proto(receipt_proto, transaction_id) for receipt_proto in receipts]
291296

292297
def execute(self, client: Client, timeout: int | float | None = None) -> TransactionReceipt:
293298
"""
@@ -315,12 +320,18 @@ def execute(self, client: Client, timeout: int | float | None = None) -> Transac
315320
parent = TransactionReceipt._from_proto(response.transactionGetReceipt.receipt, self.transaction_id)
316321

317322
if self.include_children:
318-
children = self._map_receipt_list(response.transactionGetReceipt.child_transaction_receipts)
323+
# Child receipts are sub-transactions; they don't need parent transaction_id
324+
children = self._map_receipt_list(
325+
response.transactionGetReceipt.child_transaction_receipts, include_parent_tx_id=False
326+
)
319327

320328
parent._set_children(children)
321329

322330
if self.include_duplicates:
323-
duplicates = self._map_receipt_list(response.transactionGetReceipt.duplicateTransactionReceipts)
331+
# Duplicate receipts are related to parent; keep parent transaction_id for context
332+
duplicates = self._map_receipt_list(
333+
response.transactionGetReceipt.duplicateTransactionReceipts, include_parent_tx_id=True
334+
)
324335

325336
parent._set_duplicates(duplicates)
326337

src/hiero_sdk_python/tokens/token_create_transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from hiero_sdk_python.account.account_id import AccountId
2020
from hiero_sdk_python.channels import _Channel
21+
from hiero_sdk_python.crypto.key import Key
2122
from hiero_sdk_python.Duration import Duration
2223
from hiero_sdk_python.executable import _Method
2324
from hiero_sdk_python.hapi.services import token_create_pb2, transaction_pb2
@@ -29,7 +30,7 @@
2930
from hiero_sdk_python.tokens.supply_type import SupplyType
3031
from hiero_sdk_python.tokens.token_type import TokenType
3132
from hiero_sdk_python.transaction.transaction import Transaction
32-
from hiero_sdk_python.utils.key_utils import Key, key_to_proto
33+
from hiero_sdk_python.utils.key_utils import key_to_proto
3334

3435

3536
AUTO_RENEW_PERIOD = Duration(7890000) # around 90 days in seconds

src/hiero_sdk_python/tokens/token_update_transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from hiero_sdk_python.account.account_id import AccountId
1616
from hiero_sdk_python.channels import _Channel
17+
from hiero_sdk_python.crypto.key import Key
1718
from hiero_sdk_python.Duration import Duration
1819
from hiero_sdk_python.executable import _Method
1920
from hiero_sdk_python.hapi.services import token_update_pb2, transaction_pb2
@@ -25,7 +26,7 @@
2526
from hiero_sdk_python.tokens.token_id import TokenId
2627
from hiero_sdk_python.tokens.token_key_validation import TokenKeyValidation
2728
from hiero_sdk_python.transaction.transaction import Transaction
28-
from hiero_sdk_python.utils.key_utils import Key, key_to_proto
29+
from hiero_sdk_python.utils.key_utils import key_to_proto
2930

3031

3132
@dataclass

src/hiero_sdk_python/transaction/transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from hiero_sdk_python.account.account_id import AccountId
77
from hiero_sdk_python.client.client import Client
8+
from hiero_sdk_python.crypto.key import Key
89
from hiero_sdk_python.exceptions import PrecheckError
910
from hiero_sdk_python.executable import _Executable, _ExecutionState
1011
from hiero_sdk_python.hapi.services import basic_types_pb2, transaction_contents_pb2, transaction_pb2
@@ -15,7 +16,7 @@
1516
from hiero_sdk_python.transaction.transaction_id import TransactionId
1617
from hiero_sdk_python.transaction.transaction_receipt import TransactionReceipt
1718
from hiero_sdk_python.transaction.transaction_response import TransactionResponse
18-
from hiero_sdk_python.utils.key_utils import Key, key_to_proto
19+
from hiero_sdk_python.utils.key_utils import key_to_proto
1920

2021

2122
if TYPE_CHECKING:

src/hiero_sdk_python/transaction/transaction_receipt.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,15 @@ def account_id(self) -> AccountId | None:
8888
"""
8989
Retrieves the AccountId associated with the transaction receipt, if available.
9090
91+
Unlike other ID properties (token_id, file_id, etc.), this returns the AccountId
92+
even when accountNum is 0. This is intentional to support EVM auto-account creation
93+
scenarios where the protobuf may contain an AccountID with num=0 to identify the
94+
newly created account before it's fully initialized on-chain.
95+
9196
Returns:
92-
AccountId or None: The AccountId if present; otherwise, None.
97+
AccountId or None: The AccountId if present (including num=0); otherwise, None.
9398
"""
94-
if self._receipt_proto.HasField("accountID") and self._receipt_proto.accountID.accountNum != 0:
99+
if self._receipt_proto.HasField("accountID"):
95100
return AccountId._from_proto(self._receipt_proto.accountID)
96101
return None
97102

@@ -107,7 +112,9 @@ def serial_numbers(self) -> list[int]:
107112

108113
@property
109114
def file_id(self) -> FileId | None:
110-
"""Returns the file ID associated with this receipt."""
115+
"""
116+
Returns the file ID associated with this receipt.
117+
"""
111118
if self._receipt_proto.HasField("fileID") and self._receipt_proto.fileID.fileNum != 0:
112119
return FileId._from_proto(self._receipt_proto.fileID)
113120
return None
@@ -243,14 +250,14 @@ def _to_proto(self):
243250

244251
@classmethod
245252
def _from_proto(
246-
cls, proto: transaction_receipt_pb2.TransactionReceipt, transaction_id: TransactionId
253+
cls, proto: transaction_receipt_pb2.TransactionReceipt, transaction_id: TransactionId | None
247254
) -> TransactionReceipt:
248255
"""
249256
Creates a TransactionReceipt instance from a protobuf TransactionReceipt object.
250257
251258
Args:
252259
proto (transaction_receipt_pb2.TransactionReceipt): The protobuf TransactionReceipt object.
253-
transaction_id (TransactionId): The transaction ID associated with this receipt.
260+
transaction_id (TransactionId | None): The transaction ID associated with this receipt. Can be None for child receipts.
254261
255262
Returns:
256263
TransactionReceipt: A new instance of TransactionReceipt populated with data from the protobuf object.

tests/integration/account_records_query_e2e_test.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ def test_integration_account_record_query_can_execute(env):
2020
account = env.create_account()
2121

2222
# Perform transfer transaction
23+
transfer_tx = TransferTransaction()
24+
transfer_tx.transaction_fee = Hbar(2).to_tinybars()
2325
transfer_receipt = (
24-
TransferTransaction()
25-
.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
26+
transfer_tx.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
2627
.add_hbar_transfer(env.operator_id, -Hbar(1).to_tinybars())
2728
.execute(env.client)
2829
)
@@ -50,9 +51,10 @@ def test_integration_account_record_query_get_cost(env):
5051
"""Test that AccountRecordsQuery can calculate query costs."""
5152
account = env.create_account()
5253

54+
transfer_tx = TransferTransaction()
55+
transfer_tx.transaction_fee = Hbar(2).to_tinybars()
5356
transfer_receipt = (
54-
TransferTransaction()
55-
.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
57+
transfer_tx.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
5658
.add_hbar_transfer(env.operator_id, -Hbar(1).to_tinybars())
5759
.execute(env.client)
5860
)
@@ -75,9 +77,10 @@ def test_integration_account_record_query_insufficient_payment(env):
7577
"""Test that AccountRecordsQuery fails with insufficient payment."""
7678
account = env.create_account()
7779

80+
transfer_tx = TransferTransaction()
81+
transfer_tx.transaction_fee = Hbar(2).to_tinybars()
7882
transfer_receipt = (
79-
TransferTransaction()
80-
.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
83+
transfer_tx.add_hbar_transfer(account.id, Hbar(1).to_tinybars())
8184
.add_hbar_transfer(env.operator_id, -Hbar(1).to_tinybars())
8285
.execute(env.client)
8386
)

0 commit comments

Comments
 (0)