state

package
v0.2403.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImmutableState

type ImmutableState struct {
	// contains filtered or unexported fields
}

ImmutableState is the immutable consensus state wrapper.

func NewImmutableState

func NewImmutableState(ctx context.Context, state api.ApplicationQueryState, version int64) (*ImmutableState, error)

NewImmutableState returns immutable governance state.

func (*ImmutableState) ActiveProposals

func (s *ImmutableState) ActiveProposals(ctx context.Context) ([]*governance.Proposal, error)

ActiveProposals looks up all active proposals.

func (*ImmutableState) ConsensusParameters

func (s *ImmutableState) ConsensusParameters(ctx context.Context) (*governance.ConsensusParameters, error)

ConsensusParameters returns the governance consensus parameters.

func (*ImmutableState) NextProposalIdentifier

func (s *ImmutableState) NextProposalIdentifier(ctx context.Context) (uint64, error)

NextProposalIdentifier looks up the next proposal identifier.

func (*ImmutableState) PendingUpgradeProposal

func (s *ImmutableState) PendingUpgradeProposal(ctx context.Context, id uint64) (*governance.UpgradeProposal, error)

PendingUpgradeProposal looks up a pending upgrade proposal by its identifier.

func (*ImmutableState) PendingUpgrades

func (s *ImmutableState) PendingUpgrades(ctx context.Context) ([]*upgrade.Descriptor, error)

PendingUpgrades looks up all pending upgrades.

func (*ImmutableState) Proposal

func (s *ImmutableState) Proposal(ctx context.Context, id uint64) (*governance.Proposal, error)

Proposal looks up a proposal by its identifier.

func (*ImmutableState) Proposals

func (s *ImmutableState) Proposals(ctx context.Context) ([]*governance.Proposal, error)

Proposals looks up all proposals.

func (*ImmutableState) Votes

func (s *ImmutableState) Votes(ctx context.Context, id uint64) ([]*governance.VoteEntry, error)

Votes looks up all votes for a proposal.

type MutableState

type MutableState struct {
	*ImmutableState
	// contains filtered or unexported fields
}

MutableState is a mutable consensus state wrapper.

func NewMutableState

func NewMutableState(tree mkvs.KeyValueTree) *MutableState

NewMutableState creates a new mutable governance state.

func (*MutableState) RemoveActiveProposal

func (s *MutableState) RemoveActiveProposal(ctx context.Context, proposal *governance.Proposal) error

RemoveActiveProposal removes an active proposal.

func (*MutableState) RemovePendingUpgrade

func (s *MutableState) RemovePendingUpgrade(ctx context.Context, epoch beacon.EpochTime, proposalID uint64) error

RemovePendingUpgrade removes a pending upgrade.

func (*MutableState) RemovePendingUpgradesForEpoch

func (s *MutableState) RemovePendingUpgradesForEpoch(ctx context.Context, epoch beacon.EpochTime) error

RemovePendingUpgradesForEpoch removes pending upgrades for epoch.

func (*MutableState) SetActiveProposal

func (s *MutableState) SetActiveProposal(ctx context.Context, proposal *governance.Proposal) error

SetActiveProposal sets active proposal.

func (*MutableState) SetConsensusParameters

func (s *MutableState) SetConsensusParameters(ctx context.Context, params *governance.ConsensusParameters) error

SetConsensusParameters sets governance consensus parameters.

NOTE: This method must only be called from InitChain/EndBlock contexts.

func (*MutableState) SetNextProposalIdentifier

func (s *MutableState) SetNextProposalIdentifier(ctx context.Context, id uint64) error

SetNextProposalIdentifier sets the next proposal identifier.

func (*MutableState) SetPendingUpgrade

func (s *MutableState) SetPendingUpgrade(ctx context.Context, proposalID uint64, upgrade *upgrade.Descriptor) error

SetPendingUpgrade sets a pending upgrade.

func (*MutableState) SetProposal

func (s *MutableState) SetProposal(ctx context.Context, proposal *governance.Proposal) error

SetProposal sets a proposal.

func (*MutableState) SetVote

func (s *MutableState) SetVote(
	ctx context.Context,
	proposalID uint64,
	voter staking.Address,
	vote governance.Vote,
) error

SetVote sets a vote for a proposal.

Jump to

Keyboard shortcuts

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