exported

package
v0.0.0-...-db0507b Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 19 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

func QuadraticWeightFunc(consensusPower sdkmath.Uint) sdkmath.Uint

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

Types

type Participant

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

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

NewParticipant is the constructor of Participant

func (*Participant) Descriptor

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

func (Participant) GetAddress

func (m Participant) GetAddress() sdk.ValAddress

GetAddress returns the address of the participant

func (*Participant) Marshal

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

func (*Participant) MarshalTo

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

func (*Participant) MarshalToSizedBuffer

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

func (*Participant) ProtoMessage

func (*Participant) ProtoMessage()

func (*Participant) Reset

func (m *Participant) Reset()

func (*Participant) Size

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

func (*Participant) String

func (m *Participant) String() string

func (*Participant) Unmarshal

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

func (Participant) ValidateBasic

func (m Participant) ValidateBasic() error

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

func (*Participant) XXX_DiscardUnknown

func (m *Participant) XXX_DiscardUnknown()

func (*Participant) XXX_Marshal

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

func (*Participant) XXX_Merge

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

func (*Participant) XXX_Size

func (m *Participant) XXX_Size() int

func (*Participant) XXX_Unmarshal

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

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

NewSnapshot is the constructor of Snapshot

func (Snapshot) CalculateMinPassingWeight

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

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

GetParticipantAddresses returns the addresses of all participants in the snapshot

func (Snapshot) GetParticipantWeight

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

GetParticipantWeight returns the weight of the given participant

func (Snapshot) GetParticipantsWeight

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

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

type ValidatorI interface {
	GetConsensusPower(sdkmath.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

Jump to

Keyboard shortcuts

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