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.

232 lines
4.8 KiB

  1. syntax = "proto3";
  2. package types;
  3. // This file is copied from http://github.com/tendermint/tmsp
  4. //----------------------------------------
  5. // Message types
  6. // Not being used
  7. // Could be added to request/response
  8. // so we don't have to type switch
  9. // (would be twice as fast, but we're talking about 15ns)
  10. enum MessageType {
  11. NullMessage = 0x00;
  12. Echo = 0x01;
  13. Flush = 0x02;
  14. Info = 0x03;
  15. SetOption = 0x04;
  16. Exception = 0x05;
  17. AppendTx = 0x11;
  18. CheckTx = 0x12;
  19. Commit = 0x13;
  20. Query = 0x14;
  21. InitChain = 0x15;
  22. BeginBlock = 0x16;
  23. EndBlock = 0x17;
  24. }
  25. //----------------------------------------
  26. // Code types
  27. enum CodeType {
  28. OK = 0;
  29. // General response codes, 0 ~ 99
  30. InternalError = 1;
  31. EncodingError = 2;
  32. BadNonce = 3;
  33. Unauthorized = 4;
  34. InsufficientFunds = 5;
  35. UnknownRequest = 6;
  36. // Reserved for basecoin, 100 ~ 199
  37. BaseDuplicateAddress = 101;
  38. BaseEncodingError = 102;
  39. BaseInsufficientFees = 103;
  40. BaseInsufficientFunds = 104;
  41. BaseInsufficientGasPrice = 105;
  42. BaseInvalidInput = 106;
  43. BaseInvalidOutput = 107;
  44. BaseInvalidPubKey = 108;
  45. BaseInvalidSequence = 109;
  46. BaseInvalidSignature = 110;
  47. BaseUnknownAddress = 111;
  48. BaseUnknownPubKey = 112;
  49. BaseUnknownPlugin = 113;
  50. // Reserved for governance, 200 ~ 299
  51. GovUnknownEntity = 201;
  52. GovUnknownGroup = 202;
  53. GovUnknownProposal = 203;
  54. GovDuplicateGroup = 204;
  55. GovDuplicateMember = 205;
  56. GovDuplicateProposal = 206;
  57. GovDuplicateVote = 207;
  58. GovInvalidMember = 208;
  59. GovInvalidVote = 209;
  60. GovInvalidVotingPower = 210;
  61. }
  62. //----------------------------------------
  63. // Request types
  64. message Request {
  65. oneof value{
  66. RequestEcho echo = 1;
  67. RequestFlush flush = 2;
  68. RequestInfo info = 3;
  69. RequestSetOption set_option = 4;
  70. RequestAppendTx append_tx = 5;
  71. RequestCheckTx check_tx = 6;
  72. RequestCommit commit = 7;
  73. RequestQuery query = 8;
  74. RequestInitChain init_chain = 9;
  75. RequestBeginBlock begin_block = 10;
  76. RequestEndBlock end_block = 11;
  77. }
  78. }
  79. message RequestEcho {
  80. string message = 1;
  81. }
  82. message RequestFlush {
  83. }
  84. message RequestInfo {
  85. }
  86. message RequestSetOption{
  87. string key = 1;
  88. string value = 2;
  89. }
  90. message RequestAppendTx{
  91. bytes tx = 1;
  92. }
  93. message RequestCheckTx{
  94. bytes tx = 1;
  95. }
  96. message RequestQuery{
  97. bytes query = 1;
  98. }
  99. message RequestCommit{
  100. }
  101. message RequestInitChain{
  102. repeated Validator validators = 1;
  103. }
  104. message RequestBeginBlock{
  105. uint64 height = 1;
  106. }
  107. message RequestEndBlock{
  108. uint64 height = 1;
  109. }
  110. //----------------------------------------
  111. // Response types
  112. message Response {
  113. oneof value{
  114. ResponseException exception = 1;
  115. ResponseEcho echo = 2;
  116. ResponseFlush flush = 3;
  117. ResponseInfo info = 4;
  118. ResponseSetOption set_option = 5;
  119. ResponseAppendTx append_tx = 6;
  120. ResponseCheckTx check_tx = 7;
  121. ResponseCommit commit = 8;
  122. ResponseQuery query = 9;
  123. ResponseInitChain init_chain = 10;
  124. ResponseBeginBlock begin_block = 11;
  125. ResponseEndBlock end_block = 12;
  126. }
  127. }
  128. message ResponseException{
  129. string error = 1;
  130. }
  131. message ResponseEcho {
  132. string message = 1;
  133. }
  134. message ResponseFlush{
  135. }
  136. message ResponseInfo {
  137. string info = 1;
  138. }
  139. message ResponseSetOption{
  140. string log = 1;
  141. }
  142. message ResponseAppendTx{
  143. CodeType code = 1;
  144. bytes data = 2;
  145. string log = 3;
  146. }
  147. message ResponseCheckTx{
  148. CodeType code = 1;
  149. bytes data = 2;
  150. string log = 3;
  151. }
  152. message ResponseQuery{
  153. CodeType code = 1;
  154. bytes data = 2;
  155. string log = 3;
  156. }
  157. message ResponseCommit{
  158. CodeType code = 1;
  159. bytes data = 2;
  160. string log = 3;
  161. }
  162. message ResponseInitChain{
  163. }
  164. message ResponseBeginBlock{
  165. }
  166. message ResponseEndBlock{
  167. repeated Validator diffs = 4;
  168. }
  169. //----------------------------------------
  170. // Misc types
  171. message Validator {
  172. bytes pubKey = 1;
  173. uint64 power = 2;
  174. }
  175. //----------------------------------------
  176. // Service Definition
  177. service TMSPApplication {
  178. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  179. rpc Flush(RequestFlush) returns (ResponseFlush);
  180. rpc Info(RequestInfo) returns (ResponseInfo);
  181. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  182. rpc AppendTx(RequestAppendTx) returns (ResponseAppendTx);
  183. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  184. rpc Query(RequestQuery) returns (ResponseQuery);
  185. rpc Commit(RequestCommit) returns (ResponseCommit);
  186. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  187. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  188. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  189. }