Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
format python
Browse files Browse the repository at this point in the history
  • Loading branch information
qwang98 committed Oct 25, 2023
1 parent 15d15b8 commit 83743b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions examples/factorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def setup(self):
# constrain i + 1 == i.next()
self.transition(eq(self.circuit.i + 1, self.circuit.i.next()))
# constrain the next `x` to be the product of the current `x` and the next `i`
self.transition(eq(self.circuit.x * (self.circuit.i + 1), self.circuit.x.next()))
self.transition(
eq(self.circuit.x * (self.circuit.i + 1), self.circuit.x.next())
)

def wg(self, i_value, x_value):
self.assign(self.circuit.i, F(i_value))
Expand Down Expand Up @@ -99,15 +101,19 @@ class Examples:
def test_zero(self):
factorial = Factorial()
factorial_witness = factorial.gen_witness(0)
last_assignments = list(factorial_witness.step_instances[10].assignments.values())
last_assignments = list(
factorial_witness.step_instances[10].assignments.values()
)
assert last_assignments[0] == 0 # i
assert last_assignments[1] == 1 # x
factorial.halo2_mock_prover(factorial_witness)

def test_basic(self):
factorial = Factorial()
factorial_witness = factorial.gen_witness(7)
last_assignments = list(factorial_witness.step_instances[10].assignments.values())
last_assignments = list(
factorial_witness.step_instances[10].assignments.values()
)
assert last_assignments[0] == 7 # i
assert last_assignments[1] == 5040 # x
factorial.halo2_mock_prover(factorial_witness)
Expand All @@ -116,6 +122,9 @@ def test_basic(self):
if __name__ == "__main__":
x = Examples()
for method in [
method for method in dir(x) if callable(getattr(x, method)) if not method.startswith('_')
method
for method in dir(x)
if callable(getattr(x, method))
if not method.startswith("_")
]:
getattr(x, method)()
2 changes: 1 addition & 1 deletion examples/mimc7.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ def mapping(self, x_in_value, k_value):
mimc7_super_witness = mimc7.gen_witness(F(1), F(2))
# for key, value in mimc7_super_witness.items():
# print(f"{key}: {str(value)}")
mimc7.halo2_mock_prover(mimc7_super_witness, k = 10)
mimc7.halo2_mock_prover(mimc7_super_witness, k=10)

0 comments on commit 83743b3

Please sign in to comment.