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.

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