Skip to content

Extend Foundry support testing#1512

Merged
gustavo-grieco merged 10 commits intocrytic:dev-improve-foundry-supportfrom
BowTiedRadone:dev-improve-foundry-support
Jan 13, 2026
Merged

Extend Foundry support testing#1512
gustavo-grieco merged 10 commits intocrytic:dev-improve-foundry-supportfrom
BowTiedRadone:dev-improve-foundry-support

Conversation

@BowTiedRadone
Copy link
Copy Markdown
Contributor

@BowTiedRadone BowTiedRadone commented Jan 6, 2026

This PR fixes compilation errors in checkAssertions for Foundry support and adds an end-to-end test for Foundry stateless bug reproduction.

@BowTiedRadone BowTiedRadone marked this pull request as draft January 6, 2026 13:07
@gustavo-grieco
Copy link
Copy Markdown
Collaborator

Thanks a lot for extending this PR. We will need to test:

Besides that, we will need to ensure that the impact in the codebase is minimized. I think there are a few cases that functions that are already defined elsewhere such as isFailedAssertion. Additionally, use .yaml files instead of passing the config in the code.

seed: 1234
cryticArgs: ["--solc-remaps", "forge-std/=foundry/forge-std/src/"]
symExec: true
symExecSMTSolver: z3
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We will probably use bitwuzla instead

testForgeCompilation = do
-- ============================================================================
-- Test helpers
-- ============================================================================
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please keep the document comments format consistent with the rest of our comments.

-- General utilities

-- | Run an IO action that requires forge, failing if forge is not found.
requireForge :: IO () -> IO ()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Abstract these two in a single function using arguments. Move into a more general unit test code module.

-- Concrete Tests
-- ============================================================================

-- | Verify generated test compiles with forge.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually, I don't think we need all this code. This tests are the same as normal echidna test, but the target is a foundry project, so they should work with the normal test infrastructure we already have. Check other examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call! 2ca1e04

@gustavo-grieco
Copy link
Copy Markdown
Collaborator

I think two cases remains untested:

  • assume does not produce a failing test
  • reverts are failures

@BowTiedRadone BowTiedRadone changed the title [DRAFT] Extend Foundry support testing Extend Foundry support testing Jan 13, 2026
@BowTiedRadone BowTiedRadone marked this pull request as ready for review January 13, 2026 09:50
@gustavo-grieco gustavo-grieco merged commit e1f3265 into crytic:dev-improve-foundry-support Jan 13, 2026
1 check passed
gustavo-grieco added a commit that referenced this pull request Mar 13, 2026
* improved support for foundry tests

* Extend Foundry support testing (#1512)

* Fix lint failures

* ci: bump python version to 3.10, clone submodules

* some fixes when using foundry mode

* Update hevm to `542986dea3bec4f5898731ff48877a7a21811bf4`

* Fix bugs in Foundry test generation (#1516)

* 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]>

* Update hevm to `41e6d1304411749ea8c816d131991663b5dca67a`

* Fix linter and build errors (#1521)

* improve foundry stateful invariant testing

* fix

* Fix foundry test generation linter hints and tests (#1522)

* Foundry updates (#1525)

* 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`

* fixes

* fixes

* Add support for Foundry assume (#1528)

* flake: sync hevm version with stack.yaml

* Clarify `optimization` test mode in `README` (#1529)

* IS_TEST fix

---------

Co-authored-by: Radu Bahmata <[email protected]>
Co-authored-by: Emilio López <[email protected]>
Co-authored-by: Emilio López <[email protected]>
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.

2 participants