exported

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ValidatorIllegibility_name = map[int32]string{
	0:  "VALIDATOR_ILLEGIBILITY_UNSPECIFIED",
	1:  "VALIDATOR_ILLEGIBILITY_TOMBSTONED",
	2:  "VALIDATOR_ILLEGIBILITY_JAILED",
	4:  "VALIDATOR_ILLEGIBILITY_MISSED_TOO_MANY_BLOCKS",
	8:  "VALIDATOR_ILLEGIBILITY_NO_PROXY_REGISTERED",
	16: "VALIDATOR_ILLEGIBILITY_TSS_SUSPENDED",
	32: "VALIDATOR_ILLEGIBILITY_PROXY_INSUFICIENT_FUNDS",
}
View Source
var ValidatorIllegibility_value = map[string]int32{
	"VALIDATOR_ILLEGIBILITY_UNSPECIFIED":             0,
	"VALIDATOR_ILLEGIBILITY_TOMBSTONED":              1,
	"VALIDATOR_ILLEGIBILITY_JAILED":                  2,
	"VALIDATOR_ILLEGIBILITY_MISSED_TOO_MANY_BLOCKS":  4,
	"VALIDATOR_ILLEGIBILITY_NO_PROXY_REGISTERED":     8,
	"VALIDATOR_ILLEGIBILITY_TSS_SUSPENDED":           16,
	"VALIDATOR_ILLEGIBILITY_PROXY_INSUFICIENT_FUNDS": 32,
}

Functions

func QuadraticWeightFunc added in v0.21.0

func QuadraticWeightFunc(consensusPower sdk.Uint) sdk.Uint

QuadraticWeightFunc returns floor(sqrt(consensusPower)) as the weight

Types

type Participant added in v0.21.0

