voting

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Receipt

type Receipt struct {
	InstructionHash               common.Hash   `json:"instructionHash"`
	Sequence                      uint64        `json:"sequence"`
	Signature                     hexutil.Bytes `json:"signature"`
	AdditionalVariableMessageHash common.Hash   `json:"additionalVariableMessageHash"`
	Timestamp                     uint64        `json:"timestamp"`
	VoteHash                      common.Hash   `json:"voteHash"`
}

Receipt is the vote receipt returned to a voter after a valid instruction is accepted.

func (*Receipt) Hash

func (r *Receipt) Hash() (common.Hash, error)

Hash computes the ABI-encoded Keccak256 hash of the receipt fields.

func (*Receipt) Sign

func (r *Receipt) Sign(sk *ecdsa.PrivateKey, chainID uint64) (*SignedReceipt, error)

Sign signs the receipt with the private key and returns signed receipt.

func (*Receipt) SignHash added in v0.0.18

func (r *Receipt) SignHash(chainID uint64) ([32]byte, error)

SignHash returns the domain-separated, chain-bound preimage signed over a receipt: signing.Payload{csigning.ProxyVoteReceipt, chainID, Hash()}.Hash().

type SignedReceipt

type SignedReceipt struct {
	Receipt   Receipt       `json:"receipt"`
	Signature hexutil.Bytes `json:"signature"`
}

SignedReceipt combines Receipt and its signature.

func (*SignedReceipt) RecoverPubKey

func (sr *SignedReceipt) RecoverPubKey(chainID uint64) (*ecdsa.PublicKey, error)

RecoverPubKey recovers signer of the signed receipt.

type Status

type Status struct {
	InstructionHash    common.Hash      `json:"instructionHash"`
	Finalized          bool             `json:"finalized"`
	Deleted            bool             `json:"deleted"`
	Start              uint64           `json:"start"`
	End                uint64           `json:"end"`
	Weight             uint16           `json:"weight"`
	Voters             []common.Address `json:"voters"` // addresses that successfully voted; their individual weights sum to Weight.
	Threshold          uint16           `json:"threshold"`
	Cosigners          uint16           `json:"cosigners"`
	CosignersThreshold uint16           `json:"cosignersThreshold"`
}

Status holds the voting state for a single instruction hash within a round.

type Statuses

type Statuses struct {
	InstructionID common.Hash `json:"instructionId"`
	FinalizedHash common.Hash `json:"finalizedHash"`
	Status        []Status    `json:"status"`
}

Statuses aggregates all voting statuses for a given instruction ID within a reward epoch.

Jump to

Keyboard shortcuts

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