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.

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