Documentation ¶
Index ¶
- Constants
- Variables
- func ChoiceStrToInt8(choice string) int8
- func VoteToString(status int8) string
- type AllegationRequest
- type AllegationTracker
- type AllegationVote
- type CumulativeVote
- type EvidenceStore
- func (es *EvidenceStore) CheckRequestExists(new keys.Address) bool
- func (es *EvidenceStore) CleanTracker()
- func (es *EvidenceStore) CreateSuspiciousValidator(validatorAddress keys.Address, status int8, height int64, createdAt *time.Time) (*LastValidatorHistory, error)
- func (es *EvidenceStore) DeleteAllegationRequest(ID string) (bool, error)
- func (es *EvidenceStore) GenerateRequestID() (string, error)
- func (es *EvidenceStore) Get(key []byte) ([]byte, error)
- func (es *EvidenceStore) GetAllegationRequest(ID string) (*AllegationRequest, error)
- func (es *EvidenceStore) GetAllegationTracker() (*AllegationTracker, error)
- func (es *EvidenceStore) GetCumulativeVote() (*CumulativeVote, error)
- func (es *EvidenceStore) GetFrozenMap() map[string]bool
- func (es *EvidenceStore) GetSuspiciousValidator(validatorAddress keys.Address, height int64, diff int64) (*LastValidatorHistory, error)
- func (es *EvidenceStore) GetValidatorMap() map[string]bool
- func (es *EvidenceStore) GetValidatorStatus(addr keys.Address) (*ValidatorStatus, error)
- func (es *EvidenceStore) GetVersioned(key []byte, height int64, diff int64) []byte
- func (es *EvidenceStore) GetVoteBlock(height int64) (*VoteBlock, error)
- func (es *EvidenceStore) HandleRelease(options *Options, validatorAddress keys.Address, blockHeight int64, ...) error
- func (es *EvidenceStore) IsActiveValidator(addr keys.Address) bool
- func (es *EvidenceStore) IsFrozenValidator(validatorAddress keys.Address) bool
- func (es *EvidenceStore) IsRequestIDBusy(ID string) bool
- func (es *EvidenceStore) IterateRequests(fn func(ar *AllegationRequest) bool) (stopped bool)
- func (es *EvidenceStore) IterateSuspiciousValidators(fn func(lvh *LastValidatorHistory) bool) (stopped bool)
- func (es *EvidenceStore) IterateValidatorStatuses(fn func(vs *ValidatorStatus) bool) (stopped bool)
- func (es *EvidenceStore) PerformAllegation(validatorAddress keys.Address, maliciousAddress keys.Address, ID string, ...) error
- func (es *EvidenceStore) Set(key []byte, value []byte) error
- func (es *EvidenceStore) SetAllegationRequest(ar *AllegationRequest) error
- func (es *EvidenceStore) SetAllegationTracker(at *AllegationTracker) error
- func (es *EvidenceStore) SetCumulativeVote(cv *CumulativeVote, currentHeight int64, yHeight int64) error
- func (es *EvidenceStore) SetValidatorStatus(addr keys.Address, isActive bool, height int64) error
- func (es *EvidenceStore) SetVoteBlock(height int64, votes []types.VoteInfo) error
- func (es *EvidenceStore) UpdateSuspiciousValidator(lvh *LastValidatorHistory) error
- func (es *EvidenceStore) Vote(requestID string, voteAddress keys.Address, choice int8) error
- func (es *EvidenceStore) WithState(state *storage.State) *EvidenceStore
- type LastValidatorHistory
- type MaliciousValidators
- type Options
- type ValidatorStatus
- type VoteBlock
Constants ¶
View Source
const ( VOTING int8 = 0x1 INNOCENT int8 = 0x2 GUILTY int8 = 0x3 YES int8 = 0x1 NO int8 = 0x2 )
View Source
const ( MISSED_REQUIRED_VOTES int8 = 0x01 BYZANTINE_FAULT int8 = 0x02 )
Variables ¶
View Source
var ( ErrCreateAllegationFailed = codes.ProtocolError{codes.TxErrEvidenceError, "failed to create allegation request"} ErrHandleReleaseFailed = codes.ProtocolError{codes.TxErrEvidenceError, "failed to handle release"} ErrFrozenValidator = codes.ProtocolError{codes.TxErrEvidenceError, "error frozen validator"} ErrNonFrozenValidator = codes.ProtocolError{codes.TxErrEvidenceError, "error non frozen validator"} ErrNonActiveValidator = codes.ProtocolError{codes.TxErrEvidenceError, "non active validator"} ErrInvalidHeight = codes.ProtocolError{codes.TxErrEvidenceError, "error invalid height"} ErrRequestAlreadyExists = codes.ProtocolError{codes.TxErrEvidenceError, "allegation request already exists against this address"} )
Functions ¶
func ChoiceStrToInt8 ¶ added in v0.16.1
func VoteToString ¶ added in v0.16.1
Types ¶
type AllegationRequest ¶ added in v0.16.1
type AllegationRequest struct { ID string ReporterAddress keys.Address MaliciousAddress keys.Address BlockHeight int64 ProofMsg string Status int8 Votes []*AllegationVote }
func NewAllegationRequest ¶ added in v0.16.1
func (*AllegationRequest) Bytes ¶ added in v0.16.1
func (ar *AllegationRequest) Bytes() ([]byte, error)
func (*AllegationRequest) FromBytes ¶ added in v0.16.1
func (ar *AllegationRequest) FromBytes(msg []byte) (*AllegationRequest, error)
func (*AllegationRequest) String ¶ added in v0.16.1
func (ar *AllegationRequest) String() string
type AllegationTracker ¶ added in v0.16.1
type AllegationVote ¶ added in v0.16.1
type CumulativeVote ¶ added in v0.16.1
type EvidenceStore ¶ added in v0.16.1
type EvidenceStore struct {
// contains filtered or unexported fields
}
func NewEvidenceStore ¶ added in v0.16.1
func NewEvidenceStore(prefix string, state *storage.State) *EvidenceStore
func (*EvidenceStore) CheckRequestExists ¶ added in v0.16.1
func (es *EvidenceStore) CheckRequestExists(new keys.Address) bool
func (*EvidenceStore) CleanTracker ¶ added in v0.16.1
func (es *EvidenceStore) CleanTracker()
func (*EvidenceStore) CreateSuspiciousValidator ¶ added in v0.16.1
func (es *EvidenceStore) CreateSuspiciousValidator(validatorAddress keys.Address, status int8, height int64, createdAt *time.Time) (*LastValidatorHistory, error)
func (*EvidenceStore) DeleteAllegationRequest ¶ added in v0.16.1
func (es *EvidenceStore) DeleteAllegationRequest(ID string) (bool, error)
func (*EvidenceStore) GenerateRequestID ¶ added in v0.16.1
func (es *EvidenceStore) GenerateRequestID() (string, error)
func (*EvidenceStore) Get ¶ added in v0.16.1
func (es *EvidenceStore) Get(key []byte) ([]byte, error)
func (*EvidenceStore) GetAllegationRequest ¶ added in v0.16.1
func (es *EvidenceStore) GetAllegationRequest(ID string) (*AllegationRequest, error)
func (*EvidenceStore) GetAllegationTracker ¶ added in v0.16.1
func (es *EvidenceStore) GetAllegationTracker() (*AllegationTracker, error)
func (*EvidenceStore) GetCumulativeVote ¶ added in v0.16.1
func (es *EvidenceStore) GetCumulativeVote() (*CumulativeVote, error)
func (*EvidenceStore) GetFrozenMap ¶ added in v0.16.1
func (es *EvidenceStore) GetFrozenMap() map[string]bool
func (*EvidenceStore) GetSuspiciousValidator ¶ added in v0.16.1
func (es *EvidenceStore) GetSuspiciousValidator(validatorAddress keys.Address, height int64, diff int64) (*LastValidatorHistory, error)
func (*EvidenceStore) GetValidatorMap ¶ added in v0.16.1
func (es *EvidenceStore) GetValidatorMap() map[string]bool
func (*EvidenceStore) GetValidatorStatus ¶ added in v0.16.1
func (es *EvidenceStore) GetValidatorStatus(addr keys.Address) (*ValidatorStatus, error)
func (*EvidenceStore) GetVersioned ¶ added in v0.16.1
func (es *EvidenceStore) GetVersioned(key []byte, height int64, diff int64) []byte
func (*EvidenceStore) GetVoteBlock ¶ added in v0.16.1
func (es *EvidenceStore) GetVoteBlock(height int64) (*VoteBlock, error)
func (*EvidenceStore) HandleRelease ¶ added in v0.16.1
func (*EvidenceStore) IsActiveValidator ¶ added in v0.16.1
func (es *EvidenceStore) IsActiveValidator(addr keys.Address) bool
func (*EvidenceStore) IsFrozenValidator ¶ added in v0.16.1
func (es *EvidenceStore) IsFrozenValidator(validatorAddress keys.Address) bool
func (*EvidenceStore) IsRequestIDBusy ¶ added in v0.16.1
func (es *EvidenceStore) IsRequestIDBusy(ID string) bool
func (*EvidenceStore) IterateRequests ¶ added in v0.16.1
func (es *EvidenceStore) IterateRequests(fn func(ar *AllegationRequest) bool) (stopped bool)
func (*EvidenceStore) IterateSuspiciousValidators ¶ added in v0.16.1
func (es *EvidenceStore) IterateSuspiciousValidators(fn func(lvh *LastValidatorHistory) bool) (stopped bool)
func (*EvidenceStore) IterateValidatorStatuses ¶ added in v0.16.1
func (es *EvidenceStore) IterateValidatorStatuses(fn func(vs *ValidatorStatus) bool) (stopped bool)
func (*EvidenceStore) PerformAllegation ¶ added in v0.16.1
func (*EvidenceStore) Set ¶ added in v0.16.1
func (es *EvidenceStore) Set(key []byte, value []byte) error
func (*EvidenceStore) SetAllegationRequest ¶ added in v0.16.1
func (es *EvidenceStore) SetAllegationRequest(ar *AllegationRequest) error
func (*EvidenceStore) SetAllegationTracker ¶ added in v0.16.1
func (es *EvidenceStore) SetAllegationTracker(at *AllegationTracker) error
func (*EvidenceStore) SetCumulativeVote ¶ added in v0.16.1
func (es *EvidenceStore) SetCumulativeVote(cv *CumulativeVote, currentHeight int64, yHeight int64) error
func (*EvidenceStore) SetValidatorStatus ¶ added in v0.16.1
func (*EvidenceStore) SetVoteBlock ¶ added in v0.16.1
func (es *EvidenceStore) SetVoteBlock(height int64, votes []types.VoteInfo) error
func (*EvidenceStore) UpdateSuspiciousValidator ¶ added in v0.16.1
func (es *EvidenceStore) UpdateSuspiciousValidator(lvh *LastValidatorHistory) error
func (*EvidenceStore) WithState ¶ added in v0.16.1
func (es *EvidenceStore) WithState(state *storage.State) *EvidenceStore
type LastValidatorHistory ¶ added in v0.16.1
type LastValidatorHistory struct { Address keys.Address Status int8 FrozenHeight int64 FrozenAt *time.Time ReleaseHeight int64 ReleaseAt *time.Time }
func NewLastValidatorHistory ¶ added in v0.16.1
func (*LastValidatorHistory) Bytes ¶ added in v0.16.1
func (lvh *LastValidatorHistory) Bytes() ([]byte, error)
func (*LastValidatorHistory) FromBytes ¶ added in v0.16.1
func (lvh *LastValidatorHistory) FromBytes(msg []byte) (*LastValidatorHistory, error)
func (*LastValidatorHistory) IsFrozen ¶ added in v0.16.1
func (lvh *LastValidatorHistory) IsFrozen() bool
func (*LastValidatorHistory) ReleaseReady ¶ added in v0.16.1
type MaliciousValidators ¶ added in v0.16.1
type MaliciousValidators struct {
Addresses []string
}
type Options ¶
type Options struct { // votes count required MinVotesRequired int64 `json:"minVotesRequired"` // votes boundaries H : H - VotesBlockDiff BlockVotesDiff int64 `json:"blockVotesDiff"` // penalty 1st iteration PenaltyBasePercentage int64 `json:"penaltyBasePercentage"` // penalty divisability factor PenaltyBaseDecimals int64 `json:"penaltyBaseDecimals"` // penalty cut for bounty (as example 13.43 %, stored as 1343) PenaltyBountyPercentage int64 `json:"penaltyBountyPercentage"` // penalty cut decimals PenaltyBountyDecimals int64 `json:"penaltyBountyDecimals"` // penalty cut for burn PenaltyBurnPercentage int64 `json:"penaltyBurnPercentage"` // penalty cut decimals PenaltyBurnDecimals int64 `json:"penaltyBurnDecimals"` // time to unfreeze validator (number of days) - for 2 scenario ValidatorReleaseTime int64 `json:"validatorReleaseTime"` // required validator votes ValidatorVotePercentage int64 `json:"validatorVotePercentage"` // required validator decimals ValidatorVoteDecimals int64 `json:"validatorVoteDecimals"` // allegation persent AllegationPercentage int64 `json:"allegationPercentage"` // allegation cut decimals AllegationDecimals int64 `json:"allegationDecimals"` }
type ValidatorStatus ¶ added in v0.16.1
type ValidatorStatus struct { Address keys.Address `json:"address"` IsActive bool `json:"isActive"` Height int64 `json:"height"` }
func (*ValidatorStatus) Bytes ¶ added in v0.16.1
func (vs *ValidatorStatus) Bytes() []byte
func (*ValidatorStatus) FromBytes ¶ added in v0.16.1
func (vs *ValidatorStatus) FromBytes(msg []byte) (*ValidatorStatus, error)
Click to show internal directories.
Click to hide internal directories.