feat(`cheatcodes`): assert execution revert trace of a function call within `try {} catch` context
Component
Forge, Other (please describe)
Describe the feature you would like
With the introduction of try{}catch blocks in Solidity, nested calls that might revert can be handled gracefully to not enforce Transaction revert. It would be better to add an assertion in the tests suite to assert a revert of function call instead of a transaction call
For example:
Let's say function x on contract A calls function y on contract B in which it handles the revert of y gracefully using try{}catch. It would be awesome to have an assertion function that asserts the revert of function y during the execution of function x. Obviously, expectRevert can not be used since it expects transaction revert instead of function revert
Additional context
No response
I think this should already be possible by using vm.startStateDiffRecording and vm.stopAndReturnStateDiff by checking that reverted call to the given address is present in the returned array
Though it's not as simple as expectRevert
@Brivan-26 @zerosnacks @klkvr I think this should be solved by https://github.com/foundry-rs/foundry/issues/5299#issuecomment-1623838745 wdyt?
solved by #5299