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

chore!: Require package names in Nargo.toml files #2056

Merged
merged 2 commits into from
Jul 27, 2023
Merged

Conversation

phated
Copy link
Contributor

@phated phated commented Jul 26, 2023

Description

Problem*

Resolves #2053

Summary*

This makes the name field in Nargo.toml required. By making this required, we can add a --package flag to any command to select a package in a workspace. While updating the tests, I found that some name fields in Nargo.toml were invalid package names, so I moved the name to a description field (which we now parse) and added a proper name.

This is breaking because previous projects will have been generated without a name, but new projects generated by nargo will set the directory name as the package name.

This work fell out of #1992 but should be merged as a prerequisite.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

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

BEGIN_COMMIT_OVERRIDE
chore(nargo)!: Require package names in Nargo.toml files (#2056)
END_COMMIT_OVERRIDE

@TomAFrench
Copy link
Member

This is going to break all of the existing Nargo.toml files in the wild. Users are going to see the below error message.

Error: Nargo.toml is badly formed, could not parse.

 data did not match any variant of untagged enum Manifest


Caused by:
    data did not match any variant of untagged enum Manifest


Location:
    crates/nargo_cli/src/cli/mod.rs:74:5

This doesn't really give much information on how to fix the issue. Can we display a message showing that the user should add a name field?

kobyhallx
kobyhallx previously approved these changes Jul 27, 2023
Copy link
Contributor

@kobyhallx kobyhallx left a comment

Choose a reason for hiding this comment

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

👍

@kobyhallx kobyhallx added this pull request to the merge queue Jul 27, 2023
@TomAFrench TomAFrench removed this pull request from the merge queue due to a manual request Jul 27, 2023
@TomAFrench
Copy link
Member

@kobyhallx Are you sure we want to merge like this? We're going to get a ton of issues in the Discord as a result.

@kobyhallx
Copy link
Contributor

@TomAFrench this is marked breaking change and would affect the next release. What's the alternative to introduce this change?

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.

Will demonstrate in a few mins

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.

@kobyhallx We now display in the panic message what the user needs to do in order to make their toml file valid again.

@TomAFrench
Copy link
Member

Gonna let @phated pull the trigger on this one as he's gonna be up soon.

@phated
Copy link
Contributor Author

phated commented Jul 27, 2023

Good catch @TomAFrench 🙏 We can merge this with your message and I'll open an issue to remove it in 0.12.0

@phated phated added this pull request to the merge queue Jul 27, 2023
Merged via the queue into master with commit bb28223 Jul 27, 2023
4 checks passed
@phated phated deleted the phated/package-name branch July 27, 2023 16:29
@Savio-Sou
Copy link
Collaborator

Any doc needs for the PR?

@phated
Copy link
Contributor Author

phated commented Jul 31, 2023

@Savio-Sou I scanned the noir-lang.org website and couldn't find any mention of the contents of nargo.toml, so I didn't mark it as needing documentation.

@Savio-Sou
Copy link
Collaborator

Good point, we should probably document Nargo.toml in that case. Thanks!

TomAFrench added a commit that referenced this pull request Aug 1, 2023
* master: (53 commits)
  chore: Update `noir-source-resolver` to v1.1.3 (#1912)
  chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085)
  chore: refresh ACIR test artifacts (#2091)
  feat: Add `deprecated` attribute (#2041)
  chore(ssa refactor): Implement `acir_gen` errors (#2071)
  chore: use witnesses from the generated acir in the ABI (#2095)
  fix: Fix methods not mutating fields (#2087)
  chore(nargo): Use Display impl for InputValue (#1990)
  feat: Make arrays and slices polymorphic over each other (#2070)
  feat: Remove an unnecessary witness in `mul_with_witness` (#2078)
  chore: document truncate (#2082)
  fix: avoid potential panic in `two_complement` (#2081)
  chore: Cleanup integration tests (#2074)
  chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065)
  chore!: Require package names in `Nargo.toml` files (#2056)
  fix: Avoid non-determinism in defunctionalization (#2069)
  chore: change 'unnecessary pub' error to a warning (#2064)
  feat!: Update to ACVM 0.21.0 (#2051)
  chore: Rename execute tests for an accurate description (#2063)
  chore: Restore lost integration test (#2062)
  ...
TomAFrench added a commit that referenced this pull request Aug 1, 2023
* master: (75 commits)
  fix: Mutating a variable no longer mutates its copy (#2057)
  fix: Implement `.len()` in Acir-Gen (#2077)
  chore: clippy fixes (#2101)
  chore: Update `noir-source-resolver` to v1.1.3 (#1912)
  chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085)
  chore: refresh ACIR test artifacts (#2091)
  feat: Add `deprecated` attribute (#2041)
  chore(ssa refactor): Implement `acir_gen` errors (#2071)
  chore: use witnesses from the generated acir in the ABI (#2095)
  fix: Fix methods not mutating fields (#2087)
  chore(nargo): Use Display impl for InputValue (#1990)
  feat: Make arrays and slices polymorphic over each other (#2070)
  feat: Remove an unnecessary witness in `mul_with_witness` (#2078)
  chore: document truncate (#2082)
  fix: avoid potential panic in `two_complement` (#2081)
  chore: Cleanup integration tests (#2074)
  chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065)
  chore!: Require package names in `Nargo.toml` files (#2056)
  fix: Avoid non-determinism in defunctionalization (#2069)
  chore: change 'unnecessary pub' error to a warning (#2064)
  ...
TomAFrench added a commit that referenced this pull request Aug 1, 2023
* master: (75 commits)
  fix: Mutating a variable no longer mutates its copy (#2057)
  fix: Implement `.len()` in Acir-Gen (#2077)
  chore: clippy fixes (#2101)
  chore: Update `noir-source-resolver` to v1.1.3 (#1912)
  chore: Document `GeneratedAcir::more_than_eq_comparison` (#2085)
  chore: refresh ACIR test artifacts (#2091)
  feat: Add `deprecated` attribute (#2041)
  chore(ssa refactor): Implement `acir_gen` errors (#2071)
  chore: use witnesses from the generated acir in the ABI (#2095)
  fix: Fix methods not mutating fields (#2087)
  chore(nargo): Use Display impl for InputValue (#1990)
  feat: Make arrays and slices polymorphic over each other (#2070)
  feat: Remove an unnecessary witness in `mul_with_witness` (#2078)
  chore: document truncate (#2082)
  fix: avoid potential panic in `two_complement` (#2081)
  chore: Cleanup integration tests (#2074)
  chore: replace `Type::TypeVariable`, `Type::PolymorphicInteger`, and … (#2065)
  chore!: Require package names in `Nargo.toml` files (#2056)
  fix: Avoid non-determinism in defunctionalization (#2069)
  chore: change 'unnecessary pub' error to a warning (#2064)
  ...
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.

Require crate name in nargo.toml
4 participants