-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): error hints #3135
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(forge): error hints #3135
Conversation
643b25a
to
6269656
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do u see encode_error_with_hints
being integrated?
@gakonst adding an example rn, but for example u could use it for |
Not the best example (expectEmit will take more work) but instead of writing the really big number inside of the short test result it could be a hint: Similarly, sometimes the forking backend might fail for whatever reason - it might be that the account is not accessible on your node, so a hint could be added that it's too far back if we think it is and suggest an archive node or moving the block you're forking from |
OK! This makes sense. Supportive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks pretty good, nice improvement
Ok(match code { | ||
0x00 => SolidityPanic::Generic, | ||
0x01 => SolidityPanic::Assert, | ||
0x11 => SolidityPanic::OverUnderFlow, | ||
0x12 => SolidityPanic::DivideByZero, | ||
0x21 => SolidityPanic::InvalidEnumCast, | ||
0x22 => SolidityPanic::InvalidStorageByteArray, | ||
0x31 => SolidityPanic::PopOnEmptyArray, | ||
0x32 => SolidityPanic::IndexOutOfBounds, | ||
0x41 => SolidityPanic::Alloc, | ||
0x51 => SolidityPanic::InvalidPointer, | ||
code => SolidityPanic::Unknown(code), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could move this to a separate From impl
Closing as stale. |
Motivation
Some cheatcodes lack context when they fail, but our current setup does not allow us to add very much context without the output of
forge test
becoming super clutteredSolution
Allow reverts from our backend and our inspectors to include optional hints
Effectively closes #928 as some of the more annoying cheatcode reverts are documented in other issues