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

ABI parser is reducing hex elements #2858

Closed
kevaundray opened this issue Sep 26, 2023 · 3 comments · Fixed by #3004
Closed

ABI parser is reducing hex elements #2858

kevaundray opened this issue Sep 26, 2023 · 3 comments · Fixed by #3004
Assignees
Labels
bug Something isn't working

Comments

@kevaundray
Copy link
Contributor

Aim

Seen here the ABI parser is reducing elements if given in hex format, whereas it does not reduce if given in another format.

A test circuit from discord:

// main.nr
fn main(x: Field, y: pub Field) {
    assert(x == y);
}
// Prover.toml
x = "0xf6e0a1e2ac41945a9aa7ff8a8aaa0cebc12a3bcc981a929ad5cf810a090e11ae"
y = "0x04eb19a44649738a0116a2fa03235319f826b262377b5fc48265b526590e11a9"

where the two values which look different are being reduced modulo the prime field to be the same value, running execute on this will make the circuit pass.

Expected Behavior

The circuit should fail since the default behavior should be to not reduce as this causes malleability issues.

Bug

Circuit successfully executes

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray kevaundray added bug Something isn't working P-MEDIUM labels Sep 26, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 26, 2023
@kevaundray
Copy link
Contributor Author

The easiest fix for this would be to do a roundtrip serialization

@kevaundray
Copy link
Contributor Author

This might be breaking for a lot of programs, so if possible we should have a way for users to specify that they want the value to be reduced

@kevaundray
Copy link
Contributor Author

Spoke to Guillaume and he noted that this behaviour is probably unintentional if the users inputs were being reduced, so we want to fail quickly on this

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 6, 2023
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
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants