-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(debugger
): improve debugger experience when tests fail due to event mismatch
#10342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @smol-ninja would approach in #8686 (issue #8506) work for your case? Thank you |
Hi @grandizzy, I looked at the links that you provided.
If it only highlights the unmatched event, it doesn't work for my case. I suppose |
Got it, ok, maybe we can accommodate in same pr |
@grandizzy I'd originally set out to implement @smol-ninja's first proposed solution but realized there wasn't an easy way to decode the event calldata back to english for the error string without accessing the tracing inspector, which is only available at higher verbosity. Looking at your latest response has helped me to realize my workaround isn't an easy way around this issue. Would it be permissible to have an opaque |
@topocount, would |
yep, makes sense |
debugger
): improve debugger experience when tests fail due to event mismatch
Component
Forge, Foundryup
Describe the feature you would like
Problem
When a test fails due to event mismatch, Foundry logs
FAIL: log != expected log; counterexample calldata=0x1234....1234
without specifying which event parameter did not match.Though this is fine for simple tests, in case of fuzz testing, it becomes very problematic. This is because Foundry prints lengthy
calldata
forcing to scroll extensively to trace down the error.👾 Link to warp block
Solution 1
Log the first mismatched event parameter in the failure message:
This would make it easier to identify which event parameter did not match with the expected value without having to scroll down so much.
Solution 2
Add a Foundry cheat code to enable/disable
calldata
logs. It can be calleddisplay_calldata
Most of the times, having
calldata
printed is of little value. This is because, use ofbound
can change the value of the input parameters. Thus, having a cheatcode to enablecalldata
logging can be more useful than having it enabled by default.Additional context
No response
The text was updated successfully, but these errors were encountered: