Clarify AnteHandler and MsgHandler
This commit is contained in:
parent
8ccf055ca1
commit
5c2758b8df
12
docs/apps.md
12
docs/apps.md
|
@ -17,10 +17,14 @@ stores they're given the key for. The BaseApp ensures all stores are properly lo
|
||||||
One mounted store is considered the "main" - it holds the latest block header, from which we can find and load the
|
One mounted store is considered the "main" - it holds the latest block header, from which we can find and load the
|
||||||
most recent state.
|
most recent state.
|
||||||
|
|
||||||
BaseApp distinguishes between two handler types - the `AnteHandler` and the `Handler`.
|
BaseApp distinguishes between two handler types - the `AnteHandler` and the `MsgHandler`.
|
||||||
The former is a stateful validity check (eg. checking nonce and sufficient balance),
|
The former is a global validity check (checking nonces, sigs and sufficient balances to pay fees,
|
||||||
the later the full state transition function. Only AnteHandler runs during CheckTx,
|
e.g. things that apply to all transaction from all modules), the later is the full state transition function.
|
||||||
while both run in DeliverTx.
|
During CheckTx the state transition function is only applied to the checkTxState and should return
|
||||||
|
before any expensive state transitions are run (this is up to each developer). It also needs to return the estimated
|
||||||
|
gas cost.
|
||||||
|
During DeliverTx the state transition function is applied to the blockchain state and the transactions
|
||||||
|
need to be fully executed.
|
||||||
|
|
||||||
BaseApp is responsible for managing the context passed into handlers -
|
BaseApp is responsible for managing the context passed into handlers -
|
||||||
it makes the block header available and provides the right stores for CheckTx and DeliverTx.
|
it makes the block header available and provides the right stores for CheckTx and DeliverTx.
|
||||||
|
|
Loading…
Reference in New Issue