Documentation ¶
Index ¶
- Constants
- Variables
- func CalcRespStatusToString(status uint16) string
- func ClaimBackupKey(blockHeight uint64, address common.Address) []byte
- func ClaimBackupKeyString(key []byte) string
- func CloseIScoreDB(isDB *IScoreDB)
- func DeleteCalculationResult(crDB db.Database, blockHeight uint64)
- func DoClaim(ctx *Context, req *ClaimMessage) (uint64, *common.HexInt)
- func DoCommitClaim(ctx *Context, req *CommitClaim) error
- func DoInit(ctx *Context, blockHeight uint64) error
- func DoQueryCalculateResult(ctx *Context, blockHeight uint64, resp *QueryCalculateResultResponse)
- func DoQueryCalculateStatus(ctx *Context, resp *QueryCalculateStatusResponse)
- func DoRollBack(ctx *Context, req *RollBackRequest) error
- func InitManager(cfg *RcConfig) (*manager, error)
- func LoadIISSData(iissDB db.Database) (*IISSHeader, []*IISSGovernanceVariable, []*PRep)
- func LoadPRepCandidate(dbi db.Database) (map[common.Address]*PRepCandidate, error)
- func MakeIteratorPrefix(prefix db.BucketID, blockHeight uint64, data []byte, dataSize int) *util.Range
- func MsgDataToString(data interface{}) string
- func MsgToString(msg uint) string
- func OpenIISSData(path string) db.Database
- func WriteCalculationResult(crDB db.Database, blockHeight uint64, stats *Statistics, stateHash []byte)
- type BlockInfo
- type CRData
- type CalcCancelByRollbackError
- type CalculateDone
- type CalculateRequest
- type CalculateResponse
- type CalculationResult
- type Claim
- type ClaimBackupInfo
- type ClaimData
- type ClaimMessage
- type CommitBlock
- type CommitClaim
- type Context
- type DBInfo
- type DBInfoData
- type DBInfoDataV1
- type DBInfoDataV2
- type DebugMessage
- type DelegateData
- type GVData
- type GovernanceVariable
- type IISSBlockProduceInfo
- type IISSBlockProduceInfoData
- type IISSGVData
- type IISSGovernanceVariable
- type IISSHeader
- type IISSTX
- type IISSTXData
- type IScoreAccount
- type IScoreDB
- type IScoreData
- type Manager
- type PRep
- type PRepCandidate
- type PRepCandidateData
- type PRepData
- type PRepDelegationInfo
- type PreCommit
- type PreCommitData
- type QueryCalculateResultResponse
- type QueryCalculateStatusResponse
- type RcConfig
- type ResponseClaim
- type ResponseDebugDBInfo
- type ResponseDebugGV
- type ResponseDebugPRep
- type ResponseDebugPRepCandidate
- type ResponseDebugStats
- type ResponseInit
- type ResponseQuery
- type ResponseVersion
- type RollBackRequest
- type RollBackResponse
- type Rollback
- type RollbackLowBlockHeightError
- type Statistics
- func (stats *Statistics) Bytes() []byte
- func (stats *Statistics) Decrease(field string, value interface{}) error
- func (stats *Statistics) Increase(field string, value interface{}) error
- func (stats *Statistics) Set(field string, value interface{}) error
- func (stats *Statistics) SetBytes(bs []byte) error
- func (stats *Statistics) String() string
Constants ¶
View Source
const ( NumDelegate = 10 AccountDBNameFormat = "calculate_%d_%d_%d" BackupDBNamePrefix = "backup_" BackupDBNameFormat = BackupDBNamePrefix + "%d_%d" // backup_CalcBH_accountDBIndex Revision8 uint64 = 8 RevisionMin = Revision8 RevisionMax = Revision8 )
View Source
const ( BlockHeightSize = 8 BlockHashSize = 32 TXHashSize = 32 PreCommitIDSize = BlockHeightSize + BlockHashSize + common.AddressBytes ClaimBackupIDSize = BlockHeightSize + common.AddressBytes ClaimBackupPeriod = 43120*2 - 1 )
View Source
const ( IISSDataVersion uint64 = 2 IISSDataRevisionDefault uint64 = 0 IISSDataDBPrefix = "iiss_rc_db_" IISSDataDBFormat = IISSDataDBPrefix + "%d" // $BH )
View Source
const ( TXDataTypeDelegate = 0 TXDataTypePrepReg = 1 TXDataTypePrepUnReg = 2 )
View Source
const ( MaxDBCount int = 256 NumMainPRep uint64 = 22 NumSubPRep uint64 = 78 )
View Source
const ( IPCVersion uint64 = 2 MsgVersion uint = 0 MsgClaim = 1 MsgQuery = 2 MsgCalculate = 3 MsgCommitBlock = 4 MsgCommitClaim = 5 MsgQueryCalculateStatus = 6 MsgQueryCalculateResult = 7 MsgRollBack = 8 MsgINIT = 9 MsgNotify = 100 MsgReady = MsgNotify + 0 MsgCalculateDone = MsgNotify + 1 MsgDebug = 1000 )
View Source
const ( CalcRespStatusOK uint16 = 0 CalcRespStatusInvalidData uint16 = 1 CalcRespStatusDoing uint16 = 2 CalcRespStatusInvalidBH uint16 = 3 CalcRespStatusDuplicateBH uint16 = 4 )
View Source
const ( CalculationDone uint64 = 0 CalculationDoing uint64 = 1 )
View Source
const ( DebugStatistics uint64 = 0 DebugDBInfo uint64 = 1 DebugPRep uint64 = 2 DebugPRepCandidate uint64 = 3 DebugGV uint64 = 4 DebugLogCTX uint64 = 100 )
View Source
const (
DebugAddress = "/tmp/.icon-rc-monitor.sock"
)
View Source
const (
InvalidBH uint16 = 3
)
View Source
const (
MinDelegation = blocksPerYear / iScoreMultiplier * (gvDivider / minRewardRep)
)
Variables ¶
View Source
var BigInt100 = big.NewInt(100)
View Source
var BigIntClaimMinIScore = big.NewInt(claimMinIScore)
View Source
var BigIntIScoreMultiplier = big.NewInt(iScoreMultiplier)
View Source
var BigIntRewardDivider = big.NewInt(rewardDivider)
View Source
var BigIntTwo = big.NewInt(2)
Functions ¶
func CalcRespStatusToString ¶ added in v1.1.1
func ClaimBackupKey ¶ added in v1.2.1
func ClaimBackupKeyString ¶ added in v1.2.1
func CloseIScoreDB ¶
func CloseIScoreDB(isDB *IScoreDB)
func DeleteCalculationResult ¶ added in v1.2.0
func DoClaim ¶
func DoClaim(ctx *Context, req *ClaimMessage) (uint64, *common.HexInt)
DoClaim calculates the I-Score that the ICONist in ClaimMessage can get. Writes calculated I-Score and block height to claim DB. It returns the I-Score block height and I-Score. nil I-Score means zero I-Score. In error case, block height is zero and I-Score is nil.
func DoCommitClaim ¶
func DoCommitClaim(ctx *Context, req *CommitClaim) error
func DoQueryCalculateResult ¶
func DoQueryCalculateResult(ctx *Context, blockHeight uint64, resp *QueryCalculateResultResponse)
func DoQueryCalculateStatus ¶
func DoQueryCalculateStatus(ctx *Context, resp *QueryCalculateStatusResponse)
func DoRollBack ¶ added in v1.2.0
func DoRollBack(ctx *Context, req *RollBackRequest) error
func InitManager ¶
func LoadIISSData ¶
func LoadIISSData(iissDB db.Database) (*IISSHeader, []*IISSGovernanceVariable, []*PRep)
func LoadPRepCandidate ¶
func MakeIteratorPrefix ¶ added in v1.2.1
func MsgDataToString ¶
func MsgDataToString(data interface{}) string
func MsgToString ¶
func OpenIISSData ¶ added in v1.1.1
func WriteCalculationResult ¶
func WriteCalculationResult(crDB db.Database, blockHeight uint64, stats *Statistics, stateHash []byte)
Types ¶
type BlockInfo ¶ added in v1.2.0
type BlockInfo struct { BlockHeight uint64 BlockHash [BlockHashSize]byte }
type CalcCancelByRollbackError ¶ added in v1.2.0
type CalcCancelByRollbackError struct {
BlockHeight uint64
}
func (*CalcCancelByRollbackError) Error ¶ added in v1.2.0
func (e *CalcCancelByRollbackError) Error() string
type CalculateDone ¶
func (*CalculateDone) String ¶
func (cd *CalculateDone) String() string
type CalculateRequest ¶
func (*CalculateRequest) String ¶
func (cr *CalculateRequest) String() string
type CalculateResponse ¶ added in v1.1.1
func (*CalculateResponse) String ¶ added in v1.1.1
func (cr *CalculateResponse) String() string
type CalculationResult ¶
func NewCalculationResultFromBytes ¶
func NewCalculationResultFromBytes(bs []byte) (*CalculationResult, error)
func (*CalculationResult) Bytes ¶
func (cr *CalculationResult) Bytes() ([]byte, error)
func (*CalculationResult) ID ¶
func (cr *CalculationResult) ID() []byte
func (*CalculationResult) SetBytes ¶
func (cr *CalculationResult) SetBytes(bs []byte) error
func (*CalculationResult) String ¶
func (cr *CalculationResult) String() string
type Claim ¶
func NewClaimFromBytes ¶
type ClaimBackupInfo ¶ added in v1.2.0
func (*ClaimBackupInfo) Bytes ¶ added in v1.2.0
func (cb *ClaimBackupInfo) Bytes() []byte
func (*ClaimBackupInfo) ID ¶ added in v1.2.0
func (cb *ClaimBackupInfo) ID() []byte
func (*ClaimBackupInfo) SetBytes ¶ added in v1.2.0
func (cb *ClaimBackupInfo) SetBytes(bs []byte) error
func (*ClaimBackupInfo) String ¶ added in v1.2.0
func (cb *ClaimBackupInfo) String() string
type ClaimMessage ¶
type ClaimMessage struct { Address common.Address BlockHeight uint64 BlockHash []byte TXIndex uint64 TXHash []byte }
func (*ClaimMessage) String ¶
func (cm *ClaimMessage) String() string
type CommitBlock ¶
func (*CommitBlock) String ¶
func (cb *CommitBlock) String() string
type CommitClaim ¶
type CommitClaim struct { Success bool Address common.Address BlockHeight uint64 BlockHash []byte TXIndex uint64 TXHash []byte }
func (*CommitClaim) String ¶
func (cc *CommitClaim) String() string
type Context ¶
type Context struct { DB *IScoreDB Revision uint64 PRep []*PRep PRepCandidates map[common.Address]*PRepCandidate GV []*GovernanceVariable Rollback *Rollback // contains filtered or unexported fields }
func NewContext ¶
func (*Context) RollbackManagementDB ¶ added in v1.2.0
func (*Context) UpdateGovernanceVariable ¶
func (ctx *Context) UpdateGovernanceVariable(gvList []*IISSGovernanceVariable)
Update Governance variable with IISS data
func (*Context) UpdatePRep ¶
Update Main/Sub P-Rep list
func (*Context) UpdatePRepCandidate ¶
Update P-Rep candidate with IISS TX(P-Rep register/unregister)
type DBInfoData ¶
type DBInfoData DBInfoDataV2
type DBInfoDataV1 ¶ added in v1.2.0
type DBInfoDataV2 ¶ added in v1.2.0
type DBInfoDataV2 struct { DBCount int QueryDBIsZero bool Current BlockInfo // Latest COMMIT_BLOCK block height and hash CalcDone uint64 // Latest CALCULATE_DONE block height PrevCalcDone uint64 // Previous CALCULATE_DONE block height Calculating uint64 // Latest CALCULATE block height ToggleBH uint64 // Latest account DB toggle block height }
type DebugMessage ¶
type DebugMessage struct {
Cmd uint64
}
type GovernanceVariable ¶
type GovernanceVariable struct { BlockHeight uint64 GVData BlockProduceReward common.HexInt PRepReward common.HexInt }
func LoadGovernanceVariable ¶
func LoadGovernanceVariable(dbi db.Database) ([]*GovernanceVariable, error)
func NewGVFromIISS ¶
func NewGVFromIISS(iiss *IISSGovernanceVariable) *GovernanceVariable
func (*GovernanceVariable) Bytes ¶
func (gv *GovernanceVariable) Bytes() ([]byte, error)
func (*GovernanceVariable) ID ¶
func (gv *GovernanceVariable) ID() []byte
func (*GovernanceVariable) SetBytes ¶
func (gv *GovernanceVariable) SetBytes(bs []byte) error
func (*GovernanceVariable) String ¶
func (gv *GovernanceVariable) String() string
type IISSBlockProduceInfo ¶
type IISSBlockProduceInfo struct { BlockHeight uint64 IISSBlockProduceInfoData }
func (*IISSBlockProduceInfo) Bytes ¶
func (bp *IISSBlockProduceInfo) Bytes() ([]byte, error)
func (*IISSBlockProduceInfo) ID ¶
func (bp *IISSBlockProduceInfo) ID() []byte
func (*IISSBlockProduceInfo) SetBytes ¶
func (bp *IISSBlockProduceInfo) SetBytes(bs []byte) error
func (*IISSBlockProduceInfo) String ¶
func (bp *IISSBlockProduceInfo) String() string
type IISSGVData ¶
type IISSGovernanceVariable ¶
type IISSGovernanceVariable struct { BlockHeight uint64 IISSGVData }
func (*IISSGovernanceVariable) Bytes ¶
func (gv *IISSGovernanceVariable) Bytes() ([]byte, error)
func (*IISSGovernanceVariable) ID ¶
func (gv *IISSGovernanceVariable) ID() []byte
func (*IISSGovernanceVariable) SetBytes ¶
func (gv *IISSGovernanceVariable) SetBytes(bs []byte, version uint64) error
func (*IISSGovernanceVariable) String ¶
func (gv *IISSGovernanceVariable) String() string
type IISSHeader ¶
type IISSHeader struct { Version uint64 // version of RC data BlockHeight uint64 Revision uint64 // revision of ICON Service }
func (*IISSHeader) Bytes ¶
func (ih *IISSHeader) Bytes() ([]byte, error)
func (*IISSHeader) ID ¶
func (ih *IISSHeader) ID() []byte
func (*IISSHeader) SetBytes ¶
func (ih *IISSHeader) SetBytes(bs []byte) error
func (*IISSHeader) String ¶
func (ih *IISSHeader) String() string
type IISSTX ¶
type IISSTX struct { Index uint64 IISSTXData }
type IISSTXData ¶
type IScoreAccount ¶
type IScoreAccount struct { Address common.Address IScoreData }
func NewIScoreAccountFromBytes ¶
func NewIScoreAccountFromBytes(bs []byte) (*IScoreAccount, error)
func NewIScoreAccountFromIISS ¶
func NewIScoreAccountFromIISS(iisstx *IISSTX) *IScoreAccount
func (*IScoreAccount) Bytes ¶
func (ia *IScoreAccount) Bytes() []byte
func (*IScoreAccount) BytesForHash ¶
func (ia *IScoreAccount) BytesForHash() []byte
func (*IScoreAccount) Compare ¶
func (ia *IScoreAccount) Compare(b *IScoreAccount) int
func (*IScoreAccount) ID ¶
func (ia *IScoreAccount) ID() []byte
func (*IScoreAccount) SetBytes ¶
func (ia *IScoreAccount) SetBytes(bs []byte) error
func (*IScoreAccount) String ¶
func (ia *IScoreAccount) String() string
type IScoreDB ¶
type IScoreDB struct { Account0 []db.Database Account1 []db.Database // contains filtered or unexported fields }
func (*IScoreDB) CloseAccountDB ¶ added in v1.2.0
func (idb *IScoreDB) CloseAccountDB()
func (*IScoreDB) GetCalcDBList ¶
func (*IScoreDB) OpenAccountDB ¶ added in v1.2.0
func (idb *IScoreDB) OpenAccountDB()
type IScoreData ¶
type IScoreData struct { IScore common.HexInt BlockHeight uint64 Delegations []*DelegateData }
type PRepCandidate ¶
type PRepCandidate struct { Address common.Address PRepCandidateData }
func (*PRepCandidate) Bytes ¶
func (prep *PRepCandidate) Bytes() ([]byte, error)
func (*PRepCandidate) ID ¶
func (prep *PRepCandidate) ID() []byte
func (*PRepCandidate) SetBytes ¶
func (prep *PRepCandidate) SetBytes(bs []byte) error
func (*PRepCandidate) String ¶
func (prep *PRepCandidate) String() string
type PRepCandidateData ¶
type PRepData ¶
type PRepData struct { TotalDelegation common.HexInt List []PRepDelegationInfo }
type PRepDelegationInfo ¶
func (*PRepDelegationInfo) String ¶
func (di *PRepDelegationInfo) String() string
type PreCommit ¶ added in v1.1.1
type PreCommit struct { BlockHeight uint64 BlockHash []byte PreCommitData }
type PreCommitData ¶ added in v1.1.1
func (*PreCommitData) String ¶ added in v1.2.0
func (pc *PreCommitData) String() string
type QueryCalculateResultResponse ¶
type QueryCalculateResultResponse struct { Status uint16 BlockHeight uint64 IScore common.HexInt StateHash []byte }
func (*QueryCalculateResultResponse) StatusString ¶
func (cr *QueryCalculateResultResponse) StatusString() string
func (*QueryCalculateResultResponse) String ¶
func (cr *QueryCalculateResultResponse) String() string
type QueryCalculateStatusResponse ¶
func (*QueryCalculateStatusResponse) StatusString ¶
func (cs *QueryCalculateStatusResponse) StatusString() string
func (*QueryCalculateStatusResponse) String ¶
func (cs *QueryCalculateStatusResponse) String() string
type RcConfig ¶
type RcConfig struct { IISSDataDir string `json:"IISSData"` DBDir string `json:"IScoreDB"` IpcNet string `json:"IPCNet"` IpcAddr string `json:"IPCAddress"` ClientMode bool `json:"ClientMode"` DBCount int `json:"DBCount"` Monitor bool `json:"Monitor"` LogFile string `json:"LogFile"` LogMaxSize int `json:"LogMaxSize"` LogMaxBackups int `json:"LogMaxBackups"` FileName string }
type ResponseClaim ¶
type ResponseClaim struct { ClaimMessage IScore common.HexInt }
func (*ResponseClaim) String ¶
func (rc *ResponseClaim) String() string
type ResponseDebugDBInfo ¶
type ResponseDebugDBInfo struct { DebugMessage DBInfo DBInfo }
type ResponseDebugGV ¶
type ResponseDebugGV struct { DebugMessage GV []GovernanceVariable }
type ResponseDebugPRep ¶
type ResponseDebugPRep struct { DebugMessage PReps []PRep }
type ResponseDebugPRepCandidate ¶
type ResponseDebugPRepCandidate struct { DebugMessage PRepCandidates []PRepCandidate }
type ResponseDebugStats ¶
type ResponseDebugStats struct { DebugMessage BlockHeight uint64 Stats Statistics }
type ResponseInit ¶ added in v1.2.0
func (*ResponseInit) String ¶ added in v1.2.0
func (resp *ResponseInit) String() string
type ResponseQuery ¶
func (*ResponseQuery) String ¶
func (rq *ResponseQuery) String() string
type ResponseVersion ¶
type ResponseVersion struct { Version uint64 BlockHeight uint64 BlockHash [BlockHashSize]byte }
func (*ResponseVersion) String ¶ added in v1.1.1
func (rv *ResponseVersion) String() string
type RollBackRequest ¶ added in v1.2.0
func (*RollBackRequest) String ¶ added in v1.2.0
func (rb *RollBackRequest) String() string
type RollBackResponse ¶ added in v1.2.0
type RollBackResponse struct { Success bool RollBackRequest }
func (*RollBackResponse) String ¶ added in v1.2.0
func (rb *RollBackResponse) String() string
type Rollback ¶ added in v1.2.0
type Rollback struct {
// contains filtered or unexported fields
}
func NewRollback ¶ added in v1.2.0
func NewRollback() *Rollback
func (*Rollback) GetChannel ¶ added in v1.2.0
func (rb *Rollback) GetChannel() chan struct{}
type RollbackLowBlockHeightError ¶ added in v1.2.0
func (*RollbackLowBlockHeightError) Error ¶ added in v1.2.0
func (e *RollbackLowBlockHeightError) Error() string
type Statistics ¶
type Statistics struct { Accounts uint64 TotalReward common.HexInt Beta1 common.HexInt Beta2 common.HexInt Beta3 common.HexInt }
func DoCalculate ¶
func DoCalculate(quit <-chan struct{}, ctx *Context, req *CalculateRequest, c ipc.Connection, id uint32) (error, uint64, *Statistics, []byte)
func (*Statistics) Bytes ¶
func (stats *Statistics) Bytes() []byte
func (*Statistics) Decrease ¶
func (stats *Statistics) Decrease(field string, value interface{}) error
func (*Statistics) Increase ¶
func (stats *Statistics) Increase(field string, value interface{}) error
func (*Statistics) Set ¶
func (stats *Statistics) Set(field string, value interface{}) error
func (*Statistics) SetBytes ¶
func (stats *Statistics) SetBytes(bs []byte) error
func (*Statistics) String ¶
func (stats *Statistics) String() string
Click to show internal directories.
Click to hide internal directories.