linera-io / linera-io/linera-protocol
Don't hash on deserialization.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 32.1k
- Forks
- 2.4k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 67
Description
For both blobs and certificate values:
SerializeandDeserializeare only implemented for the non-hashed versions.- There are explicit conversion functions:
with_hashcomputes the hash, converting the non-hashed to the hashed type.with_hash_uncheckedadds a given hash, without computing it, converting the non-hashed to the hashed type.forget_hashconverts the hashed to the non-hashed type.
- At public boundaries, i.e. any communication between the client and a node (server or proxy), the non-hashed version is sent, and the hash is computed on deserialization.
- In storage, the hash is stored separately (usually as the key), and after deserialization it is added using
with_hash_unchecked.
In some cases hashed certificate values are part of things that get sent over the wire, e.g. Certificate. Here we should send a LiteCertificate and the CertificateValue separately. We should do the same thing for Vote.
In gRPC messages, CertificateValues and Blobs should be sent as BCS-serialized bytes, so that its hash can be computed without re-serializing it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Serialize and Deserialize implementations for Blob and certificate values, then follow Certificate, Vote, storage boundaries, and gRPC messages across client-node communication. Done means wire formats use non-hashed values or BCS bytes, while stored hashes are restored separately without hashing during deserialization; the issue names no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, rust
- Domain
- blockchain, distributed-systems, networking
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100