epochLeader

package
v2.1.6-beta.4+incompat... Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: GPL-3.0 Imports: 19 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Big0                                   = big.NewInt(0)
	ErrInvalidRandomProposerSelection      = errors.New("Invalid Random Proposer Selection")                  //Invalid Random Proposer Selection
	ErrInvalidEpochProposerSelection       = errors.New("Invalid Epoch Proposer Selection")                   //Invalid Random Proposer Selection
	ErrInvalidProbabilityfloat2big         = errors.New("Invalid Transform Probability From Float To Bigint") //Invalid Transform Probability From Float To Bigint
	ErrInvalidGenerateCommitment           = errors.New("Invalid Commitment Generation")                      //Invalid Commitment Generation
	ErrInvalidArrayPieceGeneration         = errors.New("Invalid ArrayPiece Generation")                      //Invalid ArrayPiece Generation
	ErrInvalidDleqProofGeneration          = errors.New("Invalid DLEQ Proof Generation")                      //Invalid DLEQ Proof Generation
	ErrInvalidSecretMessageArrayGeneration = errors.New("Invalid Secret Message Array Generation")            //Invalid Secret Message Array Generation
	ErrInvalidSortPublicKeys               = errors.New("Invalid PublicKeys Sort Operation")                  //Invalid PublicKeys Sort Operation
	ErrInvalidSlotLeaderSequenceGeneration = errors.New("Invalid Slot Leader Sequence Generation")            //Invalid Slot Leader Sequence Generation
	ErrInvalidSlotLeaderLocation           = errors.New("Invalid Slot Leader Location")                       //Invalid Slot Leader Location
	ErrInvalidSlotLeaderProofGeneration    = errors.New("Invalid Slot Leader Proof Generation")               //Invalid Slot Leader Proof Generation
)

Functions

func CalEpochProbabilityStaker

func CalEpochProbabilityStaker(staker *vm.StakerInfo, epochID uint64) (infors []vm.ClientProbability, totalProbability *big.Int, err error)

TODO Is this right?

func CleanInactiveValidator

func CleanInactiveValidator(stateDb *state.StateDB, epochID uint64)

func ListValidator

func ListValidator(stateDb *state.StateDB)

func StakeOutRun

func StakeOutRun(stateDb *state.StateDB, epochID uint64) bool

Types

type EpochInfo

type EpochInfo struct {
	EpochID     uint64
	BlockNumber uint64
}

type Epocher

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

func GetEpocher

func GetEpocher() *Epocher

func NewEpocher

func NewEpocher(blc *core.BlockChain) *Epocher

func NewEpocherWithLBN

func NewEpocherWithLBN(blc *core.BlockChain, rbn string, epdbn string) *Epocher

func (*Epocher) CalProbability

func (e *Epocher) CalProbability(amountWin *big.Int, lockTime uint64) *big.Int

func (*Epocher) GetBlkChain

func (e *Epocher) GetBlkChain() *core.BlockChain

func (*Epocher) GetCurrentHeader

func (e *Epocher) GetCurrentHeader() *types.Header

func (*Epocher) GetEpLeaderGroup

func (e *Epocher) GetEpLeaderGroup(epochID uint64) []vm.Leader

func (*Epocher) GetEpochLastBlkNumber

func (e *Epocher) GetEpochLastBlkNumber(targetEpochId uint64) uint64

NOTE: if the targetEpochId is future, will return current blockNumber.

func (*Epocher) GetEpochLeaders

func (e *Epocher) GetEpochLeaders(epochID uint64) [][]byte

get epochLeaders of epochID in localdb

func (*Epocher) GetEpochProbability

func (e *Epocher) GetEpochProbability(epochId uint64, addr common.Address) (*vm.ValidatorInfo, error)

incentive use it.

func (*Epocher) GetLeaderGroup

func (e *Epocher) GetLeaderGroup(epochID uint64) []vm.Leader

func (*Epocher) GetProposerBn256PK

func (e *Epocher) GetProposerBn256PK(epochID uint64, idx uint64, addr common.Address) []byte

func (*Epocher) GetRBProposer

func (e *Epocher) GetRBProposer(epochID uint64) [][]byte

func (*Epocher) GetRBProposerG1

func (e *Epocher) GetRBProposerG1(epochID uint64) []bn256.G1

func (*Epocher) GetRBProposerGroup

func (e *Epocher) GetRBProposerGroup(epochID uint64) []vm.Leader

get rbLeaders of epochID in localdb only for incentive. for incentive.

func (*Epocher) GetTargetBlkNumber

func (e *Epocher) GetTargetBlkNumber(epochId uint64) uint64

func (*Epocher) GetWhiteArrayByEpochId

func (e *Epocher) GetWhiteArrayByEpochId(epochId uint64) ([][]byte, error)

func (*Epocher) GetWhiteByEpochId

func (e *Epocher) GetWhiteByEpochId(epochId uint64) ([]string, error)

func (*Epocher) GetWhiteInfo

func (e *Epocher) GetWhiteInfo(epochId uint64) (*vm.UpgradeWhiteEpochLeaderParam, error)

func (*Epocher) IsGenerateELSuc

func (e *Epocher) IsGenerateELSuc(epochID uint64) bool

func (*Epocher) IsGenerateRBPSuc

func (e *Epocher) IsGenerateRBPSuc(epochID uint64) bool

func (*Epocher) SelectLeadersLoop

func (e *Epocher) SelectLeadersLoop(epochId uint64) error

func (*Epocher) SetEpochIncentive

func (e *Epocher) SetEpochIncentive(epochId uint64, infors [][]vm.ClientIncentive) (err error)

type Proposer

type Proposer struct {
	PubSec256     []byte
	PubBn256      []byte
	Probabilities *big.Int
}

type ProposerSorter

type ProposerSorter []Proposer

func (ProposerSorter) Len

func (s ProposerSorter) Len() int

Len()

func (ProposerSorter) Less

func (s ProposerSorter) Less(i, j int) bool

func (ProposerSorter) Swap

func (s ProposerSorter) Swap(i, j int)

Swap()

type RefundInfo

type RefundInfo struct {
	Addr   common.Address
	Amount *big.Int
}

Jump to

Keyboard shortcuts

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