Skip to content

Commit

Permalink
Improved the json parsing in parsing_utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanMadzharov committed Oct 17, 2024
1 parent 7e86caf commit 50f8945
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import codecs
import dataclasses
import hashlib
import json
Expand Down Expand Up @@ -328,14 +329,14 @@ def from_dict(
proof = data

try:
seal = io.to_hex_str(find_item_from_key_patterns(data, ["seal"]))
image_id = io.to_hex_str(find_item_from_key_patterns(data, ["image_id"]))
journal = io.to_hex_str(find_item_from_key_patterns(data, ["journal"]))
seal = find_item_from_key_patterns(data, ["seal"])
image_id = find_item_from_key_patterns(data, ["image_id"])
journal = find_item_from_key_patterns(data, ["journal"])

return Groth16Proof._from_risc0(
seal=bytes.fromhex(seal[2:]),
image_id=bytes.fromhex(image_id[2:]),
journal=bytes.fromhex(journal[2:]),
seal=codecs.decode(seal[2:].replace("\\x", ""), "hex"),
image_id=codecs.decode(image_id[2:].replace("\\x", ""), "hex"),
journal=codecs.decode(journal[2:].replace("\\x", ""), "hex"),
)
except ValueError:
pass
Expand Down

0 comments on commit 50f8945

Please sign in to comment.