diff --git a/setup.py b/setup.py index 1ee6f23..b271ed1 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def finalize_options(self): setup( name="tonpy" if not IS_DEV else "tonpy-dev", - version="0.0.0.1.4b0" if not IS_DEV else "0.0.0.6.0b1", + version="0.0.0.1.4c0" if not IS_DEV else "0.0.0.6.0b1", author="Disintar LLP", author_email="andrey@head-labs.com", description="Types / API for TON blockchain", diff --git a/src/tonpy/abi/getter.py b/src/tonpy/abi/getter.py index 7f45fee..0d41b20 100644 --- a/src/tonpy/abi/getter.py +++ b/src/tonpy/abi/getter.py @@ -299,18 +299,21 @@ def parse_getters(self, tvm: TVM, tlb_sources, force_all: bool = False) -> dict: getter_cache.set((tvm.code_hash, tvm.data_hash, self.method_id), stack) if self.result_length_strict_check: - assert len(stack) == len(self.method_result) + if len(stack) != len(self.method_result): + return if self.result_strict_type_check: my_result_hash = stack.get_abi_hash() - assert my_result_hash == self.method_result_hash + if my_result_hash != self.method_result_hash: + return tmp = {} for getter, stack_entry in zip(self.method_result, stack): if getter.required is not None: stack_entry_value = stack_entry.as_int() if getter.type == "Int" else stack_entry.get().get_hash() - assert stack_entry_value == getter.required + if stack_entry_value != getter.required: + return try: tmp.update(getter.parse_stack_item(stack_entry, tlb_sources, force_all, tvm=tvm)) @@ -332,18 +335,21 @@ async def aparse_getters(self, tvm: TVM, tlb_sources, force_all: bool = False) - getter_cache.set((tvm.code_hash, tvm.data_hash, self.method_id), stack) if self.result_length_strict_check: - assert len(stack) == len(self.method_result) + if len(stack) != len(self.method_result): + return if self.result_strict_type_check: my_result_hash = stack.get_abi_hash() - assert my_result_hash == self.method_result_hash + if my_result_hash != self.method_result_hash: + return tmp = {} for getter, stack_entry in zip(self.method_result, stack): if getter.required is not None: stack_entry_value = stack_entry.as_int() if getter.type == "Int" else stack_entry.get().get_hash() - assert stack_entry_value == getter.required + if stack_entry_value != getter.required: + return try: tmp.update(getter.parse_stack_item(stack_entry, tlb_sources, force_all, tvm=tvm)) diff --git a/src/tonpy/abi/interface.py b/src/tonpy/abi/interface.py index 59400c9..f2fad8d 100644 --- a/src/tonpy/abi/interface.py +++ b/src/tonpy/abi/interface.py @@ -43,6 +43,9 @@ def parse_getters(self, tvm: TVM, tlb_sources): try: tmp = getter.parse_getters(tvm, tlb_sources) + if tmp is None: + return {} + for i in tmp: result[f"{self.dton_parse_prefix}{i}"] = tmp[i] @@ -60,6 +63,9 @@ async def aparse_getters(self, tvm: TVM, tlb_sources): try: tmp = await getter.aparse_getters(tvm, tlb_sources) + if tmp is None: + return {} + for i in tmp: result[f"{self.dton_parse_prefix}{i}"] = tmp[i] diff --git a/src/tonpy/blockscanner/blockscanner.py b/src/tonpy/blockscanner/blockscanner.py index fc1864c..f88e5e3 100644 --- a/src/tonpy/blockscanner/blockscanner.py +++ b/src/tonpy/blockscanner/blockscanner.py @@ -845,7 +845,7 @@ def prepare_prev_block_data(self, shards_data, mc_data): for j in range(i['master'] - 16, i['master']): prev_blocks.append(known_mcs[j].to_data()) - prev_100_seqno = int(i['master'] - i['master'] % 100) + prev_100_seqno = int((i['master'] - 1) - (i['master'] - 1) % 100) while len(prev_blocks_100) < 16: prev_blocks_100.append(known_mcs[prev_100_seqno].to_data()) if prev_100_seqno == 100: