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.

328 lines
8.2 KiB

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