From bd982b1423aca2c82aee542a777856809c7d841f Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Tue, 20 Nov 2018 20:23:09 -0800 Subject: [PATCH] Merge reference/baseapp and spec/baseapp/WIP_abci_application.md --- docs/reference/baseapp.md | 61 +++++++++++++++++++++++ docs/spec/baseapp/WIP_abci_application.md | 46 ----------------- 2 files changed, 61 insertions(+), 46 deletions(-) delete mode 100644 docs/spec/baseapp/WIP_abci_application.md diff --git a/docs/reference/baseapp.md b/docs/reference/baseapp.md index e1a80e293..ad3b56716 100644 --- a/docs/reference/baseapp.md +++ b/docs/reference/baseapp.md @@ -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. diff --git a/docs/spec/baseapp/WIP_abci_application.md b/docs/spec/baseapp/WIP_abci_application.md deleted file mode 100644 index 7baadccee..000000000 --- a/docs/spec/baseapp/WIP_abci_application.md +++ /dev/null @@ -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 -