Closed btcopenstamp closed 3 months ago
fix #379
An invalid JSON string caused a SyntaxError, resulting in the program terminating unexpectedly. The issue first appeared on the testnet during the bitname testing process. The same code is used in src20, and when added to the src20 test cases for verification, it was found that this issue indeed causes the program to terminate unexpectedly.
Error info:
Traceback (most recent call last): File "/code/btc_stamps/indexer/test_src20.py", line 68, in test_src20_variations stamp_result, parsed_stamp, valid_stamp, prevalidated_src20 = parse_stamp( File "/code/btc_stamps/indexer/src/index_core/stamp.py", line 231, in parse_stamp return processor.process_stamp(stamp_data) File "/code/btc_stamps/indexer/src/index_core/stamp.py", line 31, in process_stamp stamp_data.process_and_store_stamp_data( File "/code/btc_stamps/indexer/src/index_core/models.py", line 559, in process_and_store_stamp_data stamp = convert_to_dict_or_string(self.data, output_format="dict") File "/code/btc_stamps/indexer/src/index_core/util.py", line 315, in convert_to_dict_or_string input_data = ast.literal_eval(input_data) File "/Users/mac/.pyenv/versions/3.10.13/lib/python3.10/ast.py", line 64, in literal_eval node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval') File "/Users/mac/.pyenv/versions/3.10.13/lib/python3.10/ast.py", line 50, in parse return compile(source, filename, mode, flags, File "<unknown>", line 1 {"p":"SRC-20","op":"DEPLOY","tick":"TEST","deci":8,"lim":1000000,"max":""1000000000"} ^ SyntaxError: unterminated string literal (detected at line 1)
The location where the code execution failed:
Resolve the issue by catching the SyntaxError:
would result in the program terminating unexpectedly.