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

Prevent incomplete Eq implementations from allowing unintentional mutability when using hints #5997

Open
TomAFrench opened this issue Sep 11, 2024 · 0 comments

Comments

@TomAFrench
Copy link
Member

See: #5940 (comment)

It's a common pattern for developers to perform logic in a unconstrained function and then assert that the output is correct (due to this being cheaper than calculating the result in a constrained context). This relies on the implementation of Eq used by the types crossing the unconstrained boundary asserting an equality on every field within that type.

In the case where the Eq implementation doesn't cover all fields within the relevant type then the prover will be able to mutate any fields which are not asserted on.

We should consider whether we can fix this with a ConstrainEq trait to be used in these situations. However this could result in confusion aroundassert_eq and other functions.

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant