linera-io / linera-io/linera-protocol

Don't hash on deserialization.

Open
#2,136 0 comments 1 reaction 0 assignees View on GitHub

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:

  • Serialize and Deserialize are only implemented for the non-hashed versions.
  • There are explicit conversion functions:
    • with_hash computes the hash, converting the non-hashed to the hashed type.
    • with_hash_unchecked adds a given hash, without computing it, converting the non-hashed to the hashed type.
    • forget_hash converts 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.