-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat(cheatcodes): add vm.getFoundryVersion()
#8530
feat(cheatcodes): add vm.getFoundryVersion()
#8530
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, this should work because the vergen env var is set when the forge binary is compiled
doc nit
68e9f49
to
cc7b2b4
Compare
cc7b2b4
to
20d04fb
Compare
Do linux/mac/windows binaries all have the same UTC timestamp? I think they are built separately in CI and so likely will have the same date but different timestamps. The failure mode here is I see my foundry version is |
We can also format the build timestamp to |
I thought about this but sometimes two releases are put out in a day, e.g. when there is an import or urgent fix. I think the current approach is fine as long as we document it. Thanks for this PR! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, pending @DaniPopes re vergen dep
@leovct do you want to submit the new cheatcode to forge-std? foundry-rs/forge-std#589 nvm this is updated automatically
[build-dependencies] | ||
vergen = { workspace = true, default-features = false, features = [ | ||
"build", | ||
"git", | ||
"gitcl", | ||
] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is fine, given that we also use this in other crates and the build overhead should be minimal
Motivation
Closes #8036
Implement a new cheatcode to get the foundry version:
vm.getFoundryVersion
.Solution
The current versioning scheme incorporates the cargo version, the git SHA and the UTC timestamp of the build to simplify differentiating by version number until v1 is released.
The version format follows this structure:
<cargo_version>+<git_sha>+<build_timestamp>
.For example, a typical version might look like this:
0.2.0+faa94c384+202407110019
.Test
Install
forge
locally.Run
GetFoundryVersion
test.