From d7748d5c475cea279a7fb546770f94ee5c1d7478 Mon Sep 17 00:00:00 2001 From: Hang Su Date: Thu, 27 Apr 2023 11:49:54 -0400 Subject: [PATCH] check powerpacks for log lifting, update internal variable names --- algosdk/v2client/models/simulate_request.py | 8 ++++---- tests/steps/other_v2_steps.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/algosdk/v2client/models/simulate_request.py b/algosdk/v2client/models/simulate_request.py index c83bf781..e8e0f8e5 100644 --- a/algosdk/v2client/models/simulate_request.py +++ b/algosdk/v2client/models/simulate_request.py @@ -18,21 +18,21 @@ def dictify(self) -> Dict[str, Any]: class SimulateRequest(object): txn_groups: List[SimulateRequestTransactionGroup] - lift_log_limits: bool + allow_more_logs: bool def __init__( self, *, txn_groups: List[SimulateRequestTransactionGroup], - lift_log_limits: bool = False, + allow_more_logs: bool = False, ) -> None: self.txn_groups = txn_groups - self.lift_log_limits = lift_log_limits + self.allow_more_logs = allow_more_logs def dictify(self) -> Dict[str, Any]: return { "txn-groups": [ txn_group.dictify() for txn_group in self.txn_groups ], - "allow-more-logging": self.lift_log_limits, + "allow-more-logging": self.allow_more_logs, } diff --git a/tests/steps/other_v2_steps.py b/tests/steps/other_v2_steps.py index cab8a6e8..75fa35b2 100644 --- a/tests/steps/other_v2_steps.py +++ b/tests/steps/other_v2_steps.py @@ -1442,7 +1442,7 @@ def simulate_transaction(context): @then("the simulation should succeed without any failure message") def simulate_transaction_succeed(context): if hasattr(context, "simulate_response"): - assert len(context.simulate_response["failure-message"]) == 0 + assert len(context.simulate_response.failure_message) == 0 else: assert ( len(context.atomic_transaction_composer_return.failure_message) @@ -1482,9 +1482,9 @@ def make_simulate_request(context): context.simulate_request = SimulateRequest(txn_groups=[]) -@then("I lift log limits on that simulate request.") -def lift_log_limits_in_request(context): - context.simulate_request.lift_log_limits = True +@then("I allow more logs on that simulate request.") +def allow_more_logs_in_request(context): + context.simulate_request.allow_more_logs = True @then("I attach the simulate request to simulate the transaction group.") @@ -1496,18 +1496,18 @@ def attach_sim_request_to_txn_group_simulation(context): ) -@then('the simulation with "{power}" should not have failure message.') +@then('I check the simulation result has power packs "{power}".') def power_pack_simulation_should_pass(context, power: str): packs = power.split(",") - if len(packs) > 0: + if len(packs) == 0: + assert not context.simulate_response.eval_overrides + else: assert context.simulate_response.eval_overrides if "allow-more-logging" in packs: assert context.simulate_response.eval_overrides.max_log_calls assert context.simulate_response.eval_overrides.max_log_size - assert len(context.simulate_response.failure_message) == 0 - @when("I prepare the transaction without signatures for simulation") def step_impl(context):