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.

291 lines
6.8 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. common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
  145. }
  146. message ResponseDeliverTx {
  147. uint32 code = 1;
  148. bytes data = 2;
  149. string log = 3; // nondeterministic
  150. string info = 4; // nondeterministic
  151. int64 gas_wanted = 5;
  152. int64 gas_used = 6;
  153. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  154. common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
  155. }
  156. message ResponseEndBlock {
  157. repeated Validator validator_updates = 1 [(gogoproto.nullable)=false];
  158. ConsensusParams consensus_param_updates = 2;
  159. repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  160. }
  161. message ResponseCommit {
  162. // reserve 1
  163. bytes data = 2;
  164. }
  165. //----------------------------------------
  166. // Misc.
  167. // ConsensusParams contains all consensus-relevant parameters
  168. // that can be adjusted by the abci app
  169. message ConsensusParams {
  170. BlockSize block_size = 1;
  171. TxSize tx_size = 2;
  172. BlockGossip block_gossip = 3;
  173. }
  174. // BlockSize contain limits on the block size.
  175. message BlockSize {
  176. int32 max_bytes = 1;
  177. int32 max_txs = 2;
  178. int64 max_gas = 3;
  179. }
  180. // TxSize contain limits on the tx size.
  181. message TxSize {
  182. int32 max_bytes = 1;
  183. int64 max_gas = 2;
  184. }
  185. // BlockGossip determine consensus critical
  186. // elements of how blocks are gossiped
  187. message BlockGossip {
  188. // Note: must not be 0
  189. int32 block_part_size_bytes = 1;
  190. }
  191. //----------------------------------------
  192. // Blockchain Types
  193. // just the minimum the app might need
  194. message Header {
  195. // basics
  196. string chain_id = 1 [(gogoproto.customname)="ChainID"];
  197. int64 height = 2;
  198. int64 time = 3;
  199. // txs
  200. int32 num_txs = 4;
  201. int64 total_txs = 5;
  202. // hashes
  203. bytes last_block_hash = 6;
  204. bytes validators_hash = 7;
  205. bytes app_hash = 8;
  206. // consensus
  207. Validator proposer = 9 [(gogoproto.nullable)=false];
  208. }
  209. // Validator
  210. message Validator {
  211. bytes address = 1;
  212. PubKey pub_key = 2 [(gogoproto.nullable)=false];
  213. int64 power = 3;
  214. }
  215. // Validator with an extra bool
  216. message SigningValidator {
  217. Validator validator = 1 [(gogoproto.nullable)=false];
  218. bool signed_last_block = 2;
  219. }
  220. message PubKey {
  221. string type = 1;
  222. bytes data = 2;
  223. }
  224. message Evidence {
  225. string type = 1;
  226. Validator validator = 2 [(gogoproto.nullable)=false];
  227. int64 height = 3;
  228. int64 time = 4;
  229. int64 total_voting_power = 5;
  230. }
  231. //----------------------------------------
  232. // Service Definition
  233. service ABCIApplication {
  234. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  235. rpc Flush(RequestFlush) returns (ResponseFlush);
  236. rpc Info(RequestInfo) returns (ResponseInfo);
  237. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  238. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  239. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  240. rpc Query(RequestQuery) returns (ResponseQuery);
  241. rpc Commit(RequestCommit) returns (ResponseCommit);
  242. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  243. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  244. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  245. }