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

Implement clear rules for serializing keys in storage module. #7

Closed
alekseysidorov opened this issue Mar 31, 2017 · 1 comment
Closed
Milestone

Comments

@alekseysidorov
Copy link
Contributor

Now we implicity that any types used as keys in storage table serialized to bytes in big endian order. But the trait for keys is AsRef<[u8]> which cannot provide proper flexibility.

See the PR for details.

@dj8yfo
Copy link
Contributor

dj8yfo commented Apr 1, 2017

I don't understand the problem from description. Big endian - is fine for storage table keys (as much as i understand big endian helps lexicographically (@defuz) )close keys to be put to memory caches simultaneously by db queries).
trait StorageKey was proposed by @defuz for keys, and it has to use big endian, not implemented yet;
StorageValue (as of now both for keys and values) - for values, and it has to use little endian instead, so that ser/de number <-> StorageValue is a noop.

After a brief look at PR i assume we have to implement either:

  1. StorageValue/StorageKey for (T,U), (T, U, Z), ... tuples of StorageValue. To do that we have to add field len() to the trait. And populate it correspondigly for structs generated by storage_value! (not with SIZE in the macro, because it can contain SegmentField). Supposedly not hard, just no one did that so far. But that'll be problematic for Vec<u8> type e.g. How do we know the size of Vec during deserialization without writing the size to the tuple serialized form? This overlaps with storage_value! functionality.

  2. Use storage_value! for such composite types as (txid, validator, input_index) and all others.

@defuz defuz mentioned this issue Apr 25, 2017
23 tasks
@defuz defuz added this to the Release 0.1 milestone Apr 25, 2017
@defuz defuz closed this as completed Jul 1, 2017
stanislav-tkach pushed a commit to stanislav-tkach/exonum that referenced this issue Feb 10, 2018
stanislav-tkach pushed a commit to stanislav-tkach/exonum that referenced this issue Feb 17, 2018
Move consts to a separated section
stanislav-tkach pushed a commit to stanislav-tkach/exonum that referenced this issue Apr 4, 2018
stanislav-tkach pushed a commit to stanislav-tkach/exonum that referenced this issue Apr 23, 2018
pavel-mukhanov pushed a commit to pavel-mukhanov/exonum that referenced this issue Apr 5, 2019
Remove HashedKey from ProofMapIndex [ECR-2635]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants