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.

369 lines
12 KiB

  1. syntax = "proto3";
  2. package tendermint.abci;
  3. option go_package = "github.com/tendermint/tendermint/abci/types";
  4. // For more information on gogo.proto, see:
  5. // https://github.com/gogo/protobuf/blob/master/extensions.md
  6. import "tendermint/crypto/proof.proto";
  7. import "tendermint/types/types.proto";
  8. import "tendermint/crypto/keys.proto";
  9. import "tendermint/types/params.proto";
  10. import "google/protobuf/timestamp.proto";
  11. import "gogoproto/gogo.proto";
  12. // This file is copied from http://github.com/tendermint/abci
  13. // NOTE: When using custom types, mind the warnings.
  14. // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
  15. //----------------------------------------
  16. // Request types
  17. message Request {
  18. oneof value {
  19. RequestEcho echo = 1;
  20. RequestFlush flush = 2;
  21. RequestInfo info = 3;
  22. RequestInitChain init_chain = 4;
  23. RequestQuery query = 5;
  24. RequestBeginBlock begin_block = 6;
  25. RequestCheckTx check_tx = 7;
  26. RequestDeliverTx deliver_tx = 8;
  27. RequestEndBlock end_block = 9;
  28. RequestCommit commit = 10;
  29. RequestListSnapshots list_snapshots = 11;
  30. RequestOfferSnapshot offer_snapshot = 12;
  31. RequestLoadSnapshotChunk load_snapshot_chunk = 13;
  32. RequestApplySnapshotChunk apply_snapshot_chunk = 14;
  33. }
  34. }
  35. message RequestEcho {
  36. string message = 1;
  37. }
  38. message RequestFlush {}
  39. message RequestInfo {
  40. string version = 1;
  41. uint64 block_version = 2;
  42. uint64 p2p_version = 3;
  43. string abci_version = 4;
  44. }
  45. message RequestInitChain {
  46. google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  47. string chain_id = 2;
  48. tendermint.types.ConsensusParams consensus_params = 3;
  49. repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false];
  50. bytes app_state_bytes = 5;
  51. int64 initial_height = 6;
  52. }
  53. message RequestQuery {
  54. bytes data = 1;
  55. string path = 2;
  56. int64 height = 3;
  57. bool prove = 4;
  58. }
  59. message RequestBeginBlock {
  60. bytes hash = 1;
  61. tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
  62. LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false];
  63. repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false];
  64. }
  65. enum CheckTxType {
  66. NEW = 0 [(gogoproto.enumvalue_customname) = "New"];
  67. RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"];
  68. }
  69. message RequestCheckTx {
  70. bytes tx = 1;
  71. CheckTxType type = 2;
  72. }
  73. message RequestDeliverTx {
  74. bytes tx = 1;
  75. }
  76. message RequestEndBlock {
  77. int64 height = 1;
  78. }
  79. message RequestCommit {}
  80. // lists available snapshots
  81. message RequestListSnapshots {}
  82. // offers a snapshot to the application
  83. message RequestOfferSnapshot {
  84. Snapshot snapshot = 1; // snapshot offered by peers
  85. bytes app_hash = 2; // light client-verified app hash for snapshot height
  86. }
  87. // loads a snapshot chunk
  88. message RequestLoadSnapshotChunk {
  89. uint64 height = 1;
  90. uint32 format = 2;
  91. uint32 chunk = 3;
  92. }
  93. // Applies a snapshot chunk
  94. message RequestApplySnapshotChunk {
  95. uint32 index = 1;
  96. bytes chunk = 2;
  97. string sender = 3;
  98. }
  99. //----------------------------------------
  100. // Response types
  101. message Response {
  102. oneof value {
  103. ResponseException exception = 1;
  104. ResponseEcho echo = 2;
  105. ResponseFlush flush = 3;
  106. ResponseInfo info = 4;
  107. ResponseInitChain init_chain = 5;
  108. ResponseQuery query = 6;
  109. ResponseBeginBlock begin_block = 7;
  110. ResponseCheckTx check_tx = 8;
  111. ResponseDeliverTx deliver_tx = 9;
  112. ResponseEndBlock end_block = 10;
  113. ResponseCommit commit = 11;
  114. ResponseListSnapshots list_snapshots = 12;
  115. ResponseOfferSnapshot offer_snapshot = 13;
  116. ResponseLoadSnapshotChunk load_snapshot_chunk = 14;
  117. ResponseApplySnapshotChunk apply_snapshot_chunk = 15;
  118. }
  119. }
  120. // nondeterministic
  121. message ResponseException {
  122. string error = 1;
  123. }
  124. message ResponseEcho {
  125. string message = 1;
  126. }
  127. message ResponseFlush {}
  128. message ResponseInfo {
  129. string data = 1;
  130. // this is the software version of the application. TODO: remove?
  131. string version = 2;
  132. uint64 app_version = 3;
  133. int64 last_block_height = 4;
  134. bytes last_block_app_hash = 5;
  135. }
  136. message ResponseInitChain {
  137. tendermint.types.ConsensusParams consensus_params = 1;
  138. repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false];
  139. bytes app_hash = 3;
  140. }
  141. message ResponseQuery {
  142. uint32 code = 1;
  143. // bytes data = 2; // use "value" instead.
  144. string log = 3; // nondeterministic
  145. string info = 4; // nondeterministic
  146. int64 index = 5;
  147. bytes key = 6;
  148. bytes value = 7;
  149. tendermint.crypto.ProofOps proof_ops = 8;
  150. int64 height = 9;
  151. string codespace = 10;
  152. }
  153. message ResponseBeginBlock {
  154. repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
  155. }
  156. message ResponseCheckTx {
  157. uint32 code = 1;
  158. bytes data = 2;
  159. string log = 3; // nondeterministic
  160. string info = 4; // nondeterministic
  161. int64 gas_wanted = 5 [json_name = "gas_wanted"];
  162. int64 gas_used = 6 [json_name = "gas_used"];
  163. repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
  164. string codespace = 8;
  165. string sender = 9;
  166. int64 priority = 10;
  167. // mempool_error is set by Tendermint.
  168. // ABCI applications creating a ResponseCheckTX should not set mempool_error.
  169. string mempool_error = 11;
  170. }
  171. message ResponseDeliverTx {
  172. uint32 code = 1;
  173. bytes data = 2;
  174. string log = 3; // nondeterministic
  175. string info = 4; // nondeterministic
  176. int64 gas_wanted = 5 [json_name = "gas_wanted"];
  177. int64 gas_used = 6 [json_name = "gas_used"];
  178. repeated Event events = 7
  179. [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic
  180. string codespace = 8;
  181. }
  182. message ResponseEndBlock {
  183. repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false];
  184. tendermint.types.ConsensusParams consensus_param_updates = 2;
  185. repeated Event events = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
  186. }
  187. message ResponseCommit {
  188. // reserve 1
  189. bytes data = 2;
  190. int64 retain_height = 3;
  191. }
  192. message ResponseListSnapshots {
  193. repeated Snapshot snapshots = 1;
  194. }
  195. message ResponseOfferSnapshot {
  196. Result result = 1;
  197. enum Result {
  198. UNKNOWN = 0; // Unknown result, abort all snapshot restoration
  199. ACCEPT = 1; // Snapshot accepted, apply chunks
  200. ABORT = 2; // Abort all snapshot restoration
  201. REJECT = 3; // Reject this specific snapshot, try others
  202. REJECT_FORMAT = 4; // Reject all snapshots of this format, try others
  203. REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others
  204. }
  205. }
  206. message ResponseLoadSnapshotChunk {
  207. bytes chunk = 1;
  208. }
  209. message ResponseApplySnapshotChunk {
  210. Result result = 1;
  211. repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply
  212. repeated string reject_senders = 3; // Chunk senders to reject and ban
  213. enum Result {
  214. UNKNOWN = 0; // Unknown result, abort all snapshot restoration
  215. ACCEPT = 1; // Chunk successfully accepted
  216. ABORT = 2; // Abort all snapshot restoration
  217. RETRY = 3; // Retry chunk (combine with refetch and reject)
  218. RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject)
  219. REJECT_SNAPSHOT = 5; // Reject this snapshot, try others
  220. }
  221. }
  222. //----------------------------------------
  223. // Misc.
  224. message LastCommitInfo {
  225. int32 round = 1;
  226. repeated VoteInfo votes = 2 [(gogoproto.nullable) = false];
  227. }
  228. // Event allows application developers to attach additional information to
  229. // ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx.
  230. // Later, transactions may be queried using these events.
  231. message Event {
  232. string type = 1;
  233. repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"];
  234. }
  235. // EventAttribute is a single key-value pair, associated with an event.
  236. message EventAttribute {
  237. string key = 1;
  238. string value = 2;
  239. bool index = 3; // nondeterministic
  240. }
  241. // TxResult contains results of executing the transaction.
  242. //
  243. // One usage is indexing transaction results.
  244. message TxResult {
  245. int64 height = 1;
  246. uint32 index = 2;
  247. bytes tx = 3;
  248. ResponseDeliverTx result = 4 [(gogoproto.nullable) = false];
  249. }
  250. //----------------------------------------
  251. // Blockchain Types
  252. // Validator
  253. message Validator {
  254. bytes address = 1; // The first 20 bytes of SHA256(public key)
  255. // PubKey pub_key = 2 [(gogoproto.nullable)=false];
  256. int64 power = 3; // The voting power
  257. }
  258. // ValidatorUpdate
  259. message ValidatorUpdate {
  260. tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false];
  261. int64 power = 2;
  262. }
  263. // VoteInfo
  264. message VoteInfo {
  265. Validator validator = 1 [(gogoproto.nullable) = false];
  266. bool signed_last_block = 2;
  267. }
  268. enum EvidenceType {
  269. UNKNOWN = 0;
  270. DUPLICATE_VOTE = 1;
  271. LIGHT_CLIENT_ATTACK = 2;
  272. }
  273. message Evidence {
  274. EvidenceType type = 1;
  275. // The offending validator
  276. Validator validator = 2 [(gogoproto.nullable) = false];
  277. // The height when the offense occurred
  278. int64 height = 3;
  279. // The corresponding time where the offense occurred
  280. google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  281. // Total voting power of the validator set in case the ABCI application does
  282. // not store historical validators.
  283. // https://github.com/tendermint/tendermint/issues/4581
  284. int64 total_voting_power = 5;
  285. }
  286. //----------------------------------------
  287. // State Sync Types
  288. message Snapshot {
  289. uint64 height = 1; // The height at which the snapshot was taken
  290. uint32 format = 2; // The application-specific snapshot format
  291. uint32 chunks = 3; // Number of chunks in the snapshot
  292. bytes hash = 4; // Arbitrary snapshot hash, equal only if identical
  293. bytes metadata = 5; // Arbitrary application metadata
  294. }
  295. //----------------------------------------
  296. // Service Definition
  297. service ABCIApplication {
  298. rpc Echo(RequestEcho) returns (ResponseEcho);
  299. rpc Flush(RequestFlush) returns (ResponseFlush);
  300. rpc Info(RequestInfo) returns (ResponseInfo);
  301. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  302. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  303. rpc Query(RequestQuery) returns (ResponseQuery);
  304. rpc Commit(RequestCommit) returns (ResponseCommit);
  305. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  306. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  307. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  308. rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots);
  309. rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot);
  310. rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk);
  311. rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk);
  312. }