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: rationalise witness for constant values #984

Merged
merged 12 commits into from
Mar 22, 2023
Merged

Conversation

guipublic
Copy link
Contributor

Related issue(s)

Resolves #770

Description

Summary of changes

Update the internalVarCache when we generate a witness for an internalVar. The Pr also ensures that we create only one witness per constant value.

Test additions / changes

Unit tests added to internalVarCache

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.

Documentation needs

  • This PR requires documentation updates when merged.

Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

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

Some clippy stuff

crates/noirc_evaluator/src/ssa/context.rs Outdated Show resolved Hide resolved
@TomAFrench TomAFrench changed the title fix(770): rationalise witness for constant values fix: rationalise witness for constant values Mar 20, 2023
Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

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

LGTM overall -- just two comments left to resolve

@TomAFrench
Copy link
Member

TomAFrench commented Mar 20, 2023

Not going to block a PR over a small logic refactor so feel free to resolve. However in general, breaking our logic into discrete steps massively improves readability compared to pushing everything into a single nested for-loop.

@kevaundray
Copy link
Contributor

Not going to block a PR over a small logic refactor so feel free to resolve. However in general, breaking our logic into discrete steps massively improves readability compared to pushing everything into a single nested for-loop.

I think you have a good point re readability of the codebase -- At the offsite, I think we should reserve some time to go over some of these points. It may be that we need a document that specifies certain things we should avoid. Loosely speaking, I tend to grunt at rightwards shifting code.

Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

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

LGTM

@TomAFrench TomAFrench added this pull request to the merge queue Mar 22, 2023
@TomAFrench TomAFrench merged commit ab32365 into master Mar 22, 2023
@TomAFrench TomAFrench deleted the gd/const_witness branch March 22, 2023 19:15
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.

Remove incorrect cloning of InternalVar in acir_gen
3 participants