add addap/jmp_abs/jmp_rel opcodes#43
Conversation
cdac7c2 to
2e2be25
Compare
shaharsamocha7
left a comment
There was a problem hiding this comment.
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @giladchase)
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 17 at r1 (raw file):
use crate::utils::{Selector, SelectorTrait}; pub const ADD_AP_N_TRACE_CELLS: usize = 7;
ADD_AP is not really correct here
Suggestion:
pub const N_TRACE_CELLS: usize = 7;crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 23 at r1 (raw file):
// ``` // jmp_abs_imm = K + 1 // jmp_rel_imm = K + 2
Assumes Opcode_base=K such that:
// ```
// addap_imm = K
// jmp_abs_imm = K + 1
// jmp_rel_imm = K + 2
Code quote:
// Opcode base should be: `addap_imm = K`
// such that:
// ```
// jmp_abs_imm = K + 1
// jmp_rel_imm = K + 2crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 25 at r1 (raw file):
// jmp_rel_imm = K + 2 // ``` pub const INSTRUCTION_BASE: M31 = M31::from_u32_unchecked(0);
add a TODO to change the 0 to a real value
Rename above documentation to INSTRUCTION_BASE
Suggestion:
pub const K: M31 = M31::from_u32_unchecked(0);crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 60 at r1 (raw file):
- E::F::from(THREE) * opcode_type.clone() * opcode_type.clone() + E::F::from(TWO) * opcode_type.clone(), );
Document to the poly
Consider to move this code to a function (maybe it is already exists)
Code quote:
// assert is_trit.
eval.add_constraint(
opcode_type.clone() * opcode_type.clone() * opcode_type.clone()
- E::F::from(THREE) * opcode_type.clone() * opcode_type.clone()
+ E::F::from(TWO) * opcode_type.clone(),
);2e2be25 to
b1e6638
Compare
giladchase
left a comment
There was a problem hiding this comment.
Reviewable status: 6 of 8 files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7)
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 17 at r1 (raw file):
Previously, shaharsamocha7 wrote…
ADD_AP is not really correct here
Done.
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 23 at r1 (raw file):
Previously, shaharsamocha7 wrote…
Assumes Opcode_base=K such that:
// ```
// addap_imm = K
// jmp_abs_imm = K + 1
// jmp_rel_imm = K + 2
Done.
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 25 at r1 (raw file):
Previously, shaharsamocha7 wrote…
add a TODO to change the 0 to a real value
Rename above documentation to
INSTRUCTION_BASE
That was the opcode above, moved it now to be close to this.
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 60 at r1 (raw file):
Previously, shaharsamocha7 wrote…
Document to the poly
Consider to move this code to a function (maybe it is already exists)
Done.
302b01c to
3adeb19
Compare
shaharsamocha7
left a comment
There was a problem hiding this comment.
Reviewed 2 of 3 files at r2.
Reviewable status: 7 of 8 files reviewed, 1 unresolved discussion (waiting on @giladchase)
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 23 at r1 (raw file):
Previously, giladchase wrote…
Done.
actually maybe we want rename K -> INSTRUCTION_BASE and not the other way around
sorry :(
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 52 at r2 (raw file):
// Assert flag is in range: {0,1,2}. let opcode_type = eval.next_trace_mask();
match the name with the comment
Suggestion:
// Assert flag is in range: {0,1,2}.
let flag = eval.next_trace_mask();3fae126 to
6a01251
Compare
3adeb19 to
294ef65
Compare
giladchase
left a comment
There was a problem hiding this comment.
Reviewable status: 7 of 8 files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7)
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 23 at r1 (raw file):
Previously, shaharsamocha7 wrote…
actually maybe we want rename K -> INSTRUCTION_BASE and not the other way around
sorry :(
jj Done
crates/prover/src/components/addap_jmpabs_jmprel_opcode/component.rs line 52 at r2 (raw file):
Previously, shaharsamocha7 wrote…
match the name with the comment
I changed it the other way around, hope that's ok 😬
294ef65 to
3481381
Compare
|
Semgrep found 1 Detected 'unsafe' usage, please audit for secure usage |
shaharsamocha7
left a comment
There was a problem hiding this comment.
Reviewed 1 of 3 files at r2, 9 of 9 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @giladchase)
6a01251 to
e1ab88b
Compare
- follows current design in stwo-cairo for this opcode. - inline write_trace_row - add LookupData that wraps InteractionClaimGenerator fields, which also holds n_calls. - fix edge cases if input is smaller than LOG_N_LANES
e1ab88b to
2b6b767
Compare
3481381 to
0e0ba19
Compare
86f8551 to
dddbf1c
Compare
Only component, the rest is on the way
This change is