-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nargo): Multiple circuits info for binary programs (#4719)
# Description ## Problem\* Resolves #4697 ## Summary\* The `nargo info` command previously assumed that we only had a single circuit. In order to display accurate circuits sizes we should display the circuit size of each individual circuit entry part which is part of an entire `Program`. For improved debugging I also had to exposed names in the `GeneratedAcir`. This prompted also refactoring the context that we pass around in `ssa.rs` when creating a circuit and a program. Two new structs,`SsaProgramArtifact` and `SsaCircuitArtifact`, have been created to clean this up. Example output from `nargo info` on `fold_basic_nested_call`: <img width="847" alt="Screenshot 2024-04-04 at 3 54 46 PM" src="https://github.com/noir-lang/noir/assets/43554004/95a827c4-766c-4d7d-b03e-fb9428cfdb2a"> ## Additional Context It isn't necessarily obvious how we should display foldable circuits for contracts which already have multiple entry points. I have left this for follow-up work: #4720 ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [X] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
12 changed files
with
157 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test_programs/compile_success_contract/fold_non_contract_method/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "fold_non_contract_method" | ||
type = "contract" | ||
authors = [""] | ||
compiler_version = ">=0.26.0" | ||
|
||
[dependencies] |
18 changes: 18 additions & 0 deletions
18
test_programs/compile_success_contract/fold_non_contract_method/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
contract Foo { | ||
use crate::times_10; | ||
|
||
fn double(x: Field) -> pub Field { | ||
x * 2 | ||
} | ||
fn triple(x: Field) -> pub Field { | ||
x * 3 | ||
} | ||
fn times_40(x: Field) -> pub Field { | ||
times_10(x) * 4 | ||
} | ||
} | ||
|
||
#[fold] | ||
fn times_10(x: Field) -> Field { | ||
x * 10 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.