Documentation ¶
Index ¶
- func AddValidatorToFile(path string, v *Validator) error
- func SortByteSlices(src [][]byte)
- func SplitAndTrimEmpty(s, sep, cutset string) []string
- type OnChainValidators
- type Set
- func NewEmptyValidatorSet() *Set
- func NewValidatorSet(n uint64, vs []*Validator) *Set
- func NewValidatorSetFromEnv(env string) (*Set, error)
- func NewValidatorSetFromFile(path string) (*Set, error)
- func NewValidatorSetFromString(s string) (*Set, error)
- func NewValidatorSetFromValidators(n uint64, vs ...*Validator) *Set
- func (s *Set) AddValidator(v *Validator)
- func (s *Set) Equal(o *Set) bool
- func (s *Set) GetConfigurationNumber() uint64
- func (s *Set) GetValidatorIDs() (ids []address.Address)
- func (s *Set) GetValidators() []*Validator
- func (s *Set) HasValidatorWithID(id string) bool
- func (s *Set) Hash() ([]byte, error)
- func (s *Set) JSONString() string
- func (t *Set) MarshalCBOR(w io.Writer) error
- func (s *Set) Save(path string) error
- func (s *Set) Size() int
- func (t *Set) UnmarshalCBOR(r io.Reader) (err error)
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddValidatorToFile ¶
AddValidatorToFile adds a validator `v` to the membership file `path`. If the file does not exist it will be created.
func SortByteSlices ¶
func SortByteSlices(src [][]byte)
func SplitAndTrimEmpty ¶
Types ¶
type OnChainValidators ¶ added in v0.1.5
type OnChainValidators struct { Validators Set TotalWeight abi.TokenAmount }
OnChainValidators information stored in the gateway actor
func NewOnChainValidatorsFromSet ¶ added in v0.1.5
func NewOnChainValidatorsFromSet(set *Set) OnChainValidators
func (*OnChainValidators) MarshalCBOR ¶ added in v0.1.5
func (t *OnChainValidators) MarshalCBOR(w io.Writer) error
func (*OnChainValidators) UnmarshalCBOR ¶ added in v0.1.5
func (t *OnChainValidators) UnmarshalCBOR(r io.Reader) (err error)
type Set ¶
type Set struct { Validators []*Validator `json:"validators"` ConfigurationNumber uint64 `json:"configuration_number"` }
func NewEmptyValidatorSet ¶ added in v0.1.4
func NewEmptyValidatorSet() *Set
func NewValidatorSet ¶
func NewValidatorSetFromEnv ¶
NewValidatorSetFromEnv initializes a validator set based on the data from the environment variable.
func NewValidatorSetFromFile ¶
NewValidatorSetFromFile reads a validator set based from the file.
func NewValidatorSetFromString ¶
NewValidatorSetFromString reads a validator set from the string.
func NewValidatorSetFromValidators ¶
NewValidatorSetFromValidators creates a validator set from the validators.
func (*Set) AddValidator ¶
func (*Set) GetConfigurationNumber ¶
func (*Set) GetValidatorIDs ¶
func (s *Set) GetValidatorIDs() (ids []address.Address)
func (*Set) GetValidators ¶
func (*Set) HasValidatorWithID ¶
func (*Set) JSONString ¶
type Validator ¶
type Validator struct { Addr addr.Address `json:"addr"` // FIXME: Consider using a multiaddr NetAddr string `json:"net_addr,omitempty"` Weight *abi.TokenAmount `json:"weight,omitempty"` }
func NewValidatorFromString ¶
NewValidatorFromString creates a validator based on the string in `Addr:Weight@NetworkAddr` format.
An examples of a validator string:
- t1wpixt5mihkj75lfhrnaa6v56n27epvlgwparujy:10@/ip4/127.0.0.1/tcp/10000/p2p/12D3KooWJhKBXvytYgPCAaiRtiNLJNSFG5jreKDu2jiVpJetzvVJ
FIXME: Consider using json serde for this to support multiple multiaddr for validators.