Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secp256k1 verification failing on some signatures genereated from nodejs elliptic library (Repro attached) #4520

Open
d4n1sh404 opened this issue Mar 11, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@d4n1sh404
Copy link

d4n1sh404 commented Mar 11, 2024

Aim

I want to validate secp256k1 signatures using noir circuits , which I was generating from elliptic library of nodejs, the signature validations fail on certain inputs

Expected Behavior

All the signatures should be valid in the circuit also, they are valid while checking with the library

Bug

Some of the signatures are validated properly and some fail to be validated

To Reproduce

  1. clone the repositroy https://github.com/d4n1sh404/noir-secp256k1-verify-repro
  2. install dependencies yarn install or npm install
  3. run start script or node index.js
  4. cd to secp_verify directory and run nargo prove
  5. repeat a couple of time to see the unexpected behavior

Project Impact

Blocker

Impact Context

I am building a merkle inclusion verifier for a project, the signatures are being used as merkle leaves and need to be validated if they are valid

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

None

Nargo Version

nargo version = 0.22.0 noirc version = 0.22.0+3fae4a03fded4e3f5065e7461c563f7e39745604 (git version hash: 3fae4a0, is dirty: false)

NoirJS Version

No response

Would you like to submit a PR for this Issue?

Maybe

Support Needs

Checking and verifying if this is a bug or a normalization or converting issue while passing inputs to the circuit

@d4n1sh404 d4n1sh404 added the bug Something isn't working label Mar 11, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Mar 11, 2024
@TomAFrench
Copy link
Member

@TomAFrench
Copy link
Member

TomAFrench commented Mar 11, 2024

I've made a PR to the reproduction repository with a fix so that it will generate signatures with the canonical values of s. We reject signatures with "high" values of s as this results in signature malleability issues.

I'm going to make some changes to our signature verifier however to surface better error data however to help diagnosing issues like this in future.

@d4n1sh404
Copy link
Author

Thanks tom, have merged it and it works 👍 , and a better error message is definitely required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants