Documentation
¶
Index ¶
- func WeightOfSigners(signers []common.Address, signingPolicy *policy.SigningPolicy) uint16
- type Storage
- func (s *Storage) ActiveSigningPolicy() (*policy.SigningPolicy, error)
- func (s *Storage) ActiveSigningPolicyPublicKeys() ([]*ecdsa.PublicKey, error)
- func (s *Storage) DestroyState()
- func (s *Storage) Info() (uint32, common.Hash, uint32, common.Hash)
- func (s *Storage) InitialPolicyIDAndHash() (uint32, common.Hash)
- func (s *Storage) SetActiveSigningPolicy(policy *policy.SigningPolicy) error
- func (s *Storage) SetActiveSigningPolicyPublicKeys(addressesToPublicKeys map[common.Address]*ecdsa.PublicKey) error
- func (s *Storage) SetInitialPolicy(policy *policy.SigningPolicy, ...) error
- func (s *Storage) SigningPolicy(epochID uint32) (*policy.SigningPolicy, error)
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 ¶
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 ¶
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) InitialPolicyIDAndHash ¶
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.