-
Notifications
You must be signed in to change notification settings - Fork 184
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
Use 0x00
as key for singleton tables instead of empty array, require at least one element in a keyTuple
#1125
Comments
do we specifically want also, if we have proper key tuple names registered, do we want to give singleton tables a meaningful key tuple like |
can you illustrate a situation where using |
Hmm, I can't think of anything. Maybe keys aren't an issue with zero/uninitialized values, only values (where it's hard to tell if something is set or not set) |
This seems fine, since a singleton key/empty schema is for the entire table (only one value stored rather than one per key), so you wouldn't even use/need We can/should adjust the module to either check for key length within the hook before we do
The store event has enough information to distinguish singleton keys vs. not (empty array vs. non-empty array), so this seems like something we can/should work around in our indexers. I think I've got a decent approach for this in the TS sync stack/indexer, where a singleton key (for the purposes of the unique ID column) is effectively |
In my opinion it would be cleaner to use |
Another approach for how the |
Much more on board with this approach! |
Started fiddling with this but quickly realized we can't take that approach without support for We could work around this by storing the hash of the ABI-encoded keys in a |
More context from discussion on discord:
|
we decided to keep the we'll have to figure out an approach for this in our various modules, but saving that for another time |
the current empty array leads to a couple subtle issues: in “KeysWithValue” it’s not possible to distinguish the “singleton key” from “no keys”, and in MODE and the client we currently need custom handling of singleton tables because of the empty array. It might be easier to just use a known key, maybe just “0x00”, to use for singleton tables, so that all other tools and integrations don’t need a special case for it
The text was updated successfully, but these errors were encountered: