From aa49fc31ab4809f3b7be71a5e24dd851ff82e1f7 Mon Sep 17 00:00:00 2001 From: ygd58 Date: Thu, 9 Jul 2026 18:55:05 +0200 Subject: [PATCH] fix: use named parameter check instead of fragile >= 6 count for ABI version detection (#310) The previous check used len(inputs) >= 6 to detect whether the addTransaction ABI includes valid_until. This is fragile: a future protocol upgrade adding a 7th argument would supply an extra positional argument and silently corrupt transaction encoding. Replace the count-based check with a named-parameter check: 'valid_until' in [inp['name'] for inp in inputs] This correctly detects the v6 ABI regardless of how many other arguments are added in future upgrades. Fixes #310 --- genlayer_py/contracts/actions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/genlayer_py/contracts/actions.py b/genlayer_py/contracts/actions.py index b40f9c6..e6692f4 100644 --- a/genlayer_py/contracts/actions.py +++ b/genlayer_py/contracts/actions.py @@ -601,7 +601,8 @@ def _get_add_transaction_abi_version(abi: Optional[list]) -> str: inputs = entry.get("inputs", []) if len(inputs) == 1 and inputs[0].get("type") == "tuple": return "fees" - if len(inputs) >= 6: + input_names = [inp.get("name", "") for inp in inputs] + if "valid_until" in input_names: return "v6" return "v5"