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.

316 lines
8.0 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. string codespace = 10;
  136. }
  137. message ResponseBeginBlock {
  138. repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  139. }
  140. message ResponseCheckTx {
  141. uint32 code = 1;
  142. bytes data = 2;
  143. string log = 3; // nondeterministic
  144. string info = 4; // nondeterministic
  145. int64 gas_wanted = 5;
  146. int64 gas_used = 6;
  147. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  148. string codespace = 8;
  149. }
  150. message ResponseDeliverTx {
  151. uint32 code = 1;
  152. bytes data = 2;
  153. string log = 3; // nondeterministic
  154. string info = 4; // nondeterministic
  155. int64 gas_wanted = 5;
  156. int64 gas_used = 6;
  157. repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  158. string codespace = 8;
  159. }
  160. message ResponseEndBlock {
  161. repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false];
  162. ConsensusParams consensus_param_updates = 2;
  163. repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
  164. }
  165. message ResponseCommit {
  166. // reserve 1
  167. bytes data = 2;
  168. }
  169. //----------------------------------------
  170. // Misc.
  171. // ConsensusParams contains all consensus-relevant parameters
  172. // that can be adjusted by the abci app
  173. message ConsensusParams {
  174. BlockSize block_size = 1;
  175. EvidenceParams evidence_params = 2;
  176. }
  177. // BlockSize contains limits on the block size.
  178. message BlockSize {
  179. // Note: must be greater than 0
  180. int64 max_bytes = 1;
  181. // Note: must be greater or equal to -1
  182. int64 max_gas = 2;
  183. }
  184. // EvidenceParams contains limits on the evidence.
  185. message EvidenceParams {
  186. // Note: must be greater than 0
  187. int64 max_age = 1;
  188. }
  189. message LastCommitInfo {
  190. int32 round = 1;
  191. repeated VoteInfo votes = 2 [(gogoproto.nullable)=false];
  192. }
  193. //----------------------------------------
  194. // Blockchain Types
  195. message Header {
  196. // basic block info
  197. string chain_id = 1 [(gogoproto.customname)="ChainID"];
  198. int64 height = 2;
  199. google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  200. int64 num_txs = 4;
  201. int64 total_txs = 5;
  202. // prev block info
  203. BlockID last_block_id = 6 [(gogoproto.nullable)=false];
  204. // hashes of block data
  205. bytes last_commit_hash = 7; // commit from validators from the last block
  206. bytes data_hash = 8; // transactions
  207. // hashes from the app output from the prev block
  208. bytes validators_hash = 9; // validators for the current block
  209. bytes next_validators_hash = 10; // validators for the next block
  210. bytes consensus_hash = 11; // consensus params for current block
  211. bytes app_hash = 12; // state after txs from the previous block
  212. bytes last_results_hash = 13;// root hash of all results from the txs from the previous block
  213. // consensus info
  214. bytes evidence_hash = 14; // evidence included in the block
  215. bytes proposer_address = 15; // original proposer of the block
  216. }
  217. message BlockID {
  218. bytes hash = 1;
  219. PartSetHeader parts_header = 2 [(gogoproto.nullable)=false];
  220. }
  221. message PartSetHeader {
  222. int32 total = 1;
  223. bytes hash = 2;
  224. }
  225. // Validator
  226. message Validator {
  227. bytes address = 1;
  228. //PubKey pub_key = 2 [(gogoproto.nullable)=false];
  229. int64 power = 3;
  230. }
  231. // ValidatorUpdate
  232. message ValidatorUpdate {
  233. PubKey pub_key = 1 [(gogoproto.nullable)=false];
  234. int64 power = 2;
  235. }
  236. // VoteInfo
  237. message VoteInfo {
  238. Validator validator = 1 [(gogoproto.nullable)=false];
  239. bool signed_last_block = 2;
  240. }
  241. message PubKey {
  242. string type = 1;
  243. bytes data = 2;
  244. }
  245. message Evidence {
  246. string type = 1;
  247. Validator validator = 2 [(gogoproto.nullable)=false];
  248. int64 height = 3;
  249. google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  250. int64 total_voting_power = 5;
  251. }
  252. //----------------------------------------
  253. // Service Definition
  254. service ABCIApplication {
  255. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  256. rpc Flush(RequestFlush) returns (ResponseFlush);
  257. rpc Info(RequestInfo) returns (ResponseInfo);
  258. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  259. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  260. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  261. rpc Query(RequestQuery) returns (ResponseQuery);
  262. rpc Commit(RequestCommit) returns (ResponseCommit);
  263. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  264. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  265. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  266. }