exported

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 21 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")
)

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 Snapshot

type Snapshot struct {
	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) 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) 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 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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