fix: event filter typespec generation for events with interleaved indexed and non-indexed fields#249
Merged
alisinabh merged 2 commits intoExWeb3:mainfrom Apr 14, 2026
Conversation
alisinabh
approved these changes
Apr 14, 2026
Member
alisinabh
left a comment
There was a problem hiding this comment.
Thank you for the contribution <3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
generate_event_typespecsfunction callsEnum.take(selector.types, arity)to extract the types of the indexed fields from an event selector. The problem with this is thatEnum.take(selector.types, arity)grabs the firstaritytypes from the full ABI field list, but when an event has interleaved indexed and non-indexed fields, this produces wrong typespecs (the generated spec contains the type of a non-indexed field instead of the actual indexed field).Example
Take for example the following event
The arity of this event is 2 (there are 2 indexed fields), so in this case the
generate_event_typespecsfunction will select the first 2 fields to determine the type of the indexed fields.As a result, the
generate_event_typespecsfunction will return[uint256, address]. However, the types of the indexed fields are actually[address, address].This PR fixes this error by updating the
generate_event_typespecsfunction so that it uses theevent_indexed_typesfunction to select the types for the event typespec. This ensures the typespec is generated with the right types.