test(DON'T MERGE): develop-v2.1.0#2646
test(DON'T MERGE): develop-v2.1.0#2646shuklaayush wants to merge 7 commits intodevelop-v2.0.0-rc.1from
Conversation
|
Claude finished @shuklaayush's task in 2m 44s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass elliptic curve operations from affine coordinates (using Overall AssessmentThe migration is well-structured and thorough. The complete projective formulas are correctly implemented with good optimization of AIR column counts. The PR touches the full stack: circuit constraints, execution, guest libraries, macros, transpiler, and tests. Correctness1. Projective addition/doubling formulas look correct The implementations in 2. Native field implementations match The 3. Identity representation is consistent Identity is 4. Setup instruction correctly validates projective layout In Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}This is mathematically correct for projective equivalence, but when running inside zkVM, these multiplications emit unconstrained modular arithmetic instructions. If 2. (Low)
fn add_impl<const CHECK_SETUP: bool>(&self, p2: &Self) -> Self {
let b3 = &(&<Self as WeierstrassPoint>::CURVE_B + &<Self as WeierstrassPoint>::CURVE_B) + &<Self as WeierstrassPoint>::CURVE_B;
Self::add_a0(&self.x, &self.y, &self.z, &p2.x, &p2.y, &p2.z, &b3)
}
3. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 4. (Info) The The macro at Code QualityWell done:
Minor style notes:
Breaking ChangesThis PR changes the opcode names ( SummarySolid PR implementing a well-known optimization. The projective formulas are correctly implemented, the AIR constraints are well-optimized, and the migration touches all necessary layers consistently. The potential issues noted above are minor/informational. The test coverage is good, though integration tests (in |
|
Claude finished @shuklaayush's task in 1m 56s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (with Overall AssessmentSolid, well-executed migration. The projective formulas are correctly implemented across all layers (AIR constraints, execution, guest libraries, macros, transpiler). The AIR column count optimizations are well-documented with specific reduction percentages. The code is clean and the test coverage is comprehensive. CorrectnessAIR constraint formulas are correct. I verified the The Native implementations match. The Identity representation Setup validation is correct. Both Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}When running inside zkVM, these multiplications emit modular arithmetic instructions. Unlike 2. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 3. (Low)
fn add_impl<const CHECK_SETUP: bool>(&self, p2: &Self) -> Self {
let b3 = &(&<Self as WeierstrassPoint>::CURVE_B + &<Self as WeierstrassPoint>::CURVE_B)
+ &<Self as WeierstrassPoint>::CURVE_B;
Self::add_a0(&self.x, &self.y, &self.z, &p2.x, &p2.y, &p2.z, &b3)
}
4. (Low) Doubling in
let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1This computes Code QualityWell done:
Style notes:
Breaking ChangesThis PR changes:
All breaking changes appear correctly handled across the full stack (circuit, transpiler, guest, macros, tests, docs). SummaryWell-structured migration implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reduction percentages, and the change propagates consistently through all layers. The issues noted above are minor/informational. The existing unit tests are solid; the integration tests in |
04fd82b to
e561053
Compare
|
Claude finished @shuklaayush's task in 5m 23s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The projective formulas are correctly implemented across all layers (AIR constraints, execution, guest libraries, macros, transpiler). The AIR column count optimizations are well-documented and the code is clean. I verified the formulas in Correctness VerificationAIR constraint formulas are correct. I manually traced the a=0 addition (Algorithm 7) and general addition (Algorithm 1) against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula itself is mathematically correct for all cases (including identity — when both Z=0, both checks reduce to 0==0; when only one Z=0, the Y check fails). However, unlike 2. (Medium) Missing identity/edge-case tests The test suite in
These are the key cases that the complete projective formulas are supposed to handle correctly. Adding them would provide confidence that the complete formulas work end-to-end through the AIR. 3. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 4. (Low) Non-zkVM doubling path computes
let z3 = &(&(&(&t0 + &t0) + &t0 + &t0) + &t0 + &t0 + &t0) + &t0; // 8*t0This uses 7 additions when 3 doublings suffice: 5. (Low)
Code QualityWell done:
Minor style notes:
Breaking ChangesAll correctly handled across the full stack:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reduction percentages, and the change propagates consistently through all layers. The most actionable suggestion is adding identity/edge-case tests (issue #2) to exercise the complete formula's key advantage over the old affine approach. The other issues are minor or informational. |
1ad4372 to
87f486c
Compare
2dc3ff8 to
acfcec5
Compare
acfcec5 to
45182cf
Compare
45182cf to
5fc92b8
Compare
64261c0 to
19fdb18
Compare
|
Claude finished @shuklaayush's task in 3m 23s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented and sound. Identity representation CorrectnessAIR constraint formulas are correct. Verified against ePrint 2015/1060:
The algebraic rearrangements (combined mul-sub, inlined intermediates, degree-2 outputs) are mathematically sound and well-commented. Native implementations match. The Setup validation is correct. Both Breaking changes handled consistently. Opcode renames, memory layout (2→3 coords), trait changes, pairing crate constants — all correctly propagated. Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct, but unlike 2. (Medium) Missing identity/edge-case tests The test suite covers standard point operations well, but lacks explicit tests for the key cases that complete projective formulas are supposed to handle:
These are the primary advantage of complete formulas over the old affine approach. Adding them would provide confidence that the complete formulas work end-to-end through the AIR. Add identity tests → 3. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 4. (Low) Redundant multiplications in non-zkVM doubling path
let z3 = &(&(&(&t0 + &t0) + &t0 + &t0) + &t0 + &t0 + &t0) + &t0; // 8*t0Uses 7 additions when 3 doublings suffice: let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1Computes These are only in the non-zkVM host fallback path so the impact is minor, but they're easy wins. Fix redundant operations → 5. (Low)
Code QualityWell done:
Minor style notes:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions, and the change propagates consistently through all layers. The most actionable suggestions are:
The remaining issues are minor/informational. |
19fdb18 to
0de0239
Compare
|
Claude finished @shuklaayush's task in 4m 25s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. I verified the formulas against the ePrint reference — they match. The AIR column count optimizations are well-documented and sound. Identity representation CorrectnessAIR formulas verified correct:
Native implementations match in Setup validation correct in both
Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct (including for identity — when both Z=0, both checks reduce to 0==0). However, unlike 2. (Medium) Missing identity/edge-case tests The test suite covers standard point operations well, but lacks explicit tests for the key cases that complete projective formulas are supposed to handle:
These are the primary advantage of complete formulas over the old affine approach. Adding them would confirm the complete formulas work end-to-end through the AIR. Add identity tests → 3. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 4. (Low) Redundant multiplications in non-zkVM doubling path
let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1Computes Similarly line 209 computes These are only in the non-zkVM host fallback path so the impact is minor, but they're easy wins. Fix redundant operations → 5. (Low)
Code QualityWell done:
Minor style notes:
Breaking ChangesAll correctly handled across the full stack:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions, and the change propagates consistently through all layers. The most actionable suggestions are:
The remaining issues are minor/informational. |
0de0239 to
9feb9c5
Compare
|
Claude finished @shuklaayush's task in 3m 10s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented and sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both Breaking changes handled consistently — opcode renames, memory layout (2→3 coords), trait changes, pairing constants all correctly propagated. Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct (including identity cases). However, unlike 2. (Medium) Missing identity/edge-case tests The test suite covers standard point operations well but all circuit tests use Z=1 input (affine in projective form). The key cases that complete projective formulas are supposed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. Adding them would confirm the formulas work end-to-end through the AIR. Add identity tests → 3. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 4. (Low) Redundant multiplications in non-zkVM doubling path
let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1Computes 5. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions, and the change propagates consistently through all layers. The most actionable suggestions are:
The remaining issues are minor/informational. |
9feb9c5 to
eb2cbdf
Compare
|
Claude finished @shuklaayush's task in 4m 14s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented and sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations in Setup validation correct in both Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike 2. (Medium) Missing identity/edge-case tests The test suite covers standard point operations across multiple curves and field sizes, but all circuit-level tests use Z=1 inputs (affine in projective form). The key cases that complete projective formulas are supposed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. Adding them would confirm the formulas work end-to-end through the AIR. Add identity tests → 3. (Low) Redundant multiplications in non-zkVM doubling path
let z3 = &(&(&(&t0 + &t0) + &t0 + &t0) + &t0 + &t0 + &t0) + &t0; // 8*t0Uses 7 additions when 3 doublings suffice: let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes let t3 = &(&p.x * &p.y) + &(&p.x * &p.y); // 2*x*ySame pattern — let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1Computes These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so the impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 4. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 5. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions (22-38%), and the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs). The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
eb2cbdf to
d96449e
Compare
|
Claude finished @shuklaayush's task in 2m 35s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented and algebraically sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Setup validation is correct in both Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct (including identity cases). However, unlike 2. (Medium) Missing identity/edge-case tests in circuit-level tests The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. Adding them to the circuit tests (not just the native 3. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM fallback path compute the same product multiple times: let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes let z3 = &(&(&t2_yz * &t1) + &(&t2_yz * &t1) + &(&t2_yz * &t1)) + &(&t2_yz * &t1); // 4*t2_yz*t1Computes These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins. 4. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 5. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions (22-38%), and the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs). The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
|
Claude finished @shuklaayush's task in 5m 52s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across all layers: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented with specific reduction percentages. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Setup validation is correct in both Block size migration (9c08ad7) is correct. Note: Potential Issues1. (Medium)
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}The projective equivalence formula is mathematically correct (including identity cases). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only. The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. Adding them to circuit tests would confirm the AIR constraints work end-to-end for edge cases. Add identity tests → 3. (Low) Redundant multiplications in non-zkVM doubling path
let x3 = &(&t0 * &t1) + &(&t0 * &t1); // 2 * t0 * t1Computes Same pattern at lines 209, 210, 223 (products computed twice instead of once-and-double) and line 226 (4 multiplications instead of 1 mul + 2 additions). Also line 189 computes 4. (Low)
5. (Low) Stylistic inconsistency in prime access
Code QualityWell done:
Breaking ChangesAll correctly handled across the full stack:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions (22-38%), and the change propagates consistently through all layers. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
70aaf4d to
58582a0
Compare
|
Claude finished @shuklaayush's task in 2m 27s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack: AIR constraints, execution, guest libraries, macros, transpiler, and docs. The AIR column count optimizations are well-documented and algebraically sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct. However, unlike 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. Adding them to circuit tests would confirm the AIR constraints work end-to-end for edge cases. Add identity tests → 3. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path so runtime impact is minor, but they're easy wins. Fix redundant operations → 4. (Low)
5. (Low) Stylistic inconsistency in prime access
Code QualityWell done:
SummarySolid PR implementing a well-known optimization. The complete projective formulas are correctly implemented, AIR constraints are well-optimized with documented reductions (22-38%), and the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs). The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
51b2eed to
15e3033
Compare
a4b0557 to
c00c20c
Compare
|
Claude finished @shuklaayush's task in 3m 10s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and the benchmarks show good results. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
c00c20c to
7e6c07b
Compare
|
Claude finished @shuklaayush's task in 3m 11s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and the benchmarks look good. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
7e6c07b to
d9dd0f4
Compare
|
Claude finished @shuklaayush's task in 3m 23s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes, but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and the benchmarks look good. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
d9dd0f4 to
139e261
Compare
|
Claude finished @shuklaayush's task in 3m 43s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack. The AIR column count optimizations are well-documented with specific reduction percentages, and the algebraic rearrangements are sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes (secp256k1, BLS12-381, secp256r1), but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and the benchmarks look good. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
139e261 to
dc1f2e6
Compare
|
Claude finished @shuklaayush's task in 3m 8s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across the full stack. The AIR column count optimizations are well-documented with specific reduction percentages, and the algebraic rearrangements are sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes (secp256k1, BLS12-381, secp256r1), but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and benchmarks confirm the performance gains. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
c627316 to
0d19e9c
Compare
dc1f2e6 to
3898ae8
Compare
|
Claude finished @shuklaayush's task in 2m 35s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across all layers. The AIR column count optimizations are well-documented and algebraically sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes (secp256k1, BLS12-381, secp256r1), but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit → execution → guest → macros → transpiler → docs), and benchmarks confirm the performance gains. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
This comment has been minimized.
This comment has been minimized.
5cd1c1c to
71a0da5
Compare
A description of the `HintNonQr` and `HintSqrt` phantom instructions in the algebra extension was missing from instruction reference. This PR adds it.
Resolves INT-6133. - Rename SW_EC_ADD_NE -> SW_EC_ADD_PROJ, SW_EC_DOUBLE -> SW_EC_DOUBLE_PROJ - Update memory layout from 2*COORD_SIZE to 3*COORD_SIZE (projective) - Add r32_projective_point notation with X, Y, Z coordinates - Update setup validation to check X=modulus, Y=a, Z=b - Reference ePrint 2015/1060 complete formulas - Update ISA spec, instruction reference, transpiler, RISC-V custom code - Update circuit README and user documentation
…te (#2404) Resolves INT-6134 - Update ec_add and ec_double to use projective coordinates (X:Y:Z) instead of affine coordinates (x,y), eliminating field inversions - Implement algorithms from ePrint 2015/1060: - Algorithm 7 (add, a=0) and Algorithm 1 (add, general) - Algorithm 9 (double, a=0) and Algorithm 3 (double, general) - Add k256-specific implementations with normalize_weak() for magnitude tracking - Update BLOCKS constants from affine (2,6) to projective (3,9) - Rename opcodes: SW_EC_ADD_NE -> SW_EC_ADD_PROJ, SW_EC_DOUBLE -> SW_EC_DOUBLE_PROJ - Rename add_ne directory and all identifiers to add (EcAddNeExecutor -> EcAddExecutor, etc.)
Resolves INT-6135. Update guest-side Weierstrass EC from affine to projective coordinates: - WeierstrassPoint trait: projective interface with (X, Y, Z), identity (0, 1, 0), complete addition/doubling formulas, normalize(), is_identity() - impl_sw_proj! macro: replaces impl_sw_affine!, a=0 complete formulas from ePrint 2015/1060 - impl_sw_group_ops!: simplified with no branching (complete formulas handle all edge cases) - sw_declare!/sw_init! proc macros: projective struct, SwAddProj/SwDoubleProj opcodes, setup sends (modulus, a, b), projective PartialEq via cross-multiplication - ECDSA: normalize before extracting affine coordinates - Test programs: normalize results before comparing to known affine values
Resolves INT-6096. - CachedMulTable: updated to use projective add/double --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Adapt projective EC extension to v2's `DEFAULT_BLOCK_SIZE=4` memory constraint. The projective coordinates code used `BLOCK_SIZE=32` (secp256k1) and `BLOCK_SIZE=16` (BLS12-381) for memory accesses, but v2's `TracingMemory` enforces 4-cell accesses. This updates: - `ECC_BLOCKS` constants from `2 * NUM_LIMBS / 4` (affine, 2 coords) to `3 * NUM_LIMBS / 4` (projective, 3 coords) - All hardcoded `<3, 32>` / `<9, 16>` const generics to `<ECC_BLOCKS_N, DEFAULT_BLOCK_SIZE>` in extension, hybrid, and test code - Test helpers to write memory in 4-byte chunks resolves int-6644
3898ae8 to
0cc0b0b
Compare
|
Claude finished @shuklaayush's task in 2m 29s —— View job Code Review: PR #2646 — SW_EC Projective Coordinates Migration
This PR migrates Short Weierstrass EC operations from affine coordinates (using Overall AssessmentWell-executed migration. The complete projective formulas are correctly implemented across all layers. The AIR column count optimizations are well-documented and algebraically sound. Identity representation CorrectnessAIR constraint formulas verified correct against ePrint 2015/1060:
Native implementations match. The Identity representation Setup validation is correct in both
Breaking changes handled consistently — opcode renames ( Potential Issues1. (Medium)
impl core::cmp::PartialEq for #struct_name {
fn eq(&self, other: &Self) -> bool {
(&self.x * &other.z) == (&other.x * &self.z)
&& (&self.y * &other.z) == (&other.y * &self.z)
}
}The projective equivalence formula is mathematically correct (including identity cases — when both Z=0, both checks reduce to 0==0). However, unlike Suggestion: Add a 2. (Medium) Missing identity/edge-case tests at circuit level The test suite covers standard point operations across curves and field sizes (secp256k1, BLS12-381, secp256r1), but all circuit-level tests use Z=1 inputs only (affine in projective form). The key cases that complete projective formulas are designed to handle are missing:
These are the primary advantage of complete formulas over the old affine approach. The 3. (Low) Stylistic inconsistency in prime access between add and double execution
4. (Low) Redundant multiplications in non-zkVM doubling path ( Several lines in the non-zkVM host fallback path compute the same product multiple times:
These are only in the non-zkVM host fallback path (the zkVM path calls the chip directly), so runtime impact is minor, but they're easy wins for host-side execution performance. Fix redundant operations → 5. (Low)
if x == Self::Coordinate::ZERO && y == Self::Coordinate::ZERO {
Some(Self::IDENTITY)
}For curves where 6. (Low)
Code QualityWell done:
SummarySolid PR implementing a well-known optimization with 22-38% AIR column count reductions. The complete projective formulas are correctly implemented, the change propagates consistently through all layers (circuit -> execution -> guest -> macros -> transpiler -> docs), and benchmarks confirm the performance gains. The most actionable suggestions are:
The remaining issues are minor optimizations for the non-zkVM host fallback path. |
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 0cc0b0b |
No description provided.