feat(cheatcodes
): V1 expectCall
behavior
#7237
Labels
A-cheatcodes
Area: cheatcodes
T-likely-breaking
Type: requires changes that can be breaking
T-to-discuss
Type: requires discussion
Motivation
Right now,
expectCall
works at the "test" level—as long as there are enough calls to the target contract at any depth level in the test with the specified selector, it will pass. While this is the current accepted behavior, it was not the intended original one. For V1, we propose actually introducing the intended behavior.Current behavior
The current behavior allows using expectCall this way:
While this looks fine in this example, this is not the intended behavior, as the
expectCall
should only work for the next call. The current behavior can lead to footguns where you expect a certain call to a function to happen during the next call made, but it can instead happen later in the test and still pass. An example:New behavior
The proposed behavior is the following:
expectCall
should match calls that are strictly subcalls of the next call.Example of proposed functionality for V1:
The text was updated successfully, but these errors were encountered: