Celestia makes use of a Cosmos SDK AnteHandler in order to reject decodable sdk.Txs that do not meet certain criteria. The AnteHandler is defined in app/ante/ante.go and is invoked at multiple times during the transaction lifecycle:

  1. CheckTx prior to the transaction entering the mempool
  2. PrepareProposal when the block proposer includes the transaction in a block proposal
  3. ProcessProposal when validators validate the transaction in a block proposal
  4. DeliverTx when full nodes execute the transaction in a decided block

The AnteHandler chains together several decorators to ensure the following criteria are met:

  • The tx does not contain any extension options.
  • The tx passes ValidateBasic().
  • The tx's timeout_height has not been reached if one is specified.
  • The tx's memo is <= the max memo characters where MaxMemoCharacters = 256.
  • The tx's gas_limit is > the gas consumed based on the tx's size where TxSizeCostPerByte = 10.
  • The tx's feepayer has enough funds to pay fees for the tx. The tx's feepayer is the feegranter (if specified) or the tx's first signer. Note the feegrant module is enabled.
  • The tx's count of signatures <= the max number of signatures. The max number of signatures is TxSigLimit = 7.
  • The tx's gas_limit is > the gas consumed based on the tx's signatures.
  • The tx's signatures are valid. For each signature, ensure that the signature's sequence number (a.k.a nonce) matches the account sequence number of the signer.
  • The tx's gas_limit is > the gas consumed based on the blob size(s). Since blobs are charged based on the number of shares they occupy, the gas consumed is calculated as follows: gasToConsume = sharesNeeded(blob) * bytesPerShare * gasPerBlobByte. Where bytesPerShare is a global constant (an alias for ShareSize = 512) and gasPerBlobByte is a governance parameter that can be modified (the DefaultGasPerBlobByte = 8).
  • The tx's total blob size is <= the max blob size. The max blob size is derived from the maximum valid square size. The max valid square size is the minimum of: GovMaxSquareSize and SquareSizeUpperBound.
  • The tx does not contain a message of type MsgSubmitProposal with zero proposal messages.
  • The tx is not an IBC packet or update message that has already been processed.

In addition to the above criteria, the AnteHandler also has a number of side-effects:

  • Tx fees are deducted from the tx's feepayer and added to the fee collector module account.
  • Tx priority is calculated based on the smallest denomination of gas price in the tx and set in context.
  • The nonce of all tx signers is incremented by 1.