Documentation ¶
Index ¶
- Constants
- Variables
- func CanBaseKeyByAddr(addr common.Address) []byte
- func CanBaseKeyByNodeId(nodeId discover.NodeID) ([]byte, error)
- func CanBaseKeyByPubKey(p ecdsa.PublicKey) []byte
- func CanBaseKeyBySuffix(addr []byte) []byte
- func CanMutableKeyByAddr(addr common.Address) []byte
- func CanMutableKeyByNodeId(nodeId discover.NodeID) ([]byte, error)
- func CanMutableKeyByPubKey(p ecdsa.PublicKey) []byte
- func CanMutableKeyBySuffix(addr []byte) []byte
- func CompareDefault(removes NeedRemoveCans, left, right *Validator) int
- func CompareForDel(removes NeedRemoveCans, left, right *Validator) int
- func CompareForStore(_ NeedRemoveCans, left, right *Validator) int
- func GetAccountStakeRcKey(addr common.Address) []byte
- func GetDelegateKey(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) []byte
- func GetDelegateKeyBySuffix(suffix []byte) []byte
- func GetEpochIndexKey() []byte
- func GetEpochValArrKey(start, end uint64) []byte
- func GetPPOSHASHKey() []byte
- func GetRoundAddrBoundaryKey() []byte
- func GetRoundIndexKey() []byte
- func GetRoundValAddrArrKey(round uint64) []byte
- func GetRoundValArrKey(start, end uint64) []byte
- func GetUnStakeCountKey(epoch uint64) []byte
- func GetUnStakeItemKey(epoch, index uint64) []byte
- func TallyPowerKey(shares *big.Int, stakeBlockNum uint64, stakeTxIndex, programVersion uint32) []byte
- type Candidate
- type CandidateBase
- type CandidateBaseQueue
- type CandidateHex
- type CandidateHexQueue
- type CandidateMap
- type CandidateMutable
- func (can *CandidateMutable) AddShares(amount *big.Int)
- func (can *CandidateMutable) CleanLowRatioStatus()
- func (can *CandidateMutable) CleanShares()
- func (can *CandidateMutable) IsDuplicateSign() bool
- func (can *CandidateMutable) IsEmpty() bool
- func (can *CandidateMutable) IsInvalid() bool
- func (can *CandidateMutable) IsInvalidDuplicateSign() bool
- func (can *CandidateMutable) IsInvalidLowRatio() bool
- func (can *CandidateMutable) IsInvalidLowRatioDel() bool
- func (can *CandidateMutable) IsInvalidLowRatioNotEnough() bool
- func (can *CandidateMutable) IsInvalidNotEnough() bool
- func (can *CandidateMutable) IsInvalidWithdrew() bool
- func (can *CandidateMutable) IsLowRatio() bool
- func (can *CandidateMutable) IsLowRatioDel() bool
- func (can *CandidateMutable) IsLowRatioNotEnough() bool
- func (can *CandidateMutable) IsNotEmpty() bool
- func (can *CandidateMutable) IsNotEnough() bool
- func (can *CandidateMutable) IsPureInvalid() bool
- func (can *CandidateMutable) IsPureLowRatio() bool
- func (can *CandidateMutable) IsPureLowRatioDel() bool
- func (can *CandidateMutable) IsPureNotEnough() bool
- func (can *CandidateMutable) IsPureWithdrew() bool
- func (can *CandidateMutable) IsValid() bool
- func (can *CandidateMutable) IsWithdrew() bool
- func (can *CandidateMutable) String() string
- func (can *CandidateMutable) SubShares(amount *big.Int)
- type CandidateQueue
- type CandidateStatus
- func (status CandidateStatus) IsDuplicateSign() bool
- func (status CandidateStatus) IsInvalid() bool
- func (status CandidateStatus) IsInvalidDuplicateSign() bool
- func (status CandidateStatus) IsInvalidLowRatio() bool
- func (status CandidateStatus) IsInvalidLowRatioDel() bool
- func (status CandidateStatus) IsInvalidLowRatioNotEnough() bool
- func (status CandidateStatus) IsInvalidNotEnough() bool
- func (status CandidateStatus) IsInvalidWithdrew() bool
- func (status CandidateStatus) IsLowRatio() bool
- func (status CandidateStatus) IsLowRatioDel() bool
- func (status CandidateStatus) IsLowRatioNotEnough() bool
- func (status CandidateStatus) IsNotEnough() bool
- func (status CandidateStatus) IsPureInvalid() bool
- func (status CandidateStatus) IsPureLowRatio() bool
- func (status CandidateStatus) IsPureLowRatioDel() bool
- func (status CandidateStatus) IsPureNotEnough() bool
- func (status CandidateStatus) IsPureWithdrew() bool
- func (status CandidateStatus) IsValid() bool
- func (status CandidateStatus) IsWithdrew() bool
- type DelRelatedQueue
- type DelegateRelated
- type Delegation
- type DelegationEx
- type DelegationHex
- type Description
- type NeedRemoveCans
- type SlashNodeItem
- type SlashQueue
- type StakingDB
- func (db *StakingDB) AddAccountStakeRc(blockHash common.Hash, addr common.Address) error
- func (db *StakingDB) AddUnStakeItemStore(blockHash common.Hash, epoch uint64, canAddr common.Address, ...) error
- func (db *StakingDB) DelCanBaseStore(blockHash common.Hash, addr common.Address) error
- func (db *StakingDB) DelCanMutableStore(blockHash common.Hash, addr common.Address) error
- func (db *StakingDB) DelCanPowerStore(blockHash common.Hash, can *Candidate) error
- func (db *StakingDB) DelCandidateStore(blockHash common.Hash, addr common.Address) error
- func (db *StakingDB) DelDelegateStore(blockHash common.Hash, delAddr common.Address, nodeId discover.NodeID, ...) error
- func (db *StakingDB) DelDelegateStoreBySuffix(blockHash common.Hash, suffix []byte) error
- func (db *StakingDB) DelEpochValListByBlockHash(blockHash common.Hash, start, end uint64) error
- func (db *StakingDB) DelRoundValListByBlockHash(blockHash common.Hash, start, end uint64) error
- func (db *StakingDB) DelRoundValidatorAddrs(blockHash common.Hash, key []byte) error
- func (db *StakingDB) DelUnStakeCountStore(blockHash common.Hash, epoch uint64) error
- func (db *StakingDB) DelUnStakeItemStore(blockHash common.Hash, epoch, index uint64) error
- func (db *StakingDB) GetCanBaseStore(blockHash common.Hash, addr common.Address) (*CandidateBase, error)
- func (db *StakingDB) GetCanBaseStoreByIrr(addr common.Address) (*CandidateBase, error)
- func (db *StakingDB) GetCanBaseStoreByIrrWithSuffix(suffix []byte) (*CandidateBase, error)
- func (db *StakingDB) GetCanBaseStoreWithSuffix(blockHash common.Hash, suffix []byte) (*CandidateBase, error)
- func (db *StakingDB) GetCanMutableStore(blockHash common.Hash, addr common.Address) (*CandidateMutable, error)
- func (db *StakingDB) GetCanMutableStoreByIrr(addr common.Address) (*CandidateMutable, error)
- func (db *StakingDB) GetCanMutableStoreByIrrWithSuffix(suffix []byte) (*CandidateMutable, error)
- func (db *StakingDB) GetCanMutableStoreWithSuffix(blockHash common.Hash, suffix []byte) (*CandidateMutable, error)
- func (db *StakingDB) GetCandidateStore(blockHash common.Hash, addr common.Address) (*Candidate, error)
- func (db *StakingDB) GetCandidateStoreByIrr(addr common.Address) (*Candidate, error)
- func (db *StakingDB) GetCandidateStoreByIrrWithSuffix(suffix []byte) (*Candidate, error)
- func (db *StakingDB) GetCandidateStoreWithSuffix(blockHash common.Hash, suffix []byte) (*Candidate, error)
- func (db *StakingDB) GetDelegateStore(blockHash common.Hash, delAddr common.Address, nodeId discover.NodeID, ...) (*Delegation, error)
- func (db *StakingDB) GetDelegateStoreByIrr(delAddr common.Address, nodeId discover.NodeID, stakeBlockNumber uint64) (*Delegation, error)
- func (db *StakingDB) GetDelegateStoreBySuffix(blockHash common.Hash, keySuffix []byte) (*Delegation, error)
- func (db *StakingDB) GetEpochValIndexByBlockHash(blockHash common.Hash) (ValArrIndexQueue, error)
- func (db *StakingDB) GetEpochValIndexByIrr() (ValArrIndexQueue, error)
- func (db *StakingDB) GetEpochValListByBlockHash(blockHash common.Hash, start, end uint64) (ValidatorQueue, error)
- func (db *StakingDB) GetEpochValListByIrr(start, end uint64) (ValidatorQueue, error)
- func (db *StakingDB) GetLastKVHash(blockHash common.Hash) []byte
- func (db *StakingDB) GetRoundAddrBoundary(blockHash common.Hash) (uint64, error)
- func (db *StakingDB) GetRoundValIndexByBlockHash(blockHash common.Hash) (ValArrIndexQueue, error)
- func (db *StakingDB) GetRoundValIndexByIrr() (ValArrIndexQueue, error)
- func (db *StakingDB) GetRoundValListByBlockHash(blockHash common.Hash, start, end uint64) (ValidatorQueue, error)
- func (db *StakingDB) GetRoundValListByIrr(start, end uint64) (ValidatorQueue, error)
- func (db *StakingDB) GetUnStakeCountStore(blockHash common.Hash, epoch uint64) (uint64, error)
- func (db *StakingDB) GetUnStakeItemStore(blockHash common.Hash, epoch, index uint64) (*UnStakeItem, error)
- func (db *StakingDB) HasAccountStakeRc(blockHash common.Hash, addr common.Address) (bool, error)
- func (db *StakingDB) IteratorCandidatePowerByBlockHash(blockHash common.Hash, ranges int) iterator.Iterator
- func (db *StakingDB) IteratorDelegateByBlockHashWithAddr(blockHash common.Hash, addr common.Address, ranges int) iterator.Iterator
- func (db *StakingDB) LoadRoundValidatorAddrs(blockHash common.Hash, key []byte) ([]common.Address, error)
- func (db *StakingDB) SetCanBaseStore(blockHash common.Hash, addr common.Address, can *CandidateBase) error
- func (db *StakingDB) SetCanMutableStore(blockHash common.Hash, addr common.Address, can *CandidateMutable) error
- func (db *StakingDB) SetCanPowerStore(blockHash common.Hash, addr common.Address, can *Candidate) error
- func (db *StakingDB) SetCandidateStore(blockHash common.Hash, addr common.Address, can *Candidate) error
- func (db *StakingDB) SetDelegateStore(blockHash common.Hash, delAddr common.Address, nodeId discover.NodeID, ...) error
- func (db *StakingDB) SetDelegateStoreBySuffix(blockHash common.Hash, suffix []byte, del *Delegation) error
- func (db *StakingDB) SetEpochValIndex(blockHash common.Hash, indexArr ValArrIndexQueue) error
- func (db *StakingDB) SetEpochValList(blockHash common.Hash, start, end uint64, valArr ValidatorQueue) error
- func (db *StakingDB) SetRoundAddrBoundary(blockHash common.Hash, round uint64) error
- func (db *StakingDB) SetRoundValIndex(blockHash common.Hash, indexArr ValArrIndexQueue) error
- func (db *StakingDB) SetRoundValList(blockHash common.Hash, start, end uint64, valArr ValidatorQueue) error
- func (db *StakingDB) StoreRoundValidatorAddrs(blockHash common.Hash, key []byte, arry []common.Address) error
- func (db *StakingDB) SubAccountStakeRc(blockHash common.Hash, addr common.Address) error
- type UnStakeItem
- type ValArrIndex
- type ValArrIndexQueue
- type Validator
- type ValidatorArray
- type ValidatorEx
- type ValidatorExQueue
- type ValidatorQueue
Constants ¶
const ( CanBasePrefixStr = "CanBase" CanMutablePrefixStr = "CanMut" CanPowerPrefixStr = "Power" UnStakeCountKeyStr = "UnStakeCount" UnStakeItemKeyStr = "UnStakeItem" DelegatePrefixStr = "Del" EpochIndexKeyStr = "EpochIndex" EpochValArrPrefixStr = "EpochValArr" RoundIndexKeyStr = "RoundIndex" RoundValArrPrefixStr = "RoundValArr" AccountStakeRcPrefixStr = "AccStakeRc" PPOSHASHStr = "PPOSHASH" RoundValAddrArrPrefixStr = "RoundValAddrArr" RoundAddrBoundaryPrefixStr = "RoundAddrBoundary" )
const ( MaxExternalIdLen = 70 MaxNodeNameLen = 30 MaxWebsiteLen = 140 MaxDetailsLen = 280 )
Variables ¶
var ( CanBaseKeyPrefix = []byte(CanBasePrefixStr) CanMutableKeyPrefix = []byte(CanMutablePrefixStr) CanPowerKeyPrefix = []byte(CanPowerPrefixStr) UnStakeCountKey = []byte(UnStakeCountKeyStr) UnStakeItemKey = []byte(UnStakeItemKeyStr) DelegateKeyPrefix = []byte(DelegatePrefixStr) EpochIndexKey = []byte(EpochIndexKeyStr) EpochValArrPrefix = []byte(EpochValArrPrefixStr) RoundIndexKey = []byte(RoundIndexKeyStr) RoundValArrPrefix = []byte(RoundValArrPrefixStr) AccountStakeRcPrefix = []byte(AccountStakeRcPrefixStr) PPOSHASHKey = []byte(PPOSHASHStr) RoundValAddrArrPrefix = []byte(RoundValAddrArrPrefixStr) RoundAddrBoundaryPrefix = []byte(RoundAddrBoundaryPrefixStr) )
var ( ErrWrongBlsPubKey = common.NewBizError(301000, "Wrong bls public key") ErrWrongBlsPubKeyProof = common.NewBizError(301001, "Wrong bls public key proof") ErrDescriptionLen = common.NewBizError(301002, "The Description length is wrong") ErrWrongProgramVersionSign = common.NewBizError(301003, "The program version sign is wrong") ErrProgramVersionTooLow = common.NewBizError(301004, "The program version of the relates node's is too low") ErrDeclVsFialedCreateCan = common.NewBizError(301005, "DeclareVersion is failed on create staking") ErrNoSameStakingAddr = common.NewBizError(301006, "The address must be the same as initiated staking") ErrStakeVonTooLow = common.NewBizError(301100, "Staking deposit too low") ErrCanAlreadyExist = common.NewBizError(301101, "This candidate is already exist") ErrCanNoExist = common.NewBizError(301102, "This candidate is not exist") ErrCanStatusInvalid = common.NewBizError(301103, "This candidate status was invalided") ErrIncreaseStakeVonTooLow = common.NewBizError(301104, "IncreaseStake von is too low") ErrDelegateVonTooLow = common.NewBizError(301105, "Delegate deposit too low") ErrAccountNoAllowToDelegate = common.NewBizError(301106, "The account is not allowed to be used for delegating") ErrCanNoAllowDelegate = common.NewBizError(301107, "The candidate does not accept the delegation") ErrWithdrewDelegateVonTooLow = common.NewBizError(301108, "Withdrew delegation von is too low") ErrDelegateNoExist = common.NewBizError(301109, "This delegation is not exist") ErrWrongVonOptType = common.NewBizError(301110, "The von operation type is wrong") ErrAccountVonNoEnough = common.NewBizError(301111, "The von of account is not enough") ErrBlockNumberDisordered = common.NewBizError(301112, "The blockNumber is disordered") ErrDelegateVonNoEnough = common.NewBizError(301113, "The von of delegation is not enough") ErrWrongWithdrewDelVonCalc = common.NewBizError(301114, "Withdrew delegation von calculation is wrong") ErrValidatorNoExist = common.NewBizError(301115, "The validator is not exist") ErrWrongFuncParams = common.NewBizError(301116, "The fn params is wrong") ErrWrongSlashType = common.NewBizError(301117, "The slashing type is wrong") ErrSlashVonOverflow = common.NewBizError(301118, "Slashing amount is overflow") ErrWrongSlashVonCalc = common.NewBizError(301119, "Slashing candidate von calculate is wrong") ErrGetVerifierList = common.NewBizError(301200, "Getting verifierList is failed") ErrGetValidatorList = common.NewBizError(301201, "Getting validatorList is failed") ErrGetCandidateList = common.NewBizError(301202, "Getting candidateList is failed") ErrGetDelegateRelated = common.NewBizError(301203, "Getting related of delegate is failed") ErrQueryCandidateInfo = common.NewBizError(301204, "Query candidate info failed") ErrQueryDelegateInfo = common.NewBizError(301205, "Query delegate info failed") )
Functions ¶
func CanBaseKeyByAddr ¶ added in v0.7.4
func CanBaseKeyByNodeId ¶ added in v0.7.4
CanBase ...
func CanBaseKeyByPubKey ¶ added in v0.7.4
func CanBaseKeyBySuffix ¶ added in v0.7.4
func CanMutableKeyByAddr ¶ added in v0.7.4
func CanMutableKeyByNodeId ¶ added in v0.7.4
CanMutable ...
func CanMutableKeyByPubKey ¶ added in v0.7.4
func CanMutableKeyBySuffix ¶ added in v0.7.4
func CompareDefault ¶
func CompareDefault(removes NeedRemoveCans, left, right *Validator) int
NOTE: Sort By Default
When sorting is done by default, it is slashed and is sorted to the end.
The priorities just like that: Slashing > ProgramVersion > Shares > BlockNumber > TxIndex
Slashing: From no to yes ProgramVersion: From big to small Shares: From big to small BlockNumber: From small to big TxIndex: From small to big
Compare Left And Right 1: Left > Right 0: Left == Right -1:Left < Right
func CompareForDel ¶
func CompareForDel(removes NeedRemoveCans, left, right *Validator) int
NOTE: These are sorted by priority that will be removed
When sorting is done by delete slashing, it is slashed and is sorted to the front.
The priorities just like that: Invalid > ProgramVersion > validaotorTerm > Shares > BlockNumber > TxIndex
What is the invalid ? That are DuplicateSign and lowRatio&invalid and lowVersion and withdrew&NotInEpochValidators
Invalid Status: From invalid to valid ProgramVersion: From small to big validaotorTerm: From big to small Shares: From small to big BlockNumber: From big to small TxIndex: From big to small
Compare Left And Right 1: Left > Right 0: Left == Right -1:Left < Right
func CompareForStore ¶
func CompareForStore(_ NeedRemoveCans, left, right *Validator) int
NOTE: Sort when doing storage
The priorities just like that: (No shares) ProgramVersion > validaotorTerm > BlockNumber > TxIndex
Compare Left And Right 1: Left > Right 0: Left == Right -1:Left < Right
func GetAccountStakeRcKey ¶
func GetDelegateKey ¶
func GetDelegateKeyBySuffix ¶
func GetEpochIndexKey ¶
func GetEpochIndexKey() []byte
func GetEpochValArrKey ¶
func GetPPOSHASHKey ¶
func GetPPOSHASHKey() []byte
func GetRoundAddrBoundaryKey ¶ added in v0.7.4
func GetRoundAddrBoundaryKey() []byte
func GetRoundIndexKey ¶
func GetRoundIndexKey() []byte
func GetRoundValAddrArrKey ¶ added in v0.7.3
func GetRoundValArrKey ¶
func GetUnStakeCountKey ¶
func GetUnStakeItemKey ¶
Types ¶
type Candidate ¶
type Candidate struct { *CandidateBase *CandidateMutable }
The Candidate info
func (*Candidate) IsNotEmpty ¶ added in v0.7.4
type CandidateBase ¶ added in v0.7.4
type CandidateBase struct { NodeId discover.NodeID // bls public key BlsPubKey bls.PublicKeyHex // The account used to initiate the staking StakingAddress common.Address // The account receive the block rewards and the staking rewards BenefitAddress common.Address // The tx index at the time of staking StakingTxIndex uint32 // The version of the node program // (Store Large Verson: the 2.1.x large version is 2.1.0) ProgramVersion uint32 // Block height at the time of staking StakingBlockNum uint64 // Node desc Description }
func (*CandidateBase) IsEmpty ¶ added in v0.7.4
func (can *CandidateBase) IsEmpty() bool
func (*CandidateBase) IsNotEmpty ¶ added in v0.7.4
func (can *CandidateBase) IsNotEmpty() bool
func (*CandidateBase) String ¶ added in v0.7.4
func (can *CandidateBase) String() string
type CandidateBaseQueue ¶ added in v0.7.4
type CandidateBaseQueue []*CandidateBase
func (CandidateBaseQueue) IsEmpty ¶ added in v0.7.4
func (queue CandidateBaseQueue) IsEmpty() bool
func (CandidateBaseQueue) IsNotEmpty ¶ added in v0.7.4
func (queue CandidateBaseQueue) IsNotEmpty() bool
type CandidateHex ¶
type CandidateHex struct { NodeId discover.NodeID BlsPubKey bls.PublicKeyHex StakingAddress common.Address BenefitAddress common.Address StakingTxIndex uint32 ProgramVersion uint32 Status CandidateStatus StakingEpoch uint32 StakingBlockNum uint64 Released *hexutil.Big ReleasedHes *hexutil.Big RestrictingPlan *hexutil.Big RestrictingPlanHes *hexutil.Big Description }
Display amount field using 0x hex
func (*CandidateHex) IsEmpty ¶ added in v0.7.4
func (can *CandidateHex) IsEmpty() bool
func (*CandidateHex) IsNotEmpty ¶ added in v0.7.4
func (can *CandidateHex) IsNotEmpty() bool
func (*CandidateHex) String ¶
func (can *CandidateHex) String() string
type CandidateHexQueue ¶
type CandidateHexQueue []*CandidateHex
func (CandidateHexQueue) IsEmpty ¶ added in v0.7.4
func (queue CandidateHexQueue) IsEmpty() bool
func (CandidateHexQueue) IsNotEmpty ¶ added in v0.7.4
func (queue CandidateHexQueue) IsNotEmpty() bool
func (CandidateHexQueue) String ¶ added in v0.7.4
func (queue CandidateHexQueue) String() string
type CandidateMap ¶
type CandidateMutable ¶ added in v0.7.4
type CandidateMutable struct { // The candidate status // Reference `THE CANDIDATE STATUS` Status CandidateStatus // The epoch number at staking or edit StakingEpoch uint32 Shares *big.Int // The staking von is circulating for effective epoch (in effect) Released *big.Int // The staking von is circulating for hesitant epoch (in hesitation) ReleasedHes *big.Int // The staking von is RestrictingPlan for effective epoch (in effect) RestrictingPlan *big.Int // The staking von is RestrictingPlan for hesitant epoch (in hesitation) RestrictingPlanHes *big.Int }
func (*CandidateMutable) AddShares ¶ added in v0.7.4
func (can *CandidateMutable) AddShares(amount *big.Int)
func (*CandidateMutable) CleanLowRatioStatus ¶ added in v0.7.4
func (can *CandidateMutable) CleanLowRatioStatus()
func (*CandidateMutable) CleanShares ¶ added in v0.7.4
func (can *CandidateMutable) CleanShares()
func (*CandidateMutable) IsDuplicateSign ¶ added in v0.7.4
func (can *CandidateMutable) IsDuplicateSign() bool
func (*CandidateMutable) IsEmpty ¶ added in v0.7.4
func (can *CandidateMutable) IsEmpty() bool
func (*CandidateMutable) IsInvalid ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalid() bool
func (*CandidateMutable) IsInvalidDuplicateSign ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidDuplicateSign() bool
func (*CandidateMutable) IsInvalidLowRatio ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidLowRatio() bool
func (*CandidateMutable) IsInvalidLowRatioDel ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidLowRatioDel() bool
func (*CandidateMutable) IsInvalidLowRatioNotEnough ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidLowRatioNotEnough() bool
func (*CandidateMutable) IsInvalidNotEnough ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidNotEnough() bool
func (*CandidateMutable) IsInvalidWithdrew ¶ added in v0.7.4
func (can *CandidateMutable) IsInvalidWithdrew() bool
func (*CandidateMutable) IsLowRatio ¶ added in v0.7.4
func (can *CandidateMutable) IsLowRatio() bool
func (*CandidateMutable) IsLowRatioDel ¶ added in v0.7.4
func (can *CandidateMutable) IsLowRatioDel() bool
func (*CandidateMutable) IsLowRatioNotEnough ¶ added in v0.7.4
func (can *CandidateMutable) IsLowRatioNotEnough() bool
func (*CandidateMutable) IsNotEmpty ¶ added in v0.7.4
func (can *CandidateMutable) IsNotEmpty() bool
func (*CandidateMutable) IsNotEnough ¶ added in v0.7.4
func (can *CandidateMutable) IsNotEnough() bool
func (*CandidateMutable) IsPureInvalid ¶ added in v0.7.4
func (can *CandidateMutable) IsPureInvalid() bool
func (*CandidateMutable) IsPureLowRatio ¶ added in v0.7.4
func (can *CandidateMutable) IsPureLowRatio() bool
func (*CandidateMutable) IsPureLowRatioDel ¶ added in v0.7.4
func (can *CandidateMutable) IsPureLowRatioDel() bool
func (*CandidateMutable) IsPureNotEnough ¶ added in v0.7.4
func (can *CandidateMutable) IsPureNotEnough() bool
func (*CandidateMutable) IsPureWithdrew ¶ added in v0.7.4
func (can *CandidateMutable) IsPureWithdrew() bool
func (*CandidateMutable) IsValid ¶ added in v0.7.4
func (can *CandidateMutable) IsValid() bool
func (*CandidateMutable) IsWithdrew ¶ added in v0.7.4
func (can *CandidateMutable) IsWithdrew() bool
func (*CandidateMutable) String ¶ added in v0.7.4
func (can *CandidateMutable) String() string
func (*CandidateMutable) SubShares ¶ added in v0.7.4
func (can *CandidateMutable) SubShares(amount *big.Int)
type CandidateQueue ¶
type CandidateQueue []*Candidate
func (CandidateQueue) String ¶ added in v0.7.4
func (queue CandidateQueue) String() string
type CandidateStatus ¶ added in v0.7.4
type CandidateStatus uint32
const ( /** ###### ###### ###### ###### # THE CANDIDATE STATUS # ###### ###### ###### ###### */ Invalided CandidateStatus = 1 << iota // 0001: The current candidate withdraws from the staking qualification (Active OR Passive) LowRatio // 0010: The candidate was low package ratio AND no delete NotEnough // 0100: The current candidate's von does not meet the minimum staking threshold DuplicateSign // 1000: The Duplicate package or Duplicate sign LowRatioDel // 0001,0000: The lowRatio AND must delete Withdrew // 0010,0000: The Active withdrew Valided = 0 // 0000: The current candidate is in force NotExist = 1 << 31 // 1000,xxxx,... : The candidate is not exist )
func (CandidateStatus) IsDuplicateSign ¶ added in v0.7.4
func (status CandidateStatus) IsDuplicateSign() bool
func (CandidateStatus) IsInvalid ¶ added in v0.7.4
func (status CandidateStatus) IsInvalid() bool
func (CandidateStatus) IsInvalidDuplicateSign ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidDuplicateSign() bool
func (CandidateStatus) IsInvalidLowRatio ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidLowRatio() bool
func (CandidateStatus) IsInvalidLowRatioDel ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidLowRatioDel() bool
func (CandidateStatus) IsInvalidLowRatioNotEnough ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidLowRatioNotEnough() bool
func (CandidateStatus) IsInvalidNotEnough ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidNotEnough() bool
func (CandidateStatus) IsInvalidWithdrew ¶ added in v0.7.4
func (status CandidateStatus) IsInvalidWithdrew() bool
func (CandidateStatus) IsLowRatio ¶ added in v0.7.4
func (status CandidateStatus) IsLowRatio() bool
func (CandidateStatus) IsLowRatioDel ¶ added in v0.7.4
func (status CandidateStatus) IsLowRatioDel() bool
func (CandidateStatus) IsLowRatioNotEnough ¶ added in v0.7.4
func (status CandidateStatus) IsLowRatioNotEnough() bool
func (CandidateStatus) IsNotEnough ¶ added in v0.7.4
func (status CandidateStatus) IsNotEnough() bool
func (CandidateStatus) IsPureInvalid ¶ added in v0.7.4
func (status CandidateStatus) IsPureInvalid() bool
func (CandidateStatus) IsPureLowRatio ¶ added in v0.7.4
func (status CandidateStatus) IsPureLowRatio() bool
func (CandidateStatus) IsPureLowRatioDel ¶ added in v0.7.4
func (status CandidateStatus) IsPureLowRatioDel() bool
func (CandidateStatus) IsPureNotEnough ¶ added in v0.7.4
func (status CandidateStatus) IsPureNotEnough() bool
func (CandidateStatus) IsPureWithdrew ¶ added in v0.7.4
func (status CandidateStatus) IsPureWithdrew() bool
func (CandidateStatus) IsValid ¶ added in v0.7.4
func (status CandidateStatus) IsValid() bool
func (CandidateStatus) IsWithdrew ¶ added in v0.7.4
func (status CandidateStatus) IsWithdrew() bool
type DelRelatedQueue ¶
type DelRelatedQueue []*DelegateRelated
func (DelRelatedQueue) IsEmpty ¶ added in v0.7.4
func (queue DelRelatedQueue) IsEmpty() bool
func (DelRelatedQueue) IsNotEmpty ¶ added in v0.7.4
func (queue DelRelatedQueue) IsNotEmpty() bool
func (DelRelatedQueue) String ¶ added in v0.7.4
func (queue DelRelatedQueue) String() string
type DelegateRelated ¶
func (*DelegateRelated) IsEmpty ¶ added in v0.7.4
func (dr *DelegateRelated) IsEmpty() bool
func (*DelegateRelated) IsNotEmpty ¶ added in v0.7.4
func (dr *DelegateRelated) IsNotEmpty() bool
func (*DelegateRelated) String ¶
func (dr *DelegateRelated) String() string
type Delegation ¶
type Delegation struct { // The epoch number at delegate or edit DelegateEpoch uint32 // The delegate von is circulating for effective epoch (in effect) Released *big.Int // The delegate von is circulating for hesitant epoch (in hesitation) ReleasedHes *big.Int // The delegate von is RestrictingPlan for effective epoch (in effect) RestrictingPlan *big.Int // The delegate von is RestrictingPlan for hesitant epoch (in hesitation) RestrictingPlanHes *big.Int }
the Delegate information
func (*Delegation) IsEmpty ¶ added in v0.7.4
func (del *Delegation) IsEmpty() bool
func (*Delegation) IsNotEmpty ¶ added in v0.7.4
func (del *Delegation) IsNotEmpty() bool
func (*Delegation) String ¶
func (del *Delegation) String() string
type DelegationEx ¶
type DelegationEx struct { Addr common.Address NodeId discover.NodeID StakingBlockNum uint64 DelegationHex }
func (*DelegationEx) IsEmpty ¶ added in v0.7.4
func (dex *DelegationEx) IsEmpty() bool
func (*DelegationEx) IsNotEmpty ¶ added in v0.7.4
func (dex *DelegationEx) IsNotEmpty() bool
func (*DelegationEx) String ¶
func (dex *DelegationEx) String() string
type DelegationHex ¶
type DelegationHex struct { // The epoch number at delegate or edit DelegateEpoch uint32 // The delegate von is circulating for effective epoch (in effect) Released *hexutil.Big // The delegate von is circulating for hesitant epoch (in hesitation) ReleasedHes *hexutil.Big // The delegate von is RestrictingPlan for effective epoch (in effect) RestrictingPlan *hexutil.Big // The delegate von is RestrictingPlan for hesitant epoch (in hesitation) RestrictingPlanHes *hexutil.Big }
func (*DelegationHex) IsEmpty ¶ added in v0.7.4
func (del *DelegationHex) IsEmpty() bool
func (*DelegationHex) IsNotEmpty ¶ added in v0.7.4
func (del *DelegationHex) IsNotEmpty() bool
func (*DelegationHex) String ¶
func (delHex *DelegationHex) String() string
type Description ¶
type Description struct { // External Id for the third party to pull the node description (with length limit) ExternalId string // The Candidate Node's Name (with a length limit) NodeName string // The third-party home page of the node (with a length limit) Website string // Description of the node (with a length limit) Details string }
func (*Description) CheckLength ¶
func (desc *Description) CheckLength() error
type NeedRemoveCans ¶
type SlashNodeItem ¶ added in v0.7.3
type SlashNodeItem struct { // the nodeId will be slashed NodeId discover.NodeID // the amount of von with slashed Amount *big.Int // slash type SlashType CandidateStatus // the benefit adrr who will receive the slash amount of von BenefitAddr common.Address }
An item that exists for slash
func (*SlashNodeItem) String ¶ added in v0.7.4
func (s *SlashNodeItem) String() string
type SlashQueue ¶ added in v0.7.3
type SlashQueue []*SlashNodeItem
func (SlashQueue) String ¶ added in v0.7.4
func (queue SlashQueue) String() string
type StakingDB ¶
type StakingDB struct {
// contains filtered or unexported fields
}
func NewStakingDB ¶
func NewStakingDB() *StakingDB
func (*StakingDB) AddAccountStakeRc ¶
func (*StakingDB) AddUnStakeItemStore ¶
func (*StakingDB) DelCanBaseStore ¶ added in v0.7.4
func (*StakingDB) DelCanMutableStore ¶ added in v0.7.4
func (*StakingDB) DelCanPowerStore ¶
func (*StakingDB) DelCandidateStore ¶
func (*StakingDB) DelDelegateStore ¶
func (*StakingDB) DelDelegateStoreBySuffix ¶
func (*StakingDB) DelEpochValListByBlockHash ¶
func (*StakingDB) DelRoundValListByBlockHash ¶
func (*StakingDB) DelRoundValidatorAddrs ¶ added in v0.7.3
func (*StakingDB) DelUnStakeCountStore ¶
func (*StakingDB) DelUnStakeItemStore ¶
func (*StakingDB) GetCanBaseStore ¶ added in v0.7.4
func (*StakingDB) GetCanBaseStoreByIrr ¶ added in v0.7.4
func (db *StakingDB) GetCanBaseStoreByIrr(addr common.Address) (*CandidateBase, error)
func (*StakingDB) GetCanBaseStoreByIrrWithSuffix ¶ added in v0.7.4
func (db *StakingDB) GetCanBaseStoreByIrrWithSuffix(suffix []byte) (*CandidateBase, error)
func (*StakingDB) GetCanBaseStoreWithSuffix ¶ added in v0.7.4
func (*StakingDB) GetCanMutableStore ¶ added in v0.7.4
func (*StakingDB) GetCanMutableStoreByIrr ¶ added in v0.7.4
func (db *StakingDB) GetCanMutableStoreByIrr(addr common.Address) (*CandidateMutable, error)
func (*StakingDB) GetCanMutableStoreByIrrWithSuffix ¶ added in v0.7.4
func (db *StakingDB) GetCanMutableStoreByIrrWithSuffix(suffix []byte) (*CandidateMutable, error)
func (*StakingDB) GetCanMutableStoreWithSuffix ¶ added in v0.7.4
func (*StakingDB) GetCandidateStore ¶
func (*StakingDB) GetCandidateStoreByIrr ¶
func (*StakingDB) GetCandidateStoreByIrrWithSuffix ¶
func (*StakingDB) GetCandidateStoreWithSuffix ¶
func (*StakingDB) GetDelegateStore ¶
func (*StakingDB) GetDelegateStoreByIrr ¶
func (*StakingDB) GetDelegateStoreBySuffix ¶
func (*StakingDB) GetEpochValIndexByBlockHash ¶
func (db *StakingDB) GetEpochValIndexByBlockHash(blockHash common.Hash) (ValArrIndexQueue, error)
func (*StakingDB) GetEpochValIndexByIrr ¶
func (db *StakingDB) GetEpochValIndexByIrr() (ValArrIndexQueue, error)
func (*StakingDB) GetEpochValListByBlockHash ¶
func (*StakingDB) GetEpochValListByIrr ¶
func (db *StakingDB) GetEpochValListByIrr(start, end uint64) (ValidatorQueue, error)
func (*StakingDB) GetRoundAddrBoundary ¶ added in v0.7.4
func (*StakingDB) GetRoundValIndexByBlockHash ¶
func (db *StakingDB) GetRoundValIndexByBlockHash(blockHash common.Hash) (ValArrIndexQueue, error)
func (*StakingDB) GetRoundValIndexByIrr ¶
func (db *StakingDB) GetRoundValIndexByIrr() (ValArrIndexQueue, error)
func (*StakingDB) GetRoundValListByBlockHash ¶
func (*StakingDB) GetRoundValListByIrr ¶
func (db *StakingDB) GetRoundValListByIrr(start, end uint64) (ValidatorQueue, error)
func (*StakingDB) GetUnStakeCountStore ¶
func (*StakingDB) GetUnStakeItemStore ¶
func (*StakingDB) HasAccountStakeRc ¶
func (*StakingDB) IteratorCandidatePowerByBlockHash ¶
func (*StakingDB) IteratorDelegateByBlockHashWithAddr ¶
func (*StakingDB) LoadRoundValidatorAddrs ¶ added in v0.7.3
func (*StakingDB) SetCanBaseStore ¶ added in v0.7.4
func (*StakingDB) SetCanMutableStore ¶ added in v0.7.4
func (*StakingDB) SetCanPowerStore ¶
func (*StakingDB) SetCandidateStore ¶
func (*StakingDB) SetDelegateStore ¶
func (*StakingDB) SetDelegateStoreBySuffix ¶
func (*StakingDB) SetEpochValIndex ¶
func (db *StakingDB) SetEpochValIndex(blockHash common.Hash, indexArr ValArrIndexQueue) error
func (*StakingDB) SetEpochValList ¶
func (*StakingDB) SetRoundAddrBoundary ¶ added in v0.7.4
func (*StakingDB) SetRoundValIndex ¶
func (db *StakingDB) SetRoundValIndex(blockHash common.Hash, indexArr ValArrIndexQueue) error
func (*StakingDB) SetRoundValList ¶
func (*StakingDB) StoreRoundValidatorAddrs ¶ added in v0.7.3
type UnStakeItem ¶
type ValArrIndex ¶
func (*ValArrIndex) String ¶ added in v0.7.4
func (vindex *ValArrIndex) String() string
type ValArrIndexQueue ¶
type ValArrIndexQueue []*ValArrIndex
func (ValArrIndexQueue) ConstantAppend ¶
func (queue ValArrIndexQueue) ConstantAppend(index *ValArrIndex, size int) (*ValArrIndex, ValArrIndexQueue)
func (ValArrIndexQueue) String ¶ added in v0.7.4
func (queue ValArrIndexQueue) String() string
type Validator ¶
type Validator struct { ProgramVersion uint32 StakingTxIndex uint32 ValidatorTerm uint32 // Validator's term in the consensus round StakingBlockNum uint64 NodeAddress common.Address NodeId discover.NodeID BlsPubKey bls.PublicKeyHex }
the Validator info They are Simplified Candidate They are consensus nodes and Epoch nodes snapshot
type Validator struct { NodeAddress common.Address NodeId discover.NodeID // bls public key BlsPubKey bls.PublicKeyHex // The weight snapshot // NOTE: // converted from the weight snapshot of Candidate, they array order is: // // programVersion, candidate.shares, stakingBlocknum, stakingTxindex // // They origin type is: uint32, *big.Int, uint64, uint32 StakingWeight [SWeightItem]string // Validator's term in the consensus round ValidatorTerm uint32 }
type ValidatorArray ¶
type ValidatorArray struct { // the round start blockNumber or epoch start blockNumber Start uint64 // the round end blockNumber or epoch blockNumber End uint64 // the round validators or epoch validators Arr ValidatorQueue }
some consensus round validators or current epoch validators
func (ValidatorArray) String ¶ added in v0.7.4
func (v ValidatorArray) String() string
type ValidatorEx ¶
type ValidatorEx struct { //NodeAddress common.Address NodeId discover.NodeID // bls public key BlsPubKey bls.PublicKeyHex // The account used to initiate the staking StakingAddress common.Address // The account receive the block rewards and the staking rewards BenefitAddress common.Address // The tx index at the time of staking StakingTxIndex uint32 // The version of the node process ProgramVersion uint32 // Block height at the time of staking StakingBlockNum uint64 //Shares *big.Int Shares *hexutil.Big // Node desc Description // this is the term of validator in consensus round // [0, N] ValidatorTerm uint32 }
func (*ValidatorEx) String ¶
func (vex *ValidatorEx) String() string
type ValidatorExQueue ¶
type ValidatorExQueue []*ValidatorEx
func (ValidatorExQueue) IsEmpty ¶ added in v0.7.4
func (queue ValidatorExQueue) IsEmpty() bool
func (ValidatorExQueue) IsNotEmpty ¶ added in v0.7.4
func (queue ValidatorExQueue) IsNotEmpty() bool
func (ValidatorExQueue) String ¶ added in v0.7.4
func (queue ValidatorExQueue) String() string
type ValidatorQueue ¶
type ValidatorQueue []*Validator
func (ValidatorQueue) IsEmpty ¶ added in v0.7.4
func (queue ValidatorQueue) IsEmpty() bool
func (ValidatorQueue) IsNotEmpty ¶ added in v0.7.4
func (queue ValidatorQueue) IsNotEmpty() bool
func (ValidatorQueue) String ¶ added in v0.7.4
func (queue ValidatorQueue) String() string
func (ValidatorQueue) ValidatorSort ¶
func (arr ValidatorQueue) ValidatorSort(removes NeedRemoveCans, compare func(slashs NeedRemoveCans, c, can *Validator) int)