// Copyright 2020 The Exonum Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; import "exonum/crypto/types.proto"; import "google/protobuf/empty.proto"; package exonum.proof; option java_package = "com.exonum.messages.proof"; // Subset of map elements coupled with a proof. MapProof can assert existence/absence of certain keys // from the underlying map. message MapProof { // Array with 2 kinds of objects: `{ key, no_value }` for keys missing from // the underlying index, and `{ key, value }` for key-value pairs, existence of // which is asserted by the proof. repeated OptionalEntry entries = 1; // Array of { path: ProofPath, hash: Hash } objects. repeated MapProofEntry proof = 2; } // Key with corresponding value or an empty value if the key is missing // from the underlying map. message OptionalEntry { // Key serialized as per `BinaryValue` implementation (usually as // a Protobuf message, except for primitive types). bytes key = 1; oneof maybe_value { // Value serialized per `BinaryValue` implementation (usually as // a Protobuf message, except for primitive types). bytes value = 2; // Indicator that `key` is missing from the underlying map. google.protobuf.Empty no_value = 3; } } // Path to an intermediate Merkle Patricia tree node and a corresponding // hash value. message MapProofEntry { // Path to the node, expressed with the minimum necessary number of bytes. // Bits within each byte are indexed from the least significant to // the most significant. // The last byte may be padded with zeros if necessary. bytes path = 1; // Hash associated with the node. exonum.crypto.Hash hash = 2; // Number of zero bit padding at the end of the path. Must be in the `0..8` // interval. uint32 path_padding = 3; }