checks

package
v0.0.0-...-9f5e8be Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPunishNode

func DefaultPunishNode(err error, node *models.QosNode, logger *zap.Logger) bool

DefaultPunishNode generic punisher for whenever a node returns an error independent of a specific check

func GetBlockHeightTolerance

func GetBlockHeightTolerance(chainConfiguration chain_configurations_registry.ChainConfigurationsService, chainId string, defaultValue int) int

GetBlockHeightTolerance - helper function to retrieve block height tolerance across checks

func GetDataIntegrityHeightLookback

func GetDataIntegrityHeightLookback(chainConfiguration chain_configurations_registry.ChainConfigurationsService, chainId string, defaultValue int) int

GetDataIntegrityHeightLookback - helper function ro retrieve data integrity lookback across checks

func PerformDataIntegrityCheck

func PerformDataIntegrityCheck(check *Check, calculatePayload GetBlockByNumberPayloadFmter, path string, retrieveBlockIdentifier BlockHashParser, logger *zap.Logger)

PerformDataIntegrityCheck: is the default implementation of a data integrity check by:

func PerformDefaultHeightCheck

func PerformDefaultHeightCheck(check *Check, payload string, path string, parseHeight HeightJsonParser, logger *zap.Logger)

PerformDefaultHeightCheck is the default implementation of a height check by: 0. Filtering out nodes that have not been checked since defaultNodeHeightCheckInterval 1. Sending height request via payload to all the nodes 2. Punishing all nodes that return an error 3. Filtering out nodes that are returning a height out of the zScore threshold 4. Punishing the nodes with defaultCheckPenalty that exceed the height tolerance.

func SendRelaysAsync

func SendRelaysAsync(relayer pokt_v0.PocketRelayer, nodes []*models.QosNode, payload string, method string, path string) chan *nodeRelayResponse

Types

type BlockHashParser

type BlockHashParser func(response string) (string, error)

type Check

type Check struct {
	NodeList             []*qos_models.QosNode
	PocketRelayer        pokt_v0.PocketRelayer
	ChainConfiguration   chain_configurations_registry.ChainConfigurationsService
	ChainNetworkProvider config2.ChainNetworkProvider
}

func NewCheck

func NewCheck(pocketRelayer pokt_v0.PocketRelayer, chainConfiguration chain_configurations_registry.ChainConfigurationsService, chainNetworkProvider config2.ChainNetworkProvider) *Check

func (*Check) IsEvmChain

func (c *Check) IsEvmChain(node *qos_models.QosNode) bool

func (*Check) IsPoktChain

func (c *Check) IsPoktChain(node *qos_models.QosNode) bool

func (*Check) IsSolanaChain

func (c *Check) IsSolanaChain(node *qos_models.QosNode) bool

type CheckJob

type CheckJob interface {
	Perform()
	Name() string
	ShouldRun() bool
	SetNodes(nodes []*qos_models.QosNode)
}

type GetBlockByNumberPayloadFmter

type GetBlockByNumberPayloadFmter func(blockToFind uint64) string

type HeightJsonParser

type HeightJsonParser func(response string) (uint64, error)

Jump to

Keyboard shortcuts

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