Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'indexed' from string relType events #211

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

jdubpark
Copy link
Contributor

@jdubpark jdubpark commented Dec 1, 2023

The changes modify string indexed relType to string relType per #208.

A note on string indexed vs. string in events (from SO):
All event arguments with the indexed prefix are stored in topics while non-indexed args are stored in the data section of the transaction receipt. Since the string is of arbitrary length, Solidity hashes (keccak256) indexed string arguments and stores the hashes in the events. So filtering for string indexed relType in logs is filtering for strings of max size 32 bytes (to fit in bytes32) (= 32 letters), which means longer relType strings will get pruned with the indexed prefix.

Consideration: Can't search indexed relType anymore.
Potential solution: Have 32-letter unique ID for each relType (the mapping of ID to relType is stored off-chain), emit relType as normal string and the unique ID as indexed bytes32. Filter on unique ID based on the mapping stored off-chain.

Copy link
Contributor

@kingster-will kingster-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Good consideration.
We might also consider covert the relType to ShortString

@LeoHChen LeoHChen merged commit eb33a26 into storyprotocol:dev Dec 1, 2023
1 check passed
@jdubpark jdubpark deleted the issue/remove-indexed-reltype branch December 2, 2023 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants