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.

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