From 0c35caa54407e43635fc8408479adff1d5d4a8cc Mon Sep 17 00:00:00 2001 From: Daniel McGregor Date: Tue, 21 May 2024 18:14:42 +0800 Subject: [PATCH] fix: fix incorrectly mapped transaction arguments `global_num_uint` and `local_num_uint` in `algopy.arc4.abi_call` #232 --- src/puya/awst/nodes.py | 1 + src/puya/awst_build/eb/arc4/abi_call.py | 37 +++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/puya/awst/nodes.py b/src/puya/awst/nodes.py index e3a4527c5a..5b6c66dc91 100644 --- a/src/puya/awst/nodes.py +++ b/src/puya/awst/nodes.py @@ -692,6 +692,7 @@ class TxnFields: TxnFields.approval_program_pages, TxnFields.clear_state_program_pages, ] +TXN_FIELDS_BY_IMMEDIATE = {f.immediate: f for f in TXN_FIELDS} INNER_PARAM_TXN_FIELDS = [f for f in TXN_FIELDS if f.is_inner_param] diff --git a/src/puya/awst_build/eb/arc4/abi_call.py b/src/puya/awst_build/eb/arc4/abi_call.py index 1a3468b103..f10174f177 100644 --- a/src/puya/awst_build/eb/arc4/abi_call.py +++ b/src/puya/awst_build/eb/arc4/abi_call.py @@ -11,7 +11,7 @@ from puya import log from puya.awst import wtypes from puya.awst.nodes import ( - TXN_FIELDS, + TXN_FIELDS_BY_IMMEDIATE, ARC4Decode, BytesConstant, BytesEncoding, @@ -58,23 +58,24 @@ logger = log.get_logger(__name__) _APP_TRANSACTION_FIELDS = { - get_field_python_name(f): f - for f in TXN_FIELDS - if f.immediate - in ( - "ApplicationID", - "OnCompletion", - "ApprovalProgram", - "ClearStateProgram", - "GlobalNumUInt", - "GlobalNumByteSlice", - "LocalNumUInt", - "LocalNumByteSlice", - "ExtraProgramPages", - "Fee", - "Sender", - "Note", - "RekeyTo", + get_field_python_name(field): field + for field in ( + TXN_FIELDS_BY_IMMEDIATE[immediate] + for immediate in ( + "ApplicationID", + "OnCompletion", + "ApprovalProgram", + "ClearStateProgram", + "GlobalNumUint", + "GlobalNumByteSlice", + "LocalNumUint", + "LocalNumByteSlice", + "ExtraProgramPages", + "Fee", + "Sender", + "Note", + "RekeyTo", + ) ) }