From 31eb2fe8e49e28be9baa7171399e37f9ce2434d9 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Tue, 22 Oct 2024 22:44:12 +0300 Subject: [PATCH] Fix ABI --- src/tonpy/abi/instance.py | 2 +- src/tonpy/tvm/tvm.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tonpy/abi/instance.py b/src/tonpy/abi/instance.py index 3b5439f..7a32417 100644 --- a/src/tonpy/abi/instance.py +++ b/src/tonpy/abi/instance.py @@ -45,7 +45,7 @@ def abi_for_getters(self, getters: List[int]) -> set[ABIInterfaceInstance]: def get_parsers(self, code_hash: str, getters: List[int]) -> set[ABIInterfaceInstance]: parsers = set() - if code_hash in self.by_code_hash: + if code_hash in self.by_code_hash and self.by_code_hash[code_hash]: for parser in self.by_code_hash[code_hash]: parsers.add(parser) else: diff --git a/src/tonpy/tvm/tvm.py b/src/tonpy/tvm/tvm.py index 2bc93e2..9d6f027 100644 --- a/src/tonpy/tvm/tvm.py +++ b/src/tonpy/tvm/tvm.py @@ -82,7 +82,7 @@ def run(self, unpack_stack=True, allow_non_success=False) -> Union[Stack, List]: st = Stack(prev_stack=self.tvm.run_vm()) if allow_non_success is False: - assert self.exit_code in [-1, 0], f"TVM run failed with exit code: {self.exit_code}" + assert self.exit_code in [-1, 0], f"TVM run failed with exit code: {self.exit_code} ({self.exit_code_description()})" if self.enable_stack_dump: self.fetch_detailed_step_info() @@ -171,7 +171,10 @@ def exit_code_description(self): "Description": "The maximum number of cells in the library is exceeded or the maximum depth of the Merkle tree is exceeded."} } - return exit_codes[self.exit_code] + if self.exit_code in exit_codes: + return exit_codes[self.exit_code] + else: + return '' @property def vm_steps(self) -> int: