Open PatrickAlphaC opened 1 month ago
(IMO this is super low priority, and probably a good first issue?)
Hello! I want to take this Issue !
assigned, lmk if you need need pointers
assigned, lmk if you need need pointers
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. can I add the method getFoundryVersion there? (and then implement it with a Cheatcode) btw, the foundryVersion is the one that its in Cargo.toml in the section [workspace.package] or that one it's outdate?
can I add the method getFoundryVersion there? (and then implement it with a Cheatcode)
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 getFoundryVersion()
isn't super useful as you can't easily enforce "this version or later". Could either:
0.2.0+0001
and increment with each build0.2.0+202406111234
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
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