Skip to content

Commit 468cdf1

Browse files
committed
fix: duplicate set_default_max_transaction_fee in e2e test and improve test surface area to check default is applied if not set
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent 5cb9107 commit 468cdf1

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

src/hiero_sdk_python/transaction/transaction.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,9 @@
99
from hiero_sdk_python.crypto.key import Key
1010
from hiero_sdk_python.exceptions import PrecheckError
1111
from hiero_sdk_python.executable import _Executable, _ExecutionState
12-
from hiero_sdk_python.hapi.services import (
13-
basic_types_pb2,
14-
transaction_contents_pb2,
15-
transaction_pb2,
16-
)
17-
from hiero_sdk_python.hapi.services.schedulable_transaction_body_pb2 import (
18-
SchedulableTransactionBody,
19-
)
20-
from hiero_sdk_python.hapi.services.transaction_response_pb2 import (
21-
TransactionResponse as TransactionResponseProto,
22-
)
12+
from hiero_sdk_python.hapi.services import basic_types_pb2, transaction_contents_pb2, transaction_pb2
13+
from hiero_sdk_python.hapi.services.schedulable_transaction_body_pb2 import SchedulableTransactionBody
14+
from hiero_sdk_python.hapi.services.transaction_response_pb2 import TransactionResponse as TransactionResponseProto
2315
from hiero_sdk_python.hbar import Hbar
2416
from hiero_sdk_python.query.fee_estimate_query import FeeEstimateQuery
2517
from hiero_sdk_python.response_code import ResponseCode
@@ -322,10 +314,6 @@ def freeze_with(self, client: Client):
322314
# We iterate through every node in the node_account_id list and
323315
# For each node_account_id build the transaction body
324316
# This allows the transaction to be submitted to the given node in the network
325-
#
326-
# Batch inner transactions (node 0.0.0), explicitly-set nodes, and the
327-
# fall-back to all client network nodes are all resolved by
328-
# _resolve_node_ids(client) above, so this single loop covers every case.
329317

330318
# TODO: Should lock the node_account_ids once freeze
331319
# self._node_account_ids.set_lock(True)

tests/integration/account_update_transaction_e2e_test.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ def _apply_tiny_max_fee_if_supported(tx, client) -> bool:
248248
return True
249249
# Try client-level default
250250
for attr in (
251-
"set_default_max_transaction_fee",
252251
"set_default_max_transaction_fee",
253252
"set_default_max_fee",
254253
"setMaxTransactionFee",
@@ -295,6 +294,29 @@ def test_account_update_insufficient_fee_with_valid_expiration_bump(env):
295294
assert int(info_after.expiration_time.seconds) == base_expiry_secs
296295

297296

297+
@pytest.mark.integration
298+
def test_account_update_insufficient_fee_via_client_default(env):
299+
"""A client-level default max fee must apply to transactions that set no explicit fee."""
300+
receipt = (
301+
AccountCreateTransaction()
302+
.set_key(env.operator_key.public_key())
303+
.set_initial_balance(Hbar(1))
304+
.execute(env.client)
305+
)
306+
assert receipt.status == ResponseCode.SUCCESS
307+
account_id = receipt.account_id
308+
309+
env.client.set_default_max_transaction_fee(Hbar.from_tinybars(1))
310+
311+
# No tx-level fee: the 1-tinybar client default must be resolved at freeze and rejected at precheck.
312+
tx = AccountUpdateTransaction().set_account_id(account_id).set_account_memo("client default fee test")
313+
314+
with pytest.raises(PrecheckError) as exc_info:
315+
tx.execute(env.client)
316+
317+
assert exc_info.value.status == ResponseCode.INSUFFICIENT_TX_FEE
318+
319+
298320
@pytest.mark.integration
299321
def test_integration_account_update_transaction_with_only_account_id(env):
300322
"""Test that AccountUpdateTransaction can execute with only account ID set."""

0 commit comments

Comments
 (0)