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

Add minimum Forc version field to manifest #2188

Closed
adlerjohn opened this issue Jun 30, 2022 · 2 comments · Fixed by #2405
Closed

Add minimum Forc version field to manifest #2188

adlerjohn opened this issue Jun 30, 2022 · 2 comments · Fixed by #2405
Assignees
Labels
enhancement New feature or request forc good first issue Good for newcomers

Comments

@adlerjohn
Copy link
Contributor

Proposal

Add a field, e.g. project.forc_version that defines the minimum version of Forc supported. Example:

[project]
# ...
forc_version = "0.16.2"

Cargo ref for similar field: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field

If the current version of Forc is too low, it should error out and tell the user how to update by linking to the Sway Book's page on installing and updating.

Motivation

  1. A common source of user issues is simply an outdated forc. This will eliminate tech support and provide actual information to the end user.
  2. Will also avoid using a library that assumes certain compiler features (e.g. safety checks) from being used in an older codebase.

Misc

cc @mitchmindtree and @kayagokalp for thoughts. Should this also apply transitively?

@adlerjohn adlerjohn added enhancement New feature or request forc labels Jun 30, 2022
@adlerjohn adlerjohn moved this to Todo in Fuel Network Jun 30, 2022
@kayagokalp
Copy link
Member

I think we should definitely have this as it would mean a lot better error messages in many scenarios.

One thing that we may want to keep in mind is checking the required minimum forc version. This may require us to check all dependencies of the project and if the minimum required version coming from the dependencies is higher than the one provided with the root project we may want to produce an error.

@mitchmindtree mitchmindtree added the good first issue Good for newcomers label Jul 6, 2022
@mitchmindtree
Copy link
Contributor

Good idea!

For anyone interested in having a go at this, take a look at the forc_pkg::pkg::validate_dep_manifest function introduced in #2234. This is likely where we will want to check for a minimum version within the dependency manifests (this will handle not just direct deps, but transitive deps too). validate_dep_manifest will only handle depedencies however, so we should be sure to check the top-level project's manifest too.

We'll also want to document this entry in the book and mention what forc version the feature was introduced in.

@kayagokalp kayagokalp self-assigned this Jul 26, 2022
Repository owner moved this from Todo to Done in Fuel Network Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forc good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants