Skip to content

[BUG] check command logs a warning because a non fixed version of ink is set in templates dependencies #202

@ipapandinas

Description

@ipapandinas

Description

The ink version (4.2.1) used in contract templates do not come prefixed with a "=" or "v".
This logs the warning below when running swanky check command.

[WARNING]Some of the ink dependencies do not have a fixed version.
      This can lead to accidentally installing version higher than supported by the node.
      Please use "=" to install a fixed version (Example: "=3.0.1")

Then, this error occurs when adding the "=" prefix manually to the ink version in the Cargo.toml of the flipper contract template.

swanky check                 
✔ Check Rust
✔ Check cargo
✔ Check cargo nightly
✔ Check cargo dylint
✔ Check cargo-contract
✔ Read ink dependencies

error:   UnknownError: Invalid Version: =4.2.1
Please report this bug at: https://github.com/swankyhub/swanky-cli/issues
    at new SemVer (~/Documents/dev/astar/swanky-cli/node_modules/semver/classes/semver.js:38:13)
    at compare (~/Documents/dev/astar/swanky-cli/node_modules/semver/functions/compare.js:3:3)
    at Object.gt (~/Documents/dev/astar/swanky-cli/node_modules/semver/functions/gt.js:2:29)
    at file://~/Documents/dev/astar/swanky-cli/dist/commands/check/index.js:79:51
    at Array.forEach (<anonymous>)
    at Task.task [as taskFn] (file://~/Documents/dev/astar/swanky-cli/dist/commands/check/index.js:76:60)
    at Task.run (file://~/Documents/dev/astar/swanky-cli/node_modules/listr2/dist/index.js:1956:35)

To fix

  • Set fixed version on all contract templates dependencies.
  • Adjust the "Verify ink version" task to support "=" prefix.
  • Remove version.startsWith("v") since it is not a valid Rust prefix.

Steps to Reproduce

  1. swanky init test
  2. cd test
  3. swanky check

Expected vs. Actual Behavior

Expected: No warning logged.
Actual Behavior: Warning logged.

Environment

  • Operating system: Mac M1 darwin
  • Project version/tag: @astar-network/swanky-cli/3.1.0 darwin-arm64 node-v18.17.1
  • Rust version: rustc 1.72.1
  • Rust toolchain: 1.72-aarch64-apple-darwin
  • Node version: 18.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions