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.9 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 ValidatorUpdate 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 ValidatorUpdate 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 ValidatorUpdate 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. EvidenceParams evidence_params = 2;
  172. }
  173. // BlockSize contains limits on the block size.
  174. message BlockSize {
  175. // Note: must be greater than 0
  176. int64 max_bytes = 1;
  177. // Note: must be greater or equal to -1
  178. int64 max_gas = 2;
  179. }
  180. // EvidenceParams contains limits on the evidence.
  181. message EvidenceParams {
  182. // Note: must be greater than 0
  183. int64 max_age = 1;
  184. }
  185. message LastCommitInfo {
  186. int32 round = 1;
  187. repeated VoteInfo votes = 2 [(gogoproto.nullable)=false];
  188. }
  189. //----------------------------------------
  190. // Blockchain Types
  191. message Header {
  192. // basic block info
  193. string chain_id = 1 [(gogoproto.customname)="ChainID"];
  194. int64 height = 2;
  195. google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  196. int64 num_txs = 4;
  197. int64 total_txs = 5;
  198. // prev block info
  199. BlockID last_block_id = 6 [(gogoproto.nullable)=false];
  200. // hashes of block data
  201. bytes last_commit_hash = 7; // commit from validators from the last block
  202. bytes data_hash = 8; // transactions
  203. // hashes from the app output from the prev block
  204. bytes validators_hash = 9; // validators for the current block
  205. bytes next_validators_hash = 10; // validators for the next block
  206. bytes consensus_hash = 11; // consensus params for current block
  207. bytes app_hash = 12; // state after txs from the previous block
  208. bytes last_results_hash = 13;// root hash of all results from the txs from the previous block
  209. // consensus info
  210. bytes evidence_hash = 14; // evidence included in the block
  211. bytes proposer_address = 15; // original proposer of the block
  212. }
  213. message BlockID {
  214. bytes hash = 1;
  215. PartSetHeader parts_header = 2 [(gogoproto.nullable)=false];
  216. }
  217. message PartSetHeader {
  218. int32 total = 1;
  219. bytes hash = 2;
  220. }
  221. // Validator
  222. message Validator {
  223. bytes address = 1;
  224. //PubKey pub_key = 2 [(gogoproto.nullable)=false];
  225. int64 power = 3;
  226. }
  227. // ValidatorUpdate
  228. message ValidatorUpdate {
  229. PubKey pub_key = 1 [(gogoproto.nullable)=false];
  230. int64 power = 2;
  231. }
  232. // VoteInfo
  233. message VoteInfo {
  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. }