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

feat: Support contract package type in nargo info command #2249

Merged
merged 6 commits into from
Aug 10, 2023

Conversation

Ethan-000
Copy link
Contributor

@Ethan-000 Ethan-000 commented Aug 10, 2023

Description

Problem*

Resolves #1970
Resolves #2088

Summary*

fn main(x : Field, y : pub Field) {
    assert(x * 2 == y * 3);
}

contract Foo {
    fn double(x: Field) -> pub Field { x * 2 }
    fn triple(x: Field) -> pub Field { x * 3 }
    internal fn quadruple(x: Field) -> pub Field { x * 4 }
    open internal fn skibbidy(x: Field) -> pub Field { x * 5 }
}

run nargo info

[Foo] Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 4
[Foo] Backend circuit size: 7 

[Foo](quadruple) Total ACIR opcodes generated: 1
[Foo](quadruple) Backend circuit size: 2
[Foo](skibbidy) Total ACIR opcodes generated: 1
[Foo](skibbidy) Backend circuit size: 1
[Foo](double) Total ACIR opcodes generated: 1
[Foo](double) Backend circuit size: 2
[Foo](triple) Total ACIR opcodes generated: 1
[Foo](triple) Backend circuit size: 2

[All Contracts] Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 4
[All Contracts] Backend circuit size: 7

Documentation

Documentation issue is already opened

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@TomAFrench
Copy link
Member

What's the benefit of printing out the total number of gates summed over all of the functions in your contract and also over all the contracts in your package? This is analogous to printing the amount of gas necessary to call every function in your smart contract once but this doesn't really correspond meaningfully to anything (i.e. certain functions are more gas-sensitive than others, etc.)

We're also planning on restricting packages to containing a single contract anyway in future.

@Ethan-000
Copy link
Contributor Author

new output after modification

[Foo](double) Total ACIR opcodes generated: 1
[Foo](double) Backend circuit size: 2
[Foo](quadruple) Total ACIR opcodes generated: 1
[Foo](quadruple) Backend circuit size: 2
[Foo](skibbidy) Total ACIR opcodes generated: 1
[Foo](skibbidy) Backend circuit size: 1
[Foo](triple) Total ACIR opcodes generated: 1
[Foo](triple) Backend circuit size: 2

TomAFrench
TomAFrench previously approved these changes Aug 10, 2023
@TomAFrench TomAFrench changed the title feat: Support contract package type for the info command feat: Support contract package type in nargo info command Aug 10, 2023
@TomAFrench TomAFrench added this pull request to the merge queue Aug 10, 2023
Merged via the queue into master with commit d309cc0 Aug 10, 2023
9 checks passed
@TomAFrench TomAFrench deleted the e/contract_info_2 branch August 10, 2023 13:44
TomAFrench added a commit that referenced this pull request Aug 10, 2023
* master: (80 commits)
  fix: properly capture lvalues in closure environments (#2120) (#2257)
  fix: Optimize contracts built by `nargo info` (#2259)
  chore: impl Display for DebugType (#2258)
  chore: update `noir_wasm` build process to match `acvm_js` (#2067)
  feat: Implement traits - parser support #2094 (#2230)
  chore: Refactor DefCollector duplicate errors (#2231)
  chore: Address clippy warnings (#2246)
  feat: Support `contract` package type in `nargo info` command (#2249)
  feat: Add slice append (#2241)
  chore: Bump `async-lsp` to v0.0.5 (#2186)
  chore: Move the remaining `nargo_cli` lib funcs into `nargo` crate (#2225)
  chore: Add test for eddsa (#2237)
  chore: Split `Nargo.toml` operations into separate package (#2224)
  fix(stdlib): correct `tecurve::contains` formula (#1821)
  feat: Remove `comptime` and warn upon usage (#2178)
  fix: Remove last vestige of array of structs to struct of arrays conversion (#2217)
  fix: Add foreign impl error (#2216)
  feat(nargo)!: Replace `--contracts` flag with `contract` package type (#2204)
  feat: Optimize `x < 0` for unsigned `x` to false (#2206)
  fix: Initialize numeric generics' type to a polymorphic integer when used in an expression (#2179)
  ...
TomAFrench added a commit that referenced this pull request Aug 11, 2023
* master: (29 commits)
  feat(nargo): Add support for contracts in `nargo check` (#2267)
  chore(ci): Name wasm job more clearly (#2269)
  chore(ci): Create cache key with consideration to target (#2273)
  chore(ci): Run publish workflow against PRs (#2268)
  chore: Merge in contents of `build-nargo` repository (#2211)
  fix(lsp): Improve dependency resolution in context of `Nargo.toml` (#2226)
  chore: Remove unnecessary duplication in how we test Noir compiler (#2248)
  fix: properly capture lvalues in closure environments (#2120) (#2257)
  fix: Optimize contracts built by `nargo info` (#2259)
  chore: impl Display for DebugType (#2258)
  chore: update `noir_wasm` build process to match `acvm_js` (#2067)
  feat: Implement traits - parser support #2094 (#2230)
  chore: Refactor DefCollector duplicate errors (#2231)
  chore: Address clippy warnings (#2246)
  feat: Support `contract` package type in `nargo info` command (#2249)
  feat: Add slice append (#2241)
  chore: Bump `async-lsp` to v0.0.5 (#2186)
  chore: Move the remaining `nargo_cli` lib funcs into `nargo` crate (#2225)
  chore: Add test for eddsa (#2237)
  chore: Split `Nargo.toml` operations into separate package (#2224)
  ...
TomAFrench added a commit that referenced this pull request Aug 11, 2023
* master:
  feat(nargo): Add support for contracts in `nargo check` (#2267)
  chore(ci): Name wasm job more clearly (#2269)
  chore(ci): Create cache key with consideration to target (#2273)
  chore(ci): Run publish workflow against PRs (#2268)
  chore: Merge in contents of `build-nargo` repository (#2211)
  fix(lsp): Improve dependency resolution in context of `Nargo.toml` (#2226)
  chore: Remove unnecessary duplication in how we test Noir compiler (#2248)
  fix: properly capture lvalues in closure environments (#2120) (#2257)
  fix: Optimize contracts built by `nargo info` (#2259)
  chore: impl Display for DebugType (#2258)
  chore: update `noir_wasm` build process to match `acvm_js` (#2067)
  feat: Implement traits - parser support #2094 (#2230)
  chore: Refactor DefCollector duplicate errors (#2231)
  chore: Address clippy warnings (#2246)
  feat: Support `contract` package type in `nargo info` command (#2249)
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.

Make nargo gates work with contract functions
2 participants