// Message definitions related to Sparse Merkle Trees (SMT)

syntax = "proto3";
package smt;

import "digest.proto";
import "merkle.proto";

// Represents a single SMT leaf entry.
message SmtLeafEntry {
    // The key of the entry.
    digest.Digest key = 1;

    // The value of the entry.
    digest.Digest value = 2;
}

// Represents multiple leaf entries in an SMT.
message SmtLeafEntries {
    // The entries list.
    repeated SmtLeafEntry entries = 1;
}

// A leaf in an SMT, sitting at depth 64. A leaf can contain 0, 1 or multiple leaf entries.
message SmtLeaf {
    oneof leaf {
        // An empty leaf.
        uint64 empty = 1;

        // A single leaf entry.
        SmtLeafEntry single = 2;

        // Multiple leaf entries.
        SmtLeafEntries multiple = 3;
    }
}

// The opening of a leaf in an SMT.
message SmtOpening {
    // The merkle path to the leaf.
    merkle.MerklePath path = 1;

    // The leaf itself.
    SmtLeaf leaf = 2;
}
