Skip to content

Add warning for mismatch cargo stylus versions#367

Merged
rory-ocl merged 3 commits intomainfrom
braga/add-mismatch-version-warn
Dec 29, 2025
Merged

Add warning for mismatch cargo stylus versions#367
rory-ocl merged 3 commits intomainfrom
braga/add-mismatch-version-warn

Conversation

@bragaigor
Copy link
Contributor

@bragaigor bragaigor commented Oct 25, 2025

fixes NIT-3663

Description

Adds a very clear warning to be printed out to stdout to let users know they're using an older, potentially buggy, of stylus if they choose to use --cargo-stylus-version with an older version than the current one. Also included a warning message if users chose to use a newer version as well.

If users select an older version they'll see the following logs:

2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] ############### OLDER VERSION WARNING ###############
2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] You have selected cargo-stylus version 0.10.0-beta.0.
2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] This is OLDER than the current tool's version 0.10.0-rc.1.
2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] Using an older, potentially buggy version is not recommended.
2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] Please consider using version 0.10.0-rc.1 or newer.
2025-10-25T15:05:45.556Z WARN  [stylus_tools::core::build::reproducible] #####################################################
2025-10-25T15:05:45.556Z INFO  [stylus_tools::core::build::reproducible] Using cargo-stylus version: 0.10.0-beta.0

And if users select a newer version they'll see the following logs:

2025-10-25T15:06:19.663Z WARN  [stylus_tools::core::build::reproducible] ############### VERSION MISMATCH WARNING ###############
2025-10-25T15:06:19.663Z WARN  [stylus_tools::core::build::reproducible] Selected cargo stylus version 0.10.1-rc.0 is NEWER than current cargo stylus version 0.10.0-rc.1
2025-10-25T15:06:19.663Z WARN  [stylus_tools::core::build::reproducible] This may result in a reproducible build that does not match the original build.
2025-10-25T15:06:19.663Z WARN  [stylus_tools::core::build::reproducible] Please use the same cargo stylus version as the original build.
2025-10-25T15:06:19.663Z WARN  [stylus_tools::core::build::reproducible] ########################################################
2025-10-25T15:06:19.663Z INFO  [stylus_tools::core::build::reproducible] Using cargo-stylus version: 0.10.1-rc.0

And if users mistakenly provide an invalid version then the logs will look like:

2025-10-25T15:13:42.976Z WARN  [stylus_tools::core::build::reproducible] Invalid version string provided: '0.10.1bla'. Error: unexpected character 'b' after patch version number
2025-10-25T15:13:42.976Z WARN  [stylus_tools::core::build::reproducible] Defaulting to current version 0.10.0-rc.1.
2025-10-25T15:13:42.976Z INFO  [stylus_tools::core::build::reproducible] Using cargo-stylus version: 0.10.0-rc.1

Checklist

  • I have documented these changes where necessary.
  • I have read the DCO and ensured that these changes comply.
  • I assign this work under its open source licensing.

Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Add test for select_stylus_version

Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
@bragaigor bragaigor marked this pull request as ready for review November 3, 2025 14:18
@bragaigor bragaigor requested a review from rory-ocl November 3, 2025 14:18
@rory-ocl rory-ocl merged commit 955070b into main Dec 29, 2025
68 checks passed
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.

2 participants