Merge reference/baseapp and spec/baseapp/WIP_abci_application.md

This commit is contained in:
Jae Kwon 2018-11-20 20:23:09 -08:00
parent 4afd53d81b
commit bd982b1423
2 changed files with 61 additions and 46 deletions

View File

@ -61,3 +61,64 @@ persisted even when the following Handler processing logic fails.
It is possible that a malicious proposer may include a transaction in a block
that fails the AnteHandler. In this case, all state transitions for the
offending transaction are discarded.
## Other ABCI Messages
Besides `CheckTx` and `DeliverTx`, BaseApp handles the following ABCI messages.
### Info
TODO complete description
### SetOption
TODO complete description
### Query
TODO complete description
### InitChain
TODO complete description
During chain initialization InitChain runs the initialization logic directly on
the CommitMultiStore. The deliver and check states are initialized with the
ChainID.
Note that we do not commit after InitChain, so BeginBlock for block 1 starts
from the deliver state as initialized by InitChain.
### BeginBlock
TODO complete description
### EndBlock
TODO complete description
### Commit
TODO complete description
## Gas Management
### Gas: InitChain
During InitChain, the block gas meter is initialized with an infinite amount of
gas to run any genesis transactions.
Additionally, the InitChain request message includes ConsensusParams as
declared in the genesis.json file.
### Gas: BeginBlock
The block gas meter is reset during BeginBlock for the deliver state. If no
maximum block gas is set within baseapp then an infinite gas meter is set,
otherwise a gas meter with `ConsensusParam.BlockSize.MaxGas` is initialized.
### Gas: DeliverTx
Before the transaction logic is run, the `BlockGasMeter` is first checked to
see if any gas remains. If no gas remains, then `DeliverTx` immediately returns
an error.
After the transaction has been processed, the used gas (up to the transaction
gas limit) is deducted from the BlockGasMeter. If the remaining gas exceeds the
meter's limits, then DeliverTx returns an error and the transaction is not
committed.

View File

@ -1,46 +0,0 @@
# ABCI application
The `BaseApp` struct fulfills the tendermint-abci `Application` interface.
## Info
## SetOption
## Query
## CheckTx
## InitChain
TODO pseudo code
During chain initialization InitChain runs the initialization logic directly on
the CommitMultiStore. The deliver and check states are initialized with the
ChainID. Additionally the block gas meter is initialized with an infinite
amount of gas to run any genesis transactions.
Note that we do not `Commit` during `InitChain` however BeginBlock for block 1
starts from this deliverState.
## BeginBlock
TODO complete description & pseudo code
The block gas meter is reset within BeginBlock for the deliver state.
If no maximum block gas is set within baseapp then an infinite
gas meter is set, otherwise a gas meter with the baseapp `maximumBlockGas`
is initialized
## DeliverTx
TODO complete description & pseudo code
Before transaction logic is run, the `BlockGasMeter` is first checked for
remaining gas. If no gas remains, then `DeliverTx` immediately returns an error.
After the transaction has been processed the used gas is deducted from the
BlockGasMeter. If the remaining gas exceeds the meter's limits, then DeliverTx
returns an error and the transaction is not committed.
## EndBlock
## Commit