Skip to content

Feature request: add support for anonymous events with 4 indexed parameters #990

Description

@iceanddust

Summary

Envio does not currently support indexing anonymous Solidity events that use all 4 topic slots for indexed parameters. Since anonymous events don't emit the event signature as topic0, they can use all 4 topic slots for indexed data — but Envio's codegen assumes topic0 is always the event selector and only supports up to 3 indexed parameters.

Current Behavior

  • Adding indexed to all 4 parameters in config.yaml causes codegen to fail because LogSelection.parseEventFiltersOrThrow only supports up to ~topic3.
  • Removing indexed from the event definitions allows codegen to pass, but the indexer cannot match the events on-chain since the topic layout doesn't match.
  • The generated code in Types.res.js sets "anonymous": false in the ABI and uses a sighash for topic0 filtering, neither of which apply to anonymous events.

Expected Behavior

Envio should support anonymous events by:

  1. Allowing 4 indexed parameters in event definitions (since topic0 is not used for the event selector)
  2. Setting "anonymous": true in the generated ABI
  3. Skipping sighash/topic0 filtering for anonymous events

Testing steps

You can test the indexing of an annonymous event by using this contract:

  • Chain ID: Mainnet
  • Contract name: LockstakeMigrator
  • Contract address: 0x473d777f608C3C24B441AB6bD4bBcA6b7F9AF90B
  • Event:
event Migrate(
    address indexed oldUrn,
    address indexed newUrn,
    address indexed caller,
    uint256 indexed ink
) anonymous;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions