Skip to content

Conversation

@AztecBot
Copy link
Collaborator

@AztecBot AztecBot commented Feb 4, 2026

BEGIN_COMMIT_OVERRIDE
fix: remove intermittently failing ecdsa mul test (#20095)
END_COMMIT_OVERRIDE

### Overview

I had added a test that checked if `secp256k1_ecdsa_mul` correctly returned point at infinity when we have private key $x$ defined as:

$$x = - u_1 \cdot u_2^{-1}$$

which would mean the scalar multiplication $(u_1 \cdot G + u_2 \cdot Q) = \mathcal{O}$ would result in a point at infinity. However, since the Montgomery ladder does not handle points at infinity (for efficiency purposes, we use incomplete addition formulae in the ladder computation), the circuit can fail by hitting a point at infinity during the ladder computation. Thus, this test was hitting intermittent failure (crash) once in a while. It is best to remove this test as we do not intend for Montgomery ladder to handle intermediate points at infinity.  

As a side note, the test should not have been crashing and should gracefully fail at an assertion (with circuit failure). I've fixed this minor issue in `bigfield` and added a test in biggroup to catch the circuit failure.

### Point at Infinity in Montgomery Ladder

At round $i$ of the iterative wNAF-style MSM, the partial accumulator has the form

$R_i = \sum_{k<i} 2^{e_k} \Big(u_{2,lo}[k] \cdot Q + u_{2,hi}[k] \cdot (\lambda Q)\Big) + \sum_{k<i} 2^{f_k}\Big(u_{1,lo}[k] \cdot G + u_{1,hi}[k] \cdot (\lambda G)\Big)$

Grouping terms, this is always expressible as

$$
R_i = U_i Q + V_i G,
$$

where

$U_i=\sum_{k<i}2^{e_k}(u_{2,lo,k} + \lambda \cdot u_{2,hi,k})$

$V_i=\sum_{k<i}2^{f_k}(u_{1,lo,k} + \lambda \cdot u_{1,hi,k}).$

Writing the public key as $Q=xG$, we get

$$
R_i=(U_i x + V_i)G.
$$

Therefore an intermediate infinity occurs exactly when

$$
R_i=\mathcal{O}
\iff
U_i x + V_i \equiv 0 \pmod n.
$$

Since the wNAF slice digits $u_{1,lo},u_{1,hi},u_{2,lo},u_{2,hi} \in [ \pm1,\pm3,\pm5,\pm7 ]$ are signed, partial sums may cancel, so intermediate iterates $R_i$ may legitimately equal the point at infinity even if the final result is nonzero.
Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto-approved

@AztecBot
Copy link
Collaborator Author

AztecBot commented Feb 4, 2026

🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass.

@AztecBot AztecBot added this pull request to the merge queue Feb 4, 2026
@AztecBot
Copy link
Collaborator Author

AztecBot commented Feb 4, 2026

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/45538558948c6149�45538558948c61498;;�): cd yarn-project/kv-store && yarn test (46s) (code: 1) (\033Aztec Bot\033: feat: merge-train/barretenberg (#20152))

Merged via the queue into next with commit e9bf50b Feb 4, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants