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.

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