util

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountDetailsURL       = "/auth/accounts/%v"
	LastNoAckURL            = "/checkpoints/last-no-ack"
	CheckpointParamsURL     = "/checkpoints/params"
	MilestoneParamsURL      = "/milestone/params"
	MilestoneCountURL       = "/milestone/count"
	ChainManagerParamsURL   = "/chainmanager/params"
	ProposersURL            = "/staking/proposer/%v"
	MilestoneProposersURL   = "/staking/milestoneProposer/%v"
	BufferedCheckpointURL   = "/checkpoints/buffer"
	LatestCheckpointURL     = "/checkpoints/latest"
	LatestMilestoneURL      = "/milestone/latest"
	CountCheckpointURL      = "/checkpoints/count"
	CurrentProposerURL      = "/staking/current-proposer"
	LatestSpanURL           = "/zena/latest-span"
	NextSpanInfoURL         = "/zena/prepare-next-span"
	NextSpanSeedURL         = "/zena/next-span-seed/%v"
	DividendAccountRootURL  = "/topup/dividend-account-root"
	ValidatorURL            = "/staking/validator/%v"
	CurrentValidatorSetURL  = "staking/validator-set"
	StakingTxStatusURL      = "/staking/isoldtx"
	TopupTxStatusURL        = "/topup/isoldtx"
	ClerkTxStatusURL        = "/clerk/isoldtx"
	ClerkEventRecordURL     = "/clerk/event-record/%d"
	LatestSlashInfoBytesURL = "/slashing/latest_slash_info_bytes"
	TickSlashInfoListURL    = "/slashing/tick_slash_infos"
	SlashingTxStatusURL     = "/slashing/isoldtx"
	SlashingTickCountURL    = "/slashing/tick-count"

	TendermintUnconfirmedTxsURL      = "/unconfirmed_txs"
	TendermintUnconfirmedTxsCountURL = "/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"
	SlashingEvent BridgeEvent = "slashing"

	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(cliCtx cliContext.CLIContext, event interface{}) (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 cliContext.CLIContext, address types.IrisAddress) (account authTypes.Account, err error)

GetAccount returns iris auth account

func GetBlockHeight

func GetBlockHeight(cliCtx cliContext.CLIContext) int64

GetBlockHeight return last successful checkpoint

func GetBridgeDBInstance

func GetBridgeDBInstance(filePath string) *leveldb.DB

GetBridgeDBInstance get sington object for bridge-db

func GetBufferedCheckpoint

func GetBufferedCheckpoint(cliCtx cliContext.CLIContext) (*hmtypes.Checkpoint, error)

GetBufferedCheckpoint return checkpoint from bueffer

func GetChainmanagerParams

func GetChainmanagerParams(cliCtx cliContext.CLIContext) (*chainManagerTypes.Params, error)

GetChainmanagerParams return chain manager params

func GetCheckpointParams

func GetCheckpointParams(cliCtx cliContext.CLIContext) (*checkpointTypes.Params, error)

GetCheckpointParams return params

func GetClerkEventRecord

func GetClerkEventRecord(cliCtx cliContext.CLIContext, stateId int64) (*clerktypes.EventRecord, error)

GetClerkEventRecord return last successful checkpoint

func GetLatestCheckpoint

func GetLatestCheckpoint(cliCtx cliContext.CLIContext) (*hmtypes.Checkpoint, error)

GetLatestCheckpoint return last successful checkpoint

func GetLatestMilestone

func GetLatestMilestone(cliCtx cliContext.CLIContext) (*hmtypes.Milestone, error)

GetLatestMilestone return last successful milestone

func GetMilestoneCount

func GetMilestoneCount(cliCtx cliContext.CLIContext) (*milestoneTypes.Count, error)

GetMilestoneCount return params

func GetMilestoneParams

func GetMilestoneParams(cliCtx cliContext.CLIContext) (*milestoneTypes.Params, error)

GetMilestoneParams return params

func GetUnconfirmedTxnCount

func GetUnconfirmedTxnCount(event interface{}) int

func GetValidatorNonce

func GetValidatorNonce(cliCtx cliContext.CLIContext, validatorID uint64) (uint64, int64, error)

GetValidatorNonce fetches validator nonce and height

func GetValidatorSet

func GetValidatorSet(cliCtx cliContext.CLIContext) (*hmtypes.ValidatorSet, error)

GetValidatorSet fetches the current validator set

func IsCatchingUp

func IsCatchingUp(cliCtx cliContext.CLIContext) bool

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

func IsCurrentProposer

func IsCurrentProposer(cliCtx cliContext.CLIContext) (bool, error)

IsCurrentProposer checks if we are current proposer

func IsEventSender

func IsEventSender(cliCtx cliContext.CLIContext, validatorID uint64) bool

IsEventSender check if we are the EventSender

func IsInMilestoneProposerList

func IsInMilestoneProposerList(cliCtx cliContext.CLIContext, count uint64) (bool, error)

IsInMilestoneProposerList checks if we are in current proposer

func IsInProposerList

func IsInProposerList(cliCtx cliContext.CLIContext, count uint64) (bool, error)

IsInProposerList checks if we are in current proposer

func IsMilestoneProposer

func IsMilestoneProposer(cliCtx cliContext.CLIContext) (bool, error)

func IsProposer

func IsProposer(cliCtx cliContext.CLIContext) (bool, error)

IsProposer checks if we are proposer

func IsPubKeyFirstByteValid

func IsPubKeyFirstByteValid(pubKey []byte) bool

IsPubKeyFirstByteValid checks the validity of the first byte of the public key. It must be 0x04 for uncompressed public keys

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

func WaitForOneEvent

func WaitForOneEvent(tx tmTypes.Tx, client *httpClient.HTTP) (tmTypes.TMEventData, error)

WaitForOneEvent subscribes to a websocket event for the given event time and returns upon receiving it one time, or when the timeout duration has expired.

This handles subscribing and unsubscribing under the hood

Types

type BridgeEvent

type BridgeEvent string

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{})

type TendermintUnconfirmedTxs

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

Jump to

Keyboard shortcuts

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