Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 88414cc

Browse files
authored
another edge case (#951)
1 parent f5b630e commit 88414cc

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

zkevm-circuits/src/sig_circuit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<F: Field> SigCircuit<F> {
362362
//
363363
// WARNING: this circuit does not enforce the returned value to be true
364364
// make sure the caller checks this result!
365-
let (sig_is_valid, pk_is_zero, y_coord, y_coord_is_zero) =
365+
let (sig_is_valid, pk_is_zero, y_coord) =
366366
ecdsa_verify_no_pubkey_check::<F, Fp, Fq, Secp256k1Affine>(
367367
&ecc_chip.field_chip,
368368
ctx,
@@ -426,13 +426,13 @@ impl<F: Field> SigCircuit<F> {
426426
.range
427427
.range_check(ctx, &assigned_y_tmp, 87);
428428

429-
let y_coord_not_zero = gate.not(ctx, QuantumCell::Existing(y_coord_is_zero));
429+
let pk_not_zero = gate.not(ctx, QuantumCell::Existing(pk_is_zero));
430430
let sig_is_valid = gate.and_many(
431431
ctx,
432432
vec![
433433
QuantumCell::Existing(sig_is_valid),
434434
QuantumCell::Existing(y_is_ok),
435-
QuantumCell::Existing(y_coord_not_zero),
435+
QuantumCell::Existing(pk_not_zero),
436436
],
437437
);
438438

zkevm-circuits/src/sig_circuit/ecdsa.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ pub(crate) fn ecdsa_verify_no_pubkey_check<F: PrimeField, CF: PrimeField, SF: Pr
3131
msghash: &CRTInteger<F>,
3232
var_window_bits: usize,
3333
fixed_window_bits: usize,
34-
) -> (
35-
AssignedValue<F>,
36-
AssignedValue<F>,
37-
CRTInteger<F>,
38-
AssignedValue<F>,
39-
)
34+
) -> (AssignedValue<F>, AssignedValue<F>, CRTInteger<F>)
4035
where
4136
GA: CurveAffineExt<Base = CF, ScalarExt = SF>,
4237
{
@@ -221,6 +216,5 @@ where
221216
],
222217
);
223218

224-
let y_is_zero = scalar_chip.is_soft_zero(ctx, &sum.y);
225-
(res, is_pubkey_zero, sum.y, y_is_zero)
219+
(res, is_pubkey_zero, sum.y)
226220
}

zkevm-circuits/src/sig_circuit/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn test_edge_cases() {
109109
good_ecrecover_data.2,
110110
good_ecrecover_data.3,
111111
),
112-
// 9. cannot recover even if all inputs are valid
112+
// 9. valid msg_hash, r, s, v but pubkey not recovered
113113
(
114114
word!("0x571b659b539a9da729fca1f2efdd8b07d6a7042e0640ac5ce3a8c5e3445523d7"),
115115
word!("0x5d14c6d7824ddecc43d307891c4fae49307e370f827fae93e014796665705800"),

0 commit comments

Comments
 (0)