votepower

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrVotingPowerNotEqualOne ..
	ErrVotingPowerNotEqualOne = errors.New("voting power not equal to one")
)

Functions

func AggregateRosters

func AggregateRosters(
	rosters []*Roster,
) map[common.Address][]VoteOnSubcomittee

AggregateRosters ..

Types

type AccommodateHarmonyVote

type AccommodateHarmonyVote struct {
	PureStakedVote
	IsHarmonyNode  bool        `json:"-"`
	OverallPercent numeric.Dec `json:"overall-percent"`
}

AccommodateHarmonyVote ..

func (AccommodateHarmonyVote) String

func (v AccommodateHarmonyVote) String() string

String ..

type Ballot

type Ballot struct {
	SignerPubKeys   []bls.SerializedPublicKey `json:"bls-public-keys"`
	BlockHeaderHash common.Hash               `json:"block-header-hash"`
	Signature       []byte                    `json:"bls-signature"`
	Height          uint64                    `json:"block-height"`
	ViewID          uint64                    `json:"view-id"`
}

Ballot is a vote cast by a validator

func (Ballot) MarshalJSON

func (b Ballot) MarshalJSON() ([]byte, error)

MarshalJSON ..

func (Ballot) String

func (b Ballot) String() string

type PureStakedVote

type PureStakedVote struct {
	EarningAccount common.Address          `json:"earning-account"`
	Identity       bls.SerializedPublicKey `json:"bls-public-key"`
	GroupPercent   numeric.Dec             `json:"group-percent"`
	EffectiveStake numeric.Dec             `json:"effective-stake"`
	RawStake       numeric.Dec             `json:"raw-stake"`
}

PureStakedVote ..

type Roster

type Roster struct {
	Voters map[bls.SerializedPublicKey]*AccommodateHarmonyVote

	ShardID      uint32
	OrderedSlots []bls.SerializedPublicKey
	// contains filtered or unexported fields
}

Roster ..

func Compute

func Compute(subComm *shard.Committee, epoch *big.Int) (*Roster, error)

Compute creates a new roster based off the shard.SlotList

func NewRoster

func NewRoster(shardID uint32) *Roster

NewRoster ..

func (Roster) String

func (r Roster) String() string

func (*Roster) VotePowerByMask

func (r *Roster) VotePowerByMask(mask *bls.Mask) numeric.Dec

VotePowerByMask return the vote power with the given BLS mask. The result is a number between 0 and 1.

type Round

type Round struct {
	AggregatedVote *bls_core.Sign
	BallotBox      map[bls.SerializedPublicKey]*Ballot
}

Round is a round of voting in any FBFT phase

func NewRound

func NewRound() *Round

NewRound ..

type VoteOnSubcomittee

type VoteOnSubcomittee struct {
	AccommodateHarmonyVote
	ShardID uint32
}

VoteOnSubcomittee ..

func (VoteOnSubcomittee) MarshalJSON

func (v VoteOnSubcomittee) MarshalJSON() ([]byte, error)

MarshalJSON ..

Jump to

Keyboard shortcuts

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