Skip to content

Proposal: don't use serialized point as node reference #348

@gballet

Description

@gballet

This is a new take on #327, storing uncompressed points in the database.

The biggest problem with the approach in #327 was that all nodes references would be 64 bytes long. That also means that the keys are 64 bit long. This, in turns, induces a lot of compactions in the db.

Currently, the cachedPoint in HashedNode is evaluated in Commit() and used in several functions within Commitment(). However, the only time that the coordinates are needed, is when a Hash is inserted into, and therefore resolved. The point is computed from its serialized form, and then inserted directly into the copy-on-write list.

I propose the following changes:

  • Reference nodes by the sha256 of their coordinates
  • Make HashedNode resolution part of cowChild instead of InsertStem.
  • (optional) store the commitment as its x and y values, which should be less of a problem because the two coordinates are only stored once instead of twice (once in the parent node, and once in the child node).

This plays well with a path-based approach, because the proposal by Gary can use the faster sha2 as reference. It works well for serialization as well, since the points need not be serialized, and so we get the speedup benefit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions