From 8c30ead22687667107a84695d023f7e51ef6b35c Mon Sep 17 00:00:00 2001 From: Adam Chidlow Date: Thu, 12 Sep 2024 14:59:32 +0800 Subject: [PATCH] fix: handle zero values for TemplateVar boolean values are now also allowed as `True` or `False` also incorrect values will no longer result in a critical error, but a CLI usage error instead --------- PuyaOptions now contains a parsed set of key-values for template variables --- examples/amm/puya.log | 2 +- examples/arc_28/puya.log | 2 +- examples/auction/puya.log | 2 +- examples/box_storage/puya.log | 2 +- examples/calculator/puya.log | 2 +- examples/global_state/puya.log | 2 +- examples/hello_world/puya.log | 2 +- examples/hello_world_arc4/puya.log | 2 +- examples/local_state/puya.log | 2 +- examples/merkle/puya.log | 2 +- examples/struct_in_box/puya.log | 2 +- examples/tictactoe/puya.log | 2 +- examples/voting/puya.log | 2 +- src/puya/options.py | 7 +-- src/puya/template.py | 61 ------------------- src/puyapy/__main__.py | 36 +++++++++-- src/puyapy/template.py | 38 ++++++++++++ test_cases/abi_routing/puya.log | 2 +- test_cases/application/puya.log | 2 +- test_cases/arc4_dynamic_arrays/puya.log | 2 +- test_cases/arc4_numeric_comparisons/puya.log | 2 +- test_cases/arc4_types/puya.log | 2 +- test_cases/asset/puya.log | 2 +- test_cases/augmented_assignment/puya.log | 2 +- test_cases/avm_types_in_abi/puya.log | 2 +- test_cases/biguint_binary_ops/puya.log | 2 +- test_cases/boolean_binary_ops/puya.log | 2 +- test_cases/bytes_ops/puya.log | 2 +- test_cases/callsub/puya.log | 2 +- test_cases/chained_assignment/puya.log | 2 +- test_cases/compile/puya.log | 2 +- test_cases/conditional_execution/puya.log | 2 +- test_cases/conditional_expressions/puya.log | 2 +- test_cases/constants/puya.log | 2 +- test_cases/contains/puya.log | 2 +- test_cases/control_op_simplification/puya.log | 2 +- test_cases/diamond_mro/puya.log | 2 +- test_cases/dup2_optimization_bug/puya.log | 2 +- test_cases/edverify/puya.log | 2 +- test_cases/enumeration/puya.log | 2 +- test_cases/everything/puya.log | 2 +- test_cases/group_side_effects/puya.log | 2 +- test_cases/inheritance/puya.log | 2 +- test_cases/inner_transactions/puya.log | 2 +- test_cases/intrinsics/puya.log | 2 +- test_cases/iteration/puya.log | 2 +- test_cases/koopman/puya.log | 2 +- test_cases/less_simple/puya.log | 2 +- test_cases/literals/puya.log | 2 +- test_cases/log/puya.log | 2 +- test_cases/logic_signature/puya.log | 2 +- test_cases/loop_else/puya.log | 2 +- test_cases/match/puya.log | 2 +- test_cases/module_consts/puya.log | 2 +- test_cases/mylib/puya.log | 2 +- test_cases/nested_loops/puya.log | 2 +- test_cases/regression_tests/puya.log | 2 +- test_cases/reinterpret_cast/puya.log | 2 +- test_cases/scratch_slots/puya.log | 2 +- test_cases/simple/puya.log | 2 +- test_cases/simplish/puya.log | 2 +- test_cases/ssa/puya.log | 2 +- test_cases/ssa2/puya.log | 2 +- test_cases/state_mutations/puya.log | 2 +- test_cases/state_proxies/puya.log | 2 +- test_cases/state_totals/puya.log | 2 +- test_cases/stress_tests/puya.log | 2 +- test_cases/string_ops/puya.log | 2 +- test_cases/stubs/puya.log | 2 +- test_cases/template_variables/puya.log | 2 +- test_cases/template_variables/template.vars | 4 +- test_cases/too_many_permutations/puya.log | 2 +- test_cases/transaction/puya.log | 2 +- test_cases/tuple_support/puya.log | 2 +- test_cases/typed_abi_call/puya.log | 2 +- test_cases/typed_abi_call_txn/puya.log | 2 +- test_cases/unary/puya.log | 2 +- test_cases/unassigned_expression/puya.log | 2 +- test_cases/undefined_phi_args/puya.log | 2 +- test_cases/unssa/puya.log | 2 +- test_cases/with_reentrancy/puya.log | 2 +- tests/test_expected_output/data.py | 6 +- tests/test_logic_sig.py | 15 ++--- tests/utils/__init__.py | 15 +++-- 84 files changed, 171 insertions(+), 163 deletions(-) delete mode 100644 src/puya/template.py create mode 100644 src/puyapy/template.py diff --git a/examples/amm/puya.log b/examples/amm/puya.log index b780344290..ecde5f3022 100644 --- a/examples/amm/puya.log +++ b/examples/amm/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['amm'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['amm'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing amm/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/arc_28/puya.log b/examples/arc_28/puya.log index 85f0578f00..bdcc6a689b 100644 --- a/examples/arc_28/puya.log +++ b/examples/arc_28/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc_28'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc_28'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing arc_28/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/auction/puya.log b/examples/auction/puya.log index 60780ef4ec..f210aa01c4 100644 --- a/examples/auction/puya.log +++ b/examples/auction/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['auction'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['auction'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing auction/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/box_storage/puya.log b/examples/box_storage/puya.log index f5f92936f9..38a7e5f1c9 100644 --- a/examples/box_storage/puya.log +++ b/examples/box_storage/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['box_storage'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['box_storage'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv box_storage/contract.py:137:9 warning: expression result is ignored box_storage/contract.py:139:9 warning: expression result is ignored diff --git a/examples/calculator/puya.log b/examples/calculator/puya.log index ad1a56868e..c495af57f3 100644 --- a/examples/calculator/puya.log +++ b/examples/calculator/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['calculator'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['calculator'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing calculator/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/global_state/puya.log b/examples/global_state/puya.log index 59840d467a..c69f72c73d 100644 --- a/examples/global_state/puya.log +++ b/examples/global_state/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['global_state'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['global_state'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing global_state/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/hello_world/puya.log b/examples/hello_world/puya.log index 05547d509d..7d1519ebd2 100644 --- a/examples/hello_world/puya.log +++ b/examples/hello_world/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['hello_world'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['hello_world'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing hello_world/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/hello_world_arc4/puya.log b/examples/hello_world_arc4/puya.log index b82881e8f7..5f9fe776f7 100644 --- a/examples/hello_world_arc4/puya.log +++ b/examples/hello_world_arc4/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['hello_world_arc4'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['hello_world_arc4'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing hello_world_arc4/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/local_state/puya.log b/examples/local_state/puya.log index 963478ebfd..2c601fca80 100644 --- a/examples/local_state/puya.log +++ b/examples/local_state/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['local_state'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['local_state'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing local_state/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/merkle/puya.log b/examples/merkle/puya.log index 2cc34853a2..62e8e9bb3b 100644 --- a/examples/merkle/puya.log +++ b/examples/merkle/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['merkle'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['merkle'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing merkle/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/struct_in_box/puya.log b/examples/struct_in_box/puya.log index 9cc1980ba7..85f7ef1fcc 100644 --- a/examples/struct_in_box/puya.log +++ b/examples/struct_in_box/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['struct_in_box'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['struct_in_box'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv struct_in_box/contract.py:22:9 warning: expression result is ignored info: writing struct_in_box/out/module.awst diff --git a/examples/tictactoe/puya.log b/examples/tictactoe/puya.log index 7e1e587c6f..4282e42a53 100644 --- a/examples/tictactoe/puya.log +++ b/examples/tictactoe/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['tictactoe'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['tictactoe'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing tictactoe/out/module.awst debug: Sealing block@0: // L12 diff --git a/examples/voting/puya.log b/examples/voting/puya.log index 62fd26a047..5796503273 100644 --- a/examples/voting/puya.log +++ b/examples/voting/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['voting'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['voting'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing voting/out/module.awst debug: Sealing block@0: // L12 diff --git a/src/puya/options.py b/src/puya/options.py index c99ac1a2af..f6d829582e 100644 --- a/src/puya/options.py +++ b/src/puya/options.py @@ -4,7 +4,6 @@ import attrs -from puya import template from puya.algo_constants import MAINNET_TEAL_LANGUAGE_VERSION @@ -27,7 +26,7 @@ class PuyaOptions: debug_level: int = 1 optimization_level: int = 1 target_avm_version: int = MAINNET_TEAL_LANGUAGE_VERSION - cli_template_definitions: list[str] = attrs.field(factory=list) + cli_template_definitions: Mapping[str, int | bytes] = attrs.field(factory=dict) template_vars_prefix: str = "TMPL_" # TODO: the below is probably not scalable as a set of optimisation on/off flags, # but it'll do for now @@ -35,6 +34,4 @@ class PuyaOptions: @cached_property def template_variables(self) -> Mapping[str, int | bytes]: - return template.parse_template_vars( - self.cli_template_definitions, self.template_vars_prefix - ) + return {self.template_vars_prefix + k: v for k, v in self.cli_template_definitions.items()} diff --git a/src/puya/template.py b/src/puya/template.py deleted file mode 100644 index 86edf80b3d..0000000000 --- a/src/puya/template.py +++ /dev/null @@ -1,61 +0,0 @@ -import contextlib -from collections.abc import Iterable - -from puya.errors import PuyaError -from puya.utils import valid_bytes, valid_int64 - - -def parse_template_vars(template_vars: Iterable[str], prefix: str) -> dict[str, int | bytes]: - return { - prefix + name: _parse_template_value(name, value) - for name, value in map(_split_template_line, template_vars) - } - - -def _split_template_line(line: str) -> tuple[str, str]: - try: - name, value_str = line.split("=", maxsplit=1) - except ValueError as ex: - raise PuyaError(f"Invalid template var definition: {line=!r}") from ex - return name, value_str - - -def _parse_str(value: str) -> str | None: - if value.startswith('"') and value.endswith('"'): - return value[1:-1] - else: - return None - - -def _parse_bytes(value_str: str) -> bytes | None: - value = None - if value_str.startswith("0x"): - with contextlib.suppress(ValueError): - value = bytes.fromhex(value_str[2:]) - return value - - -def _parse_int(value_str: str) -> int | None: - try: - return int(value_str) - except ValueError: - return None - - -def _parse_template_value(name: str, value_str: str) -> int | bytes: - value: int | bytes | None = None - too_big = False - if (str_ := _parse_str(value_str)) is not None: - value = str_.encode("utf8") - too_big = not valid_bytes(value) - elif (bytes_ := _parse_bytes(value_str)) is not None: - value = bytes_ - too_big = not valid_bytes(value) - elif int_ := _parse_int(value_str): - value = int_ - too_big = not valid_int64(value) - if value is None: - raise PuyaError(f"Invalid template var definition: {value_str}") - if too_big: - raise PuyaError(f"Template value {name!r} too big: {value_str}") - return value diff --git a/src/puyapy/__main__.py b/src/puyapy/__main__.py index 4819250969..812297be31 100644 --- a/src/puyapy/__main__.py +++ b/src/puyapy/__main__.py @@ -1,4 +1,6 @@ import argparse +import typing +from collections.abc import Sequence from importlib.metadata import version from pathlib import Path @@ -8,6 +10,7 @@ from puyapy.compile import compile_to_teal from puyapy.options import PuyaPyOptions +from puyapy.template import parse_template_key_value def main() -> None: @@ -113,12 +116,11 @@ def main() -> None: "--template-var", dest="cli_template_definitions", metavar="VAR=VALUE", - action="append", + action=_ParseAndStoreTemplateVar, + nargs="+", help="Define template vars for use when assembling via --output-bytecode" " should be specified without the prefix (see --template-vars-prefix), e.g." - " -T=SOME_INT=1234" - " -T=SOME_BYTES=0x1A2B" - ' -T=SOME_STR=\\"hello\\"', + ' -T SOME_INT=1234 SOME_BYTES=0x1A2B SOME_BOOL=True SOME_STR=\\"hello\\"', ) parser.add_argument( "--template-vars-prefix", @@ -149,5 +151,31 @@ def main() -> None: compile_to_teal(options) +class _ParseAndStoreTemplateVar(argparse.Action): + @typing.override + def __call__( + self, + parser: argparse.ArgumentParser, + namespace: argparse.Namespace, + values: str | Sequence[typing.Any] | None, + option_string: str | None = None, + ) -> None: + mapping: dict[str, int | bytes] = dict(getattr(namespace, self.dest, {})) + lst = [] + if isinstance(values, str): + lst = [values] + elif values: + for value in values: + assert isinstance(value, str) + lst.append(value) + for kv in lst: + try: + name, value = parse_template_key_value(kv) + except Exception as ex: + parser.error(str(ex)) + mapping[name] = value + setattr(namespace, self.dest, mapping) + + if __name__ == "__main__": main() diff --git a/src/puyapy/template.py b/src/puyapy/template.py new file mode 100644 index 0000000000..eeb064f253 --- /dev/null +++ b/src/puyapy/template.py @@ -0,0 +1,38 @@ +import ast +import typing + +from puya.utils import valid_bytes, valid_int64 + + +def parse_template_key_value(key_value_str: str) -> tuple[str, int | bytes]: + try: + name, value_str = key_value_str.split("=", maxsplit=1) + except ValueError: + raise ValueError(f"invalid template var definition: {key_value_str!r}") from None + + if value_str.startswith("0x"): + value: int | bytes = bytes.fromhex(value_str[2:]) + else: + try: + literal = ast.literal_eval(value_str) + except ValueError: + literal = None + match literal: + case str(str_value): + value = str_value.encode("utf8") + case bool(bool_value): + value = int(bool_value) + case int(value): + pass + case _: + raise ValueError(f"invalid template var definition: {key_value_str!r}") + match value: + case int(int_result): + too_big = not valid_int64(int_result) + case bytes(bytes_result): + too_big = not valid_bytes(bytes_result) + case unexpected: + typing.assert_never(unexpected) + if too_big: + raise ValueError(f"template value {name!r} too big: {value_str}") + return name, value diff --git a/test_cases/abi_routing/puya.log b/test_cases/abi_routing/puya.log index 10c6748940..f482ce39de 100644 --- a/test_cases/abi_routing/puya.log +++ b/test_cases/abi_routing/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['abi_routing'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['abi_routing'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing abi_routing/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/application/puya.log b/test_cases/application/puya.log index c68e8fe6d5..6fc0fd0c58 100644 --- a/test_cases/application/puya.log +++ b/test_cases/application/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['application'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['application'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing application/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/arc4_dynamic_arrays/puya.log b/test_cases/arc4_dynamic_arrays/puya.log index f6191ff64b..f5eab295ee 100644 --- a/test_cases/arc4_dynamic_arrays/puya.log +++ b/test_cases/arc4_dynamic_arrays/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_dynamic_arrays'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_dynamic_arrays'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv arc4_dynamic_arrays/contract.py:169:9 warning: expression result is ignored info: writing arc4_dynamic_arrays/out/module.awst diff --git a/test_cases/arc4_numeric_comparisons/puya.log b/test_cases/arc4_numeric_comparisons/puya.log index d5088a9506..6b2b544526 100644 --- a/test_cases/arc4_numeric_comparisons/puya.log +++ b/test_cases/arc4_numeric_comparisons/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_numeric_comparisons'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_numeric_comparisons'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing arc4_numeric_comparisons/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/arc4_types/puya.log b/test_cases/arc4_types/puya.log index b5e80f4279..44e227114f 100644 --- a/test_cases/arc4_types/puya.log +++ b/test_cases/arc4_types/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_types'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['arc4_types'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv arc4_types/mutable_params.py:63:9 warning: expression result is ignored arc4_types/mutable_params.py:79:9 warning: expression result is ignored diff --git a/test_cases/asset/puya.log b/test_cases/asset/puya.log index 5565c87872..c8c66b9bb5 100644 --- a/test_cases/asset/puya.log +++ b/test_cases/asset/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['asset'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['asset'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing asset/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/augmented_assignment/puya.log b/test_cases/augmented_assignment/puya.log index 5db7abe32f..9aedd0dd12 100644 --- a/test_cases/augmented_assignment/puya.log +++ b/test_cases/augmented_assignment/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['augmented_assignment'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['augmented_assignment'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing augmented_assignment/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/avm_types_in_abi/puya.log b/test_cases/avm_types_in_abi/puya.log index 09ac111bdb..6e923d676d 100644 --- a/test_cases/avm_types_in_abi/puya.log +++ b/test_cases/avm_types_in_abi/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['avm_types_in_abi'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['avm_types_in_abi'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing avm_types_in_abi/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/biguint_binary_ops/puya.log b/test_cases/biguint_binary_ops/puya.log index 84759bfe25..f0a8bb67dd 100644 --- a/test_cases/biguint_binary_ops/puya.log +++ b/test_cases/biguint_binary_ops/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['biguint_binary_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['biguint_binary_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing biguint_binary_ops/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/boolean_binary_ops/puya.log b/test_cases/boolean_binary_ops/puya.log index d16e89fc7e..c4d8bc2f53 100644 --- a/test_cases/boolean_binary_ops/puya.log +++ b/test_cases/boolean_binary_ops/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['boolean_binary_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['boolean_binary_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing boolean_binary_ops/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/bytes_ops/puya.log b/test_cases/bytes_ops/puya.log index 29b8255afe..94aaa61c2b 100644 --- a/test_cases/bytes_ops/puya.log +++ b/test_cases/bytes_ops/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['bytes_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['bytes_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing bytes_ops/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/callsub/puya.log b/test_cases/callsub/puya.log index a39ec1b7af..4ec7c8b237 100644 --- a/test_cases/callsub/puya.log +++ b/test_cases/callsub/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['callsub'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['callsub'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing callsub/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/chained_assignment/puya.log b/test_cases/chained_assignment/puya.log index 71c8112fdf..dfb766a1f1 100644 --- a/test_cases/chained_assignment/puya.log +++ b/test_cases/chained_assignment/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['chained_assignment'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['chained_assignment'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing chained_assignment/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/compile/puya.log b/test_cases/compile/puya.log index b4514429dc..4a1f3d85cc 100644 --- a/test_cases/compile/puya.log +++ b/test_cases/compile/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=['TMPL_GREETING="tmpl"', 'PRFX_GREETING="prfx"', 'TMPL_NUM=0x42', 'TMPL_ACCOUNT=0x0000000000000000000000000000000000000000000000000000000000000000', 'TMPL_METHOD=0x00000000'], template_vars_prefix='', locals_coalescing_strategy=, paths=['compile'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={'TMPL_GREETING': b'tmpl', 'PRFX_GREETING': b'prfx', 'TMPL_NUM': b'B', 'TMPL_ACCOUNT': b'/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00', 'TMPL_METHOD': b'/x00/x00/x00/x00'}, template_vars_prefix='', locals_coalescing_strategy=, paths=['compile'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing compile/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/conditional_execution/puya.log b/test_cases/conditional_execution/puya.log index aa1d59c651..8ae299b570 100644 --- a/test_cases/conditional_execution/puya.log +++ b/test_cases/conditional_execution/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['conditional_execution'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['conditional_execution'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv conditional_execution/contract.py:11:9 warning: expression result is ignored conditional_execution/contract.py:17:9 warning: expression result is ignored diff --git a/test_cases/conditional_expressions/puya.log b/test_cases/conditional_expressions/puya.log index afeb505685..02d7fff921 100644 --- a/test_cases/conditional_expressions/puya.log +++ b/test_cases/conditional_expressions/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['conditional_expressions'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['conditional_expressions'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing conditional_expressions/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/constants/puya.log b/test_cases/constants/puya.log index 992ae6a3ef..adafc1c07d 100644 --- a/test_cases/constants/puya.log +++ b/test_cases/constants/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['constants'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['constants'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv constants/non_utf8.py:1 warning: UH OH SPAGHETTI-O's, darn tootin' non-utf8(?!) encoded file encountered: constants/non_utf8.py encoded as iso-8859-7 info: writing constants/out/module.awst diff --git a/test_cases/contains/puya.log b/test_cases/contains/puya.log index 5858fa8b42..908908863e 100644 --- a/test_cases/contains/puya.log +++ b/test_cases/contains/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['contains'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['contains'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing contains/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/control_op_simplification/puya.log b/test_cases/control_op_simplification/puya.log index 0bfd83488e..a275ab7778 100644 --- a/test_cases/control_op_simplification/puya.log +++ b/test_cases/control_op_simplification/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['control_op_simplification'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['control_op_simplification'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing control_op_simplification/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/diamond_mro/puya.log b/test_cases/diamond_mro/puya.log index a459b23d43..16949910ea 100644 --- a/test_cases/diamond_mro/puya.log +++ b/test_cases/diamond_mro/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['diamond_mro'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['diamond_mro'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing diamond_mro/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/dup2_optimization_bug/puya.log b/test_cases/dup2_optimization_bug/puya.log index 0da6bfbc97..e746905aa3 100644 --- a/test_cases/dup2_optimization_bug/puya.log +++ b/test_cases/dup2_optimization_bug/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['dup2_optimization_bug'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['dup2_optimization_bug'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing dup2_optimization_bug/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/edverify/puya.log b/test_cases/edverify/puya.log index a63ea51a8c..4bea5456f3 100644 --- a/test_cases/edverify/puya.log +++ b/test_cases/edverify/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['edverify'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['edverify'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing edverify/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/enumeration/puya.log b/test_cases/enumeration/puya.log index 078ca978a7..d7f7d8f20e 100644 --- a/test_cases/enumeration/puya.log +++ b/test_cases/enumeration/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['enumeration'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['enumeration'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing enumeration/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/everything/puya.log b/test_cases/everything/puya.log index 295fa7f4b2..2b71aaf59b 100644 --- a/test_cases/everything/puya.log +++ b/test_cases/everything/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['everything'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['everything'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing everything/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/group_side_effects/puya.log b/test_cases/group_side_effects/puya.log index 096e088d29..4525a5b85a 100644 --- a/test_cases/group_side_effects/puya.log +++ b/test_cases/group_side_effects/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['group_side_effects'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['group_side_effects'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing group_side_effects/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/inheritance/puya.log b/test_cases/inheritance/puya.log index a0e26e0f8f..d385112104 100644 --- a/test_cases/inheritance/puya.log +++ b/test_cases/inheritance/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['inheritance'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['inheritance'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing inheritance/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/inner_transactions/puya.log b/test_cases/inner_transactions/puya.log index 8880f87700..e27cf6bf3e 100644 --- a/test_cases/inner_transactions/puya.log +++ b/test_cases/inner_transactions/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['inner_transactions'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['inner_transactions'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing inner_transactions/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/intrinsics/puya.log b/test_cases/intrinsics/puya.log index a4cafea847..e6ee120833 100644 --- a/test_cases/intrinsics/puya.log +++ b/test_cases/intrinsics/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['intrinsics'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['intrinsics'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing intrinsics/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/iteration/puya.log b/test_cases/iteration/puya.log index f776434e7b..1fa33cde10 100644 --- a/test_cases/iteration/puya.log +++ b/test_cases/iteration/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['iteration'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['iteration'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv iteration/base.py:38 debug: skipping trivial method test_forwards iteration/base.py:42 debug: skipping trivial method test_reversed diff --git a/test_cases/koopman/puya.log b/test_cases/koopman/puya.log index 8d58b45cc9..f6b8695963 100644 --- a/test_cases/koopman/puya.log +++ b/test_cases/koopman/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['koopman'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['koopman'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing koopman/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/less_simple/puya.log b/test_cases/less_simple/puya.log index f2be37980b..992a1d6296 100644 --- a/test_cases/less_simple/puya.log +++ b/test_cases/less_simple/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['less_simple'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['less_simple'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing less_simple/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/literals/puya.log b/test_cases/literals/puya.log index d5cd2f9053..422feed026 100644 --- a/test_cases/literals/puya.log +++ b/test_cases/literals/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['literals'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['literals'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv literals/folding.py:7:12 warning: expression is always True literals/folding.py:8:17 warning: expression is always False diff --git a/test_cases/log/puya.log b/test_cases/log/puya.log index 9cdc4deaa4..74fce72c64 100644 --- a/test_cases/log/puya.log +++ b/test_cases/log/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['log'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['log'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing log/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/logic_signature/puya.log b/test_cases/logic_signature/puya.log index a9e2e629f5..919ab189a0 100644 --- a/test_cases/logic_signature/puya.log +++ b/test_cases/logic_signature/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=['SELLER=0x0000000000000000000000000000000000000000000000000000000000000000', 'PRICE=1', 'ASSET_ID=1'], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['logic_signature'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={'SELLER': b'/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00/x00', 'PRICE': 1, 'ASSET_ID': 1}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['logic_signature'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing logic_signature/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/loop_else/puya.log b/test_cases/loop_else/puya.log index 9e3dacea11..6e55b0b3f9 100644 --- a/test_cases/loop_else/puya.log +++ b/test_cases/loop_else/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['loop_else'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['loop_else'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing loop_else/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/match/puya.log b/test_cases/match/puya.log index 56f0dc38da..9a090cf88c 100644 --- a/test_cases/match/puya.log +++ b/test_cases/match/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['match'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['match'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing match/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/module_consts/puya.log b/test_cases/module_consts/puya.log index 24e3497864..239465aff4 100644 --- a/test_cases/module_consts/puya.log +++ b/test_cases/module_consts/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['module_consts'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['module_consts'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing module_consts/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/mylib/puya.log b/test_cases/mylib/puya.log index 09b3e31818..8f9e8ff9cb 100644 --- a/test_cases/mylib/puya.log +++ b/test_cases/mylib/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['mylib'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['mylib'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing mylib/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/nested_loops/puya.log b/test_cases/nested_loops/puya.log index 6c2f61fa2a..7e81e27dbc 100644 --- a/test_cases/nested_loops/puya.log +++ b/test_cases/nested_loops/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['nested_loops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['nested_loops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing nested_loops/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/regression_tests/puya.log b/test_cases/regression_tests/puya.log index 6febaae9f4..813350b221 100644 --- a/test_cases/regression_tests/puya.log +++ b/test_cases/regression_tests/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['regression_tests'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['regression_tests'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing regression_tests/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/reinterpret_cast/puya.log b/test_cases/reinterpret_cast/puya.log index 1b30bdc22d..ead1c03d53 100644 --- a/test_cases/reinterpret_cast/puya.log +++ b/test_cases/reinterpret_cast/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['reinterpret_cast'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['reinterpret_cast'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing reinterpret_cast/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/scratch_slots/puya.log b/test_cases/scratch_slots/puya.log index d866b0f2d1..b592bc91fc 100644 --- a/test_cases/scratch_slots/puya.log +++ b/test_cases/scratch_slots/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['scratch_slots'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['scratch_slots'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing scratch_slots/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/simple/puya.log b/test_cases/simple/puya.log index abb46d607e..14c18cd1e7 100644 --- a/test_cases/simple/puya.log +++ b/test_cases/simple/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['simple'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['simple'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing simple/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/simplish/puya.log b/test_cases/simplish/puya.log index 7a6e67b4ed..63de924605 100644 --- a/test_cases/simplish/puya.log +++ b/test_cases/simplish/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['simplish'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['simplish'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing simplish/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/ssa/puya.log b/test_cases/ssa/puya.log index 0f35b561a3..f612fae884 100644 --- a/test_cases/ssa/puya.log +++ b/test_cases/ssa/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['ssa'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['ssa'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing ssa/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/ssa2/puya.log b/test_cases/ssa2/puya.log index 43bdc862e4..f7f7352126 100644 --- a/test_cases/ssa2/puya.log +++ b/test_cases/ssa2/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['ssa2'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['ssa2'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing ssa2/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/state_mutations/puya.log b/test_cases/state_mutations/puya.log index 290fd98a01..4f159a4f7d 100644 --- a/test_cases/state_mutations/puya.log +++ b/test_cases/state_mutations/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_mutations'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_mutations'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing state_mutations/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/state_proxies/puya.log b/test_cases/state_proxies/puya.log index a90ddb6943..8135f6aa88 100644 --- a/test_cases/state_proxies/puya.log +++ b/test_cases/state_proxies/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_proxies'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_proxies'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing state_proxies/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/state_totals/puya.log b/test_cases/state_totals/puya.log index a9cb736cf5..e0eed2446c 100644 --- a/test_cases/state_totals/puya.log +++ b/test_cases/state_totals/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_totals'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['state_totals'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing state_totals/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/stress_tests/puya.log b/test_cases/stress_tests/puya.log index 8a7f010d7d..cd068c8ea8 100644 --- a/test_cases/stress_tests/puya.log +++ b/test_cases/stress_tests/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['stress_tests'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['stress_tests'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing stress_tests/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/string_ops/puya.log b/test_cases/string_ops/puya.log index 47d6c8a1d9..73fa57883c 100644 --- a/test_cases/string_ops/puya.log +++ b/test_cases/string_ops/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['string_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['string_ops'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing string_ops/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/stubs/puya.log b/test_cases/stubs/puya.log index ee5f04e519..8ae4d9a3e8 100644 --- a/test_cases/stubs/puya.log +++ b/test_cases/stubs/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['stubs'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['stubs'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing stubs/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/template_variables/puya.log b/test_cases/template_variables/puya.log index 93b8bb7f0e..5625b2d4b8 100644 --- a/test_cases/template_variables/puya.log +++ b/test_cases/template_variables/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=['SOME_BYTES=0x', 'SOME_BIG_UINT=0x', 'UPDATABLE=1', 'DELETABLE=1'], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['template_variables'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={'SOME_BYTES': b'', 'SOME_BIG_UINT': b'', 'UPDATABLE': 0, 'DELETABLE': 0}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['template_variables'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing template_variables/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/template_variables/template.vars b/test_cases/template_variables/template.vars index c4b18c963b..ff458dd2c2 100644 --- a/test_cases/template_variables/template.vars +++ b/test_cases/template_variables/template.vars @@ -1,4 +1,4 @@ SOME_BYTES=0x SOME_BIG_UINT=0x -UPDATABLE=1 -DELETABLE=1 +UPDATABLE=False +DELETABLE=0 diff --git a/test_cases/too_many_permutations/puya.log b/test_cases/too_many_permutations/puya.log index 577630144c..0278325584 100644 --- a/test_cases/too_many_permutations/puya.log +++ b/test_cases/too_many_permutations/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['too_many_permutations'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['too_many_permutations'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing too_many_permutations/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/transaction/puya.log b/test_cases/transaction/puya.log index a6e97335a8..b358b7df0c 100644 --- a/test_cases/transaction/puya.log +++ b/test_cases/transaction/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['transaction'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['transaction'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing transaction/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/tuple_support/puya.log b/test_cases/tuple_support/puya.log index b4a2fd0eb8..72236b8559 100644 --- a/test_cases/tuple_support/puya.log +++ b/test_cases/tuple_support/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['tuple_support'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['tuple_support'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing tuple_support/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/typed_abi_call/puya.log b/test_cases/typed_abi_call/puya.log index d8d78bb43a..5375ec677c 100644 --- a/test_cases/typed_abi_call/puya.log +++ b/test_cases/typed_abi_call/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['typed_abi_call'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['typed_abi_call'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing typed_abi_call/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/typed_abi_call_txn/puya.log b/test_cases/typed_abi_call_txn/puya.log index cbd11842c3..b141969cfe 100644 --- a/test_cases/typed_abi_call_txn/puya.log +++ b/test_cases/typed_abi_call_txn/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['typed_abi_call_txn'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['typed_abi_call_txn'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing typed_abi_call_txn/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/unary/puya.log b/test_cases/unary/puya.log index 8b997ef6ef..3b09275925 100644 --- a/test_cases/unary/puya.log +++ b/test_cases/unary/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unary'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unary'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing unary/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/unassigned_expression/puya.log b/test_cases/unassigned_expression/puya.log index 069a3780c2..c7239b5a20 100644 --- a/test_cases/unassigned_expression/puya.log +++ b/test_cases/unassigned_expression/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unassigned_expression'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unassigned_expression'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv unassigned_expression/contract.py:7:9 warning: expression result is ignored unassigned_expression/contract.py:11:9 warning: expression result is ignored diff --git a/test_cases/undefined_phi_args/puya.log b/test_cases/undefined_phi_args/puya.log index dff1aa1169..dfb0b71376 100644 --- a/test_cases/undefined_phi_args/puya.log +++ b/test_cases/undefined_phi_args/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['undefined_phi_args'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['undefined_phi_args'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv info: writing undefined_phi_args/out/module.awst debug: Sealing block@0: // L12 diff --git a/test_cases/unssa/puya.log b/test_cases/unssa/puya.log index da0128dcee..d13c490120 100644 --- a/test_cases/unssa/puya.log +++ b/test_cases/unssa/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unssa'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['unssa'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv unssa/contract.py:6:9 warning: expression result is ignored unssa/contract.py:13:9 warning: expression result is ignored diff --git a/test_cases/with_reentrancy/puya.log b/test_cases/with_reentrancy/puya.log index 836bdd88fb..f7bd7a22c0 100644 --- a/test_cases/with_reentrancy/puya.log +++ b/test_cases/with_reentrancy/puya.log @@ -1,4 +1,4 @@ -debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions=[], template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['with_reentrancy'], output_awst=True, output_awst_json=False, output_client=True, log_level=) +debug: PuyaPyOptions(output_teal=True, output_arc32=True, output_ssa_ir=True, output_optimization_ir=True, output_destructured_ir=True, output_memory_ir=True, output_bytecode=True, match_algod_bytecode=False, debug_level=1, optimization_level=1, target_avm_version=10, cli_template_definitions={}, template_vars_prefix='TMPL_', locals_coalescing_strategy=, paths=['with_reentrancy'], output_awst=True, output_awst_json=False, output_client=True, log_level=) info: Found python prefix: /.venv with_reentrancy/contract.py:9:9 warning: expression result is ignored info: writing with_reentrancy/out/module.awst diff --git a/tests/test_expected_output/data.py b/tests/test_expected_output/data.py index 60001b8d90..4ff98a970a 100644 --- a/tests/test_expected_output/data.py +++ b/tests/test_expected_output/data.py @@ -17,6 +17,7 @@ from puyapy.awst_build.main import FAKE_ARC4_PATH, transform_ast from puyapy.compile import parse_with_mypy from puyapy.options import PuyaPyOptions +from puyapy.template import parse_template_key_value from tests.utils import narrowed_compile_context @@ -96,7 +97,7 @@ class TestCase: name: str src_line: int files: list[TestCaseFile] = attrs.field(factory=list) - template_vars: list[str] = attrs.field(factory=list) + template_vars: dict[str, int | bytes] = attrs.field(factory=dict) approved_case_source: list[str] = attrs.field(factory=list) """An adjusted test case source that has all the expected output as comments. Defaults to original input if test case is not executed""" @@ -183,7 +184,8 @@ def parse_file(path: Path) -> tuple[list[str], list[TestCase]]: raise ValueError( f"Template encountered before a case is defined {path}:{line_num}" ) - current_case.template_vars.append(template) + template_var_name, template_var_value = parse_template_key_value(template) + current_case.template_vars[template_var_name] = template_var_value elif maybe_collecting_output_for := line_matches_prefix(line, EXPECTED_PREFIX): if not current_case: raise ValueError( diff --git a/tests/test_logic_sig.py b/tests/test_logic_sig.py index 0581b27b00..9e8fd8e707 100644 --- a/tests/test_logic_sig.py +++ b/tests/test_logic_sig.py @@ -1,3 +1,4 @@ +from collections.abc import Mapping from pathlib import Path import algokit_utils @@ -25,7 +26,7 @@ def compile_logic_sig( *, optimization_level: int = 1, debug_level: int = 2, - template_variables: list[str] | None = None, + template_variables: Mapping[str, int | bytes] | None = None, ) -> bytes: result = compile_src_from_options( PuyaPyOptions( @@ -36,7 +37,7 @@ def compile_logic_sig( output_teal=False, output_bytecode=True, out_dir=Path("out"), - cli_template_definitions=template_variables or [], + cli_template_definitions=template_variables or {}, ) ) (logic_sig,) = result.teal @@ -124,11 +125,11 @@ def test_pre_approved_sale( ) logic_sig_prog = compile_logic_sig( TEST_CASES_DIR / "logic_signature" / "signature.py", - template_variables=[ - f"SELLER=0x{algosdk.encoding.decode_address(account.address).hex()}", - "PRICE=10_000_000", - f"ASSET_ID={asset_a}", - ], + template_variables={ + "SELLER": algosdk.encoding.decode_address(account.address), + "PRICE": 10_000_000, + "ASSET_ID": asset_a, + }, ) logic_sig = LogicSigAccount(program=logic_sig_prog) logic_sig.sign(account.private_key) diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index b2923314ab..4e3d27eb0c 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -15,6 +15,7 @@ from puyapy.compile import output_awst, parse_with_mypy, write_arc32_clients from puyapy.options import PuyaPyOptions from puyapy.parse import ParseResult, SourceDiscoveryMechanism +from puyapy.template import parse_template_key_value from puyapy.utils import determine_out_dir from tests import EXAMPLES_DIR, TEST_CASES_DIR @@ -217,14 +218,16 @@ def get_all_examples() -> list[PuyaExample]: ] -def load_template_vars(path: Path | None) -> tuple[str, list[str]]: - result = [] +def load_template_vars(path: Path | None) -> tuple[str, dict[str, int | bytes]]: prefix = "TMPL_" + prefix_prefix = "prefix=" + + result = {} if path is not None: for line in path.read_text("utf8").splitlines(): - var, value_str = line.split("=", maxsplit=1) - if var == "prefix": - prefix = value_str + if line.startswith(prefix_prefix): + prefix = line.removeprefix(prefix_prefix) else: - result.append(line) + key, value = parse_template_key_value(line) + result[key] = value return prefix, result