policy

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WeightOfSigners

func WeightOfSigners(signers []common.Address, signingPolicy *policy.SigningPolicy) uint16

WeightOfSigners returns the weight of the signers in slice.

If a signer is duplicated, the weight is considered only once.

Types

type Storage

type Storage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Storage holds policies. Since policies are being added and the active policy is being modified, When a policy is added in a the SigningPolicies map, it is never modified.

func InitializeStorage

func InitializeStorage() *Storage

InitializeStorage returns an empty policy storage.

func (*Storage) ActiveSigningPolicy

func (s *Storage) ActiveSigningPolicy() (*policy.SigningPolicy, error)

ActiveSigningPolicy returns a copy of the currently active policy.

func (*Storage) ActiveSigningPolicyPublicKeys

func (s *Storage) ActiveSigningPolicyPublicKeys() ([]*ecdsa.PublicKey, error)

ActiveSigningPolicyPublicKeys returns the public keys for the active policy in voter order.

func (*Storage) DestroyState

func (s *Storage) DestroyState()

DestroyState resets the storage to an uninitialized state.

func (*Storage) Info

func (s *Storage) Info() (uint32, common.Hash, uint32, common.Hash)

Info returns ids and hashes of initial and active signing policies.

func (*Storage) InitialPolicyIDAndHash

func (s *Storage) InitialPolicyIDAndHash() (uint32, common.Hash)

InitialPolicyIDAndHash returns the ID and hash of the first policy.

func (*Storage) SetActiveSigningPolicy

func (s *Storage) SetActiveSigningPolicy(policy *policy.SigningPolicy) error

SetActiveSigningPolicy marks the provided policy as active.

func (*Storage) SetActiveSigningPolicyPublicKeys

func (s *Storage) SetActiveSigningPolicyPublicKeys(addressesToPublicKeys map[common.Address]*ecdsa.PublicKey) error

SetActiveSigningPolicyPublicKeys stores the public keys for the active policy.

func (*Storage) SetInitialPolicy

func (s *Storage) SetInitialPolicy(policy *policy.SigningPolicy, addressesToPublicKeys map[common.Address]*ecdsa.PublicKey) error

SetInitialPolicy stores the first signing policy and associated public keys.

func (*Storage) SigningPolicy

func (s *Storage) SigningPolicy(epochID uint32) (*policy.SigningPolicy, error)

SigningPolicy returns the signing policy for the reward epoch id.

Jump to

Keyboard shortcuts

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