Documentation ¶
Index ¶
- Constants
- Variables
- func AddLog(state StateDB, blockNumber uint64, contractAddr common.Address, ...)
- func AddLogWithRes(state StateDB, blockNumber uint64, contractAddr common.Address, ...)
- func AdditionalCycleTime() uint64
- func BlocksWillCreate() uint64
- func CDFAccount() common.Address
- func CDFBalance() *big.Int
- func CancelProposal_SupportRate() float64
- func CancelProposal_VoteRate() float64
- func CheckDuplicateSignReportReward(fraction int) error
- func CheckEconomicModel() error
- func CheckMaxEvidenceAge(age, unStakeFreezeDuration int) error
- func CheckMaxValidators(num int) error
- func CheckOperatingThreshold(threshold *big.Int) error
- func CheckSlashBlocksReward(rewards int) error
- func CheckSlashFractionDuplicateSign(fraction int) error
- func CheckStakeThreshold(threshold *big.Int) error
- func CheckUnStakeFreezeDuration(duration, maxEvidenceAge int) error
- func DuplicateSignReportReward() uint32
- func EconomicString() string
- func ElectionDistance() uint64
- func HesitateRatio() uint64
- func Interval() uint64
- func IsYearEnd(hash common.Hash, blockNumber uint64) (bool, error)
- func LoadAvgPackTime(hash common.Hash, snapshotDB snapshotdb.DB) (uint64, error)
- func LoadCurrentAvgPackTime() (uint64, error)
- func LoadIncIssuanceNumber(hash common.Hash, snapshotDB snapshotdb.DB) (uint64, error)
- func LoadIncIssuanceTime(hash common.Hash, snapshotDB snapshotdb.DB) (int64, error)
- func MaxConsensusVals() uint64
- func MaxEpochMinutes() uint64
- func MaxEvidenceAge() uint32
- func MaxValidators() uint64
- func NewBlockRewardRate() uint64
- func NewResult(err *common.BizError, data interface{}) []byte
- func OperatingThreshold() *big.Int
- func ParamProposalVote_DurationSeconds() uint64
- func ParamProposal_SupportRate() float64
- func ParamProposal_VoteRate() float64
- func PlatONFoundationYear() uint32
- func PlatONFundAccount() common.Address
- func PlatONFundBalance() *big.Int
- func PrintObjForErr(s string, obj interface{})
- func PrintObject(s string, obj interface{})
- func ResetEconomicDefaultConfig(newEc *EconomicModel)
- func SetNodeBlockTimeWindow(period uint64)
- func SetPerRoundBlocks(amount uint64)
- func ShiftValidatorNum() uint64
- func SlashBlocksReward() uint32
- func SlashFractionDuplicateSign() uint32
- func StakeThreshold() *big.Int
- func StorageAvgPackTime(hash common.Hash, snapshotDB snapshotdb.DB, avgPackTime uint64) error
- func StorageIncIssuanceNumber(hash common.Hash, snapshotDB snapshotdb.DB, incIssuanceNumber uint64) error
- func StorageIncIssuanceTime(hash common.Hash, snapshotDB snapshotdb.DB, incTime int64) error
- func TextProposalVote_DurationSeconds() uint64
- func TextProposal_SupportRate() float64
- func TextProposal_VoteRate() float64
- func UnStakeFreezeDuration() uint64
- func VersionProposalVote_DurationSeconds() uint64
- func VersionProposal_SupportRate() float64
- type EconomicModel
- type Result
- type StateDB
Constants ¶
View Source
const ( DefualtRule = iota StakingRule SlashingRule RestrictingRule RewardRule GovernanceRule )
plugin rule key
View Source
const ( Zero = 0 Eighty = 80 Hundred = 100 TenThousand = 10000 CeilBlocksReward = 50000 CeilMaxValidators = 201 FloorMaxConsensusVals = 4 CeilMaxConsensusVals = 25 PositiveInfinity = "+∞" CeilUnStakeFreezeDuration = 28 * 4 CeilMaxEvidenceAge = CeilUnStakeFreezeDuration - 1 )
View Source
const ( DefaultMainNet = iota // PlatON default main net flag DefaultTestNet // PlatON default test net flag DefaultRallyNet // PlatON default rally net flag DefaultUatNet // PlatON default uat net flag DefaultDemoNet // PlatON default demo net flag )
Variables ¶
View Source
var (
// 10 LAT
TenLAT, _ = new(big.Int).SetString("10000000000000000000", 10)
// 10000 LAT
TenThousandLAT, _ = new(big.Int).SetString("10000000000000000000000", 10)
// hard code genesis staking balance
// 150W LAT
GeneStakingAmount, _ = new(big.Int).SetString("1500000000000000000000000", 10)
// 100W LAT
MillionLAT, _ = new(big.Int).SetString("1000000000000000000000000", 10)
// 1000W LAT
TenMillionLAT, _ = new(big.Int).SetString("10000000000000000000000000", 10)
BillionLAT, _ = new(big.Int).SetString("1000000000000000000000000000", 10)
)
View Source
var ( AvgPackTimeKey = []byte("AvgPackTimeKey") IncIssuanceNumberKey = []byte("IncIssuanceNumberKey") IncIssuanceTimeKey = []byte("IncIssuanceTimeKey") )
Functions ¶
func AddLogWithRes ¶
func AddLogWithRes(state StateDB, blockNumber uint64, contractAddr common.Address, event, code string, res interface{})
addLog let the result add to event.
func AdditionalCycleTime ¶
func AdditionalCycleTime() uint64
func BlocksWillCreate ¶
func BlocksWillCreate() uint64
func CDFAccount ¶
func CDFBalance ¶
func CancelProposal_SupportRate ¶
func CancelProposal_SupportRate() float64
func CancelProposal_VoteRate ¶
func CancelProposal_VoteRate() float64
func CheckEconomicModel ¶
func CheckEconomicModel() error
func CheckMaxEvidenceAge ¶
func CheckMaxValidators ¶
func CheckOperatingThreshold ¶
func CheckSlashBlocksReward ¶
func CheckStakeThreshold ¶
func DuplicateSignReportReward ¶
func DuplicateSignReportReward() uint32
func EconomicString ¶
func EconomicString() string
func ElectionDistance ¶
func ElectionDistance() uint64
func HesitateRatio ¶
func HesitateRatio() uint64
func IsYearEnd ¶
Determine whether the block height belongs to the last block at the end of the year according to the passed blockNumber
func LoadAvgPackTime ¶
gets block average pack time (millisecond) from snapshot db.
func LoadCurrentAvgPackTime ¶
gets block average pack time (millisecond) from snapshot db.
func LoadIncIssuanceNumber ¶
func LoadIncIssuanceTime ¶
func MaxConsensusVals ¶
func MaxConsensusVals() uint64
func MaxEvidenceAge ¶
func MaxEvidenceAge() uint32
func MaxValidators ¶
func MaxValidators() uint64
func OperatingThreshold ¶
func ParamProposalVote_DurationSeconds ¶
func ParamProposalVote_DurationSeconds() uint64
func ParamProposal_SupportRate ¶
func ParamProposal_SupportRate() float64
func ParamProposal_VoteRate ¶
func ParamProposal_VoteRate() float64
func PlatONFoundationYear ¶
func PlatONFoundationYear() uint32
func PlatONFundBalance ¶
func PrintObjForErr ¶
func PrintObjForErr(s string, obj interface{})
func PrintObject ¶
func PrintObject(s string, obj interface{})
func ResetEconomicDefaultConfig ¶
func ResetEconomicDefaultConfig(newEc *EconomicModel)
func SetNodeBlockTimeWindow ¶
func SetNodeBlockTimeWindow(period uint64)
set the value by genesis block
func SetPerRoundBlocks ¶
func SetPerRoundBlocks(amount uint64)
func ShiftValidatorNum ¶
func ShiftValidatorNum() uint64
func SlashBlocksReward ¶
func SlashBlocksReward() uint32
func SlashFractionDuplicateSign ¶
func SlashFractionDuplicateSign() uint32
*****
- Slashing config *****
func StorageAvgPackTime ¶
saves block average pack time (millisecond) to snapshot db.
func StorageIncIssuanceNumber ¶
func StorageIncIssuanceNumber(hash common.Hash, snapshotDB snapshotdb.DB, incIssuanceNumber uint64) error
Stored the height of the block that was actually issuance
func StorageIncIssuanceTime ¶
Store the expected time for increase issuance
func TextProposalVote_DurationSeconds ¶
func TextProposalVote_DurationSeconds() uint64
func TextProposalVote_ConsensusRounds() uint64 { return ec.Gov.TextProposalVoteDurationSeconds / (Interval() * ec.Common.PerRoundBlocks * ec.Common.MaxConsensusVals) }
func TextProposal_SupportRate ¶
func TextProposal_SupportRate() float64
func TextProposal_VoteRate ¶
func TextProposal_VoteRate() float64
func UnStakeFreezeDuration ¶
func UnStakeFreezeDuration() uint64
func VersionProposalVote_DurationSeconds ¶
func VersionProposalVote_DurationSeconds() uint64
func VersionProposal_SupportRate ¶
func VersionProposal_SupportRate() float64
Types ¶
type EconomicModel ¶
type EconomicModel struct { Common commonConfig `json:"common"` Staking stakingConfig `json:"staking"` Slashing slashingConfig `json:"slashing"` Gov governanceConfig `json:"gov"` Reward rewardConfig `json:"reward"` InnerAcc innerAccount `json:"innerAcc"` }
total
type StateDB ¶
type StateDB interface { CreateAccount(common.Address) SubBalance(common.Address, *big.Int) AddBalance(common.Address, *big.Int) GetBalance(common.Address) *big.Int GetNonce(common.Address) uint64 SetNonce(common.Address, uint64) GetCodeHash(common.Address) common.Hash GetCode(common.Address) []byte SetCode(common.Address, []byte) GetCodeSize(common.Address) int GetAbiHash(common.Address) common.Hash GetAbi(common.Address) []byte SetAbi(common.Address, []byte) AddRefund(uint64) SubRefund(uint64) GetRefund() uint64 GetCommittedState(common.Address, []byte) []byte //GetState(common.Address, common.Hash) common.Hash //SetState(common.Address, common.Hash, common.Hash) GetState(common.Address, []byte) []byte SetState(common.Address, []byte, []byte) Suicide(common.Address) bool HasSuicided(common.Address) bool // Exist reports whether the given account exists in state. // Notably this should also return true for suicided accounts. Exist(common.Address) bool // Empty returns whether the given account is empty. Empty // is defined according to EIP161 (balance = nonce = code = 0). Empty(common.Address) bool RevertToSnapshot(int) Snapshot() int AddLog(*types.Log) AddPreimage(common.Hash, []byte) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) //ppos add TxHash() common.Hash TxIdx() uint32 IntermediateRoot(deleteEmptyObjects bool) common.Hash }
StateDB is an Plugin database for full state querying.
Click to show internal directories.
Click to hide internal directories.