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.

335 lines
8.4 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 "github.com/tendermint/tendermint/crypto/merkle/merkle.proto";
  7. import "github.com/tendermint/tendermint/libs/common/types.proto";
  8. import "google/protobuf/timestamp.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. BlockParams block = 1;
  177. EvidenceParams evidence = 2;
  178. ValidatorParams validator = 3;
  179. }
  180. // BlockParams contains limits on the block size and timestamp.
  181. message BlockParams {
  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. // Note: must be greater than 0
  187. int64 time_iota_ms = 3;
  188. }
  189. // EvidenceParams contains limits on the evidence.
  190. message EvidenceParams {
  191. // Note: must be greater than 0
  192. int64 max_age = 1;
  193. }
  194. // ValidatorParams contains limits on validators.
  195. message ValidatorParams {
  196. repeated string pub_key_types = 1;
  197. }
  198. message LastCommitInfo {
  199. int32 round = 1;
  200. repeated VoteInfo votes = 2 [(gogoproto.nullable)=false];
  201. }
  202. //----------------------------------------
  203. // Blockchain Types
  204. message Header {
  205. // basic block info
  206. Version version = 1 [(gogoproto.nullable)=false];
  207. string chain_id = 2 [(gogoproto.customname)="ChainID"];
  208. int64 height = 3;
  209. google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  210. int64 num_txs = 5;
  211. int64 total_txs = 6;
  212. // prev block info
  213. BlockID last_block_id = 7 [(gogoproto.nullable)=false];
  214. // hashes of block data
  215. bytes last_commit_hash = 8; // commit from validators from the last block
  216. bytes data_hash = 9; // transactions
  217. // hashes from the app output from the prev block
  218. bytes validators_hash = 10; // validators for the current block
  219. bytes next_validators_hash = 11; // validators for the next block
  220. bytes consensus_hash = 12; // consensus params for current block
  221. bytes app_hash = 13; // state after txs from the previous block
  222. bytes last_results_hash = 14;// root hash of all results from the txs from the previous block
  223. // consensus info
  224. bytes evidence_hash = 15; // evidence included in the block
  225. bytes proposer_address = 16; // original proposer of the block
  226. }
  227. message Version {
  228. uint64 Block = 1;
  229. uint64 App = 2;
  230. }
  231. message BlockID {
  232. bytes hash = 1;
  233. PartSetHeader parts_header = 2 [(gogoproto.nullable)=false];
  234. }
  235. message PartSetHeader {
  236. int32 total = 1;
  237. bytes hash = 2;
  238. }
  239. // Validator
  240. message Validator {
  241. bytes address = 1;
  242. //PubKey pub_key = 2 [(gogoproto.nullable)=false];
  243. int64 power = 3;
  244. }
  245. // ValidatorUpdate
  246. message ValidatorUpdate {
  247. PubKey pub_key = 1 [(gogoproto.nullable)=false];
  248. int64 power = 2;
  249. }
  250. // VoteInfo
  251. message VoteInfo {
  252. Validator validator = 1 [(gogoproto.nullable)=false];
  253. bool signed_last_block = 2;
  254. }
  255. message PubKey {
  256. string type = 1;
  257. bytes data = 2;
  258. }
  259. message Evidence {
  260. string type = 1;
  261. Validator validator = 2 [(gogoproto.nullable)=false];
  262. int64 height = 3;
  263. google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  264. int64 total_voting_power = 5;
  265. }
  266. //----------------------------------------
  267. // Service Definition
  268. service ABCIApplication {
  269. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  270. rpc Flush(RequestFlush) returns (ResponseFlush);
  271. rpc Info(RequestInfo) returns (ResponseInfo);
  272. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  273. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  274. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  275. rpc Query(RequestQuery) returns (ResponseQuery);
  276. rpc Commit(RequestCommit) returns (ResponseCommit);
  277. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  278. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  279. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  280. }