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:
- Allowing 4 indexed parameters in event definitions (since
topic0 is not used for the event selector)
- Setting
"anonymous": true in the generated ABI
- 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;
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 assumestopic0is always the event selector and only supports up to 3 indexed parameters.Current Behavior
indexedto all 4 parameters inconfig.yamlcauses codegen to fail becauseLogSelection.parseEventFiltersOrThrowonly supports up to~topic3.indexedfrom the event definitions allows codegen to pass, but the indexer cannot match the events on-chain since the topic layout doesn't match.Types.res.jssets"anonymous": falsein the ABI and uses asighashfortopic0filtering, neither of which apply to anonymous events.Expected Behavior
Envio should support anonymous events by:
topic0is not used for the event selector)"anonymous": truein the generated ABIsighash/topic0filtering for anonymous eventsTesting steps
You can test the indexing of an annonymous event by using this contract:
LockstakeMigrator0x473d777f608C3C24B441AB6bD4bBcA6b7F9AF90B