foundry
                                
                                
                                
                                    foundry copied to clipboard
                            
                            
                            
                        Add `vm.expectEmitAnonymous` cheatcode to support anonymous events
Component
Forge
Describe the feature you would like
Add support for a new cheatcode: vm.expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) (and corresponding equivalent overloads).
The rationale is that vm.expectEmit always checks topic0, which is the event signature, and checking everything else is optional. But with an anonymous event, you don't have an event signature, so it doesn't make sense to still force the user to check topic0.
Closes: https://github.com/foundry-rs/foundry/issues/7457
Additional context
A previous attempt at working with anonymous events without topics was implemented here but was insufficient as it tried to patch in behaviour and created a possible footgun: https://github.com/foundry-rs/foundry/pull/7461
Wondering if this is being worked on at all as we would like to add some test coverage of anonymous events as part of https://github.com/ethereum-optimism/optimism/pull/10297