fix(forge): preserve invariant replay failure reason#14136
fix(forge): preserve invariant replay failure reason#14136grandizzy merged 9 commits intofoundry-rs:masterfrom
Conversation
grandizzy
left a comment
There was a problem hiding this comment.
Thank you, overall lgtm! Could you pls add tests for invariants failing with fail() and custom error to make sure they properly displayed too?
|
Thanks for the review. I added two replay regression tests:
Both run the same invariant twice and assert that replay preserves the specific failure reason ( |
|
Thanks for the heads-up. I checked the CI failure and it appears unrelated to this PR’s changes. The failing job is This PR only updates invariant replay tests under |
|
I also added one more replay regression test for an invariant-level custom error: It ensures that when the invariant function itself reverts with a custom error, replay still preserves and displays the same custom error message. |
Motivation
During invariant replay, Foundry shows a generic message like:
[FAIL: <invariant_name> replay failure]This hides the actual property/assert message and makes debugging harder.
Closes #14134.
Solution
So replay now shows the real failure message (for example
never owner) instead of only<invariant_name> replay failure.Tests
Updated invariant CLI replay-output assertions to match the new behavior.
AI Disclosure
This PR was developed with AI assistance.