Replies: 2 comments 1 reply
|
Could you describe or link to a description of the underlying issue? I only see that a shorter key can become a prefix (or a suffix, depending on which one matters) of a longer, unrelated key, but I still feel like I don't see the full picture. |
1 reply
|
The likelihood of this happening is negligible, and we can guarantee that it can't happen by adding a byte after the viewing key for specifying the type of viewing key. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Zebra-scan currently stores keys and results in a single RocksDB column family where the key is an encoded Sapling extended full viewing key (efvk), a block height, and the transaction index in that order.
This should be okay for now because the byte length of an encoded Sapling efvk is constant.
Before adding support for different types of viewing keys in zebra-scan, we need to ensure that the disk format for different key types in that database column will remain constant so that our functions for retrieving or deleting results continue to work as expected.
We could do this by:
Padding shorter keys with empty bytes so that the disk format stays constantHashing keys and using hashes to select entries in the databaseUsing different db columns for different kinds of keysAdding a new db column to mapviewing-key -> idUsing account ids as the key and adding a new column for getting account ids by the full encoded key (this may also help with feat(scan): Associate scanning keys withAccountIDs #8229)Associating registered viewing keys with UUIDsUpdate: The likelihood of this happening is negligible, and we can guarantee that it doesn't happen by adding a byte after the viewing key for specifying the type of viewing key. We may want to add a note on correctness to the
IntoDiskimpl for scanning keys to explain why it's okay.All reactions