type Participant struct {
	Address github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"address,omitempty"`
	Weight  github_com_cosmos_cosmos_sdk_types.Uint       `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"weight"`
}

func NewParticipant added in v0.21.0

func NewParticipant(address sdk.ValAddress, weight sdk.Uint) Participant

NewParticipant is the constructor of Participant

func (*Participant) Descriptor added in v0.21.0

func (*Participant) Descriptor() ([]byte, []int)

func (Participant) GetAddress added in v0.21.0

func (m Participant) GetAddress() sdk.ValAddress

GetAddress returns the address of the participant

func (*Participant) Marshal added in v0.21.0

func (m *Participant) Marshal() (dAtA []byte, err error)

func (*Participant) MarshalTo added in v0.21.0

func (m *Participant) MarshalTo(dAtA []byte) (int, error)

func (*Participant) MarshalToSizedBuffer added in v0.21.0

func (m *Participant) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Participant) ProtoMessage added in v0.21.0

func (*Participant) ProtoMessage()

func (*Participant) Reset added in v0.21.0

func (m *Participant) Reset()

func (*Participant) Size added in v0.21.0

func (m *Participant) Size() (n int)

func (*Participant) String added in v0.21.0

func (m *Participant) String() string

func (*Participant) Unmarshal added in v0.21.0

func (m *Participant) Unmarshal(dAtA []byte) error

func (Participant) ValidateBasic added in v0.21.0

func (m Participant) ValidateBasic() error

ValidateBasic returns an error if the given participant is invalid; nil otherwise

func (*Participant) XXX_DiscardUnknown added in v0.21.0

func (m *Participant) XXX_DiscardUnknown()

func (*Participant) XXX_Marshal added in v0.21.0

func (m *Participant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Participant) XXX_Merge added in v0.21.0

func (m *Participant) XXX_Merge(src proto.Message)

func (*Participant) XXX_Size added in v0.21.0

func (m *Participant) XXX_Size() int

func (*Participant) XXX_Unmarshal added in v0.21.0

func (m *Participant) XXX_Unmarshal(b []byte) error

type SDKValidator

type SDKValidator interface {
	proto.Message
	codectypes.UnpackInterfacesMessage
	GetOperator() sdk.ValAddress
	GetConsAddr() (sdk.ConsAddress, error)
	GetConsensusPower(sdk.Int) int64
	IsJailed() bool
	IsBonded() bool
}

SDKValidator is an interface for a Cosmos validator account

type Snapshot

type Snapshot struct {
	Validators      []Validator                            `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` // Deprecated: Do not use.
	TotalShareCount github_com_cosmos_cosmos_sdk_types.Int ``                                                                // Deprecated: Do not use.
	/* 148-byte string literal not displayed */
	Counter                    int64                               `protobuf:"varint,5,opt,name=counter,proto3" json:"counter,omitempty"` // Deprecated: Do not use.
	KeyShareDistributionPolicy exported.KeyShareDistributionPolicy ``                                                                     // Deprecated: Do not use.
	/* 204-byte string literal not displayed */
	CorruptionThreshold int64                                   `protobuf:"varint,7,opt,name=corruption_threshold,json=corruptionThreshold,proto3" json:"corruption_threshold,omitempty"` // Deprecated: Do not use.
	Timestamp           time.Time                               `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"`
	Height              int64                                   `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
	Participants        map[string]Participant                  `` /* 155-byte string literal not displayed */
	BondedWeight        github_com_cosmos_cosmos_sdk_types.Uint `` /* 138-byte string literal not displayed */
}

func NewSnapshot added in v0.9.0

func NewSnapshot(timestamp time.Time, height int64, participants []Participant, bondedWeight sdk.Uint) Snapshot

NewSnapshot is the constructor of Snapshot

func (Snapshot) CalculateMinPassingWeight added in v0.21.0

func (m Snapshot) CalculateMinPassingWeight(threshold utils.Threshold) sdk.Uint

CalculateMinPassingWeight returns the minimum amount of weights to pass the given threshold

func (*Snapshot) Descriptor

func (*Snapshot) Descriptor() ([]byte, []int)

func (Snapshot) GetParticipantAddresses added in v0.21.0

func (m Snapshot) GetParticipantAddresses() []sdk.ValAddress

GetParticipantAddresses returns the addresses of all participants in the snapshot

func (Snapshot) GetParticipantWeight added in v0.21.0

func (m Snapshot) GetParticipantWeight(participant sdk.ValAddress) sdk.Uint

GetParticipantWeight returns the weight of the given participant

func (Snapshot) GetParticipantsWeight added in v0.21.0

func (m Snapshot) GetParticipantsWeight() sdk.Uint

GetParticipantsWeight returns the sum of all participants' weights

func (Snapshot) GetSuccinctJSON

func (m Snapshot) GetSuccinctJSON() ([]byte, error)

GetSuccinctJSON marshals the snapshot as JSON without including the SDKValidator data

func (Snapshot) GetValidator

func (m Snapshot) GetValidator(address sdk.ValAddress) (Validator, bool)

GetValidator returns the validator for a given address, if it is part of the snapshot

func (*Snapshot) Marshal

func (m *Snapshot) Marshal() (dAtA []byte, err error)

func (*Snapshot) MarshalTo

func (m *Snapshot) MarshalTo(dAtA []byte) (int, error)

func (*Snapshot) MarshalToSizedBuffer

func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Snapshot) ProtoMessage

func (*Snapshot) ProtoMessage()

func (*Snapshot) Reset

func (m *Snapshot) Reset()

func (*Snapshot) Size

func (m *Snapshot) Size() (n int)

func (*Snapshot) String

func (m *Snapshot) String() string

func (*Snapshot) Unmarshal

func (m *Snapshot) Unmarshal(dAtA []byte) error

func (Snapshot) UnpackInterfaces

func (m Snapshot) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage

func (Snapshot) Validate added in v0.9.0

func (m Snapshot) Validate() error

Validate returns an error if the snapshot is not valid; nil otherwise Deprecated

func (Snapshot) ValidateBasic added in v0.21.0

func (m Snapshot) ValidateBasic() error

ValidateBasic returns an error if the given snapshot is invalid; nil otherwise

func (*Snapshot) XXX_DiscardUnknown

func (m *Snapshot) XXX_DiscardUnknown()

func (*Snapshot) XXX_Marshal

func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Snapshot) XXX_Merge

func (m *Snapshot) XXX_Merge(src proto.Message)

func (*Snapshot) XXX_Size

func (m *Snapshot) XXX_Size() int

func (*Snapshot) XXX_Unmarshal

func (m *Snapshot) XXX_Unmarshal(b []byte) error

type Snapshotter

type Snapshotter interface {
	CreateSnapshot(ctx sdk.Context, candidates []sdk.ValAddress, filterFunc func(ValidatorI) bool, weightFunc func(consensusPower sdk.Uint) sdk.Uint, threshold utils.Threshold) (Snapshot, error)
	GetLatestSnapshot(ctx sdk.Context) (Snapshot, bool)
	GetSnapshot(ctx sdk.Context, seqNo int64) (Snapshot, bool)
	TakeSnapshot(ctx sdk.Context, keyRequirement tss.KeyRequirement) (Snapshot, error)
	GetOperator(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress
	GetProxy(ctx sdk.Context, principal sdk.ValAddress) (addr sdk.AccAddress, active bool)
	GetValidatorIllegibility(ctx sdk.Context, validator SDKValidator) (ValidatorIllegibility, error)
}

Snapshotter represents the interface for the snapshot module's functionality

type Validator

type Validator struct {
	SDKValidator *types.Any `protobuf:"bytes,1,opt,name=sdk_validator,json=sdkValidator,proto3" json:"sdk_validator,omitempty"`
	ShareCount   int64      `protobuf:"varint,2,opt,name=share_count,json=shareCount,proto3" json:"share_count,omitempty"`
}

func NewValidator

func NewValidator(validator SDKValidator, shareCount int64) Validator

NewValidator is the constructor for Validator

func (*Validator) Descriptor

func (*Validator) Descriptor() ([]byte, []int)

func (Validator) GetSDKValidator

func (m Validator) GetSDKValidator() SDKValidator

GetSDKValidator returns the SdkValidator

func (*Validator) Marshal

func (m *Validator) Marshal() (dAtA []byte, err error)

func (*Validator) MarshalTo

func (m *Validator) MarshalTo(dAtA []byte) (int, error)

func (*Validator) MarshalToSizedBuffer

func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Validator) ProtoMessage

func (*Validator) ProtoMessage()

func (*Validator) Reset

func (m *Validator) Reset()

func (*Validator) Size

func (m *Validator) Size() (n int)

func (*Validator) String

func (m *Validator) String() string

func (*Validator) Unmarshal

func (m *Validator) Unmarshal(dAtA []byte) error

func (Validator) UnpackInterfaces

func (m Validator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage

func (Validator) Validate added in v0.9.0

func (m Validator) Validate() error

Validate returns an error if the validator is not valid; nil otherwise

func (*Validator) XXX_DiscardUnknown

func (m *Validator) XXX_DiscardUnknown()

func (*Validator) XXX_Marshal

func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Validator) XXX_Merge

func (m *Validator) XXX_Merge(src proto.Message)

func (*Validator) XXX_Size

func (m *Validator) XXX_Size() int

func (*Validator) XXX_Unmarshal

func (m *Validator) XXX_Unmarshal(b []byte) error

type ValidatorI added in v0.21.0

type ValidatorI interface {
	GetConsensusPower(sdk.Int) int64       // validation power in tendermint
	GetOperator() sdk.ValAddress           // operator address to receive/return validators coins
	GetConsAddr() (sdk.ConsAddress, error) // validation consensus address
	IsJailed() bool                        // whether the validator is jailed
	IsBonded() bool                        // whether the validator is bonded
}

ValidatorI provides necessary functions to the validator information

type ValidatorIllegibility

type ValidatorIllegibility int32
const (
	// these enum values are used for bitwise operations, therefore they need to
	// be powers of 2
	None                  ValidatorIllegibility = 0
	Tombstoned            ValidatorIllegibility = 1
	Jailed                ValidatorIllegibility = 2
	MissedTooManyBlocks   ValidatorIllegibility = 4
	NoProxyRegistered     ValidatorIllegibility = 8
	TssSuspended          ValidatorIllegibility = 16
	ProxyInsuficientFunds ValidatorIllegibility = 32
)

func GetValidatorIllegibilities

func GetValidatorIllegibilities() []ValidatorIllegibility

GetValidatorIllegibilities returns all validator illegibilities

func (ValidatorIllegibility) EnumDescriptor

func (ValidatorIllegibility) EnumDescriptor() ([]byte, []int)

func (ValidatorIllegibility) FilterIllegibilityForMultisigSigning added in v0.14.0

func (v ValidatorIllegibility) FilterIllegibilityForMultisigSigning() ValidatorIllegibility

FilterIllegibilityForMultisigSigning filters the illegibility to only leave those ones related to handling of signing - filter out MissedTooManyBlocks so that even potentially offline validators can submit signature(s) - filter out ProxyInsuficientFunds so that validators with proxy account having low balance can submit signature(s)

func (ValidatorIllegibility) FilterIllegibilityForNewKey

func (v ValidatorIllegibility) FilterIllegibilityForNewKey() ValidatorIllegibility

FilterIllegibilityForNewKey filters the illegibility to only leave those ones related to handling of new key

func (ValidatorIllegibility) FilterIllegibilityForTssSigning added in v0.14.0

func (v ValidatorIllegibility) FilterIllegibilityForTssSigning() ValidatorIllegibility

FilterIllegibilityForTssSigning filters the illegibility to only leave those ones related to handling of signing

func (ValidatorIllegibility) Is

Is returns true if the illegibility contains the given one; false otherwise

func (ValidatorIllegibility) String

func (v ValidatorIllegibility) String() string

String returns a comma-separated string representation of illegibility

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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