Skip to content

Improved support for foundry tests#1499

Merged
gustavo-grieco merged 23 commits intomasterfrom
dev-improve-foundry-support
Mar 13, 2026
Merged

Improved support for foundry tests#1499
gustavo-grieco merged 23 commits intomasterfrom
dev-improve-foundry-support

Conversation

@gustavo-grieco
Copy link
Copy Markdown
Collaborator

Foundry tests should be able to be used, as much as possible. In particular, we could re-use all the test infrastructure, for stateless tests. We want to eventually reach some decent level of compatibility.

@gustavo-grieco
Copy link
Copy Markdown
Collaborator Author

@BowTiedRadone do you want to own this PR? We need to add some test integration with Foundry so we can verify we are catching correctly the failures (at least, for stateless tests)

@BowTiedRadone
Copy link
Copy Markdown
Contributor

@gustavo-grieco Sure! Thanks.

BowTiedRadone and others added 16 commits January 13, 2026 13:45
* Fix fallback function bug in Foundry test generation

* Fix null byte in argument bug in Foundry test generation

* Remove unnecessary config file

* Remove unused/redundant imports

* Disable Slither in Foundry test gen tests

* Conditionally run forge-std tests based on the solc version

* Reduce unnecessary test grouping and improve failed assertion messages

---------

Co-authored-by: Emilio López <[email protected]>
* Rename dapptest to foundry and support foundry assertX in assertion mode

* Rename basic foundry test contracts dir to `foundry-basic`

* Add testing modes to `README`
unlimitedGasPerBlock
(0, 0)
vm4 <- if isDapptestMode solConf.testMode && setUpFunction `elem` abi
vm4 <- if is_testFunction `elem` abi && setUpFunction `elem` abi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intentional? if so, we should document that setUp() gets called on all test modes if the contract has an IS_TEST.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems intentional. The change from isDapptestMode to checking IS_TEST() means any contract following the Foundry convention gets setUp() called regardless of test mode. To me this sound like better behavior since a contract with IS_TEST() likely expects its setUp() to run even in assertion or property mode. @gustavo-grieco please correct me if my understanding is wrong.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, let's add an IS_TEST guard, if we are using foundry, it makes sense to run that. Watch for our tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, let's check the CI ..

@gustavo-grieco gustavo-grieco merged commit e899c10 into master Mar 13, 2026
17 checks passed
@gustavo-grieco gustavo-grieco deleted the dev-improve-foundry-support branch March 13, 2026 14:49
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.

3 participants