core

package
v0.0.0-...-f99c16a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnqueueFunctions = map[string]func(chan int64) error{}

Functions

func BlockRPCWorker

func BlockRPCWorker(wg *sync.WaitGroup, blockEnqueueChan chan *EnqueueData, chainID uint, chainStringID string, cfg *config.IndexConfig, chainClient *client.ChainClient, db *gorm.DB, outputChannel chan IndexerBlockEventData)

This function is responsible for making all RPC requests to the chain needed for later processing. The indexer relies on a number of RPC endpoints for full block data, including block event and transaction searches.

func FilterRPCBlockEvents

func FilterRPCBlockEvents(blockEvents []db.BlockEventDBWrapper, filterRegistry filter.StaticBlockEventFilterRegistry) ([]db.BlockEventDBWrapper, error)

func GenerateBlockFileEnqueueFunction

func GenerateBlockFileEnqueueFunction(db *gorm.DB, cfg config.IndexConfig, client *client.ChainClient, chainID uint, blockInputFile string) (func(chan *EnqueueData) error, error)

func GenerateDefaultEnqueueFunction

func GenerateDefaultEnqueueFunction(db *gorm.DB, cfg config.IndexConfig, client *client.ChainClient, chainID uint) (func(chan *EnqueueData) error, error)

The default enqueue function will enqueue blocks according to the configuration passed in. It has a few default cases detailed here: Based on whether transaction indexing or block event indexing are enabled, it will choose a start block based on passed in config values. If reindexing is disabled, it will not reindex blocks that have already been indexed. This means it may skip around finding blocks that have not been indexed according to the current configuration. If failed block reattempts are enabled, it will enqueue those according to the passed in configuration as well.

func GenerateMsgTypeEnqueueFunction

func GenerateMsgTypeEnqueueFunction(db *gorm.DB, cfg config.IndexConfig, chainID uint, msgType string) (func(chan *EnqueueData) error, error)

func HandleFailedBlock

func HandleFailedBlock(height int64, code BlockProcessingFailure, err error)

Log error to stdout. Not much else we can do to handle right now.

func InAppTxDecoder

func InAppTxDecoder(cdc probeClient.Codec) sdk.TxDecoder

Provides an in-app tx decoder. The primary use-case for this function is to allow fallback decoding if a TX fails to decode after RPC requests. This can happen in a number of scenarios, but mainly due to missing proto definitions. We can attempt a personal decode of the TX, and see if we can continue indexing based on in-app conditions (such as message type filters). This function skips a large chunk of decoding validations, and is not recommended for general use. Its main point is to skip errors that in default Cosmos TX decoders would cause the entire decode to fail.

func ProcessBlock

func ProcessBlock(blockData *ctypes.ResultBlock, blockResultsData *ctypes.ResultBlockResults, chainID uint) (models.Block, error)

Process RPC Block data into the model object used by the application.

func ProcessFees

func ProcessFees(db *gorm.DB, authInfo cosmosTx.AuthInfo, signers []models.Address) ([]models.Fee, error)

Processes fees into model form, applying denoms and addresses to them

func ProcessMessage

func ProcessMessage(messageIndex int, message types.Msg, messageLog *txtypes.LogMessage, uniqueEventTypes map[string]models.MessageEventType, uniqueEventAttributeKeys map[string]models.MessageEventAttributeKey) (string, dbTypes.MessageDBWrapper)

func ProcessRPCBlockByHeightTXs

func ProcessRPCBlockByHeightTXs(cfg *config.IndexConfig, db *gorm.DB, cl *client.ChainClient, messageTypeFilters []filter.MessageTypeFilter, blockResults *coretypes.ResultBlock, resultBlockRes *coretypes.ResultBlockResults, customParsers map[string][]parsers.MessageParser) ([]dbTypes.TxDBWrapper, *time.Time, error)

func ProcessRPCBlockEvents

func ProcessRPCBlockEvents(block *models.Block, blockEvents []abci.Event, blockLifecyclePosition models.BlockLifecyclePosition, uniqueEventTypes map[string]models.BlockEventType, uniqueAttributeKeys map[string]models.BlockEventAttributeKey, customParsers map[string][]parsers.BlockEventParser, conf config.IndexConfig) ([]db.BlockEventDBWrapper, error)

func ProcessRPCBlockResults

func ProcessRPCBlockResults(conf config.IndexConfig, block models.Block, blockResults *ctypes.ResultBlockResults, customBeginBlockParsers map[string][]parsers.BlockEventParser, customEndBlockParsers map[string][]parsers.BlockEventParser) (*db.BlockDBWrapper, error)

func ProcessRPCTXs

func ProcessRPCTXs(cfg *config.IndexConfig, db *gorm.DB, cl *client.ChainClient, messageTypeFilters []filter.MessageTypeFilter, txEventResp *cosmosTx.GetTxsEventResponse, customParsers map[string][]parsers.MessageParser) ([]dbTypes.TxDBWrapper, *time.Time, error)

ProcessRPCTXs - Given an RPC response, build out the more specific data used by the parser.

func ProcessSigners

func ProcessSigners(cl *client.ChainClient, authInfo *cosmosTx.AuthInfo, messageSigners []types.AccAddress) ([]models.Address, error)

Processes signers in a deterministic order. 1. Processes signers from the auth info 2. Processes signers from the signers array 3. Processes the fee payer

func ProcessTx

func ProcessTx(cfg *config.IndexConfig, db *gorm.DB, tx txtypes.MergedTx, messagesRaw [][]byte, customParsers map[string][]parsers.MessageParser) (txDBWapper dbTypes.TxDBWrapper, txTime time.Time, err error)

Types

type BlockProcessingFailure

type BlockProcessingFailure int
const (
	NodeMissingBlockTxs BlockProcessingFailure = iota
	BlockQueryError
	UnprocessableTxError
	OsmosisNodeRewardLookupError
	OsmosisNodeRewardIndexError
	NodeMissingHistoryForBlock
	FailedBlockEventHandling
)

type EnqueueData

type EnqueueData struct {
	Height            int64
	IndexBlockEvents  bool
	IndexTransactions bool
}

type FailedBlockHandler

type FailedBlockHandler func(height int64, code BlockProcessingFailure, err error)

type IndexerBlockEventData

type IndexerBlockEventData struct {
	BlockData                *ctypes.ResultBlock
	BlockResultsData         *ctypes.ResultBlockResults
	BlockEventRequestsFailed bool
	GetTxsResponse           *txTypes.GetTxsEventResponse
	TxRequestsFailed         bool
	IndexBlockEvents         bool
	IndexTransactions        bool
}

Wrapper types for gathering full dataset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL