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.

878 lines
70 KiB

  1. ---
  2. order: 2
  3. title: Methods
  4. ---
  5. # Methods
  6. ## Methods existing in ABCI
  7. ### Echo
  8. * **Request**:
  9. * `Message (string)`: A string to echo back
  10. * **Response**:
  11. * `Message (string)`: The input string
  12. * **Usage**:
  13. * Echo a string to test an abci client/server implementation
  14. ### Flush
  15. * **Usage**:
  16. * Signals that messages queued on the client should be flushed to
  17. the server. It is called periodically by the client
  18. implementation to ensure asynchronous requests are actually
  19. sent, and is called immediately to make a synchronous request,
  20. which returns when the Flush response comes back.
  21. ### Info
  22. * **Request**:
  23. | Name | Type | Description | Field Number |
  24. |---------------|--------|------------------------------------------|--------------|
  25. | version | string | The Tendermint software semantic version | 1 |
  26. | block_version | uint64 | The Tendermint Block Protocol version | 2 |
  27. | p2p_version | uint64 | The Tendermint P2P Protocol version | 3 |
  28. | abci_version | string | The Tendermint ABCI semantic version | 4 |
  29. * **Response**:
  30. | Name | Type | Description | Field Number |
  31. |---------------------|--------|--------------------------------------------------|--------------|
  32. | data | string | Some arbitrary information | 1 |
  33. | version | string | The application software semantic version | 2 |
  34. | app_version | uint64 | The application protocol version | 3 |
  35. | last_block_height | int64 | Latest block for which the app has called Commit | 4 |
  36. | last_block_app_hash | bytes | Latest result of Commit | 5 |
  37. * **Usage**:
  38. * Return information about the application state.
  39. * Used to sync Tendermint with the application during a handshake
  40. that happens on startup.
  41. * The returned `app_version` will be included in the Header of every block.
  42. * Tendermint expects `last_block_app_hash` and `last_block_height` to
  43. be updated during `Commit`, ensuring that `Commit` is never
  44. called twice for the same block height.
  45. > Note: Semantic version is a reference to [semantic versioning](https://semver.org/). Semantic versions in info will be displayed as X.X.x.
  46. ### InitChain
  47. * **Request**:
  48. | Name | Type | Description | Field Number |
  49. |------------------|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|--------------|
  50. | time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Genesis time | 1 |
  51. | chain_id | string | ID of the blockchain. | 2 |
  52. | consensus_params | [ConsensusParams](#consensusparams) | Initial consensus-critical parameters. | 3 |
  53. | validators | repeated [ValidatorUpdate](#validatorupdate) | Initial genesis validators, sorted by voting power. | 4 |
  54. | app_state_bytes | bytes | Serialized initial application state. JSON bytes. | 5 |
  55. | initial_height | int64 | Height of the initial block (typically `1`). | 6 |
  56. * **Response**:
  57. | Name | Type | Description | Field Number |
  58. |------------------|----------------------------------------------|-------------------------------------------------|--------------|
  59. | consensus_params | [ConsensusParams](#consensusparams) | Initial consensus-critical parameters (optional) | 1 |
  60. | validators | repeated [ValidatorUpdate](#validatorupdate) | Initial validator set (optional). | 2 |
  61. | app_hash | bytes | Initial application hash. | 3 |
  62. * **Usage**:
  63. * Called once upon genesis.
  64. * If ResponseInitChain.Validators is empty, the initial validator set will be the RequestInitChain.Validators
  65. * If ResponseInitChain.Validators is not empty, it will be the initial
  66. validator set (regardless of what is in RequestInitChain.Validators).
  67. * This allows the app to decide if it wants to accept the initial validator
  68. set proposed by tendermint (ie. in the genesis file), or if it wants to use
  69. a different one (perhaps computed based on some application specific
  70. information in the genesis file).
  71. ### Query
  72. * **Request**:
  73. | Name | Type | Description | Field Number |
  74. |--------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  75. | data | bytes | Raw query bytes. Can be used with or in lieu of Path. | 1 |
  76. | path | string | Path field of the request URI. Can be used with or in lieu of `data`. Apps MUST interpret `/store` as a query by key on the underlying store. The key SHOULD be specified in the `data` field. Apps SHOULD allow queries over specific types like `/accounts/...` or `/votes/...` | 2 |
  77. | height | int64 | The block height for which you want the query (default=0 returns data for the latest committed block). Note that this is the height of the block containing the application's Merkle root hash, which represents the state as it was after committing the block at Height-1 | 3 |
  78. | prove | bool | Return Merkle proof with response if possible | 4 |
  79. * **Response**:
  80. | Name | Type | Description | Field Number |
  81. |-----------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  82. | code | uint32 | Response code. | 1 |
  83. | log | string | The output of the application's logger. **May be non-deterministic.** | 3 |
  84. | info | string | Additional information. **May be non-deterministic.** | 4 |
  85. | index | int64 | The index of the key in the tree. | 5 |
  86. | key | bytes | The key of the matching data. | 6 |
  87. | value | bytes | The value of the matching data. | 7 |
  88. | proof_ops | [ProofOps](#proofops) | Serialized proof for the value data, if requested, to be verified against the `app_hash` for the given Height. | 8 |
  89. | height | int64 | The block height from which data was derived. Note that this is the height of the block containing the application's Merkle root hash, which represents the state as it was after committing the block at Height-1 | 9 |
  90. | codespace | string | Namespace for the `code`. | 10 |
  91. * **Usage**:
  92. * Query for data from the application at current or past height.
  93. * Optionally return Merkle proof.
  94. * Merkle proof includes self-describing `type` field to support many types
  95. of Merkle trees and encoding formats.
  96. ### CheckTx
  97. * **Request**:
  98. | Name | Type | Description | Field Number |
  99. |------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  100. | tx | bytes | The request transaction bytes | 1 |
  101. | type | CheckTxType | One of `CheckTx_New` or `CheckTx_Recheck`. `CheckTx_New` is the default and means that a full check of the tranasaction is required. `CheckTx_Recheck` types are used when the mempool is initiating a normal recheck of a transaction. | 2 |
  102. * **Response**:
  103. | Name | Type | Description | Field Number |
  104. |------------|-------------------------------------------------------------|-----------------------------------------------------------------------|--------------|
  105. | code | uint32 | Response code. | 1 |
  106. | data | bytes | Result bytes, if any. | 2 |
  107. | log | string | The output of the application's logger. **May be non-deterministic.** | 3 |
  108. | info | string | Additional information. **May be non-deterministic.** | 4 |
  109. | gas_wanted | int64 | Amount of gas requested for transaction. | 5 |
  110. | gas_used | int64 | Amount of gas consumed by transaction. | 6 |
  111. | events | repeated [Event](abci++_basic_concepts_002_draft.md#events) | Type & Key-Value events for indexing transactions (eg. by account). | 7 |
  112. | codespace | string | Namespace for the `code`. | 8 |
  113. | sender | string | The transaction's sender (e.g. the signer) | 9 |
  114. | priority | int64 | The transaction's priority (for mempool ordering) | 10 |
  115. * **Usage**:
  116. * Technically optional - not involved in processing blocks.
  117. * Guardian of the mempool: every node runs `CheckTx` before letting a
  118. transaction into its local mempool.
  119. * The transaction may come from an external user or another node
  120. * `CheckTx` validates the transaction against the current state of the application,
  121. for example, checking signatures and account balances, but does not apply any
  122. of the state changes described in the transaction.
  123. not running code in a virtual machine.
  124. * Transactions where `ResponseCheckTx.Code != 0` will be rejected - they will not be broadcast to
  125. other nodes or included in a proposal block.
  126. * Tendermint attributes no other value to the response code
  127. ### ListSnapshots
  128. * **Request**:
  129. | Name | Type | Description | Field Number |
  130. |--------|-------|------------------------------------|--------------|
  131. Empty request asking the application for a list of snapshots.
  132. * **Response**:
  133. | Name | Type | Description | Field Number |
  134. |-----------|--------------------------------|--------------------------------|--------------|
  135. | snapshots | repeated [Snapshot](#snapshot) | List of local state snapshots. | 1 |
  136. * **Usage**:
  137. * Used during state sync to discover available snapshots on peers.
  138. * See `Snapshot` data type for details.
  139. ### LoadSnapshotChunk
  140. * **Request**:
  141. | Name | Type | Description | Field Number |
  142. |--------|--------|-----------------------------------------------------------------------|--------------|
  143. | height | uint64 | The height of the snapshot the chunk belongs to. | 1 |
  144. | format | uint32 | The application-specific format of the snapshot the chunk belongs to. | 2 |
  145. | chunk | uint32 | The chunk index, starting from `0` for the initial chunk. | 3 |
  146. * **Response**:
  147. | Name | Type | Description | Field Number |
  148. |-------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  149. | chunk | bytes | The binary chunk contents, in an arbitray format. Chunk messages cannot be larger than 16 MB _including metadata_, so 10 MB is a good starting point. | 1 |
  150. * **Usage**:
  151. * Used during state sync to retrieve snapshot chunks from peers.
  152. ### OfferSnapshot
  153. * **Request**:
  154. | Name | Type | Description | Field Number |
  155. |----------|-----------------------|--------------------------------------------------------------------------|--------------|
  156. | snapshot | [Snapshot](#snapshot) | The snapshot offered for restoration. | 1 |
  157. | app_hash | bytes | The light client-verified app hash for this height, from the blockchain. | 2 |
  158. * **Response**:
  159. | Name | Type | Description | Field Number |
  160. |--------|-------------------|-----------------------------------|--------------|
  161. | result | [Result](#result) | The result of the snapshot offer. | 1 |
  162. #### Result
  163. ```protobuf
  164. enum Result {
  165. UNKNOWN = 0; // Unknown result, abort all snapshot restoration
  166. ACCEPT = 1; // Snapshot is accepted, start applying chunks.
  167. ABORT = 2; // Abort snapshot restoration, and don't try any other snapshots.
  168. REJECT = 3; // Reject this specific snapshot, try others.
  169. REJECT_FORMAT = 4; // Reject all snapshots with this `format`, try others.
  170. REJECT_SENDER = 5; // Reject all snapshots from all senders of this snapshot, try others.
  171. }
  172. ```
  173. * **Usage**:
  174. * `OfferSnapshot` is called when bootstrapping a node using state sync. The application may
  175. accept or reject snapshots as appropriate. Upon accepting, Tendermint will retrieve and
  176. apply snapshot chunks via `ApplySnapshotChunk`. The application may also choose to reject a
  177. snapshot in the chunk response, in which case it should be prepared to accept further
  178. `OfferSnapshot` calls.
  179. * Only `AppHash` can be trusted, as it has been verified by the light client. Any other data
  180. can be spoofed by adversaries, so applications should employ additional verification schemes
  181. to avoid denial-of-service attacks. The verified `AppHash` is automatically checked against
  182. the restored application at the end of snapshot restoration.
  183. * For more information, see the `Snapshot` data type or the [state sync section](../p2p/messages/state-sync.md).
  184. ### ApplySnapshotChunk
  185. * **Request**:
  186. | Name | Type | Description | Field Number |
  187. |--------|--------|-----------------------------------------------------------------------------|--------------|
  188. | index | uint32 | The chunk index, starting from `0`. Tendermint applies chunks sequentially. | 1 |
  189. | chunk | bytes | The binary chunk contents, as returned by `LoadSnapshotChunk`. | 2 |
  190. | sender | string | The P2P ID of the node who sent this chunk. | 3 |
  191. * **Response**:
  192. | Name | Type | Description | Field Number |
  193. |----------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  194. | result | Result (see below) | The result of applying this chunk. | 1 |
  195. | refetch_chunks | repeated uint32 | Refetch and reapply the given chunks, regardless of `result`. Only the listed chunks will be refetched, and reapplied in sequential order. | 2 |
  196. | reject_senders | repeated string | Reject the given P2P senders, regardless of `Result`. Any chunks already applied will not be refetched unless explicitly requested, but queued chunks from these senders will be discarded, and new chunks or other snapshots rejected. | 3 |
  197. ```proto
  198. enum Result {
  199. UNKNOWN = 0; // Unknown result, abort all snapshot restoration
  200. ACCEPT = 1; // The chunk was accepted.
  201. ABORT = 2; // Abort snapshot restoration, and don't try any other snapshots.
  202. RETRY = 3; // Reapply this chunk, combine with `RefetchChunks` and `RejectSenders` as appropriate.
  203. RETRY_SNAPSHOT = 4; // Restart this snapshot from `OfferSnapshot`, reusing chunks unless instructed otherwise.
  204. REJECT_SNAPSHOT = 5; // Reject this snapshot, try a different one.
  205. }
  206. ```
  207. * **Usage**:
  208. * The application can choose to refetch chunks and/or ban P2P peers as appropriate. Tendermint
  209. will not do this unless instructed by the application.
  210. * The application may want to verify each chunk, e.g. by attaching chunk hashes in
  211. `Snapshot.Metadata` and/or incrementally verifying contents against `AppHash`.
  212. * When all chunks have been accepted, Tendermint will make an ABCI `Info` call to verify that
  213. `LastBlockAppHash` and `LastBlockHeight` matches the expected values, and record the
  214. `AppVersion` in the node state. It then switches to fast sync or consensus and joins the
  215. network.
  216. * If Tendermint is unable to retrieve the next chunk after some time (e.g. because no suitable
  217. peers are available), it will reject the snapshot and try a different one via `OfferSnapshot`.
  218. The application should be prepared to reset and accept it or abort as appropriate.
  219. ## New methods introduced in ABCI++
  220. ### PrepareProposal
  221. #### Parameters and Types
  222. * **Request**:
  223. | Name | Type | Description | Field Number |
  224. |-------------------------|---------------------------------------------|------------------------------------------------------------------------------------------------------------------|--------------|
  225. | hash | bytes | The block header's hash of the block to propose. Present for convenience (can be derived from the block header). | 1 |
  226. | header | [Header](../core/data_structures.md#header) | The header of the block to propose. | 2 |
  227. | txs | repeated bytes | Preliminary list of transactions that have been picked as part of the block to propose. | 3 |
  228. | last_commit_info | [LastCommitInfo](#lastcommitinfo) | Info about the last commit, including the round, the validator list, and which ones signed the last block. | 4 |
  229. | byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
  230. | max_tx_bytes | int64 | Currently configured maximum size in bytes taken by the modified transactions. | 6 |
  231. >**TODO**: Add the changes needed in LastCommitInfo for vote extensions
  232. >**TODO**: DISCUSS: We need to make clear whether a proposer is also running the logic of a non-proposer node (in particular "ProcessProposal")
  233. From the App's perspective, they'll probably skip ProcessProposal
  234. * **Response**:
  235. | Name | Type | Description | Field Number |
  236. |-------------------------|--------------------------------------------------|---------------------------------------------------------------------------------------------|--------------|
  237. | modified_tx | bool | The Application sets it to true to denote it made changes to transactions | 1 |
  238. | tx_records | repeated [TxRecord](#txrecord) | Possibly modified list of transactions that have been picked as part of the proposed block. | 2 |
  239. | app_hash | bytes | The Merkle root hash of the application state. | 3 |
  240. | tx_results | repeated [ExecTxResult](#txresult) | List of structures containing the data resulting from executing the transactions | 4 |
  241. | validator_updates | repeated [ValidatorUpdate](#validatorupdate) | Changes to validator set (set voting power to 0 to remove). | 5 |
  242. | consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 6 |
  243. | app_signed_updates | repeated bytes | Optional changes to the *app_signed* part of vote extensions. | 7 |
  244. * **Usage**:
  245. * Contains a preliminary block to be proposed, called _raw block_, which the Application can modify.
  246. * The first five parameters of `RequestPrepareProposal` are the same as `RequestProcessProposal`
  247. and `RequestFinalizeBlock`.
  248. * The header contains the height, timestamp, and more - it exactly matches the
  249. Tendermint block header.
  250. * The Application can modify the transactions received in `RequestPrepareProposal` before sending
  251. them in `ResponsePrepareProposal`. In that case, `ResponsePrepareProposal.modified_tx` is set to true.
  252. * If `ResponsePrepareProposal.modified_tx` is false, then Tendermint will ignore the contents of
  253. `ResponsePrepareProposal.tx_records`.
  254. * If the Application modifies the transactions, the modified transactions MUST NOT exceed the configured maximum size,
  255. contained in `RequestPrepareProposal.max_tx_bytes`.
  256. * If the Application modifies the *app_signed* part of vote extensions via `ResponsePrepareProposal.app_signed_updates`,
  257. the new total size of those extensions cannot exceed their initial size.
  258. * The Application may choose to not modify the *app_signed* part of vote extensions by leaving parameter
  259. `ResponsePrepareProposal.app_signed_updates` empty.
  260. * In same-block execution mode, the Application must provide values for `ResponsePrepareProposal.app_hash`,
  261. `ResponsePrepareProposal.tx_results`, `ResponsePrepareProposal.validator_updates`, and
  262. `ResponsePrepareProposal.consensus_param_updates`, as a result of fully executing the block.
  263. * The values for `ResponsePrepareProposal.validator_updates`, or
  264. `ResponsePrepareProposal.consensus_param_updates` may be empty. In this case, Tendermint will keep
  265. the current values.
  266. * `ResponsePrepareProposal.validator_updates`, triggered by block `H`, affect validation
  267. for blocks `H+1`, and `H+2`. Heights following a validator update are affected in the following way:
  268. * `H`: `NextValidatorsHash` includes the new `validator_updates` value.
  269. * `H+1`: The validator set change takes effect and `ValidatorsHash` is updated.
  270. * `H+2`: `last_commit_info` is changed to include the altered validator set.
  271. * `ResponseFinalizeBlock.consensus_param_updates` returned for block `H` apply to the consensus
  272. params for block `H+1` even if the change is agreed in block `H`.
  273. For more information on the consensus parameters,
  274. see the [application spec entry on consensus parameters](../abci/apps.md#consensus-parameters).
  275. * It is the responsibility of the Application to set the right value for _TimeoutPropose_ so that
  276. the (synchronous) execution of the block does not cause other processes to prevote `nil` because
  277. their propose timeout goes off.
  278. * In next-block execution mode, Tendermint will ignore parameters `ResponsePrepareProposal.tx_results`,
  279. `ResponsePrepareProposal.validator_updates`, and `ResponsePrepareProposal.consensus_param_updates`.
  280. * As a result of executing the prepared proposal, the Application may produce header events or transaction events.
  281. The Application must keep those events until a block is decided and then pass them on to Tendermint via
  282. `ResponseFinalizeBlock`.
  283. * Likewise, in next-block execution mode, the Application must keep all responses to executing transactions
  284. until it can call `ResponseFinalizeBlock`.
  285. * The Application can change the transaction list via `ResponsePrepareProposal.tx_records`.
  286. See [TxRecord](#txrecord) for further information on how to use it. Some notes:
  287. * To remove a transaction from the proposed block the Application _marks_ the transaction as
  288. "REMOVE". It does not remove it from the list. The transaction will also be removed from the mempool.
  289. * Removing a transaction from the list means it is too early to propose that transaction,
  290. so it will be excluded from the proposal but will stay in the mempool for later proposals.
  291. The Application should be extra-careful, as abusing this feature may cause transactions to
  292. stay forever in the mempool.
  293. * The `new_hashes` field, besides helping with mempool maintenance, helps Tendermint handle
  294. queries such as "what happened with this Tx?", by answering "it was modified into these ones".
  295. * The Application _can_ reorder the transactions in the list.
  296. * As a sanity check, Tendermint will check the returned parameters for validity if the Application modified them.
  297. In particular, `ResponsePrepareProposal.tx_records` will be deemed invalid if
  298. * There is a duplicate transaction in the list.
  299. * The `new_hashes` field contains a dangling reference to a non-existing transaction.
  300. * A new or modified transaction is marked as "TXUNMODIFIED" or "TXREMOVED".
  301. * An unmodified transaction is marked as "TXADDED".
  302. * A transaction is marked as "TXUNKNOWN".
  303. * If Tendermint's sanity checks on the parameters of `ResponsePrepareProposal` fails, then it will drop the proposal
  304. and proceed to the next round (thus simulating a network loss/delay of the proposal).
  305. * **TODO**: [From discussion with William] Another possibility here is to panic. What do folks think we should do here?
  306. * The implementation of `PrepareProposal` can be non-deterministic.
  307. #### When does Tendermint call it?
  308. When a validator _p_ enters Tendermint consensus round _r_, height _h_, in which _p_ is the proposer,
  309. and _p_'s _validValue_ is `nil`:
  310. 1. _p_'s Tendermint collects outstanding transactions from the mempool
  311. * The transactions will be collected in order of priority
  312. * Let $C$ the list of currently collected transactions
  313. * The collection stops when any of the following conditions are met
  314. * the mempool is empty
  315. * the total size of transactions $\in C$ is greater than or equal to `consensusParams.block.max_bytes`
  316. * the sum of `GasWanted` field of transactions $\in C$ is greater than or equal to
  317. `consensusParams.block.max_gas`
  318. * _p_'s Tendermint creates a block header.
  319. 2. _p_'s Tendermint calls `RequestPrepareProposal` with the newly generated block.
  320. The call is synchronous: Tendermint's execution will block until the Application returns from the call.
  321. 3. The Application checks the block (header, transactions, commit info, evidences). Besides,
  322. * in same-block execution mode, the Application can (and should) provide `ResponsePrepareProposal.app_hash`,
  323. `ResponsePrepareProposal.validator_updates`, or
  324. `ResponsePrepareProposal.consensus_param_updates`.
  325. * in "next-block execution" mode, _p_'s Tendermint will ignore the values for `ResponsePrepareProposal.app_hash`,
  326. `ResponsePrepareProposal.validator_updates`, and `ResponsePrepareProposal.consensus_param_updates`.
  327. * in both modes, the Application can manipulate transactions
  328. * leave transactions untouched - `TxAction = UNMODIFIED`
  329. * add new transactions (not previously in the mempool) - `TxAction = ADDED`
  330. * remove transactions (invalid) from the proposal and from the mempool - `TxAction = REMOVED`
  331. * remove transactions from the proposal but not from the mempool (effectively _delaying_ them) - the
  332. Application removes the transaction from the list
  333. * modify transactions (e.g. aggregate them) - `TxAction = ADDED` followed by `TxAction = REMOVED`
  334. * reorder transactions - the Application reorders transactions in the list
  335. 4. If the block is modified, the Application sets `ResponsePrepareProposal.modified` to true,
  336. and includes the modified block in the return parameters (see the rules in section _Usage_).
  337. The Application returns from the call.
  338. 5. _p_'s Tendermint uses the (possibly) modified block as _p_'s proposal in round _r_, height _h_.
  339. Note that, if _p_ has a non-`nil` _validValue_, Tendermint will use it as proposal and will not call `RequestPrepareProposal`.
  340. ### ProcessProposal
  341. #### Parameters and Types
  342. * **Request**:
  343. | Name | Type | Description | Field Number |
  344. |----------------------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------|
  345. | hash | bytes | The block header's hash of the proposed block. Present for convenience (can be derived from the block header). | 1 |
  346. | header | [Header](../core/data_structures.md#header) | The proposed block's header. | 2 |
  347. | txs | repeated bytes | List of transactions that have been picked as part of the proposed block. | 3 |
  348. | last_commit_info | [LastCommitInfo](#lastcommitinfo) | Info about the last commit, including the round , the validator list, and which ones signed the last block. | 4 |
  349. | byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
  350. * **Response**:
  351. | Name | Type | Description | Field Number |
  352. |-------------------------|--------------------------------------------------|-----------------------------------------------------------------------------------|--------------|
  353. | accept | bool | If false, the received block failed verification. | 1 |
  354. | app_hash | bytes | The Merkle root hash of the application state. | 2 |
  355. | tx_results | repeated [ExecTxResult](#txresult) | List of structures containing the data resulting from executing the transactions. | 3 |
  356. | validator_updates | repeated [ValidatorUpdate](#validatorupdate) | Changes to validator set (set voting power to 0 to remove). | 4 |
  357. | consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 5 |
  358. * **Usage**:
  359. * Contains a full proposed block.
  360. * The parameters and types of `RequestProcessProposal` are the same as `RequestPrepareProposal`
  361. and `RequestFinalizeBlock`.
  362. * The Application may fully execute the block as though it was handling `RequestFinalizeBlock`.
  363. However, any resulting state changes must be kept as _canditade state_,
  364. and the Application should be ready to backtrack/discard it in case the decided block is different.
  365. * The header exactly matches the Tendermint header of the proposed block.
  366. * In next-block execution mode, the header hashes _AppHash_, _LastResultHash_, _ValidatorHash_,
  367. and _ConsensusHash_ refer to the **last committed block** (data was provided by the last call to
  368. `ResponseFinalizeBlock`).
  369. * In same-block execution mode, the header hashes _AppHash_, _LastResultHash_, _ValidatorHash_,
  370. and _ConsensusHash_ refer to the **same** block being passed in the `Request*` call to this
  371. method (data was provided by the call to `ResponsePrepareProposal` at the current height that
  372. resulted in the block being passed in the `Request*` call to this method)
  373. * If `ResponseProcessProposal.accept` is _false_, Tendermint assumes the proposal received
  374. is not valid.
  375. * In same-block execution mode, the Application is required to fully execute the block and provide values
  376. for parameters `ResponseProcessProposal.app_hash`, `ResponseProcessProposal.tx_results`,
  377. `ResponseProcessProposal.validator_updates`, and `ResponseProcessProposal.consensus_param_updates`,
  378. so that Tendermint can then verify the hashes in the block's header are correct.
  379. If the hashes mismatch, Tendermint will reject the block even if `ResponseProcessProposal.accept`
  380. was set to _true_.
  381. * In next-block execution mode, the Application should *not* provide values for parameters
  382. `ResponseProcessProposal.app_hash`, `ResponseProcessProposal.tx_results`,
  383. `ResponseProcessProposal.validator_updates`, and `ResponseProcessProposal.consensus_param_updates`.
  384. * The implementation of `ProcessProposal` MUST be deterministic. Moreover, the value of
  385. `ResponseProcessProposal.accept` MUST **exclusively** depend on the parameters passed in
  386. the call to `RequestProcessProposal`, and the last committed Application state
  387. (see [Requirements](abci++_app_requirements_002_draft.md) section).
  388. * Moreover, application implementors SHOULD always set `ResponseProcessProposal.accept` to _true_,
  389. unless they _really_ know what the potential liveness implications of returning _false_ are.
  390. >**TODO**: should `ResponseProcessProposal.accept` be of type `Result` rather than `bool`? (so we are able to extend the possible values in the future?)
  391. #### When does Tendermint call it?
  392. When a validator _p_ enters Tendermint consensus round _r_, height _h_, in which _q_ is the proposer (possibly _p_ = _q_):
  393. 1. _p_ sets up timer `ProposeTimeout`.
  394. 2. If _p_ is the proposer, _p_ executes steps 1-6 in [PrepareProposal](#prepareproposal).
  395. 3. Upon reception of Proposal message (which contains the header) for round _r_, height _h_ from _q_, _p_'s Tendermint verifies the block header.
  396. 4. Upon reception of Proposal message, along with all the block parts, for round _r_, height _h_ from _q_, _p_'s Tendermint follows its algorithm
  397. to check whether it should prevote for the block just received, or `nil`
  398. 5. If Tendermint should prevote for the block just received
  399. 1. Tendermint calls `RequestProcessProposal` with the block. The call is synchronous.
  400. 2. The Application checks/processes the proposed block, which is read-only, and returns true (_accept_) or false (_reject_) in `ResponseProcessProposal.accept`.
  401. * The Application, depending on its needs, may call `ResponseProcessProposal`
  402. * either after it has completely processed the block (the simpler case),
  403. * or immediately (after doing some basic checks), and process the block asynchronously. In this case the Application will
  404. not be able to reject the block, or force prevote/precommit `nil` afterwards.
  405. 3. If the returned value is
  406. * _accept_, Tendermint prevotes on this proposal for round _r_, height _h_.
  407. * _reject_, Tendermint prevotes `nil`.
  408. ### ExtendVote
  409. #### Parameters and Types
  410. * **Request**:
  411. | Name | Type | Description | Field Number |
  412. |--------|-------|-------------------------------------------------------------------------------|--------------|
  413. | hash | bytes | The header hash of the proposed block that the vote extension is to refer to. | 1 |
  414. | height | int64 | Height of the proposed block (for sanity check). | 2 |
  415. * **Response**:
  416. | Name | Type | Description | Field Number |
  417. |-------------------|-------|---------------------------------------------------------------------|--------------|
  418. | app_signed | bytes | Optional information signed by the Application (not by Tendermint). | 1 |
  419. | tendermint_signed | bytes | Optional information signed by Tendermint. | 2 |
  420. * **Usage**:
  421. * Both `ResponseExtendVote.app_signed` and `ResponseExtendVote.tendermint_signed` are optional information that will
  422. be attached to the Precommit message.
  423. * `RequestExtendVote.hash` corresponds to the hash of a proposed block that was made available to the application
  424. in a previous call to `ProcessProposal` or `PrepareProposal` for the current height.
  425. * `ResponseExtendVote.app_signed` and `ResponseExtendVote.tendermint_signed` will always be attached to a non-`nil`
  426. Precommit message. If Tendermint is to precommit `nil`, it will not call `RequestExtendVote`.
  427. * The Application logic that creates the extension can be non-deterministic.
  428. #### When does Tendermint call it?
  429. When a validator _p_ is in Tendermint consensus state _prevote_ of round _r_, height _h_, in which _q_ is the proposer; and _p_ has received
  430. * the Proposal message _v_ for round _r_, height _h_, along with all the block parts, from _q_,
  431. * `Prevote` messages from _2f + 1_ validators' voting power for round _r_, height _h_, prevoting for the same block _id(v)_,
  432. then _p_'s Tendermint locks _v_ and sends a Precommit message in the following way
  433. 1. _p_'s Tendermint sets _lockedValue_ and _validValue_ to _v_, and sets _lockedRound_ and _validRound_ to _r_
  434. 2. _p_'s Tendermint calls `RequestExtendVote` with _id(v)_ (`RequestExtendVote.hash`). The call is synchronous.
  435. 3. The Application returns an array of bytes, `ResponseExtendVote.extension`, which is not interpreted by Tendermint.
  436. 4. _p_'s Tendermint includes `ResponseExtendVote.extension` as a new field in the Precommit message.
  437. 5. _p_'s Tendermint signs and broadcasts the Precommit message.
  438. In the cases when _p_'s Tendermint is to broadcast `precommit nil` messages (either _2f+1_ `prevote nil` messages received, or _timeoutPrevote_ triggered), _p_'s Tendermint does **not** call `RequestExtendVote` and will include an empty byte array as vote extension in the `precommit nil` message.
  439. ### VerifyVoteExtension
  440. #### Parameters and Types
  441. * **Request**:
  442. | Name | Type | Description | Field Number |
  443. |-------------------|-------|------------------------------------------------------------------------------------------|--------------|
  444. | app_signed | bytes | Optional information signed by the Application (not by Tendermint). | 1 |
  445. | tendermint_signed | bytes | Optional information signed by Tendermint. | 2 |
  446. | hash | bytes | The header hash of the propsed block that the vote extension refers to. | 3 |
  447. | validator_address | bytes | [Address](../core/data_structures.md#address) of the validator that signed the extension | 4 |
  448. | height | int64 | Height of the block (for sanity check). | 5 |
  449. * **Response**:
  450. | Name | Type | Description | Field Number |
  451. |--------|------|-------------------------------------------------------|--------------|
  452. | accept | bool | If false, Application is rejecting the vote extension | 1 |
  453. * **Usage**:
  454. * If `ResponseVerifyVoteExtension.accept` is _false_, Tendermint will reject the whole received vote.
  455. See the [Requirements](abci++_app_requirements_002_draft.md) section to understand the potential
  456. liveness implications of this.
  457. * The implementation of `VerifyVoteExtension` MUST be deterministic. Moreover, the value of
  458. `ResponseVerifyVoteExtension.accept` MUST **exclusively** depend on the parameters passed in
  459. the call to `RequestVerifyVoteExtension`, and the last committed Application state
  460. (see [Requirements](abci++_app_requirements_002_draft.md) section).
  461. * Moreover, application implementors SHOULD always set `ResponseVerifyVoteExtension.accept` to _true_,
  462. unless they _really_ know what the potential liveness implications of returning _false_ are.
  463. #### When does Tendermint call it?
  464. When a validator _p_ is in Tendermint consensus round _r_, height _h_, state _prevote_ (**TODO** discuss: I think I must remove the state
  465. from this condition, but not sure), and _p_ receives a Precommit message for round _r_, height _h_ from _q_:
  466. 1. _p_'s Tendermint calls `RequestVerifyVoteExtension`.
  467. 2. The Application returns _accept_ or _reject_ via `ResponseVerifyVoteExtension.accept`.
  468. 3. If the Application returns
  469. * _accept_, _p_'s Tendermint will keep the received vote, together with its corresponding
  470. vote extension in its internal data structures. It will be used to:
  471. * calculate field _LastCommitHash_ in the header of the block proposed for height _h + 1_
  472. (in the rounds where _p_ will be proposer).
  473. * populate _LastCommitInfo_ in calls to `RequestPrepareProposal`, `RequestProcessProposal`,
  474. and `RequestFinalizeBlock` in height _h + 1_.
  475. * _reject_, _p_'s Tendermint will deem the Precommit message invalid and discard it.
  476. ### FinalizeBlock
  477. #### Parameters and Types
  478. * **Request**:
  479. | Name | Type | Description | Field Number |
  480. |----------------------|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------|
  481. | hash | bytes | The block header's hash. Present for convenience (can be derived from the block header). | 1 |
  482. | header | [Header](../core/data_structures.md#header) | The block header. | 2 |
  483. | txs | repeated bytes | List of transactions committed as part of the block. | 3 |
  484. | last_commit_info | [LastCommitInfo](#lastcommitinfo) | Info about the last commit, including the round, and the list of validators and which ones signed the last block. | 4 |
  485. | byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
  486. * **Response**:
  487. | Name | Type | Description | Field Number |
  488. |-------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------|--------------|
  489. | block_events | repeated [Event](abci++_basic_concepts_002_draft.md#events) | Type & Key-Value events for indexing | 1 |
  490. | tx_results | repeated [ExecTxResult](#txresult) | List of structures containing the data resulting from executing the transactions | 2 |
  491. | validator_updates | repeated [ValidatorUpdate](#validatorupdate) | Changes to validator set (set voting power to 0 to remove). | 3 |
  492. | consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 4 |
  493. | app_hash | bytes | The Merkle root hash of the application state. | 5 |
  494. | retain_height | int64 | Blocks below this height may be removed. Defaults to `0` (retain all). | 6 |
  495. * **Usage**:
  496. * Contains a newly decided block.
  497. * This method is equivalent to the call sequence `BeginBlock`, [`DeliverTx`],
  498. `EndBlock`, `Commit` in the previous version of ABCI.
  499. * The header exactly matches the Tendermint header of the proposed block.
  500. * The Application can use `RequestFinalizeBlock.last_commit_info` and `RequestFinalizeBlock.byzantine_validators`
  501. to determine rewards and punishments for the validators.
  502. * The application must execute the transactions in full, in the order they appear in `RequestFinalizeBlock.txs`,
  503. before returning control to Tendermint. Alternatively, it can commit the candidate state corresponding to the same block
  504. previously executed via `PrepareProposal` or `ProcessProposal`.
  505. * `ResponseFinalizeBlock.tx_results[i].Code == 0` only if the _i_-th transaction is fully valid.
  506. * In next-block execution mode, the Application must provide values for `ResponseFinalizeBlock.app_hash`,
  507. `ResponseFinalizeBlock.tx_results`, `ResponseFinalizeBlock.validator_updates`, and
  508. `ResponseFinalizeBlock.consensus_param_updates` as a result of executing the block.
  509. * The values for `ResponseFinalizeBlock.validator_updates`, or
  510. `ResponseFinalizeBlock.consensus_param_updates` may be empty. In this case, Tendermint will keep
  511. the current values.
  512. * `ResponseFinalizeBlock.validator_updates`, triggered by block `H`, affect validation
  513. for blocks `H+1`, `H+2`, and `H+3`. Heights following a validator update are affected in the following way:
  514. - Height `H+1`: `NextValidatorsHash` includes the new `validator_updates` value.
  515. - Height `H+2`: The validator set change takes effect and `ValidatorsHash` is updated.
  516. - Height `H+3`: `last_commit_info` is changed to include the altered validator set.
  517. * `ResponseFinalizeBlock.consensus_param_updates` returned for block `H` apply to the consensus
  518. params for block `H+1`. For more information on the consensus parameters,
  519. see the [application spec entry on consensus parameters](../abci/apps.md#consensus-parameters).
  520. * In same-block execution mode, Tendermint will log an error and ignore values for
  521. `ResponseFinalizeBlock.app_hash`, `ResponseFinalizeBlock.tx_results`, `ResponseFinalizeBlock.validator_updates`,
  522. and `ResponsePrepareProposal.consensus_param_updates`, as those must have been provided by `PrepareProposal`.
  523. * Application is expected to persist its state at the end of this call, before calling `ResponseFinalizeBlock`.
  524. * `ResponseFinalizeBlock.app_hash` contains an (optional) Merkle root hash of the application state.
  525. * `ResponseFinalizeBlock.app_hash` is included
  526. * [in next-block execution mode] as the `Header.AppHash` in the next block.
  527. * [in same-block execution mode] as the `Header.AppHash` in the current block. In this case,
  528. `PrepareProposal` is required to fully execute the block and set the App hash before
  529. returning the proposed block to Tendermint.
  530. * `ResponseFinalizeBlock.app_hash` may also be empty or hard-coded, but MUST be
  531. **deterministic** - it must not be a function of anything that did not come from the parameters
  532. of `RequestFinalizeBlock` and the previous committed state.
  533. * Later calls to `Query` can return proofs about the application state anchored
  534. in this Merkle root hash.
  535. * Use `ResponseFinalizeBlock.retain_height` with caution! If all nodes in the network remove historical
  536. blocks then this data is permanently lost, and no new nodes will be able to join the network and
  537. bootstrap. Historical blocks may also be required for other purposes, e.g. auditing, replay of
  538. non-persisted heights, light client verification, and so on.
  539. * Just as `ProcessProposal`, the implementation of `FinalizeBlock` MUST be deterministic, since it is
  540. making the Application's state evolve in the context of state machine replication.
  541. * Currently, Tendermint will fill up all fields in `RequestFinalizeBlock`, even if they were
  542. already passed on to the Application via `RequestPrepareProposal` or `RequestProcessProposal`.
  543. If the Application is in same-block execution mode, it applies the right candidate state here
  544. (rather than executing the whole block). In this case the Application disregards all parameters in
  545. `RequestFinalizeBlock` except `RequestFinalizeBlock.hash`.
  546. #### When does Tendermint call it?
  547. When a validator _p_ is in Tendermint consensus height _h_, and _p_ receives
  548. * the Proposal message with block _v_ for a round _r_, along with all its block parts, from _q_,
  549. which is the proposer of round _r_, height _h_,
  550. * `Precommit` messages from _2f + 1_ validators' voting power for round _r_, height _h_,
  551. precommitting the same block _id(v)_,
  552. then _p_'s Tendermint decides block _v_ and finalizes consensus for height _h_ in the following way
  553. 1. _p_'s Tendermint persists _v_ as decision for height _h_.
  554. 2. _p_'s Tendermint locks the mempool -- no calls to checkTx on new transactions.
  555. 3. _p_'s Tendermint calls `RequestFinalizeBlock` with _id(v)_. The call is synchronous.
  556. 4. _p_'s Application processes block _v_, received in a previous call to `RequestProcessProposal`.
  557. 5. _p_'s Application commits and persists the state resulting from processing the block.
  558. 6. _p_'s Application calculates and returns the _AppHash_, along with an array of arrays of bytes representing the output of each of the transactions
  559. 7. _p_'s Tendermint hashes the array of transaction outputs and stores it in _ResultHash_
  560. 8. _p_'s Tendermint persists _AppHash_ and _ResultHash_
  561. 9. _p_'s Tendermint unlocks the mempool -- newly received transactions can now be checked.
  562. 10. _p_'s starts consensus for a new height _h+1_, round 0
  563. ## Data Types existing in ABCI
  564. Most of the data structures used in ABCI are shared [common data structures](../core/data_structures.md). In certain cases, ABCI uses different data structures which are documented here:
  565. ### Validator
  566. * **Fields**:
  567. | Name | Type | Description | Field Number |
  568. |---------|-------|---------------------------------------------------------------------|--------------|
  569. | address | bytes | [Address](../core/data_structures.md#address) of validator | 1 |
  570. | power | int64 | Voting power of the validator | 3 |
  571. * **Usage**:
  572. * Validator identified by address
  573. * Used in RequestBeginBlock as part of VoteInfo
  574. * Does not include PubKey to avoid sending potentially large quantum pubkeys
  575. over the ABCI
  576. ### ValidatorUpdate
  577. * **Fields**:
  578. | Name | Type | Description | Field Number |
  579. |---------|--------------------------------------------------|-------------------------------|--------------|
  580. | pub_key | [Public Key](../core/data_structures.md#pub_key) | Public key of the validator | 1 |
  581. | power | int64 | Voting power of the validator | 2 |
  582. * **Usage**:
  583. * Validator identified by PubKey
  584. * Used to tell Tendermint to update the validator set
  585. ### Evidence
  586. * **Fields**:
  587. | Name | Type | Description | Field Number |
  588. |--------------------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------|
  589. | type | [EvidenceType](#evidencetype) | Type of the evidence. An enum of possible evidence's. | 1 |
  590. | validator | [Validator](#validator) | The offending validator | 2 |
  591. | height | int64 | Height when the offense occurred | 3 |
  592. | time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Time of the block that was committed at the height that the offense occurred | 4 |
  593. | total_voting_power | int64 | Total voting power of the validator set at height `Height` | 5 |
  594. #### EvidenceType
  595. * **Fields**
  596. EvidenceType is an enum with the listed fields:
  597. | Name | Field Number |
  598. |---------------------|--------------|
  599. | UNKNOWN | 0 |
  600. | DUPLICATE_VOTE | 1 |
  601. | LIGHT_CLIENT_ATTACK | 2 |
  602. ### LastCommitInfo
  603. * **Fields**:
  604. | Name | Type | Description | Field Number |
  605. |-------|--------------------------------|-----------------------------------------------------------------------------------------------------------------------|--------------|
  606. | round | int32 | Commit round. Reflects the total amount of rounds it took to come to consensus for the current block. | 1 |
  607. | votes | repeated [VoteInfo](#voteinfo) | List of validators addresses in the last validator set with their voting power and whether or not they signed a vote. | 2 |
  608. ### ConsensusParams
  609. * **Fields**:
  610. | Name | Type | Description | Field Number |
  611. |-----------|---------------------------------------------------------------|------------------------------------------------------------------------------|--------------|
  612. | block | [BlockParams](../core/data_structures.md#blockparams) | Parameters limiting the size of a block and time between consecutive blocks. | 1 |
  613. | evidence | [EvidenceParams](../core/data_structures.md#evidenceparams) | Parameters limiting the validity of evidence of byzantine behaviour. | 2 |
  614. | validator | [ValidatorParams](../core/data_structures.md#validatorparams) | Parameters limiting the types of public keys validators can use. | 3 |
  615. | version | [VersionsParams](../core/data_structures.md#versionparams) | The ABCI application version. | 4 |
  616. ### ProofOps
  617. * **Fields**:
  618. | Name | Type | Description | Field Number |
  619. |------|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  620. | ops | repeated [ProofOp](#proofop) | List of chained Merkle proofs, of possibly different types. The Merkle root of one op is the value being proven in the next op. The Merkle root of the final op should equal the ultimate root hash being verified against.. | 1 |
  621. ### ProofOp
  622. * **Fields**:
  623. | Name | Type | Description | Field Number |
  624. |------|--------|------------------------------------------------|--------------|
  625. | type | string | Type of Merkle proof and how it's encoded. | 1 |
  626. | key | bytes | Key in the Merkle tree that this proof is for. | 2 |
  627. | data | bytes | Encoded Merkle proof for the key. | 3 |
  628. ### Snapshot
  629. * **Fields**:
  630. | Name | Type | Description | Field Number |
  631. |----------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
  632. | height | uint64 | The height at which the snapshot was taken (after commit). | 1 |
  633. | format | uint32 | An application-specific snapshot format, allowing applications to version their snapshot data format and make backwards-incompatible changes. Tendermint does not interpret this. | 2 |
  634. | chunks | uint32 | The number of chunks in the snapshot. Must be at least 1 (even if empty). | 3 |
  635. | hash | bytes | TAn arbitrary snapshot hash. Must be equal only for identical snapshots across nodes. Tendermint does not interpret the hash, it only compares them. | 3 |
  636. | metadata | bytes | Arbitrary application metadata, for example chunk hashes or other verification data. | 3 |
  637. * **Usage**:
  638. * Used for state sync snapshots, see the [state sync section](../p2p/messages/state-sync.md) for details.
  639. * A snapshot is considered identical across nodes only if _all_ fields are equal (including
  640. `Metadata`). Chunks may be retrieved from all nodes that have the same snapshot.
  641. * When sent across the network, a snapshot message can be at most 4 MB.
  642. ## Data types introduced or modified in ABCI++
  643. ### VoteInfo
  644. * **Fields**:
  645. | Name | Type | Description | Field Number |
  646. |-----------------------------|-------------------------|---------------------------------------------------------------|--------------|
  647. | validator | [Validator](#validator) | A validator | 1 |
  648. | signed_last_block | bool | Indicates whether or not the validator signed the last block | 2 |
  649. | tendermint_signed_extension | bytes | Indicates whether or not the validator signed the last block | 3 |
  650. | app_signed_extension | bytes | Indicates whether or not the validator signed the last block | 3 |
  651. * **Usage**:
  652. * Indicates whether a validator signed the last block, allowing for rewards
  653. based on validator availability
  654. * `tendermint_signed_extension` conveys the part of the validator's vote extension that was signed by Tendermint.
  655. * `app_signed_extension` conveys the optional *app_signed* part of the validator's vote extension.
  656. ### ExecTxResult
  657. * **Fields**:
  658. | Name | Type | Description | Field Number |
  659. |------------|-------------------------------------------------------------|-----------------------------------------------------------------------|--------------|
  660. | code | uint32 | Response code. | 1 |
  661. | data | bytes | Result bytes, if any. | 2 |
  662. | log | string | The output of the application's logger. **May be non-deterministic.** | 3 |
  663. | info | string | Additional information. **May be non-deterministic.** | 4 |
  664. | gas_wanted | int64 | Amount of gas requested for transaction. | 5 |
  665. | gas_used | int64 | Amount of gas consumed by transaction. | 6 |
  666. | tx_events | repeated [Event](abci++_basic_concepts_002_draft.md#events) | Type & Key-Value events for indexing transactions (e.g. by account). | 7 |
  667. | codespace | string | Namespace for the `code`. | 8 |
  668. ### TxAction
  669. ```protobuf
  670. enum TxAction {
  671. TXUNKNOWN = 0; // Unknown action
  672. TXUNMODIFIED = 1; // The Application did not modify this transaction. Ignore new_hashes field
  673. TXADDED = 2; // The Application added this transaction. Ignore new_hashes field
  674. TXREMOVED = 3; // The Application wants this transaction removed from the proposal and the mempool.
  675. // Use new_hashes field if the transaction was modified
  676. }
  677. ```
  678. * **Usage**:
  679. * If `Action` is TXUNKNOWN, a problem happened in the Application. Tendermint will ignore this transaction. **TODO** should we panic?
  680. * If `Action` is TXUNMODIFIED, Tendermint includes the transaction in the proposal. Nothing to do on the mempool. Field `new_hashes` is ignored.
  681. * If `Action` is TXADDED, Tendermint includes the transaction in the proposal. The transaction is also added to the mempool and gossipped. Field `new_hashes` is ignored.
  682. * If `Action` is TXREMOVED, Tendermint excludes the transaction from the proposal. The transaction is also removed from the mempool if it exists,
  683. similar to `CheckTx` returning _false_. Tendermint can use field `new_hashes` to help clients trace transactions that have been modified into other transactions.
  684. ### TxRecord
  685. * **Fields**:
  686. | Name | Type | Description | Field Number |
  687. |------------|-----------------------|------------------------------------------------------------------|--------------|
  688. | action | [TxAction](#txaction) | What should Tendermint do with this transaction? | 1 |
  689. | tx | bytes | Transaction contents | 2 |
  690. | new_hashes | repeated bytes | List of hashes of successor transactions | 3 |
  691. * **Usage**:
  692. * The hashes contained in `new_hashes` MUST follow the same algorithm used by Tendermint for hashing transactions
  693. that are in the mempool.
  694. * As `new_hashes` is a list, `TxRecord` allows to trace many-to-many modifications. Some examples:
  695. * Transaction $t1$ modified into $t2$ is represented with these records
  696. * $t2$ "ADDED"
  697. * $t1$ "REMOVED"; `new_hashes` contains [$id(t2)$]
  698. * Transaction $t1$ modified into $t2$ and $t3$ is represented with these `TxRecord` records
  699. * $t2$ "ADDED"
  700. * $t3$ "ADDED"
  701. * $t1$ "REMOVED"; `new_hashes` contains [$id(t2)$, $id(t3)$]
  702. * Transactions $t1$ and $t2$ aggregated into $t3$ is represented with these `TxRecord` records
  703. * $t3$ "ADDED"
  704. * $t1$ "REMOVED"; `new_hashes` contains [$id(t3)$]
  705. * $t2$ "REMOVED"; `new_hashes` contains [$id(t3)$]
  706. * Transactions $t1$ and $t2$ combined into $t3$ and $t4$ is represented with these `TxRecord` records
  707. * $t3$ "ADDED"
  708. * $t4$ "ADDED"
  709. * $t1$ "REMOVED" and `new_hashes` containing [$id(t3)$, $id(t4)$]
  710. * $t2$ "REMOVED" and `new_hashes` containing [$id(t3)$, $id(t4)$]