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

Debug compilation for Noir programs #2128

Open
vezenovm opened this issue Aug 2, 2023 · 4 comments
Open

Debug compilation for Noir programs #2128

vezenovm opened this issue Aug 2, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@vezenovm
Copy link
Contributor

vezenovm commented Aug 2, 2023

Problem

When working with nargo test, everything supplied to a function is a constant. This leads to issues as outlined in this PR: #2116, where println does not work in tests with failing constraints. Essentially a failed constraint is resolved during compilation before we ever reach execution (where the println foreign call is handled).

Happy Case

We should offer a debug compile option that does not enforce constrain instructions at compile-time. This compile option will be enabled during nargo test to allow println to execute even with compile time constraint failures.

Alternatives Considered

Otherwise println just will not work during failing tests which leads to inconsistent functionality with nargo execute. No realistic alternatives.

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@TomAFrench
Copy link
Member

There are a number of other optimisations which we could turn off in order to improve debugging here, e.g. the redundant range optimisation can result in an overflow not being displayed due to the fact that it's being caught later.

@kevaundray
Copy link
Contributor

An alternative approach is for tests to make the input be seen as non-constant, so that you can reproduce the exact environment one gets when a program is executed (with optimizations)

@vezenovm
Copy link
Contributor Author

Linking this comment (#2446 (comment)) to note another optimization that can be removed in a debug compilation mode

@TomAFrench
Copy link
Member

In the short term (and complementary to debug mode in the future), we could add something similar to Rust's blackbox function. This would just be an identity function which is listed as having side-effects, which would block any SSA optimizations from being applied to the outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

5 participants