Messages

TODO make this file conform to typical messages spec

Handlers

The auth module presently has no transaction handlers of its own, but does expose the special AnteHandler, used for performing basic validity checks on a transaction, such that it could be thrown out of the mempool. Note that the ante handler is called on CheckTx, but also on DeliverTx, as Tendermint proposers presently have the ability to include in their proposed block transactions which fail CheckTx.

Ante Handler

anteHandler(ak AccountKeeper, fck FeeCollectionKeeper, tx sdk.Tx)
  if !tx.(StdTx)
    fail with "not a StdTx"

  if isCheckTx and tx.Fee < config.SubjectiveMinimumFee
    fail with "insufficient fee for mempool inclusion"

  if tx.ValidateBasic() != nil
    fail with "tx failed ValidateBasic"

  if tx.Fee > 0
    account = GetAccount(tx.GetSigners()[0])
    coins := acount.GetCoins()
    if coins < tx.Fee
      fail with "insufficient fee to pay for transaction"
    account.SetCoins(coins - tx.Fee)
    fck.AddCollectedFees(tx.Fee)

  for index, signature in tx.GetSignatures()
    account = GetAccount(tx.GetSigners()[index])
    bytesToSign := StdSignBytes(chainID, acc.GetAccountNumber(),
      acc.GetSequence(), tx.Fee, tx.Msgs, tx.Memo)
    if !signature.Verify(bytesToSign)
      fail with "invalid signature"

  return
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Last Updated: 2/21/2019, 2:21:57 AM