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.

312 lines
7.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 "google/protobuf/timestamp.proto";
  7. import "github.com/tendermint/tendermint/libs/common/types.proto";
  8. // This file is copied from http://github.com/tendermint/abci
  9. // NOTE: When using custom types, mind the warnings.
  10. // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
  11. option (gogoproto.marshaler_all) = true;
  12. option (gogoproto.unmarshaler_all) = true;
  13. option (gogoproto.sizer_all) = true;
  14. option (gogoproto.goproto_registration) = true;
  15. // Generate tests
  16. option (gogoproto.populate_all) = true;
  17. option (gogoproto.equal_all) = true;
  18. option (gogoproto.testgen_all) = true;
  19. //----------------------------------------
  20. // Request types
  21. message Request {
  22. oneof value {
  23. RequestEcho echo = 2;
  24. RequestFlush flush = 3;
  25. RequestInfo info = 4;
  26. RequestSetOption set_option = 5;
  27. RequestInitChain init_chain = 6;
  28. RequestQuery query = 7;
  29. RequestBeginBlock begin_block = 8;
  30. RequestCheckTx check_tx = 9;
  31. RequestDeliverTx deliver_tx = 19;
  32. RequestEndBlock end_block = 11;
  33. RequestCommit commit = 12;
  34. }
  35. }
  36. message RequestEcho {
  37. string message = 1;
  38. }
  39. message RequestFlush {
  40. }
  41. message RequestInfo {
  42. string version = 1;
  43. }
  44. // nondeterministic
  45. message RequestSetOption {
  46. string key = 1;
  47. string value = 2;
  48. }
  49. message RequestInitChain {
  50. google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  51. string chain_id = 2;
  52. ConsensusParams consensus_params = 3;
  53. repeated Validator validators = 4 [(gogoproto.nullable)=false];
  54. bytes app_state_bytes = 5;
  55. }
  56. message RequestQuery {
  57. bytes data = 1;
  58. string path = 2;
  59. int64 height = 3;
  60. bool prove = 4;
  61. }
  62. // NOTE: validators here have empty pubkeys.
  63. message RequestBeginBlock {
  64. bytes hash = 1;
  65. Header header = 2 [(gogoproto.nullable)=false];
  66. LastCommitInfo last_commit_info = 3 [(gogoproto.nullable)=false];
  67. repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
  68. }
  69. message RequestCheckTx {
  70. bytes tx = 1;
  71. }
  72. message RequestDeliverTx {
  73. bytes tx = 1;
  74. }
  75. message RequestEndBlock {
  76. int64 height = 1;
  77. }
  78. message RequestCommit {
  79. }
  80. //----------------------------------------
  81. // Response types
  82. message Response {
  83. oneof value {
  84. ResponseException exception = 1;
  85. ResponseEcho echo = 2;
  86. ResponseFlush flush = 3;
  87. ResponseInfo info = 4;
  88. ResponseSetOption set_option = 5;
  89. ResponseInitChain init_chain = 6;
  90. ResponseQuery query = 7;
  91. ResponseBeginBlock begin_block = 8;
  92. ResponseCheckTx check_tx = 9;
  93. ResponseDeliverTx deliver_tx = 10;
  94. ResponseEndBlock end_block = 11;
  95. ResponseCommit commit = 12;
  96. }
  97. }
  98. // nondeterministic
  99. message ResponseException {
  100. string error = 1;
  101. }
  102. message ResponseEcho {
  103. string message = 1;
  104. }
  105. message ResponseFlush {
  106. }
  107. message ResponseInfo {
  108. string data = 1;
  109. string version = 2;
  110. int64 last_block_height = 3;
  111. bytes last_block_app_hash = 4;
  112. }
  113. // nondeterministic
  114. message ResponseSetOption {
  115. uint32 code = 1;
  116. // bytes data = 2;
  117. string log = 3;
  118. string info = 4;
  119. }
  120. message ResponseInitChain {
  121. ConsensusParams consensus_params = 1;
  122. repeated Validator validators = 2 [(gogoproto.nullable)=false];
  123. }
  124. message ResponseQuery {
  125. uint32 code = 1;
  126. // bytes data = 2; // use "value" instead.
  127. string log = 3; // nondeterministic
  128. string info = 4; // nondeterministic
  129. int64 index = 5;
  130. bytes key = 6;
  131. bytes value = 7;
  132. bytes proof = 8;
  133. int64 height = 9;
  134. }
  135. message ResponseBeginBlock {
  136. repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  137. }
  138. message ResponseCheckTx {
  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. }
  147. message ResponseDeliverTx {
  148. uint32 code = 1;
  149. bytes data = 2;
  150. string log = 3; // nondeterministic
  151. string info = 4; // nondeterministic
  152. int64 gas_wanted = 5;
  153. int64 gas_used = 6;
  154. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  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 contains 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 contains 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. message LastCommitInfo {
  192. int32 commit_round = 1;
  193. repeated SigningValidator validators = 2 [(gogoproto.nullable)=false];
  194. }
  195. //----------------------------------------
  196. // Blockchain Types
  197. message Header {
  198. // basic block info
  199. string chain_id = 1 [(gogoproto.customname)="ChainID"];
  200. int64 height = 2;
  201. google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  202. int64 num_txs = 4;
  203. int64 total_txs = 5;
  204. // prev block info
  205. BlockID last_block_id = 6 [(gogoproto.nullable)=false];
  206. // hashes of block data
  207. bytes last_commit_hash = 7; // commit from validators from the last block
  208. bytes data_hash = 8; // transactions
  209. // hashes from the app output from the prev block
  210. bytes validators_hash = 9; // validators for the current block
  211. bytes consensus_hash = 10; // consensus params for current block
  212. bytes app_hash = 11; // state after txs from the previous block
  213. bytes last_results_hash = 12;// root hash of all results from the txs from the previous block
  214. // consensus info
  215. bytes evidence_hash = 13; // evidence included in the block
  216. bytes proposer_address = 14; // original proposer of the block
  217. }
  218. message BlockID {
  219. bytes hash = 1;
  220. PartSetHeader parts_header = 2 [(gogoproto.nullable)=false];
  221. }
  222. message PartSetHeader {
  223. int32 total = 1;
  224. bytes hash = 2;
  225. }
  226. // Validator
  227. message Validator {
  228. bytes address = 1;
  229. PubKey pub_key = 2 [(gogoproto.nullable)=false];
  230. int64 power = 3;
  231. }
  232. // Validator with an extra bool
  233. message SigningValidator {
  234. Validator validator = 1 [(gogoproto.nullable)=false];
  235. bool signed_last_block = 2;
  236. }
  237. message PubKey {
  238. string type = 1;
  239. bytes data = 2;
  240. }
  241. message Evidence {
  242. string type = 1;
  243. Validator validator = 2 [(gogoproto.nullable)=false];
  244. int64 height = 3;
  245. google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  246. int64 total_voting_power = 5;
  247. }
  248. //----------------------------------------
  249. // Service Definition
  250. service ABCIApplication {
  251. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  252. rpc Flush(RequestFlush) returns (ResponseFlush);
  253. rpc Info(RequestInfo) returns (ResponseInfo);
  254. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  255. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  256. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  257. rpc Query(RequestQuery) returns (ResponseQuery);
  258. rpc Commit(RequestCommit) returns (ResponseCommit);
  259. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  260. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  261. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  262. }