Documentation
¶
Index ¶
- Variables
- type BLSValidator
- func (v *BLSValidator) Addr() types.Address
- func (v *BLSValidator) Bytes() []byte
- func (v *BLSValidator) Copy() Validator
- func (v *BLSValidator) Equal(vr Validator) bool
- func (v *BLSValidator) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value
- func (v *BLSValidator) SetFromBytes(input []byte) error
- func (v *BLSValidator) String() string
- func (v *BLSValidator) Type() ValidatorType
- func (v *BLSValidator) UnmarshalRLPFrom(p *fastrlp.Parser, val *fastrlp.Value) error
- type BLSValidatorPublicKey
- type ECDSAValidator
- func (v *ECDSAValidator) Addr() types.Address
- func (v *ECDSAValidator) Bytes() []byte
- func (v *ECDSAValidator) Copy() Validator
- func (v *ECDSAValidator) Equal(vr Validator) bool
- func (v *ECDSAValidator) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value
- func (v *ECDSAValidator) SetFromBytes(input []byte) error
- func (v *ECDSAValidator) String() string
- func (v *ECDSAValidator) Type() ValidatorType
- func (v *ECDSAValidator) UnmarshalRLPFrom(p *fastrlp.Parser, val *fastrlp.Value) error
- type Set
- func (s *Set) Add(val Validator) error
- func (s *Set) At(index uint64) Validator
- func (s *Set) Copy() Validators
- func (s *Set) Del(val Validator) error
- func (s *Set) Equal(ss Validators) bool
- func (s *Set) Includes(addr types.Address) bool
- func (s *Set) Index(addr types.Address) int64
- func (s *Set) Len() int
- func (s *Set) MarshalJSON() ([]byte, error)
- func (s *Set) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value
- func (s *Set) Merge(ss Validators) error
- func (s *Set) Type() ValidatorType
- func (s *Set) UnmarshalJSON(data []byte) error
- func (s *Set) UnmarshalRLPFrom(p *fastrlp.Parser, val *fastrlp.Value) error
- type Validator
- type ValidatorType
- type Validators
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidValidatorType = errors.New("invalid validator type") ErrMismatchValidatorType = errors.New("mismatch between validator and validators") ErrMismatchValidatorsType = errors.New("mismatch between two validators") ErrValidatorAlreadyExists = errors.New("validator already exists in validators") ErrValidatorNotFound = errors.New("validator not found in validators") ErrInvalidValidators = errors.New("container is not ") )
var (
ErrInvalidBLSValidatorFormat = errors.New("invalid validator format, expected [Validator Address]:[BLS Public Key]")
)
var (
ErrInvalidTypeAssert = errors.New("invalid type assert")
)
Functions ¶
This section is empty.
Types ¶
type BLSValidator ¶
type BLSValidator struct {
Address types.Address
BLSPublicKey BLSValidatorPublicKey
}
BLSValidator is a validator using BLS signing algorithm
func NewBLSValidator ¶
func NewBLSValidator(addr types.Address, blsPubkey []byte) *BLSValidator
NewBLSValidator is a constructor of BLSValidator
func ParseBLSValidator ¶
func ParseBLSValidator(validator string) (*BLSValidator, error)
ParseBLSValidator parses BLSValidator represented in string
func (*BLSValidator) Addr ¶
func (v *BLSValidator) Addr() types.Address
Addr returns the validator address
func (*BLSValidator) Bytes ¶
func (v *BLSValidator) Bytes() []byte
Bytes returns bytes of BLSValidator in RLP encode
func (*BLSValidator) Copy ¶
func (v *BLSValidator) Copy() Validator
Copy returns copy of BLS Validator
func (*BLSValidator) Equal ¶
func (v *BLSValidator) Equal(vr Validator) bool
Equal checks the given validator matches with its data
func (*BLSValidator) MarshalRLPWith ¶
func (v *BLSValidator) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value
MarshalRLPWith is a RLP Marshaller
func (*BLSValidator) SetFromBytes ¶
func (v *BLSValidator) SetFromBytes(input []byte) error
SetFromBytes parses given bytes in RLP encode and map to its fields
func (*BLSValidator) String ¶
func (v *BLSValidator) String() string
String returns string representation of BLSValidator Format => [Address]:[BLSPublicKey]
func (*BLSValidator) Type ¶
func (v *BLSValidator) Type() ValidatorType
Type returns the ValidatorType of BLSValidator
func (*BLSValidator) UnmarshalRLPFrom ¶
UnmarshalRLPFrom is a RLP Unmarshaller
type BLSValidatorPublicKey ¶
type BLSValidatorPublicKey []byte
func (BLSValidatorPublicKey) MarshalText ¶
func (k BLSValidatorPublicKey) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler
func (BLSValidatorPublicKey) String ¶
func (k BLSValidatorPublicKey) String() string
String returns a public key in hex
func (*BLSValidatorPublicKey) UnmarshalText ¶
func (k *BLSValidatorPublicKey) UnmarshalText(input []byte) error
UnmarshalText parses an BLS Public Key in hex
type ECDSAValidator ¶
BLSValidator is a validator using ECDSA signing algorithm
func NewECDSAValidator ¶
func NewECDSAValidator(addr types.Address) *ECDSAValidator
NewECDSAValidator is a constructor of ECDSAValidator
func ParseECDSAValidator ¶
func ParseECDSAValidator(validator string) *ECDSAValidator
ParseBLSValidator parses ECDSAValidator represented in string
func (*ECDSAValidator) Addr ¶
func (v *ECDSAValidator) Addr() types.Address
Addr returns the validator address
func (*ECDSAValidator) Bytes ¶
func (v *ECDSAValidator) Bytes() []byte
Bytes returns bytes of ECDSAValidator
func (*ECDSAValidator) Copy ¶
func (v *ECDSAValidator) Copy() Validator
Copy returns copy of ECDSAValidator
func (*ECDSAValidator) Equal ¶
func (v *ECDSAValidator) Equal(vr Validator) bool
Equal checks the given validator matches with its data
func (*ECDSAValidator) MarshalRLPWith ¶
func (v *ECDSAValidator) MarshalRLPWith(arena *fastrlp.Arena) *fastrlp.Value
MarshalRLPWith is a RLP Marshaller
func (*ECDSAValidator) SetFromBytes ¶
func (v *ECDSAValidator) SetFromBytes(input []byte) error
SetFromBytes parses given bytes
func (*ECDSAValidator) String ¶
func (v *ECDSAValidator) String() string
String returns string representation of ECDSAValidator
func (*ECDSAValidator) Type ¶
func (v *ECDSAValidator) Type() ValidatorType
Type returns the ValidatorType of ECDSAValidator
func (*ECDSAValidator) UnmarshalRLPFrom ¶
UnmarshalRLPFrom is a RLP Unmarshaller
type Set ¶
type Set struct {
ValidatorType ValidatorType
Validators []Validator
}
func (*Set) Equal ¶
func (s *Set) Equal(ss Validators) bool
Equal checks the given validators matches with its data
func (*Set) Includes ¶
Includes return the bool indicating whether the validator whose address matches with the given address exists or not
func (*Set) Index ¶
Index returns the index of the validator whose address matches with the given address
func (*Set) MarshalJSON ¶
Marshal implements json marshal function
func (*Set) MarshalRLPWith ¶
MarshalRLPWith is a RLP Marshaller