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

fix: correct type checking to handle false bools #893

Merged
merged 2 commits into from
Feb 22, 2023
Merged

Conversation

TomAFrench
Copy link
Member

Related issue(s)

Resolves #889

Description

Summary of changes

FieldElement.num_bits() returns 0 for `FieldElement::zero() so the current check for satisfying the AbiType fails. I've relaxed the check to accept 0 or 1 bits to address this.

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.
  • This PR requires documentation updates when merged.

Additional context

Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change num_bits itself to return 1 bit for the value 0 since we still need to store it somewhere. Would require some testing though.

@TomAFrench
Copy link
Member Author

TomAFrench commented Feb 22, 2023

Yes, that's true. As that requires us to bubble up changes to ACIR, let's just switch this to an explicit 0 or 1 check (field value, not num bits) for the time being.

@jfecher jfecher added this pull request to the merge queue Feb 22, 2023
Merged via the queue into master with commit 6c7aa2f Feb 22, 2023
@jfecher jfecher deleted the TomAFrench-patch-1 branch February 22, 2023 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot pass in false in Prover.toml
2 participants