diff --git a/electrumx/lib/util_atomicals.py b/electrumx/lib/util_atomicals.py index 2a1b0168..a8ee9989 100644 --- a/electrumx/lib/util_atomicals.py +++ b/electrumx/lib/util_atomicals.py @@ -1217,7 +1217,7 @@ def parse_protocols_operations_from_witness_array(tx, tx_hash, allow_args_bytes) # Also enforce that if there are meta, args, or ctx fields that they must be dicts # This is done to ensure that these fields are always easily parseable and do not contain unexpected data which could cause parsing problems later # Ensure that they are not allowed to contain bytes like objects - if not is_sanitized_dict_whitelist_only(decoded_object) or not is_sanitized_dict_whitelist_only(decoded_object.get('meta', {})) or not is_sanitized_dict_whitelist_only(decoded_object.get('args', {}), allow_args_bytes) or not is_sanitized_dict_whitelist_only(decoded_object.get('ctx', {})) or not is_sanitized_dict_whitelist_only(decoded_object.get('init', {}), True): + if not is_sanitized_dict_whitelist_only(decoded_object.get('meta', {})) or not is_sanitized_dict_whitelist_only(decoded_object.get('args', {}), allow_args_bytes) or not is_sanitized_dict_whitelist_only(decoded_object.get('ctx', {})) or not is_sanitized_dict_whitelist_only(decoded_object.get('init', {}), True): print(f'parse_protocols_operations_from_witness_array found {op_name} but decoded CBOR payload has an args, meta, ctx, or init that has not permitted data type {tx} {decoded_object}. Skipping tx input...') continue diff --git a/electrumx/server/block_processor.py b/electrumx/server/block_processor.py index 56aa669a..c81afc4f 100644 --- a/electrumx/server/block_processor.py +++ b/electrumx/server/block_processor.py @@ -1617,7 +1617,10 @@ def put_or_delete_init_state_updates(self, mint_info, data_payload, Delete): height = mint_info['reveal_location_height'] # Make a deep copy of the data payload and remove the reserved sections - copied_data_state = {k: v for k, v in data_payload.items() if k != "args"} + copied_data_state = {} + for k, v in data_payload.items(): + if k != 'args': + copied_data_state[k] = v init_payload_bytes = dumps(copied_data_state) op_struct = { 'op': 'mod', diff --git a/tests/lib/test_atomicals_utils.py b/tests/lib/test_atomicals_utils.py index 05de84a5..321761e6 100644 --- a/tests/lib/test_atomicals_utils.py +++ b/tests/lib/test_atomicals_utils.py @@ -9,8 +9,7 @@ calculate_expected_bitwork, is_txid_valid_for_perpetual_bitwork, get_next_bitwork_full_str, - MINT_REALM_CONTAINER_TICKER_COMMIT_REVEAL_DELAY_BLOCKS, - parse_protocols_operations_from_witness_array + MINT_REALM_CONTAINER_TICKER_COMMIT_REVEAL_DELAY_BLOCKS ) coin = Bitcoin @@ -1013,10 +1012,4 @@ def test_get_next_bitwork_full_str(): assert(get_next_bitwork_full_str('88888', 2) == '888') assert(get_next_bitwork_full_str('88888', 3) == '8888') assert(get_next_bitwork_full_str('88888', 4) == '88888') - -def test_parse_protocols_operations_from_witness_array(): - raw_tx_str = '01000000000101447f2f5cfbac5dd33c7f37b47e937c98b221a2aaeed4afecf9aa452e931084410000000000ffffffff010b00000000000000225120e326627e5b4b8740c3720b233eb69eec21c89075e4a0803513cf1e55e42d3c180340a179fe5f80f018b2d875ca34e43f4a6c15b58bf639ee1e75bccfa6b84596c7cd18d93be4058b28db3b110dced93000afca08d3fbce5c88314ded9e5c2cb64022fdb60620e89589270b4d6aa8443326be89ced39546ac09dbf8206a02558b5f312a443ff3ac00630461746f6d036466744d0802a36869636f6e2e706e67a26324637469696d6167652f706e67622462d84058f089504e470d0a1a0a0000000d494844520000001c0000001c080300000045d32fa60000002a504c544547704cffffffffcb72f4b91075dd35ffa100cca25b64b4f2cc8100f7690051b413007dddee01001e1e1eeaa9f7a10000000174524e530040e6d866000000744944415478dab5ce4b0e85201044d1ee07cf42d4fd6f570ba34d226dfcc43ba8c981807c9e32d74208aa9ef9aaa407686fdefeedc0b46ccbb0e7e2510107ede6b454a68d20a28998807562cc0744bf16d5d4d02ce65a0b8ea553ccb40d01a225998983629652b794d2af4eae208107fe756f7106670109a1f6c07de70000000049454e44ae4260826461726773a86b6d696e745f616d6f756e741903e86b6d696e745f68656967687400696d61785f6d696e74731952086d6d696e745f626974776f726b6364646464646e726571756573745f7469636b6572646464646468626974776f726b636434313834656e6f6e6365006474696d651a661bb448646d657461a3646e616d6564444444446b6465736372697074696f6e781c5468652041746f6d6963616c73206572612068617320626567756e2e656c6567616ca1657465726d737904ae54686520546f6b656e2069732070726f766964656420274153204953272c20776974686f75742077617272616e7479206f6620616e79206b694d08026e642c2065787072657373206f7220696d706c6965642c20696e636c7564696e6720627574206e6f74206c696d6974656420746f207468652077617272616e74696573206f66206d65726368616e746162696c6974792c206669746e65737320666f72206120706172746963756c617220707572706f736520616e64206e6f6e2d696e6672696e67656d656e742e20496e206e6f206576656e74207368616c6c207468652063726561746f72732c20617574686f7273206f7220636f7079726967687420686f6c64657273206265206c6961626c6520666f7220616e7920636c61696d2c2064616d61676573206f72206f74686572206c696162696c6974792c207768657468657220696e20616e20616374696f6e206f6620636f6e74726163742c20746f7274206f72206f74686572776973652c2061726973696e672066726f6d2c206f7574206f66206f7220696e20636f6e6e656374696f6e20776974682054686520546f6b656e206f722074686520757365206f72206f74686572206465616c696e677320696e2054686520546f6b656e2e2054686520546f6b656e20646f6573206e6f7420726570726573656e7420616e7920696e766573746d656e742c2073656375726974792c2066696e616e6369616c20696e737472756d656e742c20726564656d7074696f6e2c2070726f6d6973652c2062656172657220696e737472756d656e4d080274206f7220636f6d6d69746d656e74206f6620616e79206b696e642e2054686520546f6b656e20697320696e74656e646564206f6e6c7920666f7220656475636174696f6e616c20616e64206578706572696d656e746174696f6e20707572706f736573206f6e6c7920616e64206973206e6f74206261636b6564206f7220737570706f7274656420627920616e7920696e646976696475616c206f72207465616d2e20546865726520617265206e6f206675747572652070726f737065637473206f7220706c616e73206f6620616e79206b696e64206265796f6e642074686520656475636174696f6e616c20616e64206578706572696d656e746174696f6e20757361676573206f662054686520546f6b656e2e20416e7920757365206f7220696e746572616374696f6e20776974682054686520546f6b656e20697320657870726573736c792070726f6869626974656420756e6c65737320796f7572206a7572697364696374696f6e20616e642063697263756d7374616e636573206578706c696369746c79207065726d697473207468652075736520616e6420696e746572616374696f6e20776974682054686520546f6b656e2e20416e7920696e746572616374696f6e20776974682054686520546f6b656e20636f6e737469747574657320616363657074616e6365206f66207468657365207465726d7320616e6420746865204c6575736572206163636570747320616c6c20726573706f6e736962696c69747920616e6420616c6c207269736b73206173736f6369617465642077697468207468652075736520616e6420696e746572616374696f6e20776974682054686520546f6b656e2e6821c1e89589270b4d6aa8443326be89ced39546ac09dbf8206a02558b5f312a443ff300000000' - raw_tx = bytes.fromhex(raw_tx_str) - tx, tx_hash = coin.DESERIALIZER(raw_tx, 0).read_tx_and_hash() - operation_found_at_inputs = parse_protocols_operations_from_witness_array(tx, tx_hash, True) - assert(operation_found_at_inputs == None) \ No newline at end of file + \ No newline at end of file