voting

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Round

type Round struct {
	Voting votingSync // instructionID -> instructionHash -> VoteBox

	sync.Mutex
	// contains filtered or unexported fields
}

type Storage

type Storage struct {
	*storage.Cyclic[uint32, *Round]

	// Channel for actions created by voting.
	Out chan *types.Action
	// contains filtered or unexported fields
}

Storage uses a cyclic storage that host voting processes in rounds - one round for each signingPolicy. Round for signing policy ID is stored at ID%size. When a new round is created, the old one at its place is overwritten.

Meta provides the meta data for voting processes.

func NewStorage

func NewStorage(config *config.Voting, meta meta.Meta) *Storage

func (*Storage) AddVote

func (s *Storage) AddVote(data *instruction.Data, signer common.Address, signature []byte) (*voting.Receipt, error)

AddVote adds vote to a correct vote box in a correct round and returns a receipt. If a round does not exits, an error is returned. If a VoteBox does not exist yet, a new VoteBox is created if the proposer is not limited.

func (*Storage) StoreNewRound

func (s *Storage) StoreNewRound(policy *policy.SigningPolicy)

StoreNewRound creates a round for signing policy and stores it. This in process overwrites an old round in the place of the new one. If a round is already created nothing happens.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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