You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
6.5 KiB

8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
  1. syntax = "proto3";
  2. package types;
  3. // For more information on gogo.proto, see:
  4. // https://github.com/gogo/protobuf/blob/master/extensions.md
  5. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  6. import "github.com/tendermint/tmlibs/common/types.proto";
  7. // This file is copied from http://github.com/tendermint/abci
  8. // NOTE: When using custom types, mind the warnings.
  9. // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
  10. //----------------------------------------
  11. // Request types
  12. message Request {
  13. oneof value {
  14. RequestEcho echo = 2;
  15. RequestFlush flush = 3;
  16. RequestInfo info = 4;
  17. RequestSetOption set_option = 5;
  18. RequestInitChain init_chain = 6;
  19. RequestQuery query = 7;
  20. RequestBeginBlock begin_block = 8;
  21. RequestCheckTx check_tx = 9;
  22. RequestDeliverTx deliver_tx = 19;
  23. RequestEndBlock end_block = 11;
  24. RequestCommit commit = 12;
  25. }
  26. }
  27. message RequestEcho {
  28. string message = 1;
  29. }
  30. message RequestFlush {
  31. }
  32. message RequestInfo {
  33. string version = 1;
  34. }
  35. // nondeterministic
  36. message RequestSetOption {
  37. string key = 1;
  38. string value = 2;
  39. }
  40. message RequestInitChain {
  41. int64 time = 1;
  42. string chain_id = 2;
  43. ConsensusParams consensus_params = 3;
  44. repeated Validator validators = 4 [(gogoproto.nullable)=false];
  45. bytes app_state_bytes = 5;
  46. }
  47. message RequestQuery {
  48. bytes data = 1;
  49. string path = 2;
  50. int64 height = 3;
  51. bool prove = 4;
  52. }
  53. message RequestBeginBlock {
  54. bytes hash = 1;
  55. Header header = 2 [(gogoproto.nullable)=false];
  56. repeated SigningValidator validators = 3 [(gogoproto.nullable)=false];
  57. repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
  58. }
  59. message RequestCheckTx {
  60. bytes tx = 1;
  61. }
  62. message RequestDeliverTx {
  63. bytes tx = 1;
  64. }
  65. message RequestEndBlock {
  66. int64 height = 1;
  67. }
  68. message RequestCommit {
  69. }
  70. //----------------------------------------
  71. // Response types
  72. message Response {
  73. oneof value {
  74. ResponseException exception = 1;
  75. ResponseEcho echo = 2;
  76. ResponseFlush flush = 3;
  77. ResponseInfo info = 4;
  78. ResponseSetOption set_option = 5;
  79. ResponseInitChain init_chain = 6;
  80. ResponseQuery query = 7;
  81. ResponseBeginBlock begin_block = 8;
  82. ResponseCheckTx check_tx = 9;
  83. ResponseDeliverTx deliver_tx = 10;
  84. ResponseEndBlock end_block = 11;
  85. ResponseCommit commit = 12;
  86. }
  87. }
  88. // nondeterministic
  89. message ResponseException {
  90. string error = 1;
  91. }
  92. message ResponseEcho {
  93. string message = 1;
  94. }
  95. message ResponseFlush {
  96. }
  97. message ResponseInfo {
  98. string data = 1;
  99. string version = 2;
  100. int64 last_block_height = 3;
  101. bytes last_block_app_hash = 4;
  102. }
  103. // nondeterministic
  104. message ResponseSetOption {
  105. uint32 code = 1;
  106. // bytes data = 2;
  107. string log = 3;
  108. string info = 4;
  109. }
  110. message ResponseInitChain {
  111. ConsensusParams consensus_params = 1;
  112. repeated Validator validators = 2 [(gogoproto.nullable)=false];
  113. }
  114. message ResponseQuery {
  115. uint32 code = 1;
  116. // bytes data = 2; // use "value" instead.
  117. string log = 3; // nondeterministic
  118. string info = 4; // nondeterministic
  119. int64 index = 5;
  120. bytes key = 6;
  121. bytes value = 7;
  122. bytes proof = 8;
  123. int64 height = 9;
  124. }
  125. message ResponseBeginBlock {
  126. repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  127. }
  128. message ResponseCheckTx {
  129. uint32 code = 1;
  130. bytes data = 2;
  131. string log = 3; // nondeterministic
  132. string info = 4; // nondeterministic
  133. int64 gas_wanted = 5;
  134. int64 gas_used = 6;
  135. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  136. common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
  137. }
  138. message ResponseDeliverTx {
  139. uint32 code = 1;
  140. bytes data = 2;
  141. string log = 3; // nondeterministic
  142. string info = 4; // nondeterministic
  143. int64 gas_wanted = 5;
  144. int64 gas_used = 6;
  145. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  146. common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
  147. }
  148. message ResponseEndBlock {
  149. repeated Validator validator_updates = 1 [(gogoproto.nullable)=false];
  150. ConsensusParams consensus_param_updates = 2;
  151. repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  152. }
  153. message ResponseCommit {
  154. // reserve 1
  155. bytes data = 2;
  156. }
  157. //----------------------------------------
  158. // Misc.
  159. // ConsensusParams contains all consensus-relevant parameters
  160. // that can be adjusted by the abci app
  161. message ConsensusParams {
  162. BlockSize block_size = 1;
  163. TxSize tx_size = 2;
  164. BlockGossip block_gossip = 3;
  165. }
  166. // BlockSize contain limits on the block size.
  167. message BlockSize {
  168. int32 max_bytes = 1;
  169. int32 max_txs = 2;
  170. int64 max_gas = 3;
  171. }
  172. // TxSize contain limits on the tx size.
  173. message TxSize {
  174. int32 max_bytes = 1;
  175. int64 max_gas = 2;
  176. }
  177. // BlockGossip determine consensus critical
  178. // elements of how blocks are gossiped
  179. message BlockGossip {
  180. // Note: must not be 0
  181. int32 block_part_size_bytes = 1;
  182. }
  183. //----------------------------------------
  184. // Blockchain Types
  185. // just the minimum the app might need
  186. message Header {
  187. // basics
  188. string chain_id = 1 [(gogoproto.customname)="ChainID"];
  189. int64 height = 2;
  190. int64 time = 3;
  191. // txs
  192. int32 num_txs = 4;
  193. int64 total_txs = 5;
  194. // hashes
  195. bytes last_block_hash = 6;
  196. bytes app_hash = 7;
  197. // consensus
  198. Validator proposer = 8 [(gogoproto.nullable)=false];
  199. }
  200. // Validator
  201. message Validator {
  202. bytes address = 1;
  203. PubKey pub_key = 2 [(gogoproto.nullable)=false];
  204. int64 power = 3;
  205. }
  206. // Validator with an extra bool
  207. message SigningValidator {
  208. Validator validator = 1 [(gogoproto.nullable)=false];
  209. bool signed_last_block = 2;
  210. }
  211. message PubKey {
  212. string type = 1;
  213. bytes data = 2;
  214. }
  215. message Evidence {
  216. string type = 1;
  217. Validator validator = 2 [(gogoproto.nullable)=false];
  218. int64 height = 3;
  219. int64 time = 4;
  220. int64 total_voting_power = 5;
  221. }
  222. //----------------------------------------
  223. // Service Definition
  224. service ABCIApplication {
  225. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  226. rpc Flush(RequestFlush) returns (ResponseFlush);
  227. rpc Info(RequestInfo) returns (ResponseInfo);
  228. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  229. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  230. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  231. rpc Query(RequestQuery) returns (ResponseQuery);
  232. rpc Commit(RequestCommit) returns (ResponseCommit);
  233. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  234. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  235. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  236. }