util

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountDetailsURL       = "/cosmos/auth/v1beta1/accounts/%v"
	AccountParamsURL        = "/cosmos/auth/v1beta1/params"
	LastNoAckURL            = "/checkpoints/last-no-ack"
	CheckpointParamsURL     = "/checkpoints/params"
	CheckpointSignaturesURL = "/checkpoint/signatures/%v"
	MilestoneCountURL       = "/milestone/count"
	ChainManagerParamsURL   = "/chainmanager/params"
	ProposersURL            = "/stake/proposers/%v"
	MilestoneProposersURL   = "/milestone/proposer/%v"
	BufferedCheckpointURL   = "/checkpoints/buffer"
	LatestCheckpointURL     = "/checkpoints/latest"
	LatestMilestoneURL      = "/milestone/latest"
	CountCheckpointURL      = "/checkpoints/count"
	CurrentProposerURL      = "/checkpoint/proposers/current"
	LatestSpanURL           = "/bor/span/latest"
	NextSpanInfoURL         = "/bor/span/prepare"
	NextSpanSeedURL         = "/bor/span/seed/%v"
	DividendAccountRootURL  = "/topup/dividend-account-root"
	ValidatorURL            = "/stake/validator/%v"
	CurrentValidatorSetURL  = "/stake/validator-set"
	StakingTxStatusURL      = "/stake/is-old-tx"
	TopupTxStatusURL        = "/topup/isoldtx"
	ClerkTxStatusURL        = "/clerk/isoldtx"
	ClerkEventRecordURL     = "/clerk/event-record/%d"

	CometBFTUnconfirmedTxsURL      = "/unconfirmed_txs"
	CometBFTUnconfirmedTxsCountURL = "/num_unconfirmed_txs"

	TransactionTimeout      = 1 * time.Minute
	CommitTimeout           = 2 * time.Minute
	TaskDelayBetweenEachVal = 10 * time.Second
	RetryTaskDelay          = 12 * time.Second
	RetryStateSyncTaskDelay = 24 * time.Second

	// Bridge event types
	StakingEvent BridgeEvent = "staking"
	TopupEvent   BridgeEvent = "topup"
	ClerkEvent   BridgeEvent = "clerk"

	BridgeDBFlag = "bridge-db"
)

Variables

This section is empty.

Functions

func AppendPrefix

func AppendPrefix(signerPubKey []byte) []byte

AppendPrefix returns PublicKey in uncompressed format

func CalculateTaskDelay

func CalculateTaskDelay(event interface{}, cdc codec.Codec) (bool, time.Duration)

CalculateTaskDelay calculates delay required for current validator to propose the tx It solves for multiple validators sending same transaction.

func CloseBridgeDBInstance

func CloseBridgeDBInstance()

CloseBridgeDBInstance closes bridge-db instance

func CreateURLWithQuery

func CreateURLWithQuery(uri string, param map[string]interface{}) (string, error)

CreateURLWithQuery receives the uri and parameters in key value form it will return the new url with the given query from the parameter

func GetAccount

func GetAccount(cliCtx client.Context, address string) (sdk.AccountI, error)

GetAccount returns heimdall auth account

func GetAccountParamsURL

func GetAccountParamsURL(cdc codec.Codec) (*authtypes.Params, error)

GetAccountParamsURL return auth account params

func GetBridgeDBInstance

func GetBridgeDBInstance(filePath string) *leveldb.DB

GetBridgeDBInstance get singleton object for bridge-db

func GetBufferedCheckpoint

func GetBufferedCheckpoint(cdc codec.Codec) (*checkpointTypes.Checkpoint, error)

GetBufferedCheckpoint return checkpoint from buffer

func GetChainmanagerParams

func GetChainmanagerParams(cdc codec.Codec) (*chainmanagertypes.Params, error)

GetChainmanagerParams return chain manager params

func GetCheckpointParams

func GetCheckpointParams(cdc codec.Codec) (*checkpointTypes.Params, error)

GetCheckpointParams return checkpoint params

func GetClerkEventRecord

func GetClerkEventRecord(stateId int64, cdc codec.Codec) (*clerktypes.EventRecord, error)

GetClerkEventRecord return last successful checkpoint

func GetLatestCheckpoint

func GetLatestCheckpoint(cdc codec.Codec) (*checkpointTypes.Checkpoint, error)

GetLatestCheckpoint return last successful checkpoint

func GetLatestMilestone

func GetLatestMilestone(cdc codec.Codec) (*milestoneTypes.Milestone, error)

GetLatestMilestone return last successful milestone

func GetMilestoneCount

func GetMilestoneCount(cdc codec.Codec) (uint64, error)

GetMilestoneCount return milestones count

func GetUnconfirmedTxnCount

func GetUnconfirmedTxnCount(event interface{}) int

func GetValidatorNonce

func GetValidatorNonce(validatorID uint64, cdc codec.Codec) (uint64, error)

GetValidatorNonce fetches validator nonce and height

func GetValidatorSet

func GetValidatorSet(cdc codec.Codec) (*staketypes.ValidatorSet, error)

GetValidatorSet fetches the current validator set

func IsCatchingUp

func IsCatchingUp(cliCtx client.Context, ctx context.Context) bool

IsCatchingUp checks if the heimdall node you are connected to is fully synced or not returns true when synced

func IsCurrentProposer

func IsCurrentProposer(cdc codec.Codec) (bool, error)

IsCurrentProposer checks if we are current proposer

func IsEventSender

func IsEventSender(validatorID uint64, cdc codec.Codec) bool

IsEventSender checks if the validatorID belongs to the event sender

func IsInMilestoneProposerList

func IsInMilestoneProposerList(count uint64, cdc codec.Codec) (bool, error)

IsInMilestoneProposerList checks if we are in the current milestone proposers list

func IsInProposerList

func IsInProposerList(count uint64, cdc codec.Codec) (bool, error)

IsInProposerList checks if we are in the current proposers list

func IsMilestoneProposer

func IsMilestoneProposer(cdc codec.Codec) (bool, error)

IsMilestoneProposer checks if we are the milestone proposer

func IsProposer

func IsProposer(cdc codec.Codec) (bool, error)

IsProposer checks if we are proposer

func LogElapsedTimeForStateSyncedEvent

func LogElapsedTimeForStateSyncedEvent(event interface{}, functionName string, startTime time.Time)

LogElapsedTimeForStateSyncedEvent logs useful info for StateSynced events

func Logger

func Logger() log.Logger

Logger returns logger singleton instance

Types

type BridgeEvent

type BridgeEvent string

type CometBFTUnconfirmedTxs

type CometBFTUnconfirmedTxs struct {
	Result struct {
		Total string   `json:"total"`
		Txs   []string `json:"txs"`
	} `json:"result"`
}

type NoopLogger

type NoopLogger struct{}

NoopLogger no operational logger

func (NoopLogger) Fatal

func (NoopLogger) Fatal(...interface{})

func (NoopLogger) Fatalf

func (NoopLogger) Fatalf(string, ...interface{})

func (NoopLogger) Fatalln

func (NoopLogger) Fatalln(...interface{})

func (NoopLogger) Panic

func (NoopLogger) Panic(...interface{})

func (NoopLogger) Panicf

func (NoopLogger) Panicf(string, ...interface{})

func (NoopLogger) Panicln

func (NoopLogger) Panicln(...interface{})

func (NoopLogger) Print

func (NoopLogger) Print(...interface{})

func (NoopLogger) Printf

func (NoopLogger) Printf(string, ...interface{})

func (NoopLogger) Println

func (NoopLogger) Println(...interface{})

Jump to

Keyboard shortcuts

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