voting

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpochVoteSubmissions

type EpochVoteSubmissions struct {
	TotalSubmissionWeight abi.TokenAmount
	MostVotedKey          []byte
	Submitters            cid.Cid // TCid<THamt<Address, ()>>
	SubmissionWeights     cid.Cid // TCid<THamt<UniqueBytesKey, TokenAmount>>
	Submissions           cid.Cid // TCid<THamt<UniqueBytesKey, T>>
}

EpochVoteSubmissions tracks all the vote submissions of an epoch for a checkpoint voting.

func (*EpochVoteSubmissions) MarshalCBOR

func (t *EpochVoteSubmissions) MarshalCBOR(w io.Writer) error

func (*EpochVoteSubmissions) UnmarshalCBOR

func (t *EpochVoteSubmissions) UnmarshalCBOR(r io.Reader) (err error)

type Ratio

type Ratio struct {
	Num   uint64
	Denom uint64
}

func (*Ratio) MarshalCBOR

func (t *Ratio) MarshalCBOR(w io.Writer) error

func (*Ratio) UnmarshalCBOR

func (t *Ratio) UnmarshalCBOR(r io.Reader) (err error)

type Voting

type Voting struct {
	GenesisEpoch         abi.ChainEpoch
	SubmissionPeriod     abi.ChainEpoch
	LastVotingExecuted   abi.ChainEpoch
	ExecutableEpochQueue []abi.ChainEpoch //Option<BTreeSet<ChainEpoch>>
	EpochVoteSubmission  cid.Cid          //TCid<THamt<ChainEpoch, EpochVoteSubmissions<T>>>
	Ratio                Ratio
}

Voting is the Go implementation of the Voting<T> struct from Rust ipc-actors

func NewWithRatio

func NewWithRatio(store adt.Store, genesis, period abi.ChainEpoch, ratio Ratio) (Voting, error)

func (*Voting) MarshalCBOR

func (t *Voting) MarshalCBOR(w io.Writer) error

func (*Voting) UnmarshalCBOR

func (t *Voting) UnmarshalCBOR(r io.Reader) (err error)

func (*Voting) ValidatorHasVoted

func (v *Voting) ValidatorHasVoted(s adt.Store, epoch abi.ChainEpoch, validator address.Address) (bool, error)

ValidatorHasVoted checks if a validator has already voted for a checkpoint.

This function expects the ID (f0 address) of the validator address, which is the one used to index validators in the actor state. f1 and f3 addresses will have to be translated to f0 addresses before using this function.

Jump to

Keyboard shortcuts

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