Skip to content

Commit 0f48a46

Browse files
Apply suggestions from code review
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
1 parent 9fc7cee commit 0f48a46

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

spec/expr.typ

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
assert(type(typ.at(1)) == int, message: "Array types need to have a constant dimension")
1010
typ = typ.at(0)
1111
}
12-
assert(type(typ.at(0)) == str, message: "Array types need to have a regular type as base")
12+
assert(type(typ) == str, message: "Array types need to have a regular type as base")
1313
}
1414

1515
// Render a type to code
@@ -60,7 +60,7 @@
6060
"cast": 3, // cast
6161
"mul": 4, // *
6262
"div": 5, // /
63-
"mod": 6, // %
63+
"mod": 6, // mod
6464
"sum": 7, // Σ
6565
"not": 8, // not
6666
"sub": 9, // -

spec/keccak.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The chip therefore contributes the following interaction to the lookup-argument:
3939

4040
The address containing the state to be permuted is passed in as argument `A0 = x10`.
4141
The following constraints describe that this address is read into `addr` (@keccak:c:read_addr), from which `state_ptr` --- the collection of pointers to all lanes of the state --- is derived (@keccak:c:state_ptr).
42-
The state is then read into `input_state`, while the `output_state` is written back to the indicated address (@keccack:c:load_store_state).
42+
The state is then read into `input_state`, while the `output_state` is written back to the indicated address (@keccak:c:load_store_state).
4343
#render_constraint_table(chip, config, groups: "mem")
4444

4545
Lastly, the input state is pushed to the Keccak-round function, while the output after 24 rounds is taken off the bus:

spec/src/keccak.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ input = [0, ["cast", ["idx", ["idx", "state_ptr", "x"], "y"], "DWordWL"], ["idx"
8484
output = ["idx", ["idx", "input_state", "x"], "y"]
8585
iters = [["x", 0, 4], ["y", 0, 4]]
8686
multiplicity = "μ"
87-
ref = "keccack:c:load_store_state"
87+
ref = "keccak:c:load_store_state"
8888

8989
[[constraint_groups]]
9090
name = "round"

spec/tooling/chip.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ def typecheck(self, env: Environment) -> Type:
266266

267267
if isinstance(modulus, list) or not modulus.is_const():
268268
reporter.error(f"Invalid non-constant modulus: {self.modulus!r}")
269+
return Range.const(1)
269270
modulus = modulus.get_const()
270271
if modulus <= 0:
271-
reporter.error(f"Invalid zero non-positive modulus: {self.modulus!r}")
272+
reporter.error(f"Invalid non-positive modulus: {self.modulus!r}")
273+
return Range(1)
272274

273275
if elt.is_const():
274276
elt = elt.get_const()

0 commit comments

Comments
 (0)