Documentation ¶
Overview ¶
Package checkers provides functions and structures to verify common types and aggregate errors.
Index ¶
- Variables
- func AssertGovAuthority(authority string) error
- func DecInZeroOne(a sdk.Dec, name string, oneInclusive bool) error
- func DecMaxDiff(a, b, maxDiff sdk.Dec, note string) error
- func Description(d string) error
- func EmergencyGroupAuthority(authority string, eg WithEmergencyGroup) (bool, error)
- func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error
- func IsGovAuthority(authority string) bool
- func Merge(errs1, errs2 []error) []error
- func Proposal(authority, description string) error
- func RequireDecMaxDiff(t *testing.T, a, b, maxDiff sdk.Dec, note string)
- func Signers(signers ...string) []sdk.AccAddress
- func ValidateAddr(addr, name string) error
- type WithEmergencyGroup
Constants ¶
This section is empty.
Variables ¶
var GovModuleAddr string
GovModuleAddr is set during the first call of ValidateProposal
Functions ¶
func AssertGovAuthority ¶
AssertGovAuthority errors is the authority is not the gov module address. Panics if the gov module address is not set during the package initialization.
func DecInZeroOne ¶
DecInZeroOne asserts that 0 <= a <= 1 when oneInclusive=True, otherwise asserts 0 <= a < 1
func Description ¶
func EmergencyGroupAuthority ¶
func EmergencyGroupAuthority(authority string, eg WithEmergencyGroup) (bool, error)
EmergencyGroupAuthority returns true if the authority is EmergencyGroup. Returns false if authority is the x/gov address. Returns error otherwise. Note: we use WithEmergencyGroup rather than emergency group AccAddress to avoid storage read if it's not necessary.
func IntegerMaxDiff ¶
func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error
func IsGovAuthority ¶
IsGovAuthority returns true if the authority is the gov module address. Panics if the gov module address is not set during the package initialization.
func Proposal ¶
Proposal checks the format of the description in relation to the authority (x/gov account or other valid account). Authority must be a correct bech32 address.
func Signers ¶
func Signers(signers ...string) []sdk.AccAddress
Signers converts signer bech32 addresses to sdk.AccAddress list. The function ignores errors. It is supposed to be used within Msg.GetSigners implementation.
func ValidateAddr ¶
Types ¶
type WithEmergencyGroup ¶
type WithEmergencyGroup interface {
EmergencyGroup() sdk.AccAddress
}
WithEmergencyGroup is a copy of ugov.WithEmergencyGroup to avoid import cycle