Skip to content

Commit

Permalink
Add more msm calldata options (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime authored Aug 12, 2024
1 parent 8b6dddb commit 33ee6c5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tools/starknet/tests_and_calldata_generators/msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ def to_cairo_1_test(self):
return code

def serialize_to_calldata(
self, include_digits_decomposition=True, include_points_and_scalars=True
self,
include_digits_decomposition=True,
include_points_and_scalars=True,
serialize_as_pure_felt252_array=False,
) -> list[int]:
inputs = self._get_input_structs()
option = (
Expand All @@ -306,7 +309,10 @@ def serialize_to_calldata(
if include_points_and_scalars:
call_data.append(self.curve_id.value)

return [len(call_data)] + call_data
if serialize_as_pure_felt252_array:
return [len(call_data)] + call_data
else:
return call_data


if __name__ == "__main__":
Expand All @@ -319,6 +325,10 @@ def serialize_to_calldata(
points=[G1Point.gen_random_point(c) for _ in range(1)],
scalars=[random.randint(0, order) for _ in range(1)],
)
cd = msm.serialize_to_calldata(True)
cd = msm.serialize_to_calldata(
include_digits_decomposition=True,
include_points_and_scalars=True,
serialize_as_pure_felt252_array=False,
)
print(cd)
print(len(cd))

0 comments on commit 33ee6c5

Please sign in to comment.