Skip to content

Conversation

@ivokub
Copy link
Collaborator

@ivokub ivokub commented Sep 10, 2025

Description

In Consensys/gnark-crypto#725 gnark-crypto prevents returning ECDSA signatures with large s (>(mod-1)/2), but we're testing the mismatch case in the precompile tests here.

Handle it manually now and explicitly create large s in tests.

This PR currently depends on a gnark-crypto branch as the change isn't merged yet. When corresponding gnark-crypto PR is merged then also should update dependency here to gnark-crypto@master.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • TestECRecoverCircuitShortMismatch

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Note

Update tests to manually create large-S ECDSA signatures for ecrecover, remove ECDSA benchmarks, and bump gnark-crypto dependency.

  • Tests (EVM precompiles ecrecover):
    • Replace looped signing with explicit large-s handling in testRoutineECRecover by flipping v and making s = mod - s when needed.
    • Adjust Strict logic and update test cases to use the new helper; add second valid assignment and extra failure-path checks.
  • Tests (ECDSA secp-r):
    • Remove benchmark-related code and unused imports from ecdsa_secpr_test.go.
  • Dependencies:
    • Bump github.com/consensys/gnark-crypto to v0.19.3-0.20251115174214-022ec58e8c19 in go.mod and go.sum.

Written by Cursor Bugbot for commit bd6ded8. This will update automatically on new commits. Configure here.

@ivokub ivokub self-assigned this Sep 10, 2025
@ivokub ivokub added the type: bug Something isn't working label Sep 10, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@ivokub ivokub marked this pull request as draft September 10, 2025 13:27
@ivokub ivokub mentioned this pull request Sep 10, 2025
9 tasks
@ivokub ivokub changed the base branch from master to fix/smallfields-generation November 14, 2025 11:45
@ivokub ivokub force-pushed the test/crypto-no-malleable-s branch from 38a0bc0 to caf2e18 Compare November 14, 2025 11:49
@ivokub ivokub marked this pull request as ready for review November 14, 2025 11:50
@socket-security
Copy link

socket-security bot commented Nov 14, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgithub.com/​consensys/​gnark-crypto@​v0.19.3-0.20251114101102-c7c3213680f8 ⏵ v0.19.3-0.20251115174214-022ec58e8c1976 +1100100100100

View full report

ThomasPiellard
ThomasPiellard previously approved these changes Nov 14, 2025
Base automatically changed from fix/smallfields-generation to master November 15, 2025 17:41
@ivokub ivokub dismissed ThomasPiellard’s stale review November 15, 2025 17:41

The base branch was changed.

@ivokub ivokub merged commit 9c9cf0d into master Nov 15, 2025
9 checks passed
@ivokub ivokub deleted the test/crypto-no-malleable-s branch November 15, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants