foundry-rs / starknet-foundry

Blazing fast toolkit for developing Starknet contracts.
https://foundry-rs.github.io/starknet-foundry/
MIT License
329 stars 180 forks source link

Check, if possible, that a compatible version of Scarb is in use #2719

Open amanusk opened 1 week ago

amanusk commented 1 week ago

Which component is your feature related to?

Forge

Feature Request

When using versions that require a minimal Scarb version to operate correctly, display an informative error that an incompatible version of Scarb is being used.

For example If someone installed an old Scarb version with a script, and also with adsf, the older version might appear first in the path and be used, even if there is a .tool-versions file present in the repository.

Example of a repository with an older 2.6.4 installed and found in the path:

snforge test

error: failed to lookup for `openzeppelin_token ^0.19.0` in registry: registry+https://there-is-no-default-registry-yet.com/

Caused by:
    0: failed to fetch registry config
    1: error sending request for url (https://there-is-no-default-registry-yet.com/config.json): error trying to connect: dns error: failed to lookup address information: Name or service not known
    2: error trying to connect: dns error: failed to lookup address information: Name or service not known
    3: dns error: failed to lookup address information: Name or service not known
    4: failed to lookup address information: Name or service not known
[ERROR] error: could not gather project metadata from Scarb due to previous error: `scarb metadata` exited with error

This error does tell me the users anything about what might be wrong with there setup.

Another example, If the use snforge init with an older Scarb version installed, the created directory will be a scarb-test project and not an snfoundy project

cptartur commented 1 week ago

Related #2720