github.com/cosmos/cosmos-sdk@v0.50.10/types/abci.go (about)

     1  package types
     2  
     3  import (
     4  	abci "github.com/cometbft/cometbft/abci/types"
     5  )
     6  
     7  // InitChainer initializes application state at genesis
     8  type InitChainer func(ctx Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
     9  
    10  // PrepareCheckStater runs code during commit after the block has been committed, and the `checkState`
    11  // has been branched for the new block.
    12  type PrepareCheckStater func(ctx Context)
    13  
    14  // Precommiter runs code during commit immediately before the `deliverState` is written to the `rootMultiStore`.
    15  type Precommiter func(ctx Context)
    16  
    17  // PeerFilter responds to p2p filtering queries from Tendermint
    18  type PeerFilter func(info string) *abci.ResponseQuery
    19  
    20  // ProcessProposalHandler defines a function type alias for processing a proposer
    21  type ProcessProposalHandler func(Context, *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error)
    22  
    23  // PrepareProposalHandler defines a function type alias for preparing a proposal
    24  type PrepareProposalHandler func(Context, *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error)
    25  
    26  // ExtendVoteHandler defines a function type alias for extending a pre-commit vote.
    27  type ExtendVoteHandler func(Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
    28  
    29  // VerifyVoteExtensionHandler defines a function type alias for verifying a
    30  // pre-commit vote extension.
    31  type VerifyVoteExtensionHandler func(Context, *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error)
    32  
    33  // PreBlocker runs code before the `BeginBlocker` and defines a function type alias for executing logic right
    34  // before FinalizeBlock is called (but after its context has been set up). It is
    35  // intended to allow applications to perform computation on vote extensions and
    36  // persist their results in state.
    37  //
    38  // Note: returning an error will make FinalizeBlock fail.
    39  type PreBlocker func(Context, *abci.RequestFinalizeBlock) (*ResponsePreBlock, error)
    40  
    41  // BeginBlocker defines a function type alias for executing application
    42  // business logic before transactions are executed.
    43  //
    44  // Note: The BeginBlock ABCI method no longer exists in the ABCI specification
    45  // as of CometBFT v0.38.0. This function type alias is provided for backwards
    46  // compatibility with applications that still use the BeginBlock ABCI method
    47  // and allows for existing BeginBlock functionality within applications.
    48  type BeginBlocker func(Context) (BeginBlock, error)
    49  
    50  // EndBlocker defines a function type alias for executing application
    51  // business logic after transactions are executed but before committing.
    52  //
    53  // Note: The EndBlock ABCI method no longer exists in the ABCI specification
    54  // as of CometBFT v0.38.0. This function type alias is provided for backwards
    55  // compatibility with applications that still use the EndBlock ABCI method
    56  // and allows for existing EndBlock functionality within applications.
    57  type EndBlocker func(Context) (EndBlock, error)
    58  
    59  // EndBlock defines a type which contains endblock events and validator set updates
    60  type EndBlock struct {
    61  	ValidatorUpdates []abci.ValidatorUpdate
    62  	Events           []abci.Event
    63  }
    64  
    65  // BeginBlock defines a type which contains beginBlock events
    66  type BeginBlock struct {
    67  	Events []abci.Event
    68  }
    69  
    70  type ResponsePreBlock struct {
    71  	ConsensusParamsChanged bool
    72  }
    73  
    74  func (r ResponsePreBlock) IsConsensusParamsChanged() bool {
    75  	return r.ConsensusParamsChanged
    76  }