feeder

package
v0.0.3-hotfix Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: LGPL-3.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BlockTopic = "block"
View Source
const SaltLength = 4

Variables

This section is empty.

Functions

func BlockDataListToBlockDataString

func BlockDataListToBlockDataString(bdList []oracletypes.BlockData) string

BlockDataListToBlockDataString converts a list of BlockData to a string

func GenerateAbstainString

func GenerateAbstainString(subs []subscriber.Subscriber) string

GenerateAbstainString generates an abstain string from a list of chains To abstain from voting, we send a prevote with a negative blocknumber -1

func GeneratePrevoteHash

func GeneratePrevoteHash(bd, salt string) string

GeneratePrevoteHash generates a prevote hash from a block data string and a salt

func GenerateSalt

func GenerateSalt() (string, error)

GenerateSalt generates a random salt string of length SaltLength by slicing a uuid string

Types

type BlockFeeder

type BlockFeeder struct {
	// contains filtered or unexported fields
}

func NewBlockFeeder

func NewBlockFeeder(
	config *config.Config,
	sc *client.SettlusClient,
	chainclients []subscriber.Subscriber,
	logger log.Logger,
) (*BlockFeeder, error)

func (*BlockFeeder) HandleAbstain

func (feeder *BlockFeeder) HandleAbstain(ctx context.Context, height int64) error

HandleAbstain Handles a prevote period when block data string cannot be gathered

func (*BlockFeeder) HandlePrevote

func (feeder *BlockFeeder) HandlePrevote(ctx context.Context, height int64) error

HandlePrevote Handles a prevote period

func (*BlockFeeder) HandleVote

func (feeder *BlockFeeder) HandleVote(ctx context.Context, height int64) error

HandleVote Handles a vote period

func (*BlockFeeder) IsPreVotingPeriod

func (feeder *BlockFeeder) IsPreVotingPeriod(height int64) bool

IsPreVotingPeriod returns true if the current height is a prevoting period

func (*BlockFeeder) IsVotingPeriod

func (feeder *BlockFeeder) IsVotingPeriod(height int64) bool

IsVotingPeriod returns true if the current height is a voting period

func (*BlockFeeder) WantAbstain

func (feeder *BlockFeeder) WantAbstain(height int64) bool

WantAbstain returns true if the feeder wants to abstain from voting

type BlockVoteInfo

type BlockVoteInfo struct {
	Height          int64
	Salt            string
	BlockDataString string
}

type Feeder

type Feeder interface {
	IsPreVotingPeriod(height int64) bool
	IsVotingPeriod(height int64) bool
	WantAbstain(height int64) bool

	HandlePrevote(ctx context.Context, height int64) error
	HandleVote(ctx context.Context, height int64) error
	HandleAbstain(ctx context.Context, height int64) error
}

func InitFeeders

func InitFeeders(config *config.Config, sc *client.SettlusClient, chainClients []subscriber.Subscriber, logger log.Logger) ([]Feeder, error)

func NewFeeder

func NewFeeder(feederType string, config *config.Config, sc *client.SettlusClient, chainClients []subscriber.Subscriber, logger log.Logger) (Feeder, error)

Jump to

Keyboard shortcuts

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