feat(cheatcodes): add event expecter which supports anonymous events#8429
Conversation
0730b5f to
d31ec52
Compare
Sorry, don't think I am following. I believe that However, I'd expect |
|
Sorry you're right - I got confused by the 4th element in |
8b4108c to
e1f9f1b
Compare
|
Okay I updated. Let's see what CI thinks. |
…with no indexed topics
e1f9f1b to
16f2d24
Compare
| event_to_fill_or_check.log = Some(log.data.clone()); | ||
| // Unless the caller is trying to match an anonymous event, the first topic must be | ||
| // filled. | ||
| // TODO: failing this check should probably cause a warning |
There was a problem hiding this comment.
I think we'd want to revert here ideally, should be possible after bluealloy/revm#1610
closes #7457, closes #7545
--
From #7545:
This PR introduces the
vm.expectEmitAnonymouscheatcode and corresponding overloads. Additionally, it disallows matching anonymous events with no indexed topics viavm.expectEmit. If the anonymous has at least one indexed event, it's impossible to differentiate from a non-anonymous event.The restriction is necessary, because the way
vm.expectEmitworks is surprising (see #8416). The valuecheckTopic1is basically disregarded. Since Solidity uses it to encode the event signature, it is the best way to match the signature between the expected event and actual.The ideal solution would be to break this interface and only allow checking of 3 topics viaexpectEmit, since that is essentially what's possible now.