github.com/franono/tendermint@v0.32.2-0.20200527150959-749313264ce9/abci/types/types.proto (about)

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