Skip to content

[Bug] Empty Anonymous Events Can Decode Any Event #1038

Closed

Description

@cre-mer

Component

sol-types

What version of Alloy are you on?

v1.0.38

Operating System

macOS (Apple Silicon)

Describe the bug

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

  1. added
    bug
    on Nov 5, 2025
  2. mattsse commented on Nov 5, 2025

    @mattsse
    Member

    @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

  3. moved this from Todo to Done in Alloyon May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions