Merge branch 'master' into develop

This commit is contained in:
Ethan Buchman 2018-03-01 23:55:14 -05:00
commit 9e0e00bef4
3 changed files with 84 additions and 45 deletions

View File

@ -4,15 +4,20 @@
BREAKING CHANGES: BREAKING CHANGES:
- [types] Socket messages are length prefixed with real protobuf Varint instead of `<len of len><big endian len>`
- [types] Drop gogo custom type magic with data.Bytes - [types] Drop gogo custom type magic with data.Bytes
- [types] Add `info string` field to responses for SetOption, Query, CheckTx, DeliverTx - [types] Use `[(gogoproto.nullable)=false]` to prefer value over pointer for the types
- [types] Remove IsOk/IsErr methods from response types. - [types] Field re-ordering ...
- [types] Replace KVPair with common.KVPair - [types] KVPair: replace with common.KVPair. Add common KI64Pair too (for fees).
- [types] Updates to CheckTx/DeliverTx around tags and fees - [types] CheckTx/DeliverTx: updates for tags, gas, fees
- [types] Remove code and log from Commit - [types] Commit: Remove code and log from Commit
- [types] SetOption: Remove code
- [example/dummy] remove dependence on IAVL
- [types] IsOk/IsErr: methods removed
FEATURES: FEATURES:
- [types] SetOption/Query/CheckTx/DeliverTx: Add `info string` field to responses
- [types] RequestInitChain.AppStateBytes for app's genesis state - [types] RequestInitChain.AppStateBytes for app's genesis state
IMPROVEMENTS: IMPROVEMENTS:

View File

