-
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()
#8036
Comments
(IMO this is super low priority, and probably a good first issue?) |
Hello! I want to take this Issue ! |
assigned, |
oh perfect! I was taking a look into the code, and there is a file (crates/cheatcodes/spec/src/vm.rs) that is the interface with the EVM. |
exactly, you can get the version by duplicating this in the cheatcodes crate https://github.com/foundry-rs/foundry/blob/master/crates/forge/bin/opts.rs#L12-L19 |
@mattsse what do you think about also appending a build identifier to versions, to simplify differentiating by version number until v1 is released? Currently everything is 0.2.0 with different commits, so
Then you can do: function assertMinFoundryVersion() internal view {
string memory version = vm.getFoundryVersion();
uint256 buildId = vm.parseUint(vm.split(version, "+")[1]);
require(buildId >= 202406111234, "too old"); |
makes sense |
Hi @LukePereyra, any updates on this ticket? Would be great to get this in Let me know if you are running into anything or need any pointers |
cheatcodes
): add vm.getFoundryVersion()
Hi @zerosnacks, I'd like to take over if possible. |
Re-assigning to @leovct |
There will be a breaking change introduced in #9683 that changes the format of
We will also start versioning our releases more actively allowing you to more easily match on the Cargo version number |
Component
Forge
Describe the feature you would like
It would be great if there was a way to get the foundry version in our scripts. I can make sure a script with
ffi
, but it would be cool if there was an API like:To let people know that some tests will only work on certain editions of foundry.
Additional context
No response
The text was updated successfully, but these errors were encountered: