github.com/adoriasoft/tendermint@v0.34.0-dev1.0.20200722151356-96d84601a75a/proto/tendermint/abci/types.proto (about)

     1  syntax = "proto3";
     2  package tendermint.abci;
     3  
     4  option go_package = "github.com/adoriasoft/tendermint/abci/types";
     5  
     6  // For more information on gogo.proto, see:
     7  // https://github.com/gogo/protobuf/blob/master/extensions.md
     8  import "tendermint/crypto/proof.proto";
     9  import "tendermint/types/types.proto";
    10  import "tendermint/crypto/keys.proto";
    11  import "tendermint/types/params.proto";
    12  import "google/protobuf/timestamp.proto";
    13  import "tendermint/google/api/annotations.proto";
    14  import "gogoproto/gogo.proto";
    15  
    16  // This file is copied from http://github.com/tendermint/abci
    17  // NOTE: When using custom types, mind the warnings.
    18  // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
    19  
    20  //----------------------------------------
    21  // Request types
    22  
    23  message Request {
    24    oneof value {
    25      RequestEcho               echo                 = 1;
    26      RequestFlush              flush                = 2;
    27      RequestInfo               info                 = 3;
    28      RequestSetOption          set_option           = 4;
    29      RequestInitChain          init_chain           = 5;
    30      RequestQuery              query                = 6;
    31      RequestBeginBlock         begin_block          = 7;
    32      RequestCheckTx            check_tx             = 8;
    33      RequestDeliverTx          deliver_tx           = 9;
    34      RequestEndBlock           end_block            = 10;
    35      RequestCommit             commit               = 11;
    36      RequestListSnapshots      list_snapshots       = 12;
    37      RequestOfferSnapshot      offer_snapshot       = 13;
    38      RequestLoadSnapshotChunk  load_snapshot_chunk  = 14;
    39      RequestApplySnapshotChunk apply_snapshot_chunk = 15;
    40    }
    41  }
    42  
    43  message RequestEcho {
    44    string message = 1;
    45  }
    46  
    47  message RequestFlush {}
    48  
    49  message RequestInfo {
    50    string version       = 1;
    51    uint64 block_version = 2;
    52    uint64 p2p_version   = 3;
    53  }
    54  
    55  // nondeterministic
    56  message RequestSetOption {
    57    string key   = 1;
    58    string value = 2;
    59  }
    60  
    61  message RequestInitChain {
    62    google.protobuf.Timestamp time = 1
    63        [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
    64    string                   chain_id         = 2;
    65    ConsensusParams          consensus_params = 3;
    66    repeated ValidatorUpdate validators       = 4 [(gogoproto.nullable) = false];
    67    bytes                    app_state_bytes  = 5;
    68  }
    69  
    70  message RequestQuery {
    71    bytes  data   = 1;
    72    string path   = 2;
    73    int64  height = 3;
    74    bool   prove  = 4;
    75  }
    76  
    77  message RequestBeginBlock {
    78    bytes                   hash                 = 1;
    79    tendermint.types.Header header               = 2 [(gogoproto.nullable) = false];
    80    LastCommitInfo          last_commit_info     = 3 [(gogoproto.nullable) = false];
    81    repeated Evidence       byzantine_validators = 4 [(gogoproto.nullable) = false];
    82  }
    83  
    84  enum CheckTxType {
    85    NEW     = 0 [(gogoproto.enumvalue_customname) = "New"];
    86    RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"];
    87  }
    88  
    89  message RequestCheckTx {
    90    bytes       tx   = 1;
    91    CheckTxType type = 2;
    92  }
    93  
    94  message RequestDeliverTx {
    95    bytes tx = 1;
    96  }
    97  
    98  message RequestEndBlock {
    99    int64 height = 1;
   100  }
   101  
   102  message RequestCommit {}
   103  
   104  // lists available snapshots
   105  message RequestListSnapshots {
   106  }
   107  
   108  // offers a snapshot to the application
   109  message RequestOfferSnapshot {
   110    Snapshot snapshot = 1;  // snapshot offered by peers
   111    bytes    app_hash = 2;  // light client-verified app hash for snapshot height
   112  }
   113  
   114  // loads a snapshot chunk
   115  message RequestLoadSnapshotChunk {
   116    uint64 height = 1;
   117    uint32 format = 2;
   118    uint32 chunk  = 3;
   119  }
   120  
   121  // Applies a snapshot chunk
   122  message RequestApplySnapshotChunk {
   123    uint32 index  = 1;
   124    bytes  chunk  = 2;
   125    string sender = 3;
   126  }
   127  
   128  //----------------------------------------
   129  // Response types
   130  
   131  message Response {
   132    oneof value {
   133      ResponseException          exception            = 1;
   134      ResponseEcho               echo                 = 2;
   135      ResponseFlush              flush                = 3;
   136      ResponseInfo               info                 = 4;
   137      ResponseSetOption          set_option           = 5;
   138      ResponseInitChain          init_chain           = 6;
   139      ResponseQuery              query                = 7;
   140      ResponseBeginBlock         begin_block          = 8;
   141      ResponseCheckTx            check_tx             = 9;
   142      ResponseDeliverTx          deliver_tx           = 10;
   143      ResponseEndBlock           end_block            = 11;
   144      ResponseCommit             commit               = 12;
   145      ResponseListSnapshots      list_snapshots       = 13;
   146      ResponseOfferSnapshot      offer_snapshot       = 14;
   147      ResponseLoadSnapshotChunk  load_snapshot_chunk  = 15;
   148      ResponseApplySnapshotChunk apply_snapshot_chunk = 16;
   149    }
   150  }
   151  
   152  // nondeterministic
   153  message ResponseException {
   154    string error = 1;
   155  }
   156  
   157  message ResponseEcho {
   158    string message = 1;
   159  }
   160  
   161  message ResponseFlush {}
   162  
   163  message ResponseInfo {
   164    string data = 1;
   165  
   166    string version     = 2;
   167    uint64 app_version = 3;
   168  
   169    int64 last_block_height   = 4;
   170    bytes last_block_app_hash = 5;
   171  }
   172  
   173  // nondeterministic
   174  message ResponseSetOption {
   175    uint32 code = 1;
   176    // bytes data = 2;
   177    string log  = 3;
   178    string info = 4;
   179  }
   180  
   181  message ResponseInitChain {
   182    ConsensusParams          consensus_params = 1;
   183    repeated ValidatorUpdate validators       = 2 [(gogoproto.nullable) = false];
   184  }
   185  
   186  message ResponseQuery {
   187    uint32 code = 1;
   188    // bytes data = 2; // use "value" instead.
   189    string                     log       = 3;  // nondeterministic
   190    string                     info      = 4;  // nondeterministic
   191    int64                      index     = 5;
   192    bytes                      key       = 6;
   193    bytes                      value     = 7;
   194    tendermint.crypto.ProofOps proof_ops = 8;
   195    int64                      height    = 9;
   196    string                     codespace = 10;
   197  }
   198  
   199  message ResponseBeginBlock {
   200    repeated Event events = 1
   201        [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
   202  }
   203  
   204  message ResponseCheckTx {
   205    uint32         code       = 1;
   206    bytes          data       = 2;
   207    string         log        = 3;  // nondeterministic
   208    string         info       = 4;  // nondeterministic
   209    int64          gas_wanted = 5 [json_name = "gas_wanted"];
   210    int64          gas_used   = 6 [json_name = "gas_used"];
   211    repeated Event events     = 7
   212        [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
   213    string codespace = 8;
   214  }
   215  
   216  message ResponseDeliverTx {
   217    uint32         code       = 1;
   218    bytes          data       = 2;
   219    string         log        = 3;  // nondeterministic
   220    string         info       = 4;  // nondeterministic
   221    int64          gas_wanted = 5 [json_name = "gas_wanted"];
   222    int64          gas_used   = 6 [json_name = "gas_used"];
   223    repeated Event events     = 7
   224        [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
   225    string codespace = 8;
   226  }
   227  
   228  message ResponseEndBlock {
   229    repeated ValidatorUpdate validator_updates = 1
   230        [(gogoproto.nullable) = false];
   231    ConsensusParams consensus_param_updates = 2;
   232    repeated Event  events                  = 3
   233        [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
   234  }
   235  
   236  message ResponseCommit {
   237    // reserve 1
   238    bytes data          = 2;
   239    int64 retain_height = 3;
   240  }
   241  
   242  message ResponseListSnapshots {
   243    repeated Snapshot snapshots = 1;
   244  }
   245  
   246  message ResponseOfferSnapshot {
   247    Result result = 1;
   248  
   249    enum Result {
   250      UNKNOWN       = 0;  // Unknown result, abort all snapshot restoration
   251      ACCEPT        = 1;  // Snapshot accepted, apply chunks
   252      ABORT         = 2;  // Abort all snapshot restoration
   253      REJECT        = 3;  // Reject this specific snapshot, try others
   254      REJECT_FORMAT = 4;  // Reject all snapshots of this format, try others
   255      REJECT_SENDER = 5;  // Reject all snapshots from the sender(s), try others
   256    }
   257  }
   258  
   259  message ResponseLoadSnapshotChunk {
   260    bytes chunk = 1;
   261  }
   262  
   263  message ResponseApplySnapshotChunk {
   264    Result          result         = 1;
   265    repeated uint32 refetch_chunks = 2;  // Chunks to refetch and reapply
   266    repeated string reject_senders = 3;  // Chunk senders to reject and ban
   267  
   268    enum Result {
   269      UNKNOWN         = 0;  // Unknown result, abort all snapshot restoration
   270      ACCEPT          = 1;  // Chunk successfully accepted
   271      ABORT           = 2;  // Abort all snapshot restoration
   272      RETRY           = 3;  // Retry chunk (combine with refetch and reject)
   273      RETRY_SNAPSHOT  = 4;  // Retry snapshot (combine with refetch and reject)
   274      REJECT_SNAPSHOT = 5;  // Reject this snapshot, try others
   275    }
   276  }
   277  
   278  //----------------------------------------
   279  // Misc.
   280  
   281  // ConsensusParams contains all consensus-relevant parameters
   282  // that can be adjusted by the abci app
   283  message ConsensusParams {
   284    BlockParams                      block     = 1;
   285    tendermint.types.EvidenceParams  evidence  = 2;
   286    tendermint.types.ValidatorParams validator = 3;
   287    tendermint.types.VersionParams   version   = 4;
   288  }
   289  
   290  // BlockParams contains limits on the block size.
   291  message BlockParams {
   292    // Note: must be greater than 0
   293    int64 max_bytes = 1;
   294    // Note: must be greater or equal to -1
   295    int64 max_gas = 2;
   296  }
   297  
   298  message LastCommitInfo {
   299    int32             round = 1;
   300    repeated VoteInfo votes = 2 [(gogoproto.nullable) = false];
   301  }
   302  
   303  // Event allows application developers to attach additional information to
   304  // ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx.
   305  // Later, transactions may be queried using these events.
   306  message Event {
   307    string                  type       = 1;
   308    repeated EventAttribute attributes = 2 [
   309      (gogoproto.nullable) = false,
   310      (gogoproto.jsontag)  = "attributes,omitempty"
   311    ];
   312  }
   313  
   314  // EventAttribute is a single key-value pair, associated with an event.
   315  message EventAttribute {
   316    bytes key   = 1;
   317    bytes value = 2;
   318    bool  index = 3;  // nondeterministic
   319  }
   320  
   321  // TxResult contains results of executing the transaction.
   322  //
   323  // One usage is indexing transaction results.
   324  message TxResult {
   325    int64             height = 1;
   326    uint32            index  = 2;
   327    bytes             tx     = 3;
   328    ResponseDeliverTx result = 4 [(gogoproto.nullable) = false];
   329  }
   330  
   331  //----------------------------------------
   332  // Blockchain Types
   333  
   334  // Validator
   335  message Validator {
   336    bytes address = 1;
   337    // PubKey pub_key = 2 [(gogoproto.nullable)=false];
   338    int64 power = 3;
   339  }
   340  
   341  // ValidatorUpdate
   342  message ValidatorUpdate {
   343    tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false];
   344    int64                       power   = 2;
   345  }
   346  
   347  // VoteInfo
   348  message VoteInfo {
   349    Validator validator         = 1 [(gogoproto.nullable) = false];
   350    bool      signed_last_block = 2;
   351  }
   352  
   353  message Evidence {
   354    string                    type      = 1;
   355    Validator                 validator = 2 [(gogoproto.nullable) = false];
   356    int64                     height    = 3;
   357    google.protobuf.Timestamp time      = 4 [
   358      (gogoproto.nullable) = false,
   359      (gogoproto.stdtime)  = true
   360    ];
   361    // Total voting power of the validator set in case the ABCI application does
   362    // not store historical validators.
   363    // https://github.com/tendermint/tendermint/issues/4581
   364    int64 total_voting_power = 5;
   365  }
   366  
   367  //----------------------------------------
   368  // State Sync Types
   369  
   370  message Snapshot {
   371    uint64 height   = 1;  // The height at which the snapshot was taken
   372    uint32 format   = 2;  // The application-specific snapshot format
   373    uint32 chunks   = 3;  // Number of chunks in the snapshot
   374    bytes  hash     = 4;  // Arbitrary snapshot hash, equal only if identical
   375    bytes  metadata = 5;  // Arbitrary application metadata
   376  }
   377  
   378  //----------------------------------------
   379  // Service Definition
   380  
   381  service ABCIApplication {
   382    rpc Echo(RequestEcho) returns (ResponseEcho);
   383    rpc Flush(RequestFlush) returns (ResponseFlush);
   384    rpc Info(RequestInfo) returns (ResponseInfo);
   385    rpc SetOption(RequestSetOption) returns (ResponseSetOption);
   386    rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx) {
   387      option (google.api.http) = {
   388        post : "/abci/v1/DeliverTx"
   389        body : "*"
   390      };
   391    }
   392    rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx) {
   393      option (google.api.http) = {
   394        post : "/abci/v1/CheckTx"
   395        body : "*"
   396      };
   397    }
   398    rpc Query(RequestQuery) returns (ResponseQuery);
   399    rpc Commit(RequestCommit) returns (ResponseCommit) {
   400      option (google.api.http) = {
   401        post : "/abci/v1/Commit"
   402        body : "*"
   403      };
   404    }
   405    rpc InitChain(RequestInitChain) returns (ResponseInitChain) {
   406      option (google.api.http) = {
   407        get : "/abci/v1/InitChain"
   408      };
   409    }
   410    rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock) {
   411      option (google.api.http) = {
   412        post : "/abci/v1/BeginBlock"
   413        body : "*"
   414      };
   415    }
   416    rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock) {
   417      option (google.api.http) = {
   418        post : "/abci/v1/EndBlock"
   419        body : "*"
   420      };
   421    }
   422    rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots);
   423    rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot);
   424    rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk);
   425    rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk);
   426  }