fix: use generic security level in aux precompute instead of hardcoded SecurityLevel128 - #187
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes aux-info multiexponentiation precomputation in tests so it respects the generic security level L (instead of always using SecurityLevel128), resolving type/parameter mismatches for curves like secp384r1 that require SecurityLevel192.
Changes:
- Replace hardcoded
SecurityLevel128with the genericLinget_aux_innerwhen callingprecompute_multiexp_table.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @survived , this PR fixes the secp384r1 failures. |
4e36c7f to
bda8464
Compare
|
|
||
| # Enable debug assertions for workspace packages even in release builds, so that | ||
| # debug_assert! calls in library code fire during `cargo test --release` (as used | ||
| # in CI). Third-party dependencies are NOT affected by these overrides. |
There was a problem hiding this comment.
Nitpick: it's evident that crates not listed here are not affected. I'd rather have a comment like « the binaries using the listed crates are not affected since these options only affect the builds in the context of this workspace », except I phrased it terribly. This fact was not evident to me
|
Looks good, but your patch fails the |
bda8464 to
3781d6d
Compare
|
Fixed @maurges |
…sertions in test builds Signed-off-by: Aditya Jagrani <adityajagrani8@gmail.com>
3781d6d to
6b93ab9
Compare
| # Enable debug assertions for workspace packages in release builds so that | ||
| # debug_assert! calls in library code fire during `cargo test --release`. | ||
| # Note: these overrides only apply within this workspace — binaries that | ||
| # depend on these crates externally are not affected. |
There was a problem hiding this comment.
Replace with:
Enable debug assertions in the release builds since we have to run the tests in release mode, because they are too slow
A comment should rarely be an explaination, it should state intent and reason.
And remove the lines between sections, they make them seem unrelated
Closes #185
Problem
get_aux_innerintests/src/lib.rscallsprecompute_multiexp_tablewith a hardcodedSecurityLevel128, ignoring the genericLparameter already in scope on the function signature.This causes all
secp384r1tests to fail because that curve usesSecurityLevel192(via theCurveParamstrait impl at line 509), creating a type mismatch during aux info precomputation. The bug was silent because CI runscargo test --release, which compiles out alldebug_assert!calls — so no assertion fired to catch it.Fix
1. One-line bug fix (
tests/src/lib.rs):2. Enable debug assertions in release test builds (
Cargo.toml):Added
[profile.release.package.*]overrides sodebug_assert!calls inside workspace library code fire duringcargo test --release, as CI does. Third-party dependencies are unaffected.This ensures existing
debug_assert!guards inpaillier-zk,key-share,cggmp24-keygen, andcggmp24/src/signing.rswill catch invariant violations in future CI runs.Impact
secp384r1signing testssecp256k1,secp256r1, orstark