Skip to content

General Merkle Proof #2502

@mossid

Description

@mossid

Summary

The current format for the Merkle proofs is simply []byte which is mostly amino encoded single Merkle proof. This has the following problems:

  • ABCI apps will have multilayer Merkle proof instead of single layer. For example SDK is using Simple Merkle Proof in rootmultistore and IAVL Proof in iavlstore, and they are composed horizontally.
  • It is hard to extend the set of Merkle proof formats. Each time we use a new Merkle proof format, we have to define a completely new type, which is app-specific and not reusable.

Proposal

Define ProofOp. It is a triple of (type string, key []byte, data [][]byte) and decoded into type ProofOperator interface depending on its type. It has a method Run() which can be used for chaining multiple ProopOperators.

Also each concrete type of ProofOperator can declare its own OpDecoder which later can be used for decoding ProofOp to ProofOperator. Those are registered in map[type string]OpDecoder way. Since it does not rely on amino, lite clients on non-golang environment, for example, a mobile client, can define OpDecoder for json or subset of amino,

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