Skip to content

Commit

Permalink
serialize vk to cairo
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Nov 5, 2024
1 parent 79ebd7c commit 2dd4e47
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 0 deletions.
17 changes: 17 additions & 0 deletions hydra/garaga/precompiled_circuits/honk_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,23 @@ def from_bytes(cls, bytes: bytes) -> "HonkVk":
**points,
)

def serialize_to_cairo(self, name: str = "vk") -> str:
code = f"const {name}: HonkVk = HonkVk {{\n"
code += f"circuit_size: {self.circuit_size},\n"
code += f"log_circuit_size: {self.log_circuit_size},\n"
code += f"public_inputs_size: {self.public_inputs_size},\n"
code += f"public_inputs_offset: {self.public_inputs_offset},\n"

g1_points = [
field.name
for field in fields(self)
if field.type == G1Point and field.name != "name"
]
for field_name in g1_points:
code += f"{field_name}: {getattr(self, field_name).serialize_to_cairo(name=field_name, raw=True)},\n"
code += "};"
return code


class Sha3Transcript:
def __init__(self):
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 2dd4e47

Please sign in to comment.