util

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: GPL-3.0 Imports: 25 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 = "/checkpoints/signatures/%v"
	ChainManagerParamsURL   = "/chainmanager/params"
	ProposersURL            = "/stake/proposers/%v"
	BufferedCheckpointURL   = "/checkpoints/buffer"
	LatestCheckpointURL     = "/checkpoints/latest"
	CountCheckpointURL      = "/checkpoints/count"
	CurrentProposerURL      = "/stake/proposers/current"
	LatestSpanURL           = "/bor/spans/latest"
	SpanByIdURL             = "/bor/spans/%v"
	NextSpanInfoURL         = "/bor/spans/prepare"
	NextSpanSeedURL         = "/bor/spans/seed/%v"
	ProducerVotesURL        = "/bor/producer-votes/%v"
	DividendAccountRootURL  = "/topup/dividend-account-root"
	ValidatorURL            = "/stake/validator/%v"
	CurrentValidatorSetURL  = "/stake/validators-set"
	StakingTxStatusURL      = "/stake/is-old-tx"
	TopupTxStatusURL        = "/topup/is-old-tx"
	ClerkTxStatusURL        = "/clerk/is-old-tx"
	ClerkEventRecordURL     = "/clerk/event-records/%d"
	LatestMilestoneURL      = "/milestones/latest"

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

	TaskDelayBetweenEachVal = 10 * time.Second
	RetryTaskDelay          = 12 * time.Second
	RetryStateSyncTaskDelay = 24 * time.Second

	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 the current validator to propose the tx It solves for multiple validators sending the 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(ctx context.Context, 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 GetCheckpointAckCount added in v0.2.6

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

GetCheckpointAckCount return checkpoint ack count

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 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 the current proposer

func IsEventSender

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

IsEventSender checks if the validatorID belongs to the event sender

func IsInProposerList

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

IsInProposerList checks if we are in the current proposers list

func IsProposer

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

IsProposer checks if the current is the 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