Documentation
¶
Index ¶
- Variables
- type AddressOrderDelegatees
- type BlockMarker
- type Delegatee
- func (delegatee *Delegatee) AddStake(stakes ...*Stake) xerrors.XError
- func (delegatee *Delegatee) Decode(d []byte) xerrors.XError
- func (delegatee *Delegatee) DelAllStakes() []*Stake
- func (delegatee *Delegatee) DelStake(txhash bytes2.HexBytes) *Stake
- func (delegatee *Delegatee) DelStakeByIdx(idx int) *Stake
- func (delegatee *Delegatee) DoSlash(ratio int64) int64
- func (delegatee *Delegatee) Encode() ([]byte, xerrors.XError)
- func (delegatee *Delegatee) FindStake(txhash bytes2.HexBytes) (int, *Stake)
- func (delegatee *Delegatee) GetAddress() types.Address
- func (delegatee *Delegatee) GetAllStakes() []*Stake
- func (delegatee *Delegatee) GetNotSignedBlockCount(h0, h1 int64) int
- func (delegatee *Delegatee) GetSelfPower() int64
- func (delegatee *Delegatee) GetStake(idx int) *Stake
- func (delegatee *Delegatee) GetTotalPower() int64
- func (delegatee *Delegatee) Key() v1.LedgerKey
- func (delegatee *Delegatee) ProcessNotSignedBlock(height int64) xerrors.XError
- func (delegatee *Delegatee) SelfStakeRatio(added int64) int64
- func (delegatee *Delegatee) StakesLen() int
- func (delegatee *Delegatee) StakesOf(addr types.Address) []*Stake
- func (delegatee *Delegatee) String() string
- func (delegatee *Delegatee) SumPower() int64
- func (delegatee *Delegatee) SumPowerOf(addr types.Address) int64
- type DelegateeArray
- type InitStake
- type PowerOrderDelegatees
- type Reward
- func (rwd *Reward) Address() types.Address
- func (rwd *Reward) Decode(d []byte) xerrors.XError
- func (rwd *Reward) Encode() ([]byte, xerrors.XError)
- func (rwd *Reward) GetCumulated() *uint256.Int
- func (rwd *Reward) GetIssued() *uint256.Int
- func (rwd *Reward) GetSlashed() *uint256.Int
- func (rwd *Reward) GetWithdrawn() *uint256.Int
- func (rwd *Reward) Height() int64
- func (rwd *Reward) Issue(r *uint256.Int, h int64) xerrors.XError
- func (rwd *Reward) Key() v1.LedgerKey
- func (rwd *Reward) MarshalJSON() ([]byte, error)
- func (rwd *Reward) Slash(r *uint256.Int, h int64) xerrors.XError
- func (rwd *Reward) String() string
- func (rwd *Reward) UnmarshalJSON(d []byte) error
- func (rwd *Reward) Withdraw(r *uint256.Int, h int64) xerrors.XError
- type RewardProto
- func (*RewardProto) Descriptor() ([]byte, []int)deprecated
- func (x *RewardProto) GetAddress() []byte
- func (x *RewardProto) GetHeight() int64
- func (x *RewardProto) GetXCumulated() []byte
- func (x *RewardProto) GetXIssued() []byte
- func (x *RewardProto) GetXSlashed() []byte
- func (x *RewardProto) GetXWithdrawn() []byte
- func (*RewardProto) ProtoMessage()
- func (x *RewardProto) ProtoReflect() protoreflect.Message
- func (x *RewardProto) Reset()
- func (x *RewardProto) String() string
- type Stake
- type StakeCtrler
- func (ctrler *StakeCtrler) BeginBlock(blockCtx *ctrlertypes.BlockContext) ([]abcitypes.Event, xerrors.XError)
- func (ctrler *StakeCtrler) Close() xerrors.XError
- func (ctrler *StakeCtrler) Commit() ([]byte, int64, xerrors.XError)
- func (ctrler *StakeCtrler) DelegatedPowerOf(addr types.Address) int64
- func (ctrler *StakeCtrler) Delegatee(addr types.Address) *Delegatee
- func (ctrler *StakeCtrler) DoPunish(evi *abcitypes.Evidence, slashRatio int64) (int64, xerrors.XError)
- func (ctrler *StakeCtrler) DoReward(height int64, votes []abcitypes.VoteInfo) (*uint256.Int, xerrors.XError)
- func (ctrler *StakeCtrler) EndBlock(ctx *ctrlertypes.BlockContext) ([]abcitypes.Event, xerrors.XError)
- func (ctrler *StakeCtrler) ExecuteTrx(ctx *ctrlertypes.TrxContext) xerrors.XError
- func (ctrler *StakeCtrler) InitLedger(req interface{}) xerrors.XError
- func (ctrler *StakeCtrler) IsValidator(addr types.Address) bool
- func (ctrler *StakeCtrler) Query(req abcitypes.RequestQuery) ([]byte, xerrors.XError)
- func (ctrler *StakeCtrler) ReadFrozenStakes() []*Stake
- func (ctrler *StakeCtrler) ReadTotalAmount() *uint256.Int
- func (ctrler *StakeCtrler) ReadTotalPower() int64
- func (ctrler *StakeCtrler) SelfPowerOf(addr types.Address) int64
- func (ctrler *StakeCtrler) TotalPowerOf(addr types.Address) int64
- func (ctrler *StakeCtrler) UpdateValidators(maxVals int) []abcitypes.ValidatorUpdate
- func (ctrler *StakeCtrler) ValidateTrx(ctx *ctrlertypes.TrxContext) xerrors.XError
- func (ctrler *StakeCtrler) Validators() ([]*abcitypes.Validator, int64)
- type StakeLimiter
Constants ¶
This section is empty.
Variables ¶
var File_reward_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AddressOrderDelegatees ¶
type AddressOrderDelegatees []*Delegatee
func (AddressOrderDelegatees) Len ¶
func (vs AddressOrderDelegatees) Len() int
func (AddressOrderDelegatees) Less ¶
func (vs AddressOrderDelegatees) Less(i, j int) bool
ascending order by address
func (AddressOrderDelegatees) Swap ¶
func (vs AddressOrderDelegatees) Swap(i, j int)
type BlockMarker ¶
type BlockMarker struct { BlockHeights []int64 `json:"blockHeights"` // contains filtered or unexported fields }
func (*BlockMarker) CountInWindow ¶
func (bm *BlockMarker) CountInWindow(h0, h1 int64, rewin bool) int
CountInWindow() returns the number of marked height in [startHeight, endHeight]. If `rewin` is true, all heights before `h0` is removed after counting.
type Delegatee ¶
type Delegatee struct { Addr types.Address `json:"address"` PubKey bytes2.HexBytes `json:"pubKey"` SelfPower int64 `json:"selfPower,string"` TotalPower int64 `json:"totalPower,string"` SlashedPower int64 `json:"slashedPower,string"` Stakes []*Stake `json:"stakes"` NotSignedHeights *BlockMarker `json:"notSignedBlocks"` // contains filtered or unexported fields }
func (*Delegatee) DelAllStakes ¶
func (*Delegatee) DelStakeByIdx ¶
func (*Delegatee) GetAddress ¶
func (*Delegatee) GetAllStakes ¶
func (*Delegatee) GetNotSignedBlockCount ¶
GetNotSignedBlockCount() returns the number of marked height in [h0, h1].
func (*Delegatee) GetSelfPower ¶
func (*Delegatee) GetTotalPower ¶
func (*Delegatee) ProcessNotSignedBlock ¶
func (*Delegatee) SelfStakeRatio ¶
type DelegateeArray ¶
type DelegateeArray []*Delegatee
func (DelegateeArray) SumTotalPower ¶
func (delgs DelegateeArray) SumTotalPower() int64
type PowerOrderDelegatees ¶
type PowerOrderDelegatees []*Delegatee
func (PowerOrderDelegatees) Len ¶
func (vs PowerOrderDelegatees) Len() int
func (PowerOrderDelegatees) Less ¶
func (vs PowerOrderDelegatees) Less(i, j int) bool
descending order by TotalPower
func (PowerOrderDelegatees) Swap ¶
func (vs PowerOrderDelegatees) Swap(i, j int)
type Reward ¶
type Reward struct {
// contains filtered or unexported fields
}
func (*Reward) GetCumulated ¶
func (*Reward) GetSlashed ¶
func (*Reward) GetWithdrawn ¶
func (*Reward) MarshalJSON ¶
func (*Reward) UnmarshalJSON ¶
type RewardProto ¶
type RewardProto struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` XIssued []byte `protobuf:"bytes,2,opt,name=_issued,json=Issued,proto3" json:"_issued,omitempty"` XWithdrawn []byte `protobuf:"bytes,3,opt,name=_withdrawn,json=Withdrawn,proto3" json:"_withdrawn,omitempty"` XSlashed []byte `protobuf:"bytes,4,opt,name=_slashed,json=Slashed,proto3" json:"_slashed,omitempty"` XCumulated []byte `protobuf:"bytes,5,opt,name=_cumulated,json=Cumulated,proto3" json:"_cumulated,omitempty"` Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"` // contains filtered or unexported fields }
func (*RewardProto) Descriptor
deprecated
func (*RewardProto) Descriptor() ([]byte, []int)
Deprecated: Use RewardProto.ProtoReflect.Descriptor instead.
func (*RewardProto) GetAddress ¶
func (x *RewardProto) GetAddress() []byte
func (*RewardProto) GetHeight ¶
func (x *RewardProto) GetHeight() int64
func (*RewardProto) GetXCumulated ¶
func (x *RewardProto) GetXCumulated() []byte
func (*RewardProto) GetXIssued ¶
func (x *RewardProto) GetXIssued() []byte
func (*RewardProto) GetXSlashed ¶
func (x *RewardProto) GetXSlashed() []byte
func (*RewardProto) GetXWithdrawn ¶
func (x *RewardProto) GetXWithdrawn() []byte
func (*RewardProto) ProtoMessage ¶
func (*RewardProto) ProtoMessage()
func (*RewardProto) ProtoReflect ¶
func (x *RewardProto) ProtoReflect() protoreflect.Message
func (*RewardProto) Reset ¶
func (x *RewardProto) Reset()
func (*RewardProto) String ¶
func (x *RewardProto) String() string
type Stake ¶
type Stake struct { From types.Address `json:"owner"` To types.Address `json:"to"` TxHash abytes.HexBytes `json:"txhash"` StartHeight int64 `json:"startHeight,string"` RefundHeight int64 `json:"refundHeight,string"` Power int64 `json:"power,string"` // contains filtered or unexported fields }
func NewStakeWithAmount ¶
func NewStakeWithPower ¶
func (*Stake) IsSelfStake ¶
type StakeCtrler ¶
type StakeCtrler struct {
// contains filtered or unexported fields
}
func NewStakeCtrler ¶
func NewStakeCtrler(config *cfg.Config, govHandler ctrlertypes.IGovHandler, logger tmlog.Logger) (*StakeCtrler, xerrors.XError)
func (*StakeCtrler) BeginBlock ¶
func (ctrler *StakeCtrler) BeginBlock(blockCtx *ctrlertypes.BlockContext) ([]abcitypes.Event, xerrors.XError)
BeginBlock are called in BeatozApp::BeginBlock
func (*StakeCtrler) Close ¶
func (ctrler *StakeCtrler) Close() xerrors.XError
func (*StakeCtrler) DelegatedPowerOf ¶
func (ctrler *StakeCtrler) DelegatedPowerOf(addr types.Address) int64
DelegatedPowerOf is used only to test
func (*StakeCtrler) Delegatee ¶
func (ctrler *StakeCtrler) Delegatee(addr types.Address) *Delegatee
Delegatee is used only to test
func (*StakeCtrler) DoReward ¶
func (ctrler *StakeCtrler) DoReward(height int64, votes []abcitypes.VoteInfo) (*uint256.Int, xerrors.XError)
DoReward is only used to test
func (*StakeCtrler) EndBlock ¶
func (ctrler *StakeCtrler) EndBlock(ctx *ctrlertypes.BlockContext) ([]abcitypes.Event, xerrors.XError)
func (*StakeCtrler) ExecuteTrx ¶
func (ctrler *StakeCtrler) ExecuteTrx(ctx *ctrlertypes.TrxContext) xerrors.XError
func (*StakeCtrler) InitLedger ¶
func (ctrler *StakeCtrler) InitLedger(req interface{}) xerrors.XError
func (*StakeCtrler) IsValidator ¶
func (ctrler *StakeCtrler) IsValidator(addr types.Address) bool
func (*StakeCtrler) Query ¶
func (ctrler *StakeCtrler) Query(req abcitypes.RequestQuery) ([]byte, xerrors.XError)
func (*StakeCtrler) ReadFrozenStakes ¶
func (ctrler *StakeCtrler) ReadFrozenStakes() []*Stake
ReadFrozenStakes is used only to test
func (*StakeCtrler) ReadTotalAmount ¶
func (ctrler *StakeCtrler) ReadTotalAmount() *uint256.Int
ReadTotalAmount is used only to test
func (*StakeCtrler) ReadTotalPower ¶
func (ctrler *StakeCtrler) ReadTotalPower() int64
ReadTotalPower is used only to test
func (*StakeCtrler) SelfPowerOf ¶
func (ctrler *StakeCtrler) SelfPowerOf(addr types.Address) int64
SelfPowerOf is used only to test
func (*StakeCtrler) TotalPowerOf ¶
func (ctrler *StakeCtrler) TotalPowerOf(addr types.Address) int64
TotalPowerOf is used only to test
func (*StakeCtrler) UpdateValidators ¶
func (ctrler *StakeCtrler) UpdateValidators(maxVals int) []abcitypes.ValidatorUpdate
func (*StakeCtrler) ValidateTrx ¶
func (ctrler *StakeCtrler) ValidateTrx(ctx *ctrlertypes.TrxContext) xerrors.XError
func (*StakeCtrler) Validators ¶
func (ctrler *StakeCtrler) Validators() ([]*abcitypes.Validator, int64)
IStakeHandler's methods
type StakeLimiter ¶
type StakeLimiter struct {
// contains filtered or unexported fields
}
StakeLimiter limits the amount of stake changes in one block.
func NewStakeLimiter ¶
func NewStakeLimiter(vals PowerOrderDelegatees, maxValCnt, indiLimitRatio, upLimitRatio int64) *StakeLimiter
func (*StakeLimiter) CheckLimit ¶
func (sl *StakeLimiter) CheckLimit(delg *Delegatee, changePower int64) xerrors.XError
func (*StakeLimiter) Reset ¶
func (sl *StakeLimiter) Reset(vals PowerOrderDelegatees, maxValCnt, indiLimitRatio, upLimitRatio int64)