You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Empty Anonymous Events Can Decode Any Event #1038
An empty anonymous event can decode any other event. For example:
sol!{
event NonAnonymousLog(addres, uint256,bool);
event AnonymousLog() anonymous;}// Execute a transaction that emits `NonAnonymousLog(addres, uint256, bool)` and try decoding the log with `AnonymousLog`let anonymous_log = tx.decoded_log::<AnonymousLog>();// This will return `Some`assert!(anonymous.is_some());// This will not fail
This does not work if the event has fields. For instance, event AnonymousLog(address) anonymous cannot decode other events. I assume this happens because the empty anonymous event has no topics and no data, so the checks are skipped, which is not the case for a non-empty event.
Not sure whether this behavior is expected or not, but it is not very clear and can cause confusion or bugs in tests.
Activity
mattsse commentedon Nov 5, 2025
@cre-mer can you try
decode_log_validate@DaniPopes can't really remember the context here but we might want to add some additional docs for all of this