@ -64,10 +64,13 @@ See the [examples](#examples) below for more information.
ABCI is best implemented as a streaming protocol. ABCI is best implemented as a streaming protocol.
The socket implementation provides for asynchronous, ordered message passing over unix or tcp. The socket implementation provides for asynchronous, ordered message passing over unix or tcp.
Messages are serialized using Protobuf3 and length-prefixed. Messages are serialized using Protobuf3 and length-prefixed with a [signed Varint](https://developers.google.com/protocol-buffers/docs/encoding?csw=1#signed-integers)
Protobuf3 doesn't have an official length-prefix standard, so we use our own. The first byte represents the length of the big-endian encoded length.
For example, if the Protobuf3 encoded ABCI message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x0104DEADBEEF`. If the Protobuf3 encoded ABCI message is 65535 bytes long, the length-prefixed message would be like `0x02FFFF...`. For example, if the Protobuf3 encoded ABCI message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x08DEADBEEF`, since `0x08` is the signed varint
encoding of `4`. If the Protobuf3 encoded ABCI message is 65535 bytes long, the length-prefixed message would be like `0xFEFF07...`.
Note the benefit of using this `varint` encoding over the old version (where integers were encoded as `<len of len><big endian len>` is that
it is the standard way to encode integers in Protobuf. It is also generally shorter.
### GRPC ### GRPC

View File

@ -40,6 +40,10 @@ Flush
Info Info
^^^^ ^^^^
- **Arguments**:
- ``Version (string)``: The Tendermint version
- **Returns**: - **Returns**:
- ``Data (string)``: Some arbitrary information - ``Data (string)``: Some arbitrary information
@ -48,8 +52,10 @@ Info
called Commit called Commit
- ``LastBlockAppHash ([]byte)``: Latest result of Commit - ``LastBlockAppHash ([]byte)``: Latest result of Commit
- **Usage**: Return information about the application state. Used to - **Usage**:
sync the app with Tendermint on crash/restart.
- Return information about the application state.
- Used to sync the app with Tendermint on crash/restart.
SetOption SetOption
^^^^^^^^^ ^^^^^^^^^
@ -62,11 +68,14 @@ SetOption
- **Returns**: - **Returns**:
- ``Code (uint32)``: Response code - ``Code (uint32)``: Response code
- ``Log (string)``: Debug or error message - ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Info (string)``: Additional information. May be non-deterministic.
- **Usage**: Set application options. E.g. Key="mode", Value="mempool" - **Usage**:
for a mempool connection, or Key="mode", Value="consensus" for a
consensus connection. Other options are application specific. - Set non-consensus critical application specific options.
- e.g. Key="min-fee", Value="100fermion" could set the minimum fee required for CheckTx
(but not DeliverTx - that would be consensus critical).
InitChain InitChain
^^^^^^^^^ ^^^^^^^^^
@ -76,7 +85,9 @@ InitChain
- ``Validators ([]Validator)``: Initial genesis validators - ``Validators ([]Validator)``: Initial genesis validators
- ``AppStateBytes ([]byte)``: Serialized initial application state - ``AppStateBytes ([]byte)``: Serialized initial application state
- **Usage**: Called once upon genesis - **Usage**:
- Called once upon genesis
Query Query
^^^^^ ^^^^^
@ -100,15 +111,22 @@ Query
- **Returns**: - **Returns**:
- ``Code (uint32)``: Response code - ``Code (uint32)``: Response code.
- ``Key ([]byte)``: The key of the matching data - ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Value ([]byte)``: The value of the matching data - ``Info (string)``: Additional information. May be non-deterministic.
- ``Proof ([]byte)``: Proof for the data, if requested - ``Index (int64)``: The index of the key in the tree.
- ``Key ([]byte)``: The key of the matching data.
- ``Value ([]byte)``: The value of the matching data.
- ``Proof ([]byte)``: Proof for the data, if requested.
- ``Height (int64)``: The block height from which data was derived. - ``Height (int64)``: The block height from which data was derived.
Note that this is the height of the block containing the Note that this is the height of the block containing the
application's Merkle root hash, which represents the state as it application's Merkle root hash, which represents the state as it
was after committing the block at Height-1 was after committing the block at Height-1
- ``Log (string)``: Debug or error message
- **Usage**:
- Query for data from the application at current or past height.
- Optionally return Merkle proof.
BeginBlock BeginBlock
^^^^^^^^^^ ^^^^^^^^^^
@ -123,9 +141,11 @@ BeginBlock
- ``ByzantineValidators ([]Evidence)``: List of evidence of - ``ByzantineValidators ([]Evidence)``: List of evidence of
validators that acted maliciously validators that acted maliciously
- **Usage**: Signals the beginning of a new block. Called prior to any - **Usage**:
DeliverTxs. The header is expected to at least contain the Height.
The ``AbsentValidators`` and ``ByzantineValidators`` can be used to - Signals the beginning of a new block. Called prior to any DeliverTxs.
- The header is expected to at least contain the Height.
- The ``AbsentValidators`` and ``ByzantineValidators`` can be used to
determine rewards and punishments for the validators. determine rewards and punishments for the validators.
CheckTx CheckTx
@ -133,15 +153,17 @@ CheckTx
- **Arguments**: - **Arguments**:
- ``Data ([]byte)``: The request transaction bytes - ``Tx ([]byte)``: The request transaction bytes
- **Returns**: - **Returns**:
- ``Code (uint32)``: Response code - ``Code (uint32)``: Response code
- ``Data ([]byte)``: Result bytes, if any - ``Data ([]byte)``: Result bytes, if any.
- ``Log (string)``: Debug or error message - ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Gas (int64)``: Amount of gas consumed by transaction - ``Info (string)``: Additional information. May be non-deterministic.
- ``Fee (int64)``: Fee paid by transaction - ``GasWanted (int64)``: Amount of gas consumed by transaction.
- ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
- ``Fee ([]cmn.KI64Pair)``: Fee paid for the transaction.
- **Usage**: Validate a mempool transaction, prior to broadcasting or - **Usage**: Validate a mempool transaction, prior to broadcasting or
proposing. This message should not mutate the main state, but proposing. This message should not mutate the main state, but
@ -157,42 +179,49 @@ CheckTx
Transactions are first run through CheckTx before broadcast to peers Transactions are first run through CheckTx before broadcast to peers
in the mempool layer. You can make CheckTx semi-stateful and clear in the mempool layer. You can make CheckTx semi-stateful and clear
the state upon ``Commit`` or ``BeginBlock``, to allow for dependent the state upon ``Commit``, to allow for dependent sequences of transactions
sequences of transactions in the same block. in the same block.
DeliverTx DeliverTx
^^^^^^^^^ ^^^^^^^^^
- **Arguments**: - **Arguments**:
- ``Data ([]byte)``: The request transaction bytes - ``Tx ([]byte)``: The request transaction bytes.
- **Returns**: - **Returns**:
- ``Code (uint32)``: Response code - ``Code (uint32)``: Response code.
- ``Data ([]byte)``: Result bytes, if any - ``Data ([]byte)``: Result bytes, if any.
- ``Log (string)``: Debug or error message - ``Log (string)``: The output of the application's logger. May be non-deterministic.
- ``Tags ([]*KVPair)``: Optional tags for indexing - ``Info (string)``: Additional information. May be non-deterministic.
- ``GasWanted (int64)``: Amount of gas predicted to be consumed by transaction.
- ``GasUsed (int64)``: Amount of gas consumed by transaction.
- ``Tags ([]cmn.KVPair)``: Key-Value tags for filtering and indexing transactions (eg. by account).
- **Usage**: Append and run a transaction. If the transaction is valid, - **Usage**:
returns CodeType.OK - Deliver a transaction to be executed in full by the application. If the transaction is valid,
returns CodeType.OK.
EndBlock EndBlock
^^^^^^^^ ^^^^^^^^
- **Arguments**: - **Arguments**:
- ``Height (int64)``: The block height that ended - ``Height (int64)``: Height of the block just executed.
- **Returns**: - **Returns**:
- ``ValidatorUpdates ([]Validator)``: Changes to validator set (set - ``ValidatorUpdates ([]Validator)``: Changes to validator set (set
voting power to 0 to remove) voting power to 0 to remove).
- ``ConsensusParamUpdates (ConsensusParams)``: Changes to - ``ConsensusParamUpdates (ConsensusParams)``: Changes to
consensus-critical time/size parameters consensus-critical time, size, and other parameters.
- **Usage**: Signals the end of a block. Called prior to each Commit - **Usage**:
after all transactions. Validator set is updated with the result.
- Signals the end of a block.
- Called prior to each Commit, after all transactions.
- Validator set and consensus params are updated with the result.
Commit Commit
^^^^^^ ^^^^^^
@ -200,6 +229,8 @@ Commit
- **Returns**: - **Returns**:
- ``Data ([]byte)``: The Merkle root hash - ``Data ([]byte)``: The Merkle root hash
- ``Log (string)``: Debug or error message
- **Usage**: Return a Merkle root hash of the application state. - **Usage**:
- Persist the application state.
- Return a Merkle root hash of the application state.