github.com/ava-labs/avalanchego@v1.11.11/proto/sync/sync.proto (about)

     1  syntax = "proto3";
     2  
     3  package sync;
     4  
     5  import "google/protobuf/empty.proto";
     6  
     7  option go_package = "github.com/ava-labs/avalanchego/proto/pb/sync";
     8  
     9  // Request represents a request for information during syncing.
    10  message Request {
    11    oneof message {
    12      SyncGetRangeProofRequest range_proof_request = 1;
    13      SyncGetChangeProofRequest change_proof_request = 2;
    14    }
    15  }
    16  
    17  // The interface required by an x/sync/SyncManager for syncing.
    18  // Note this service definition only exists for use in tests.
    19  // A database shouldn't expose this over the internet, as it
    20  // allows for reading/writing to the database.
    21  service DB {
    22    rpc GetMerkleRoot(google.protobuf.Empty) returns (GetMerkleRootResponse);
    23  
    24    rpc Clear(google.protobuf.Empty) returns (google.protobuf.Empty);
    25  
    26    rpc GetProof(GetProofRequest) returns (GetProofResponse);
    27  
    28    rpc GetChangeProof(GetChangeProofRequest) returns (GetChangeProofResponse);
    29    rpc VerifyChangeProof(VerifyChangeProofRequest) returns (VerifyChangeProofResponse);
    30    rpc CommitChangeProof(CommitChangeProofRequest) returns (google.protobuf.Empty);
    31  
    32    rpc GetRangeProof(GetRangeProofRequest) returns (GetRangeProofResponse);
    33    rpc CommitRangeProof(CommitRangeProofRequest) returns (google.protobuf.Empty);
    34  }
    35  
    36  message GetMerkleRootResponse {
    37    bytes root_hash = 1;
    38  }
    39  
    40  message GetProofRequest {
    41    bytes key = 1;
    42  }
    43  
    44  message GetProofResponse {
    45    Proof proof = 1;
    46  }
    47  
    48  message Proof {
    49    bytes key = 1;
    50    MaybeBytes value = 2;
    51    repeated ProofNode proof = 3;
    52  }
    53  
    54  // For use in sync client, which has a restriction on the size of
    55  // the response. GetChangeProof in the DB service doesn't.
    56  message SyncGetChangeProofRequest {
    57    bytes start_root_hash = 1;
    58    bytes end_root_hash = 2;
    59    MaybeBytes start_key = 3;
    60    MaybeBytes end_key = 4;
    61    uint32 key_limit = 5;
    62    uint32 bytes_limit = 6;
    63  }
    64  
    65  message SyncGetChangeProofResponse {
    66    oneof response {
    67      ChangeProof change_proof = 1;
    68      RangeProof range_proof = 2;
    69    }
    70  }
    71  
    72  message GetChangeProofRequest {
    73    bytes start_root_hash = 1;
    74    bytes end_root_hash = 2;
    75    MaybeBytes start_key = 3;
    76    MaybeBytes end_key = 4;
    77    uint32 key_limit = 5;
    78  }
    79  
    80  message GetChangeProofResponse {
    81    oneof response {
    82      ChangeProof change_proof = 1;
    83      // True iff server errored with merkledb.ErrInsufficientHistory.
    84      bool root_not_present = 2;
    85    }
    86  }
    87  
    88  message VerifyChangeProofRequest {
    89    ChangeProof proof = 1;
    90    MaybeBytes start_key = 2;
    91    MaybeBytes end_key = 3;
    92    bytes expected_root_hash = 4;
    93  }
    94  
    95  message VerifyChangeProofResponse {
    96    // If empty, there was no error.
    97    string error = 1;
    98  }
    99  
   100  message CommitChangeProofRequest {
   101    ChangeProof proof = 1;
   102  }
   103  
   104  // For use in sync client, which has a restriction on the size of
   105  // the response. GetRangeProof in the DB service doesn't.
   106  message SyncGetRangeProofRequest {
   107    bytes root_hash = 1;
   108    MaybeBytes start_key = 2;
   109    MaybeBytes end_key = 3;
   110    uint32 key_limit = 4;
   111    uint32 bytes_limit = 5;
   112  }
   113  
   114  message GetRangeProofRequest {
   115    bytes root_hash = 1;
   116    MaybeBytes start_key = 2;
   117    MaybeBytes end_key = 3;
   118    uint32 key_limit = 4;
   119  }
   120  
   121  message GetRangeProofResponse {
   122    RangeProof proof = 1;
   123  }
   124  
   125  message CommitRangeProofRequest {
   126    MaybeBytes start_key = 1;
   127    MaybeBytes end_key = 2;
   128    RangeProof range_proof = 3;
   129  }
   130  
   131  message ChangeProof {
   132    repeated ProofNode start_proof = 1;
   133    repeated ProofNode end_proof = 2;
   134    repeated KeyChange key_changes = 3;
   135  }
   136  
   137  message RangeProof {
   138    repeated ProofNode start_proof = 1;
   139    repeated ProofNode end_proof = 2;
   140    repeated KeyValue key_values = 3;
   141  }
   142  
   143  message ProofNode {
   144    Key key = 1;
   145    MaybeBytes value_or_hash = 2;
   146    map<uint32, bytes> children = 3;
   147  }
   148  
   149  message KeyChange {
   150    bytes key = 1;
   151    MaybeBytes value = 2;
   152  }
   153  
   154  message Key {
   155    uint64 length = 1;
   156    bytes value = 2;
   157  }
   158  
   159  message MaybeBytes {
   160    bytes value = 1;
   161    // If false, this is None.
   162    // Otherwise this is Some.
   163    bool is_nothing = 2;
   164  }
   165  
   166  message KeyValue {
   167    bytes key = 1;
   168    bytes value = 2;
   169  }