votepower

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// HarmonysShare ..
	HarmonysShare = numeric.MustNewDecFromStr("0.68")
	// StakersShare ..
	StakersShare = numeric.MustNewDecFromStr("0.32")
	// ErrVotingPowerNotEqualOne ..
	ErrVotingPowerNotEqualOne = errors.New("voting power not equal to one")
)

Functions

func AggregateRosters

func AggregateRosters(rosters []RosterPerShard) map[common.Address]Staker

AggregateRosters ..

Types

type Ballot

type Ballot struct {
	SignerPubKey       shard.BlsPublicKey `json:"bls-public-key"`
	Signature          *bls.Sign          `json:"signature"`
	OptSerializedBlock []byte             `json:"opt-rlp-encoded-block"`
}

Ballot is a vote cast by a validator

type BallotResults added in v1.3.1

type BallotResults struct {
	Signature shard.BLSSignature // (aggregated) signature
	Bitmap    []byte             // corresponding bitmap mask for agg signature
}

BallotResults are a completed round of votes

func (BallotResults) EncodePair added in v1.3.1

func (b BallotResults) EncodePair() (string, string)

EncodePair returns hex encoded tuple (signature, bitmap)

type Roster

type Roster struct {
	Voters                          map[shard.BlsPublicKey]stakedVoter
	OurVotingPowerTotalPercentage   numeric.Dec
	TheirVotingPowerTotalPercentage numeric.Dec
	RawStakedTotal                  numeric.Dec
	HmySlotCount                    int64
}

Roster ..

func Compute

func Compute(staked shard.SlotList) (*Roster, error)

Compute creates a new roster based off the shard.SlotList

func NewRoster

func NewRoster() *Roster

NewRoster ..

func (*Roster) JSON

func (r *Roster) JSON() string

JSON dump

type RosterPerShard

type RosterPerShard struct {
	ShardID uint32
	Record  *Roster
}

RosterPerShard ..

type Round

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

Round is a round of voting in any FBFT phase

func NewRound

func NewRound() *Round

NewRound ..

type Staker

type Staker struct {
	TotalEffectiveStake numeric.Dec
	VotingPower         []staking.VotePerShard
	BLSPublicKeysOwned  []staking.KeysPerShard
}

Staker ..

Jump to

Keyboard shortcuts

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