Skip to content

Use immutable key for nodes to avoid excessive LevelDB reorgs #137

@mdyring

Description

@mdyring

Follow-up of cosmos/cosmos-sdk#2131.

After discussion on Slack, a suggestion to implement a fix:

  1. For each new node in IAVL tree, assign an sequential integer ID. This ID never changes for the node.
  2. Use this integer ID as "key" in the <key, value> pair stored in LevelDB.
  3. The value part stored in LevelDB contains the node hash (existing LevelDB key).
  4. All parent/child references must be through integer IDs.
  5. A special "root" key stored in LevelDB has an value that contains the integer ID of the root node.

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