foundry
foundry copied to clipboard
Solidity Test that can run multiple solidity versions at once.
Component
Forge
Describe the feature you would like
Solidity Test that can run multiple solidity versions at once. From time to time, you might need to test new code against/with old code such as UniswapV2 which require completely incompatible versions. Currently this is not possible to do as it wouldn't even compile. (is there even a work around)?
Additional context
No response
A somewhat cumbersome workaround is to compile it and to vm.etch
the runtime code. You can also manually deploy it (with some args) and copy the code to etch (see https://github.com/0xPhaze/paradigm-ctf-2021-foundry/blob/master/src/ParadigmSetup.sol as an example). Or you can get the creation code and concatenate with your constructorArgs.
related #2704
A somewhat cumbersome workaround is to compile it and to
vm.etch
the runtime code. You can also manually deploy it (with some args) and copy the code to etch (see https://github.com/0xPhaze/paradigm-ctf-2021-foundry/blob/master/src/ParadigmSetup.sol as an example). Or you can get the creation code and concatenate with your constructorArgs.
ok I'll try that. Ultimately the best way to fix this would a fix for backwards compatibility in solc directly. but yeah anything is appreciated rn
Just noting this is related to #3062 which proposes a config format for supporting multiple solc versions/settings
Just noting this is related to #3062 which proposes a config format for supporting multiple solc versions/settings
well it is a bit but this problem is more than just a config problem rn. SOLC itself cannot mix and max sol versions together in the same file. foundry can actually deal with multiple solidity versions in the project but cannot deal with multiple in the same file.
Oh maybe I misunderstood then. I interpreted the issue as being for different test files. You want to have two different solc versions uses in the same file? If solc doesn't support that, it seems more like a solidity issue than a foundry issue IIUC
Oh maybe I misunderstood then. I interpreted the issue as being for different test files. You want to have two different solc versions uses in the same file? If solc doesn't support that, it seems more like a solidity issue than a foundry issue IIUC
yes it is preferrably fixed with solc but there should be a good supported work around tbh. This is a pretty common issue imo.
Would it be feasible to come up with a cheatcode that produces sth. like 0xPhaze/paradigm-ctf-2021-foundry@master/src/ParadigmSetup.sol without that cumbersome manual initialization?
Especially for large code bases that grow and migrate through several versions over time this would be a big deal.
EDIT: Whoops, nevermind... Just realized that that already exists (deployCode
) :-)
I'd like the ability to have multiple solc versions configured like Hardhat allows to do with the compilers
filed in hardhat.config
This is closest I found for foundry on that https://github.com/hbarcelos/forge-multi-version