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

Refactors ECRecover tests to manually create large-s signatures and updates cases accordingly; also bumps gnark-crypto dependency.

  • Tests:
    • ECRecover (std/evmprecompiles/01-ecrecover_test.go):
      • Refactor testRoutineECRecover to accept forceLargeS and manually create large-s signatures by s = modulus - s and flipping v.
      • Update strict/lax and mismatch tests to use the new helper; add a second valid assignment in the full test; extend failure-tag checks to large-s.
    • ECDSA secpR tests (std/signature/ecdsa/ecdsa_secpr_test.go): remove benchmark code and related imports.
  • Dependencies:
    • Bump github.com/consensys/gnark-crypto to v0.19.3-0.20251114115201-b301c0c81f19 in go.mod/go.sum.

Written by Cursor Bugbot for commit 22617a0. 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.20251114115201-b301c0c81f1976 +1100100100100

View full report

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